@adhdev/daemon-standalone 1.0.21-rc.4 → 1.0.21-rc.5

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
@@ -33262,10 +33262,10 @@ var require_dist3 = __commonJS({
33262
33262
  }
33263
33263
  function getDaemonBuildInfo() {
33264
33264
  if (cached2) return cached2;
33265
- const commit = readInjected(true ? "6c7d05ae6b6e0449e7b28773f528a151ae2371df" : void 0) ?? "unknown";
33266
- const commitShort = readInjected(true ? "6c7d05ae" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33267
- const version2 = readInjected(true ? "1.0.21-rc.4" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33268
- const builtAt = readInjected(true ? "2026-07-23T18:35:14.928Z" : void 0);
33265
+ const commit = readInjected(true ? "57d6b342db3f9f235038696295dbc4761e227e3c" : void 0) ?? "unknown";
33266
+ const commitShort = readInjected(true ? "57d6b342" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33267
+ const version2 = readInjected(true ? "1.0.21-rc.5" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33268
+ const builtAt = readInjected(true ? "2026-07-24T01:21:22.419Z" : void 0);
33269
33269
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
33270
33270
  return cached2;
33271
33271
  }
@@ -48982,13 +48982,13 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
48982
48982
  });
48983
48983
  const workerResult = evidence.workerResult;
48984
48984
  const selfAttributing = workerResult.source === "final_summary_json";
48985
- const dispatchTime = dispatch?.timestamp ? new Date(dispatch.timestamp).getTime() : Number.NaN;
48985
+ const dispatchTime = dispatch?.timestamp ? new Date(dispatch.timestamp).getTime() : args.dispatchTimestamp ? new Date(args.dispatchTimestamp).getTime() : Number.NaN;
48986
48986
  const transcriptTime = args.transcriptMessageAt ? new Date(args.transcriptMessageAt).getTime() : Number.NaN;
48987
48987
  const transcriptAfterDispatch = Number.isFinite(dispatchTime) && Number.isFinite(transcriptTime) && transcriptTime >= dispatchTime;
48988
- if (workerResult.source !== "final_summary_json" && !transcriptAfterDispatch) {
48988
+ if (!args.preValidatedTranscriptEvidence && workerResult.source !== "final_summary_json" && !transcriptAfterDispatch) {
48989
48989
  return { reconciled: false, reason: "transcript_not_proven_after_dispatch" };
48990
48990
  }
48991
- if (Number.isFinite(dispatchTime) && workerResult.source !== "final_summary_json") {
48991
+ if (!args.preValidatedTranscriptEvidence && Number.isFinite(dispatchTime) && workerResult.source !== "final_summary_json") {
48992
48992
  const dispatchedToIdleSession = dispatch?.payload?.dispatchedToIdleSession === true;
48993
48993
  const graceMs = dispatchedToIdleSession ? DIRECT_DISPATCH_IDLE_SESSION_RECONCILE_GRACE_MS : DIRECT_DISPATCH_RECONCILE_GRACE_MS;
48994
48994
  if (Date.now() - dispatchTime < graceMs) {
@@ -57263,7 +57263,15 @@ ${cleanBody}`;
57263
57263
  if (!(Number.isFinite(dispatchedAtMs) && Number.isFinite(transcriptAtMs) && transcriptAtMs >= dispatchedAtMs)) {
57264
57264
  return null;
57265
57265
  }
57266
- return "completed";
57266
+ return {
57267
+ outcome: "completed",
57268
+ finalSummary: evidence.finalSummary,
57269
+ ...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
57270
+ ...readNonEmptyString(payload.providerSessionId) ? { providerSessionId: readNonEmptyString(payload.providerSessionId) } : {},
57271
+ ...providerType ? { providerType } : {},
57272
+ ...nodeId ? { nodeId } : {},
57273
+ sessionId
57274
+ };
57267
57275
  }
57268
57276
  var init_mesh_completion_synthesis = __esm2({
57269
57277
  "src/mesh/mesh-completion-synthesis.ts"() {
@@ -57613,6 +57621,32 @@ ${cleanBody}`;
57613
57621
  }
57614
57622
  return verdict === "UNKNOWN";
57615
57623
  }
57624
+ function propagateWatchdogTranscriptCompletion(meshId, row, evidence, source) {
57625
+ const sessionId = readNonEmptyString(row.assignedSessionId) || evidence.sessionId;
57626
+ if (!sessionId || !readNonEmptyString(evidence.finalSummary)) {
57627
+ return false;
57628
+ }
57629
+ try {
57630
+ const result = reconcileDirectDispatchCompletionFromTranscript({
57631
+ meshId,
57632
+ nodeId: readNonEmptyString(row.assignedNodeId) || evidence.nodeId,
57633
+ sessionId,
57634
+ providerType: readNonEmptyString(row.assignedProviderType) || evidence.providerType,
57635
+ providerSessionId: evidence.providerSessionId,
57636
+ taskId: row.id,
57637
+ finalSummary: evidence.finalSummary,
57638
+ ...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
57639
+ ...readNonEmptyString(row.dispatchTimestamp) ? { dispatchTimestamp: readNonEmptyString(row.dispatchTimestamp) } : {},
57640
+ // The watchdog poll already enforced idle + post-dispatch + no-trailing-tool + streak;
57641
+ // skip the reconcile's own grace/transcript_not_proven gates (dedup backstops remain).
57642
+ preValidatedTranscriptEvidence: true,
57643
+ source
57644
+ });
57645
+ return result.reconciled || result.alreadyTerminal === true;
57646
+ } catch {
57647
+ return false;
57648
+ }
57649
+ }
57616
57650
  async function recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds = []) {
57617
57651
  const meshId = mesh.id;
57618
57652
  const assigned = getQueue(meshId, { status: ["assigned"] });
@@ -57643,11 +57677,17 @@ ${cleanBody}`;
57643
57677
  const terminalEvidence = await pollAssignedTaskTerminalEvidence(components, mesh, row);
57644
57678
  if (terminalEvidence) {
57645
57679
  assignedIdleFinalAssistantSince.delete(idleTranscriptStreakKey);
57646
- updateTaskStatus(meshId, row.id, terminalEvidence);
57647
- if (!findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id })) {
57680
+ updateTaskStatus(meshId, row.id, terminalEvidence.outcome);
57681
+ const propagated = propagateWatchdogTranscriptCompletion(
57682
+ meshId,
57683
+ row,
57684
+ terminalEvidence,
57685
+ "early_idle_transcript_evidence"
57686
+ );
57687
+ if (!propagated && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id })) {
57648
57688
  try {
57649
57689
  appendLedgerEntry(meshId, {
57650
- kind: terminalEvidence === "completed" ? "task_completed" : "task_failed",
57690
+ kind: terminalEvidence.outcome === "completed" ? "task_completed" : "task_failed",
57651
57691
  nodeId: row.assignedNodeId,
57652
57692
  sessionId: row.assignedSessionId,
57653
57693
  providerType: row.assignedProviderType,
@@ -57660,14 +57700,14 @@ ${cleanBody}`;
57660
57700
  } catch {
57661
57701
  }
57662
57702
  }
57663
- LOG2.warn("MeshReconcile", `Early-completed assigned task ${row.id} on mesh ${meshId} (node=${row.assignedNodeId ?? "?"} session=${row.assignedSessionId ?? "?"}): worker idle with a final assistant message after dispatch for \u2265${Math.round(ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS / 1e3)}s \u2014 the completion event was lost/late (pure-PTY provider), task is ${terminalEvidence} without waiting the 15-min deadline`);
57664
- traceMeshEventDrop("assigned_early_transcript_completed", {
57703
+ LOG2.warn("MeshReconcile", `Early-completed assigned task ${row.id} on mesh ${meshId} (node=${row.assignedNodeId ?? "?"} session=${row.assignedSessionId ?? "?"}): worker idle with a final assistant message after dispatch for \u2265${Math.round(ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS / 1e3)}s \u2014 the completion event was lost/late (pure-PTY provider), task is ${terminalEvidence.outcome} without waiting the 15-min deadline${propagated ? " (finalSummary propagated to coordinator)" : ""}`);
57704
+ traceMeshEventStage("assigned_early_transcript_completed", {
57665
57705
  taskId: row.id,
57666
57706
  sessionId: row.assignedSessionId,
57667
57707
  nodeId: row.assignedNodeId,
57668
57708
  meshId,
57669
57709
  event: "agent:generating_completed"
57670
- }, terminalEvidence);
57710
+ }, propagated ? "propagated" : terminalEvidence.outcome);
57671
57711
  continue;
57672
57712
  }
57673
57713
  assignedIdleFinalAssistantSince.delete(idleTranscriptStreakKey);
@@ -57805,11 +57845,17 @@ ${cleanBody}`;
57805
57845
  const terminalEvidence = await pollAssignedTaskTerminalEvidence(components, mesh, row);
57806
57846
  if (terminalEvidence) {
57807
57847
  deliveredNoTurnUnknownStreak.delete(streakKey);
57808
- updateTaskStatus(meshId, row.id, terminalEvidence);
57809
- if (!findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id })) {
57848
+ updateTaskStatus(meshId, row.id, terminalEvidence.outcome);
57849
+ const propagated = propagateWatchdogTranscriptCompletion(
57850
+ meshId,
57851
+ row,
57852
+ terminalEvidence,
57853
+ "redrive_deadline_transcript_evidence"
57854
+ );
57855
+ if (!propagated && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id })) {
57810
57856
  try {
57811
57857
  appendLedgerEntry(meshId, {
57812
- kind: terminalEvidence === "completed" ? "task_completed" : "task_failed",
57858
+ kind: terminalEvidence.outcome === "completed" ? "task_completed" : "task_failed",
57813
57859
  nodeId: row.assignedNodeId,
57814
57860
  sessionId: row.assignedSessionId,
57815
57861
  providerType: row.assignedProviderType,
@@ -57822,14 +57868,14 @@ ${cleanBody}`;
57822
57868
  } catch {
57823
57869
  }
57824
57870
  }
