@adhdev/daemon-core 1.0.18-rc.15 → 1.0.18-rc.16

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
@@ -442,10 +442,10 @@ function readInjected(value) {
442
442
  }
443
443
  function getDaemonBuildInfo() {
444
444
  if (cached) return cached;
445
- const commit = readInjected(true ? "64f056340da99d3b28464efcf5c05fe643e5db63" : void 0) ?? "unknown";
446
- const commitShort = readInjected(true ? "64f05634" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
447
- const version = readInjected(true ? "1.0.18-rc.15" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
448
- const builtAt = readInjected(true ? "2026-07-23T00:51:36.808Z" : void 0);
445
+ const commit = readInjected(true ? "74f34080bcd7c145e55fd7e5fd492a40a4942bc4" : void 0) ?? "unknown";
446
+ const commitShort = readInjected(true ? "74f34080" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
447
+ const version = readInjected(true ? "1.0.18-rc.16" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
448
+ const builtAt = readInjected(true ? "2026-07-23T02:29:46.281Z" : void 0);
449
449
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
450
450
  return cached;
451
451
  }
@@ -19182,6 +19182,26 @@ function selectFinalAssistantTurnEndMessage(messages) {
19182
19182
  }
19183
19183
  return null;
19184
19184
  }
19185
+ function hasTrailingToolActivityAfterFinalAssistant(messages) {
19186
+ if (!Array.isArray(messages) || messages.length === 0) return false;
19187
+ let sawTrailingToolActivity = false;
19188
+ for (let i = messages.length - 1; i >= 0; i--) {
19189
+ const msg = messages[i];
19190
+ if (!msg) continue;
19191
+ const classification = classifyChatMessageVisibility(msg);
19192
+ if (classification.isUserFacing && (msg.role === "assistant" || msg.role === "model")) {
19193
+ if (flattenContent(msg.content).trim()) return sawTrailingToolActivity;
19194
+ return false;
19195
+ }
19196
+ if (classification.isUserFacing) {
19197
+ return false;
19198
+ }
19199
+ if (classification.kind === "tool" || classification.kind === "terminal") {
19200
+ sawTrailingToolActivity = true;
19201
+ }
19202
+ }
19203
+ return false;
19204
+ }
19185
19205
  function canonicalizeKindHint(value) {
19186
19206
  return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
19187
19207
  }
@@ -22873,6 +22893,7 @@ async function pollAssignedTaskTerminalEvidence(components, mesh, row) {
22873
22893
  const messages = Array.isArray(payload.messages) ? payload.messages : [];
22874
22894
  const evidence = extractFinalAssistantSummaryEvidence(messages);
22875
22895
  if (!evidence.finalSummary) return null;
22896
+ if (hasTrailingToolActivityAfterFinalAssistant(messages)) return null;
22876
22897
  const dispatchedAtMs = Date.parse(readNonEmptyString(row.dispatchTimestamp));
22877
22898
  const transcriptAtMs = Date.parse(evidence.transcriptMessageAt ?? "");
22878
22899
  if (!(Number.isFinite(dispatchedAtMs) && Number.isFinite(transcriptAtMs) && transcriptAtMs >= dispatchedAtMs)) {
@@ -23165,6 +23186,52 @@ function assignedRowLiveStatusIsAwaitingApproval(mesh, nodeId, sessionId) {
23165
23186
  return false;
23166
23187
  }
23167
23188
  }
23189
+ function resolveLocalSessionPurePty(components, sessionId) {
23190
+ try {
23191
+ const instances = components.instanceManager?.getByCategory?.("cli") || [];
23192
+ const inst = instances.find((i) => {
23193
+ const sid = readNonEmptyString(i?.getState?.().instanceId);
23194
+ return sid && sessionIdsEquivalent(sid, sessionId);
23195
+ });
23196
+ if (!inst) return void 0;
23197
+ const provider = inst.provider;
23198
+ if (!provider || typeof provider !== "object") return void 0;
23199
+ return isPurePtyTranscriptProvider(provider);
23200
+ } catch {
23201
+ return void 0;
23202
+ }
23203
+ }
23204
+ async function evaluateEarlyIdleTranscriptArm(components, mesh, store, row, localDaemonId, selfIds = []) {
23205
+ const sessionId = readNonEmptyString(row.assignedSessionId);
23206
+ if (!sessionId) return false;
23207
+ const verdict = resolveSessionBusyVerdict(components, sessionId);
23208
+ if (verdict === "GENERATING") return false;
23209
+ if (verdict === "UNKNOWN") {
23210
+ const nodeId = readNonEmptyString(row.assignedNodeId);
23211
+ const node = (mesh.nodes ?? []).find((n) => n.id === nodeId);
23212
+ const liveStatus = nodeId ? readNonEmptyString(sessionStatusFromNodes(mesh.nodes, nodeId, sessionId).status).toLowerCase() : "";
23213
+ if (liveStatus && liveStatus !== "idle") return false;
23214
+ if (!liveStatus) {
23215
+ const nodeDaemonId = readNonEmptyString(node?.daemonId);
23216
+ const isLocalNode = !nodeDaemonId || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || daemonIdListIncludes(selfIds, nodeDaemonId) || !!components.instanceManager?.getInstance?.(sessionId);
23217
+ const providerType = readNonEmptyString(row.assignedProviderType);
23218
+ const readArgs = {
23219
+ sessionId,
23220
+ targetSessionId: sessionId,
23221
+ tailLimit: 1,
23222
+ ...node?.workspace ? { workspace: node.workspace } : {},
23223
+ ...providerType ? { agentType: providerType, providerType } : {}
23224
+ };
23225
+ const probedStatus = await reprobeWorkerStatus(components, { isLocalNode, nodeDaemonId, readArgs });
23226
+ if (probedStatus !== "idle") return false;
23227
+ }
23228
+ }
23229
+ if (store.taskDeliveryConsumed(mesh.id, row.id)) return true;
23230
+ const localPurePty = resolveLocalSessionPurePty(components, sessionId);
23231
+ if (localPurePty === true) return true;
23232
+ if (localPurePty === false) return false;
23233
+ return verdict === "UNKNOWN";
23234
+ }
23168
23235
  async function recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds = []) {
23169
23236
  const meshId = mesh.id;
23170
23237
  const assigned = getQueue(meshId, { status: ["assigned"] });
@@ -23186,7 +23253,8 @@ async function recoverStrandedAssignedDispatches(components, mesh, store, localD
23186
23253
  if (!Number.isFinite(dispatchedAtMs)) continue;
23187
23254
  const ageMs = nowMs - dispatchedAtMs;
23188
23255
  const idleTranscriptStreakKey = `${meshId}::${row.id}`;
23189
- if (store.taskHasConfirmedDelivery(meshId, row.id) && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id }) && readNonEmptyString(row.assignedSessionId) && resolveSessionBusyVerdict(components, row.assignedSessionId) !== "GENERATING") {
23256
+ const earlyArm = store.taskHasConfirmedDelivery(meshId, row.id) && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id }) && readNonEmptyString(row.assignedSessionId) ? await evaluateEarlyIdleTranscriptArm(components, mesh, store, row, localDaemonId, selfIds) : false;
23257
+ if (earlyArm) {
23190
23258
  const since = assignedIdleFinalAssistantSince.get(idleTranscriptStreakKey);
23191
23259
  if (since === void 0) {
23192
23260
  assignedIdleFinalAssistantSince.set(idleTranscriptStreakKey, nowMs);
@@ -23925,6 +23993,7 @@ var init_mesh_reconcile_loop = __esm({
23925
23993
  init_mesh_reconcile_identity();
23926
23994
  init_mesh_reconcile_config();
23927
23995
  init_mesh_remote_event_pull();
23996
+ init_provider_cli_shared();
23928
23997
  init_mesh_disk_retention();
23929
23998
  init_mesh_completion_synthesis();
23930
23999
  init_mesh_active_work();