@adhdev/daemon-standalone 0.9.76-rc.30 → 0.9.76-rc.31
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 +25 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +53 -13
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -61110,33 +61110,49 @@ data: ${JSON.stringify(msg.data)}
|
|
|
61110
61110
|
init_config();
|
|
61111
61111
|
init_mesh_config();
|
|
61112
61112
|
init_logger();
|
|
61113
|
+
function readNonEmptyString(value) {
|
|
61114
|
+
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
61115
|
+
}
|
|
61116
|
+
function formatCompletionMetadata(event) {
|
|
61117
|
+
const parts = [
|
|
61118
|
+
readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
|
|
61119
|
+
readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
|
|
61120
|
+
readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
|
|
61121
|
+
].filter(Boolean);
|
|
61122
|
+
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
61123
|
+
}
|
|
61113
61124
|
function setupMeshEventForwarding(components) {
|
|
61114
61125
|
components.instanceManager.onEvent((event) => {
|
|
61115
61126
|
if (event.event !== "agent:generating_completed" && event.event !== "agent:waiting_approval") return;
|
|
61116
|
-
const instanceId = event.instanceId;
|
|
61127
|
+
const instanceId = readNonEmptyString(event.instanceId);
|
|
61117
61128
|
if (!instanceId) return;
|
|
61118
61129
|
const sourceInstance = components.instanceManager.getInstance(instanceId);
|
|
61119
61130
|
if (!sourceInstance || sourceInstance.category !== "cli") return;
|
|
61120
61131
|
const state = sourceInstance.getState();
|
|
61121
|
-
const workspace = state.workspace;
|
|
61132
|
+
const workspace = readNonEmptyString(state.workspace);
|
|
61122
61133
|
if (!workspace) return;
|
|
61123
|
-
const
|
|
61124
|
-
|
|
61134
|
+
const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
|
|
61135
|
+
const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
|
|
61136
|
+
const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
|
|
61137
|
+
const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
|
|
61138
|
+
if (!meshId) return;
|
|
61125
61139
|
const allInstances = components.instanceManager.getByCategory("cli");
|
|
61126
61140
|
const coordinatorInstances = allInstances.filter((inst) => {
|
|
61127
61141
|
const instState = inst.getState();
|
|
61128
|
-
if (instState.settings?.meshCoordinatorFor !==
|
|
61142
|
+
if (instState.settings?.meshCoordinatorFor !== meshId) return false;
|
|
61129
61143
|
if (instState.instanceId === instanceId) return false;
|
|
61130
61144
|
return true;
|
|
61131
61145
|
});
|
|
61132
61146
|
if (coordinatorInstances.length === 0) return;
|
|
61133
|
-
const targetNode = mesh
|
|
61134
|
-
const
|
|
61147
|
+
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
61148
|
+
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
61149
|
+
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
61150
|
+
const metadata = formatCompletionMetadata(event);
|
|
61135
61151
|
let messageText = "";
|
|
61136
61152
|
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.`;
|
|
61153
|
+
messageText = `[System] ${nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
|
|
61138
61154
|
} 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.`;
|
|
61155
|
+
messageText = `[System] ${nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
61140
61156
|
}
|
|
61141
61157
|
if (!messageText) return;
|
|
61142
61158
|
for (const coord of coordinatorInstances) {
|