57825
- LOG2.warn("MeshReconcile", `Skipped delivered-no-turn re-drive for task ${row.id} on mesh ${meshId} (node=${row.assignedNodeId ?? "?"} session=${row.assignedSessionId ?? "?"}): worker transcript is idle with a final assistant message after dispatch \u2014 the completion event was lost/late, task is ${terminalEvidence}, NOT re-driving`);
57826
- traceMeshEventDrop("redrive_deadline_transcript_completed", {
57871
+ LOG2.warn("MeshReconcile", `Skipped delivered-no-turn re-drive for task ${row.id} on mesh ${meshId} (node=${row.assignedNodeId ?? "?"} session=${row.assignedSessionId ?? "?"}): worker transcript is idle with a final assistant message after dispatch \u2014 the completion event was lost/late, task is ${terminalEvidence.outcome}, NOT re-driving${propagated ? " (finalSummary propagated to coordinator)" : ""}`);
57872
+ traceMeshEventStage("redrive_deadline_transcript_completed", {
57827
57873
  taskId: row.id,
57828
57874
  sessionId: row.assignedSessionId,
57829
57875
  nodeId: row.assignedNodeId,
57830
57876
  meshId,
57831
57877
  event: "agent:generating_completed"
57832
- }, `${reclaimReason} \u2192 transcript ${terminalEvidence}`);
57878
+ }, `${reclaimReason} \u2192 transcript ${terminalEvidence.outcome}${propagated ? " propagated" : ""}`);
57833
57879
  continue;
