@adhdev/daemon-standalone 0.9.82-rc.373 → 0.9.82-rc.374

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
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
30036
30036
  }
30037
30037
  function getDaemonBuildInfo() {
30038
30038
  if (cached2) return cached2;
30039
- const commit = readInjected(true ? "f16b5e6cdf653b4258f8f44cb11fb6ad8c13329f" : void 0) ?? "unknown";
30040
- const commitShort = readInjected(true ? "f16b5e6c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
- const version2 = readInjected(true ? "0.9.82-rc.373" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
- const builtAt = readInjected(true ? "2026-06-24T16:29:42.060Z" : void 0);
30039
+ const commit = readInjected(true ? "47e042dcb10c9ca07c30ac4bf8e0d5a4153a63c6" : void 0) ?? "unknown";
30040
+ const commitShort = readInjected(true ? "47e042dc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
+ const version2 = readInjected(true ? "0.9.82-rc.374" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
+ const builtAt = readInjected(true ? "2026-06-25T00:33:32.738Z" : void 0);
30043
30043
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30044
30044
  return cached2;
30045
30045
  }
@@ -38527,7 +38527,7 @@ Next step: ${nextStep}`;
38527
38527
  "src/mesh/mesh-events-utils.ts"() {
38528
38528
  "use strict";
38529
38529
  MESH_SURFACED_PREVIEW_MAX_CHARS = 512;
38530
- MESH_COMPLETION_SURFACE_MAX_CHARS = 4e3;
38530
+ MESH_COMPLETION_SURFACE_MAX_CHARS = 16e3;
38531
38531
  }
38532
38532
  });
38533
38533
  function normalizeCoordinatorDaemonIds(coordinatorDaemonId) {
@@ -39170,6 +39170,22 @@ Next step: ${nextStep}`;
39170
39170
  const diag = readRecord4(payload.completionDiagnostic);
39171
39171
  return diag?.finalAssistantPresent === false || diag?.blockReason === "missing_final_assistant";
39172
39172
  }
39173
+ function findTerminalLedgerEvidenceForTask(args) {
39174
+ const taskId = readNonEmptyString2(args.taskId);
39175
+ if (!taskId) return null;
39176
+ const entries = readLedgerEntries(args.meshId, { tail: args.tail ?? 500 });
39177
+ for (let i = entries.length - 1; i >= 0; i--) {
39178
+ const entry = entries[i];
39179
+ if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
39180
+ const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
39181
+ if (terminalTaskId !== taskId) continue;
39182
+ if (entry.kind === "task_completed" && isWeakCompletionLedgerPayload(entry.payload)) continue;
39183
+ if (args.sessionId && entry.sessionId && entry.sessionId !== args.sessionId) continue;
39184
+ if (!args.sessionId && args.nodeId && entry.nodeId && !meshNodeIdMatches(entry, args.nodeId)) continue;
39185
+ return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
39186
+ }
39187
+ return null;
39188
+ }
39173
39189
  function findDirectDispatchLedgerEntry(args) {
39174
39190
  const entries = readLedgerEntries(args.meshId, { tail: 500 });
39175
39191
  for (let i = entries.length - 1; i >= 0; i--) {
@@ -41308,7 +41324,7 @@ Next step: ${nextStep}`;
41308
41324
  "src/providers/chat-message-normalization.ts"() {
41309
41325
  "use strict";
41310
41326
  init_contracts();
41311
- DEFAULT_FINAL_SUMMARY_MAX_CHARS = 4e3;
41327
+ DEFAULT_FINAL_SUMMARY_MAX_CHARS = 16e3;
41312
41328
  BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
41313
41329
  CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
41314
41330
  CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
@@ -42817,6 +42833,23 @@ ${cleanBody}`;
42817
42833
  if (!task) {
42818
42834
  return false;
42819
42835
  }
42836
+ const terminal = findTerminalLedgerEvidenceForTask({
42837
+ meshId,
42838
+ taskId: task.id
42839
+ });
42840
+ if (terminal) {
42841
+ const status = terminal.kind === "task_completed" ? "completed" : "failed";
42842
+ updateTaskStatus(meshId, task.id, status);
42843
+ LOG2.info("MeshQueue", `Skipped dispatch for terminal task ${task.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
42844
+ traceMeshEventDrop("dispatch_terminal_ledger", {
42845
+ taskId: task.id,
42846
+ sessionId,
42847
+ nodeId,
42848
+ meshId,
42849
+ event: "agent_command"
42850
+ }, terminal.kind);
42851
+ return false;
42852
+ }
42820
42853
  LOG2.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
42821
42854
  if (node?.daemonId && components.dispatchMeshCommand) {
42822
42855
  const isLocalNode = components.cliManager.adapters.has(sessionId);
@@ -44372,20 +44405,24 @@ ${cleanBody}`;
44372
44405
  if (host.role && host.role !== "host") return false;
44373
44406
  const hostDaemonId = readNonEmptyString2(host.hostDaemonId);
44374
44407
  if (!hostDaemonId) return true;
44375
- return daemonIds.includes(hostDaemonId);
44408
+ return daemonIdListIncludes(daemonIds, hostDaemonId);
44409
+ }
44410
+ function daemonIdListIncludes(ids, id) {
44411
+ if (!id) return false;
44412
+ return ids.some((candidate) => candidate === id || daemonIdsEquivalent(candidate, id));
44376
44413
  }
44377
44414
  function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
44378
44415
  const ids = new Set(drainDaemonIds);
44379
44416
  for (const node of mesh.nodes) {
44380
44417
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
44381
44418
  const nodeMachineId = readNonEmptyString2(node.machineId);
44382
- const isSelf = nodeDaemonId && drainDaemonIds.includes(nodeDaemonId) || nodeMachineId && drainDaemonIds.includes(nodeMachineId);
44419
+ const isSelf = nodeDaemonId && daemonIdListIncludes(drainDaemonIds, nodeDaemonId) || nodeMachineId && daemonIdListIncludes(drainDaemonIds, nodeMachineId);
44383
44420
  if (!isSelf) continue;
44384
44421
  if (nodeDaemonId) ids.add(nodeDaemonId);
44385
44422
  if (nodeMachineId) ids.add(nodeMachineId);
44386
44423
  }
44387
44424
  const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
44388
- if (hostDaemonId && ids.has(hostDaemonId)) ids.add(hostDaemonId);
44425
+ if (hostDaemonId && daemonIdListIncludes([...ids], hostDaemonId)) ids.add(hostDaemonId);
44389
44426
  return [...ids];
44390
44427
  }
44391
44428
  function findLiveCoordinators(components) {
@@ -44463,6 +44500,23 @@ ${cleanBody}`;
44463
44500
  const dispatchedAtMs = Date.parse(row.dispatchTimestamp ?? "");
44464
44501
  if (!Number.isFinite(dispatchedAtMs)) continue;
44465
44502
  if (nowMs - dispatchedAtMs < ASSIGNED_STRANDED_DEADLINE_MS) continue;
44503
+ const terminal = findTerminalLedgerEvidenceForTask({
44504
+ meshId,
44505
+ taskId: row.id
44506
+ });
44507
+ if (terminal) {
44508
+ const status = terminal.kind === "task_completed" ? "completed" : "failed";
44509
+ updateTaskStatus(meshId, row.id, status);
44510
+ LOG2.warn("MeshReconcile", `Skipped stranded reclaim redispatch for terminal task ${row.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
44511
+ traceMeshEventDrop("assigned_stranded_terminal_ledger", {
44512
+ taskId: row.id,
44513
+ sessionId: row.assignedSessionId,
44514
+ nodeId: row.assignedNodeId,
44515
+ meshId,
44516
+ event: "agent:generating_completed"
44517
+ }, terminal.kind);
44518
+ continue;
44519
+ }
44466
44520
  if (store.taskHasConfirmedDelivery(meshId, row.id)) continue;
44467
44521
  const reclaimed = reclaimStrandedAssignedTask(meshId, row.id, {
44468
44522
  reason: "assigned_stranded_dispatch_unconfirmed",
@@ -44759,7 +44813,7 @@ ${cleanBody}`;
44759
44813
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
44760
44814
  if (!nodeDaemonId) continue;
44761
44815
  if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) continue;
44762
- if (candidateDaemonIds.includes(nodeDaemonId)) continue;
44816
+ if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) continue;
44763
44817
  for (const pendingEventArgs of pulls) {
44764
44818
  let events;
44765
44819
  try {
@@ -44815,7 +44869,7 @@ ${cleanBody}`;
44815
44869
  if (!sessionId || !nodeId || !taskId) continue;
44816
44870
  const node = nodeById.get(nodeId);
44817
44871
  const nodeDaemonId = readNonEmptyString2(node?.daemonId);
44818
- const isLocalNode = !nodeDaemonId || selfIds.includes(nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
44872
+ const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
44819
44873
  const providerType = readNonEmptyString2(dispatch.providerType);
44820
44874
  const readArgs = {
44821
44875
  sessionId,
@@ -44890,7 +44944,7 @@ ${cleanBody}`;
44890
44944
  const dispatchMeshCommand = components.dispatchMeshCommand;
44891
44945
  return Promise.all(mesh.nodes.map(async (node) => {
44892
44946
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
44893
- const isLocalNode = !nodeDaemonId || selfIds.includes(nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
44947
+ const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
44894
44948
  let statusResult;
44895
44949
  try {
44896
44950
  if (isLocalNode) {
@@ -76447,7 +76501,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
76447
76501
  return "";
76448
76502
  }
76449
76503
  })();
76450
- const isCoordinatorBaseNode = !!selfDaemonId && (nodeDaemonId === selfDaemonId || nodeMachineId === selfDaemonId) || !!selfMachineId && (nodeDaemonId === selfMachineId || nodeMachineId === selfMachineId);
76504
+ const isCoordinatorBaseNode = !!selfDaemonId && (daemonIdsEquivalent(nodeDaemonId, selfDaemonId) || daemonIdsEquivalent(nodeMachineId, selfDaemonId)) || !!selfMachineId && (daemonIdsEquivalent(nodeDaemonId, selfMachineId) || daemonIdsEquivalent(nodeMachineId, selfMachineId));
76451
76505
  if (isCoordinatorBaseNode) {
76452
76506
  return {
76453
76507
  success: false,