@adhdev/daemon-core 0.9.76-rc.30 → 0.9.76-rc.32

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
@@ -3270,9 +3270,8 @@ ${lastSnapshot}`;
3270
3270
  };
3271
3271
  this.recordTrace("submit_echo_missing", diagnostic);
3272
3272
  if (this.requirePromptEchoBeforeSubmit) {
3273
- const message = `${this.cliName} prompt echo was not observed on the PTY screen before submit`;
3274
- LOG.warn("CLI", `[${this.cliType}] ${message} elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs} screen=${JSON.stringify(diagnostic.screenText).slice(0, 240)}`);
3275
- completion.rejectOnce(new Error(message));
3273
+ LOG.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending guarded submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs} screen=${JSON.stringify(diagnostic.screenText).slice(0, 240)}`);
3274
+ this.submitSendKey(state, completion);
3276
3275
  return;
3277
3276
  }
3278
3277
  LOG.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs}`);
@@ -29934,33 +29933,49 @@ init_config();
29934
29933
  // src/mesh/mesh-events.ts
29935
29934
  init_mesh_config();
29936
29935
  init_logger();
29936
+ function readNonEmptyString(value) {
29937
+ return typeof value === "string" && value.trim() ? value.trim() : "";
29938
+ }
29939
+ function formatCompletionMetadata(event) {
29940
+ const parts = [
29941
+ readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
29942
+ readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
29943
+ readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
29944
+ ].filter(Boolean);
29945
+ return parts.length > 0 ? ` (${parts.join("; ")})` : "";
29946
+ }
29937
29947
  function setupMeshEventForwarding(components) {
29938
29948
  components.instanceManager.onEvent((event) => {
29939
29949
  if (event.event !== "agent:generating_completed" && event.event !== "agent:waiting_approval") return;
29940
- const instanceId = event.instanceId;
29950
+ const instanceId = readNonEmptyString(event.instanceId);
29941
29951
  if (!instanceId) return;
29942
29952
  const sourceInstance = components.instanceManager.getInstance(instanceId);
29943
29953
  if (!sourceInstance || sourceInstance.category !== "cli") return;
29944
29954
  const state = sourceInstance.getState();
29945
- const workspace = state.workspace;
29955
+ const workspace = readNonEmptyString(state.workspace);
29946
29956
  if (!workspace) return;
29947
- const mesh = getMeshByRepo(workspace);
29948
- if (!mesh) return;
29957
+ const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
29958
+ const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
29959
+ const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
29960
+ const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
29961
+ if (!meshId) return;
29949
29962
  const allInstances = components.instanceManager.getByCategory("cli");
29950
29963
  const coordinatorInstances = allInstances.filter((inst) => {
29951
29964
  const instState = inst.getState();
29952
- if (instState.settings?.meshCoordinatorFor !== mesh.id) return false;
29965
+ if (instState.settings?.meshCoordinatorFor !== meshId) return false;
29953
29966
  if (instState.instanceId === instanceId) return false;
29954
29967
  return true;
29955
29968
  });
29956
29969
  if (coordinatorInstances.length === 0) return;
29957
- const targetNode = mesh.nodes.find((n) => n.workspace === workspace);
29958
- const nodeLabel = targetNode ? `Node '${targetNode.id}'` : `Agent at ${workspace}`;
29970
+ const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
29971
+ const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
29972
+ const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
29973
+ const metadata = formatCompletionMetadata(event);
29959
29974
  let messageText = "";
29960
29975
  if (event.event === "agent:generating_completed") {
29961
- messageText = `[System] ${nodeLabel} has completed its task and is now idle. You may use mesh_read_chat to review its progress.`;
29976
+ messageText = `[System] ${nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
29962
29977
  } else if (event.event === "agent:waiting_approval") {
29963
- messageText = `[System] ${nodeLabel} is waiting for approval to proceed. You may use mesh_read_chat and mesh_approve to handle it.`;
29978
+ messageText = `[System] ${nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
29964
29979
  }
29965
29980
  if (!messageText) return;
29966
29981
  for (const coord of coordinatorInstances) {