57834
57880
  }
57835
57881
  const reclaimedLost = reclaimStrandedAssignedTask(meshId, row.id, {
@@ -58755,7 +58801,12 @@ ${cleanBody}`;
58755
58801
  requiresFinalAssistantBeforeIdle: {
58756
58802
  type: "boolean",
58757
58803
  default: false,
58758
- description: "When true, daemon defers generating\u2192idle until parseSession includes a final standard assistant message."
58804
+ description: "When true, daemon defers generating\u2192idle until parseSession includes a final standard assistant message. Also selects the completion-timing floor for a native-source provider: an idle without a final assistant reply is treated as a possible mid-tool-call quiet valley, so the decoupled CANON-C completion is held under the min-elapsed floor (noExternalTranscriptSource) rather than emitted immediately. A provider that leaves this false is a write-lag native source (e.g. claude-cli) whose transcript merely trails the finished idle by a write, so it emits immediately."
58805
+ },
58806
+ holdCompletionForTranscript: {
58807
+ type: "boolean",
58808
+ default: false,
58809
+ description: "Completion-timing authority for a native-history provider whose live idle verdict is PTY-derived but whose authoritative answer lands in native history (e.g. antigravity-cli). When true, an idle-without-final-assistant HOLDS for the native transcript to land (holdForTranscript) instead of emitting or applying the min-elapsed floor, and the hold persists past the 30s finalization cap while the PTY is still active (bounded by the hard cap). This is the third completion-timing class alongside immediate (requiresFinalAssistantBeforeIdle=false) and floor (requiresFinalAssistantBeforeIdle=true)."
58759
58810
  },
58760
58811
  augmentStaleSnapshot: {
58761
58812
  type: "boolean",
@@ -83767,7 +83818,7 @@ ${body}
83767
83818
  if (probe?.lastRole === "assistant" && (probe.contentLen ?? 0) > 0) {
83768
83819
  return null;
83769
83820
  }
83770
- if (this.type === "antigravity-cli") {
83821
+ if (this.provider?.holdCompletionForTranscript === true) {
83771
83822
  if (allowMissingAssistantTimeout) {
83772
83823
  return { reason: "missing_final_assistant", terminal: false, holdForTranscript: true };
83773
83824
  }
@@ -83776,7 +83827,7 @@ ${body}
83776
83827
  if (allowMissingAssistantTimeout && pending.previousStatus === "waiting_approval") {
83777
83828
  return { reason: "missing_final_assistant", terminal: false, holdForTranscript: true };
83778
83829
  }
83779
- const isWriteLagNativeSource = this.type === "claude-cli";
83830
+ const isWriteLagNativeSource = this.provider.requiresFinalAssistantBeforeIdle !== true;
83780
83831
  return {
83781
83832
  reason: "missing_final_assistant",
83782
83833
  terminal: true,
@@ -84561,7 +84612,7 @@ ${body}
84561
84612
  this.scheduleCompletedDebounceFlush(COMPLETED_FINALIZATION_RETRY_MS);
84562
84613
  return;
84563
84614
  }
84564
- if (this.type === "antigravity-cli" && block2.holdForTranscript === true && waitedMs < ANTIGRAVITY_HOLD_HARD_CAP_MS && this.antigravityHoldPtyStillActive()) {
84615
+ if (this.provider?.holdCompletionForTranscript === true && block2.holdForTranscript === true && waitedMs < ANTIGRAVITY_HOLD_HARD_CAP_MS && this.antigravityHoldPtyStillActive()) {
84565
84616
  if (pending.loggedBlockReason !== "antigravity_hold_pty_active") {
84566
84617
  LOG2.info("CLI", `[${this.type}] 30s cap reached but PTY still generating; holding antigravity completion past cap (waitedMs=${waitedMs} hardCap=${ANTIGRAVITY_HOLD_HARD_CAP_MS}) (${blockReason})`);
84567
84618
  if (this.isMeshWorkerSession()) {
@@ -88683,6 +88734,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
88683
88734
  "submitStrategy",
88684
88735
  "requirePromptEchoBeforeSubmit",
88685
88736
  "requiresFinalAssistantBeforeIdle",
88737
+ "holdCompletionForTranscript",
88686
88738
  "augmentStaleSnapshot",
88687
88739
  "timeouts",
88688
88740
  "disableUpstream"