@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.mjs CHANGED
@@ -437,10 +437,10 @@ function readInjected(value) {
437
437
  }
438
438
  function getDaemonBuildInfo() {
439
439
  if (cached) return cached;
440
- const commit = readInjected(true ? "64f056340da99d3b28464efcf5c05fe643e5db63" : void 0) ?? "unknown";
441
- const commitShort = readInjected(true ? "64f05634" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
442
- const version = readInjected(true ? "1.0.18-rc.15" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
443
- const builtAt = readInjected(true ? "2026-07-23T00:51:36.808Z" : void 0);
440
+ const commit = readInjected(true ? "74f34080bcd7c145e55fd7e5fd492a40a4942bc4" : void 0) ?? "unknown";
441
+ const commitShort = readInjected(true ? "74f34080" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
442
+ const version = readInjected(true ? "1.0.18-rc.16" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
443
+ const builtAt = readInjected(true ? "2026-07-23T02:29:46.281Z" : void 0);
444
444
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
445
445
  return cached;
446
446
  }
@@ -19184,6 +19184,26 @@ function selectFinalAssistantTurnEndMessage(messages) {
19184
19184
  }
19185
19185
  return null;
19186
19186
  }
19187
+ function hasTrailingToolActivityAfterFinalAssistant(messages) {
19188
+ if (!Array.isArray(messages) || messages.length === 0) return false;
19189
+ let sawTrailingToolActivity = false;
19190
+ for (let i = messages.length - 1; i >= 0; i--) {
19191
+ const msg = messages[i];
19192
+ if (!msg) continue;
19193
+ const classification = classifyChatMessageVisibility(msg);
19194
+ if (classification.isUserFacing && (msg.role === "assistant" || msg.role === "model")) {
19195
+ if (flattenContent(msg.content).trim()) return sawTrailingToolActivity;
19196
+ return false;
19197
+ }
19198
+ if (classification.isUserFacing) {
19199
+ return false;
19200
+ }
19201
+ if (classification.kind === "tool" || classification.kind === "terminal") {
19202
+ sawTrailingToolActivity = true;
19203
+ }
19204
+ }
19205
+ return false;
19206
+ }
19187
19207
  function canonicalizeKindHint(value) {
19188
19208
  return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
19189
19209
  }
@@ -22881,6 +22901,7 @@ async function pollAssignedTaskTerminalEvidence(components, mesh, row) {
22881
22901
  const messages = Array.isArray(payload.messages) ? payload.messages : [];
22882
22902
  const evidence = extractFinalAssistantSummaryEvidence(messages);
22883
22903
  if (!evidence.finalSummary) return null;
22904
+ if (hasTrailingToolActivityAfterFinalAssistant(messages)) return null;
22884
22905
  const dispatchedAtMs = Date.parse(readNonEmptyString(row.dispatchTimestamp));
22885
22906
  const transcriptAtMs = Date.parse(evidence.transcriptMessageAt ?? "");
22886
22907
  if (!(Number.isFinite(dispatchedAtMs) && Number.isFinite(transcriptAtMs) && transcriptAtMs >= dispatchedAtMs)) {
@@ -23173,6 +23194,52 @@ function assignedRowLiveStatusIsAwaitingApproval(mesh, nodeId, sessionId) {
23173
23194
  return false;
23174
23195
  }
23175
23196
  }
23197
+ function resolveLocalSessionPurePty(components, sessionId) {
23198
+ try {
23199
+ const instances = components.instanceManager?.getByCategory?.("cli") || [];
23200
+ const inst = instances.find((i) => {
23201
+ const sid = readNonEmptyString(i?.getState?.().instanceId);
23202
+ return sid && sessionIdsEquivalent(sid, sessionId);
23203
+ });
23204
+ if (!inst) return void 0;
23205
+ const provider = inst.provider;
23206
+ if (!provider || typeof provider !== "object") return void 0;
23207
+ return isPurePtyTranscriptProvider(provider);
23208
+ } catch {
23209
+ return void 0;
23210
+ }
23211
+ }
23212
+ async function evaluateEarlyIdleTranscriptArm(components, mesh, store, row, localDaemonId, selfIds = []) {
23213
+ const sessionId = readNonEmptyString(row.assignedSessionId);
23214
+ if (!sessionId) return false;
23215
+ const verdict = resolveSessionBusyVerdict(components, sessionId);
23216
+ if (verdict === "GENERATING") return false;
23217
+ if (verdict === "UNKNOWN") {
23218
+ const nodeId = readNonEmptyString(row.assignedNodeId);
23219
+ const node = (mesh.nodes ?? []).find((n) => n.id === nodeId);
23220
+ const liveStatus = nodeId ? readNonEmptyString(sessionStatusFromNodes(mesh.nodes, nodeId, sessionId).status).toLowerCase() : "";
23221
+ if (liveStatus && liveStatus !== "idle") return false;
23222
+ if (!liveStatus) {
23223
+ const nodeDaemonId = readNonEmptyString(node?.daemonId);
23224
+ const isLocalNode = !nodeDaemonId || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || daemonIdListIncludes(selfIds, nodeDaemonId) || !!components.instanceManager?.getInstance?.(sessionId);
23225
+ const providerType = readNonEmptyString(row.assignedProviderType);
23226
+ const readArgs = {
23227
+ sessionId,
23228
+ targetSessionId: sessionId,
23229
+ tailLimit: 1,
23230
+ ...node?.workspace ? { workspace: node.workspace } : {},
23231
+ ...providerType ? { agentType: providerType, providerType } : {}
23232
+ };
23233
+ const probedStatus = await reprobeWorkerStatus(components, { isLocalNode, nodeDaemonId, readArgs });
23234
+ if (probedStatus !== "idle") return false;
23235
+ }
23236
+ }
23237
+ if (store.taskDeliveryConsumed(mesh.id, row.id)) return true;
23238
+ const localPurePty = resolveLocalSessionPurePty(components, sessionId);
23239
+ if (localPurePty === true) return true;
23240
+ if (localPurePty === false) return false;
23241
+ return verdict === "UNKNOWN";
23242
+ }
23176
23243
  async function recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds = []) {
23177
23244
  const meshId = mesh.id;
23178
23245
  const assigned = getQueue(meshId, { status: ["assigned"] });
@@ -23194,7 +23261,8 @@ async function recoverStrandedAssignedDispatches(components, mesh, store, localD
23194
23261
  if (!Number.isFinite(dispatchedAtMs)) continue;
23195
23262
  const ageMs = nowMs - dispatchedAtMs;
23196
23263
  const idleTranscriptStreakKey = `${meshId}::${row.id}`;
23197
- if (store.taskHasConfirmedDelivery(meshId, row.id) && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id }) && readNonEmptyString(row.assignedSessionId) && resolveSessionBusyVerdict(components, row.assignedSessionId) !== "GENERATING") {
23264
+ const earlyArm = store.taskHasConfirmedDelivery(meshId, row.id) && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id }) && readNonEmptyString(row.assignedSessionId) ? await evaluateEarlyIdleTranscriptArm(components, mesh, store, row, localDaemonId, selfIds) : false;
23265
+ if (earlyArm) {
23198
23266
  const since = assignedIdleFinalAssistantSince.get(idleTranscriptStreakKey);
23199
23267
  if (since === void 0) {
23200
23268
  assignedIdleFinalAssistantSince.set(idleTranscriptStreakKey, nowMs);
@@ -23933,6 +24001,7 @@ var init_mesh_reconcile_loop = __esm({
23933
24001
  init_mesh_reconcile_identity();
23934
24002
  init_mesh_reconcile_config();
23935
24003
  init_mesh_remote_event_pull();
24004
+ init_provider_cli_shared();
23936
24005
  init_mesh_disk_retention();
23937
24006
  init_mesh_completion_synthesis();
23938
24007
  init_mesh_active_work();