@adhdev/daemon-standalone 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.js CHANGED
@@ -34485,9 +34485,8 @@ ${lastSnapshot}`;
34485
34485
  };
34486
34486
  this.recordTrace("submit_echo_missing", diagnostic);
34487
34487
  if (this.requirePromptEchoBeforeSubmit) {
34488
- const message = `${this.cliName} prompt echo was not observed on the PTY screen before submit`;
34489
- LOG2.warn("CLI", `[${this.cliType}] ${message} elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs} screen=${JSON.stringify(diagnostic.screenText).slice(0, 240)}`);
34490
- completion.rejectOnce(new Error(message));
34488
+ LOG2.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)}`);
34489
+ this.submitSendKey(state, completion);
34491
34490
  return;
34492
34491
  }
34493
34492
  LOG2.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs}`);
@@ -61110,33 +61109,49 @@ data: ${JSON.stringify(msg.data)}
61110
61109
  init_config();
61111
61110
  init_mesh_config();
61112
61111
  init_logger();
61112
+ function readNonEmptyString(value) {
61113
+ return typeof value === "string" && value.trim() ? value.trim() : "";
61114
+ }
61115
+ function formatCompletionMetadata(event) {
61116
+ const parts = [
61117
+ readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
61118
+ readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
61119
+ readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
61120
+ ].filter(Boolean);
61121
+ return parts.length > 0 ? ` (${parts.join("; ")})` : "";
61122
+ }
61113
61123
  function setupMeshEventForwarding(components) {
61114
61124
  components.instanceManager.onEvent((event) => {
61115
61125
  if (event.event !== "agent:generating_completed" && event.event !== "agent:waiting_approval") return;
61116
- const instanceId = event.instanceId;
61126
+ const instanceId = readNonEmptyString(event.instanceId);
61117
61127
  if (!instanceId) return;
61118
61128
  const sourceInstance = components.instanceManager.getInstance(instanceId);
61119
61129
  if (!sourceInstance || sourceInstance.category !== "cli") return;
61120
61130
  const state = sourceInstance.getState();
61121
- const workspace = state.workspace;
61131
+ const workspace = readNonEmptyString(state.workspace);
61122
61132
  if (!workspace) return;
61123
- const mesh = getMeshByRepo(workspace);
61124
- if (!mesh) return;
61133
+ const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
61134
+ const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
61135
+ const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
61136
+ const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
61137
+ if (!meshId) return;
61125
61138
  const allInstances = components.instanceManager.getByCategory("cli");
61126
61139
  const coordinatorInstances = allInstances.filter((inst) => {
61127
61140
  const instState = inst.getState();
61128
- if (instState.settings?.meshCoordinatorFor !== mesh.id) return false;
61141
+ if (instState.settings?.meshCoordinatorFor !== meshId) return false;
61129
61142
  if (instState.instanceId === instanceId) return false;
61130
61143
  return true;
61131
61144
  });
61132
61145
  if (coordinatorInstances.length === 0) return;
61133
- const targetNode = mesh.nodes.find((n) => n.workspace === workspace);
61134
- const nodeLabel = targetNode ? `Node '${targetNode.id}'` : `Agent at ${workspace}`;
61146
+ const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
61147
+ const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
61148
+ const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
61149
+ const metadata = formatCompletionMetadata(event);
61135
61150
  let messageText = "";
61136
61151
  if (event.event === "agent:generating_completed") {
61137
- messageText = `[System] ${nodeLabel} has completed its task and is now idle. You may use mesh_read_chat to review its progress.`;
61152
+ messageText = `[System] ${nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
61138
61153
  } else if (event.event === "agent:waiting_approval") {
61139
- messageText = `[System] ${nodeLabel} is waiting for approval to proceed. You may use mesh_read_chat and mesh_approve to handle it.`;
61154
+ messageText = `[System] ${nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
61140
61155
  }
61141
61156
  if (!messageText) return;
61142
61157
  for (const coord of coordinatorInstances) {