@adhdev/daemon-standalone 1.0.56-rc.1 → 1.0.56-rc.2

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
@@ -36610,10 +36610,10 @@ var require_dist3 = __commonJS({
36610
36610
  }
36611
36611
  function getDaemonBuildInfo() {
36612
36612
  if (cached2) return cached2;
36613
- const commit = readInjected(true ? "01396fb738f781d71372c84175dc5f0e789c265c" : void 0) ?? "unknown";
36614
- const commitShort = readInjected(true ? "01396fb7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36615
- const version2 = readInjected(true ? "1.0.56-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36616
- const builtAt = readInjected(true ? "2026-08-18T03:03:01.505Z" : void 0);
36613
+ const commit = readInjected(true ? "d18e98383ad155cd7b5e8060ce3597e1ca15edaf" : void 0) ?? "unknown";
36614
+ const commitShort = readInjected(true ? "d18e9838" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36615
+ const version2 = readInjected(true ? "1.0.56-rc.2" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36616
+ const builtAt = readInjected(true ? "2026-08-18T03:36:51.553Z" : void 0);
36617
36617
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36618
36618
  return cached2;
36619
36619
  }
@@ -47876,9 +47876,23 @@ Next step: ${nextStep}`;
47876
47876
  LOG2.debug("MeshQueue", `Refusing updateTaskStatus(${taskId} \u2192 ${status}) on mesh ${meshId}: row is terminal (${entry.status}). A late writer (e.g. dispatch-failure requeue) must not resurrect a cancelled/completed/failed task. Pass force to override.`);
47877
47877
  return { entry, cascaded: [] };
47878
47878
  }
47879
+ const priorStatus = entry.status;
47879
47880
  entry.status = status;
47880
47881
  MeshRuntimeStore.getInstance().updateQueueEntry(entry);
47881
47882
  if (status !== "assigned") endTaskDispatchInFlight(meshId, taskId);
47883
+ if (TERMINAL_TASK_STATUSES.has(status) && !TERMINAL_TASK_STATUSES.has(priorStatus)) {
47884
+ try {
47885
+ proposeTurnCompletion({
47886
+ meshId,
47887
+ taskId,
47888
+ outcome: status,
47889
+ source: "stall_reconcile",
47890
+ sessionId: entry.assignedSessionId,
47891
+ reason: `task_status_terminal:${status}`
47892
+ });
47893
+ } catch {
47894
+ }
47895
+ }
47882
47896
  const cascaded = DEPENDENCY_FAILURE_TERMINALS.has(status) ? propagateDependencyFailure(meshId, taskId) : [];
47883
47897
  return { entry, cascaded };
47884
47898
  });
@@ -65945,12 +65959,19 @@ ${cleanBody}`;
65945
65959
  }
65946
65960
  const authorityClass = readNonEmptyString(evidence.authorityClass);
65947
65961
  const timing = readNonEmptyString(evidence.timing);
65962
+ const evidenceSource = readNonEmptyString(diagnostic.finalAssistantEvidenceSource);
65963
+ const profileDetail = { authorityClass, evidenceSource, timing };
65948
65964
  if (authorityClass !== "native-source" && authorityClass !== "pure-pty" || timing !== "floor" && timing !== "hold" && timing !== "immediate") {
65949
- return { authoritative: false, reason: "non_transcript_authority_profile" };
65965
+ return { authoritative: false, reason: "non_transcript_authority_profile", detail: profileDetail };
65950
65966
  }
65951
- const evidenceSource = readNonEmptyString(diagnostic.finalAssistantEvidenceSource);
65952
- if (authorityClass === "native-source" && evidenceSource !== "external-native" || authorityClass === "pure-pty" && evidenceSource !== "parsed") {
65953
- return { authoritative: false, reason: "evidence_source_profile_mismatch" };
65967
+ const ADMISSIBLE_EVIDENCE_SOURCES = /* @__PURE__ */ new Set([
65968
+ "external-native",
65969
+ "parsed",
65970
+ "native-signal",
65971
+ "cached-summary"
65972
+ ]);
65973
+ if (!evidenceSource || !ADMISSIBLE_EVIDENCE_SOURCES.has(evidenceSource)) {
65974
+ return { authoritative: false, reason: "evidence_source_profile_mismatch", detail: profileDetail };
65954
65975
  }
65955
65976
  const finalSummary = readNonEmptyString(metadataEvent.finalSummary);
65956
65977
  const finalContentLength = readFiniteNumber2(evidence.finalContentLength) ?? 0;
@@ -66447,8 +66468,13 @@ ${cleanBody}`;
66447
66468
  attempt
66448
66469
  });
66449
66470
  const heldForRetry = retryEligible && holdCompletionForLiveStateRetry(components, args, eventSessionId, Date.now(), injectMeshSystemMessage);
66450
- LOG2.info("MeshEvents", `Suppressed agent:generating_completed for session ${eventSessionId} (mesh ${args.meshId}): current live evidence remains pending (${live.kind ?? "unknown"}); transcript authority=${authority.authoritative ? "fresh_but_not_newer" : authority.reason}${heldForRetry ? " \u2014 bounded content-free retry armed" : ""}`);
66451
- traceMeshEventDrop("mid_turn_live_state_pending", traceCtx, heldForRetry ? "retry_held" : void 0);
66471
+ const authorityDetail = !authority.authoritative && authority.detail ? ` [authorityClass=${authority.detail.authorityClass ?? "none"} evidenceSource=${authority.detail.evidenceSource ?? "none"} timing=${authority.detail.timing ?? "none"}]` : "";
66472
+ LOG2.info("MeshEvents", `Suppressed agent:generating_completed for session ${eventSessionId} (mesh ${args.meshId}): current live evidence remains pending (${live.kind ?? "unknown"}); transcript authority=${authority.authoritative ? "fresh_but_not_newer" : authority.reason}${authorityDetail}${heldForRetry ? " \u2014 bounded content-free retry armed" : ""}`);
66473
+ traceMeshEventDrop(
66474
+ "mid_turn_live_state_pending",
66475
+ traceCtx,
66476
+ `${heldForRetry ? "retry_held" : "dropped"}${authority.authoritative ? "" : ` authority=${authority.reason}${authorityDetail}`}`
66477
+ );
66452
66478
  return {
66453
66479
  kind: "suppress",
66454
66480
  result: {
@@ -70497,6 +70523,44 @@ ${cleanBody}`;
70497
70523
  }, `${reason} stale=${Math.round((nowMs - anchorMs) / 6e4)}m`);
70498
70524
  }
70499
70525
  }
70526
+ function reconcileUnsettledTerminalAttempts(mesh) {
70527
+ const meshId = mesh.id;
70528
+ const terminalRows = getQueue(meshId, { status: ["completed", "failed", "cancelled"] });
70529
+ if (!terminalRows.length) return 0;
70530
+ const store = MeshRuntimeStore.getInstance();
70531
+ const nowMs = Date.now();
70532
+ let settled = 0;
70533
+ for (const row of terminalRows) {
70534
+ const attempt = (() => {
70535
+ try {
70536
+ return store.getCurrentTurnAttempt(meshId, row.id);
70537
+ } catch {
70538
+ return null;
70539
+ }
70540
+ })();
70541
+ if (!attempt || attempt.terminalOutcome || isTerminalTurnStage(attempt.stage)) continue;
70542
+ const anchor = Date.parse(attempt.updatedAt || attempt.createdAt || "");
70543
+ if (!Number.isFinite(anchor) || nowMs - anchor < UNSETTLED_ATTEMPT_GRACE_MS) continue;
70544
+ const outcome = row.status === "completed" ? "completed" : row.status === "cancelled" ? "cancelled" : "failed";
70545
+ LOG2.warn("MeshReconcile", `Unsettled attempt safety net: task ${row.id} on mesh ${meshId} is terminal (${row.status}) but attempt ${attempt.attemptId} is still ${attempt.stage} (lease=${attempt.leaseDeadlineMs ?? "null"}, attempt idle ${Math.round((nowMs - anchor) / 1e3)}s) \u2014 settling it as ${outcome}. THIS SHOULD NOT HAPPEN: a terminal writer bypassed the updateTaskStatus choke point; find it rather than relying on this net.`);
70546
+ traceMeshEventStage("unsettled_attempt_safety_net", {
70547
+ taskId: row.id,
70548
+ sessionId: attempt.sessionId ?? row.assignedSessionId,
70549
+ nodeId: row.assignedNodeId,
70550
+ meshId,
70551
+ event: "agent:generating_completed"
70552
+ }, `${row.status}->${outcome} stage=${attempt.stage}`);
70553
+ if (reconcileTerminalViaReducer({
70554
+ meshId,
70555
+ taskId: row.id,
70556
+ outcome,
70557
+ source: "stall_reconcile",
70558
+ sessionId: attempt.sessionId ?? row.assignedSessionId,
70559
+ reason: `unsettled_attempt_safety_net:${row.status}`
70560
+ })) settled += 1;
70561
+ }
70562
+ return settled;
70563
+ }
70500
70564
  var ASSIGNED_STRANDED_DEADLINE_MS;
70501
70565
  var DELIVERED_NO_TURN_DEADLINE_MS;
70502
70566
  var NATIVE_SOURCE_ACTIVITY_STALE_MS;
@@ -70509,6 +70573,7 @@ ${cleanBody}`;
70509
70573
  var ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS;
70510
70574
  var assignedIdleFinalAssistantSince;
70511
70575
  var ZOMBIE_ASSIGNED_MIN_AGE_MS;
70576
+ var UNSETTLED_ATTEMPT_GRACE_MS;
70512
70577
  var init_mesh_reconcile_stranded_dispatch = __esm2({
70513
70578
  "src/mesh/mesh-reconcile-stranded-dispatch.ts"() {
70514
70579
  "use strict";
@@ -70541,6 +70606,7 @@ ${cleanBody}`;
70541
70606
  ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS = 8e3;
70542
70607
  assignedIdleFinalAssistantSince = /* @__PURE__ */ new Map();
70543
70608
  ZOMBIE_ASSIGNED_MIN_AGE_MS = 30 * 60 * 1e3;
70609
+ UNSETTLED_ATTEMPT_GRACE_MS = 60 * 1e3;
70544
70610
  }
70545
70611
  });
70546
70612
  function scheduleUnresolvedForwardNudge(components) {
@@ -70715,6 +70781,11 @@ ${cleanBody}`;
70715
70781
  } catch (e) {
70716
70782
  LOG2.warn("MeshReconcile", `Assigned-zombie sweep failed for mesh ${mesh.id}: ${e?.message || e}`);
70717
70783
  }
70784
+ try {
70785
+ reconcileUnsettledTerminalAttempts(mesh);
70786
+ } catch (e) {
70787
+ LOG2.warn("MeshReconcile", `Unsettled-attempt safety net failed for mesh ${mesh.id}: ${e?.message || e}`);
70788
+ }
70718
70789
  }
70719
70790
  }
70720
70791
  for (const mesh of listMeshes()) {