@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.js +27 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +7 -3
- package/src/mesh/mesh-events.ts +40 -17
package/dist/index.js
CHANGED
|
@@ -3274,9 +3274,8 @@ ${lastSnapshot}`;
|
|
|
3274
3274
|
};
|
|
3275
3275
|
this.recordTrace("submit_echo_missing", diagnostic);
|
|
3276
3276
|
if (this.requirePromptEchoBeforeSubmit) {
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
completion.rejectOnce(new Error(message));
|
|
3277
|
+
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)}`);
|
|
3278
|
+
this.submitSendKey(state, completion);
|
|
3280
3279
|
return;
|
|
3281
3280
|
}
|
|
3282
3281
|
LOG.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs}`);
|
|
@@ -30121,33 +30120,49 @@ init_config();
|
|
|
30121
30120
|
// src/mesh/mesh-events.ts
|
|
30122
30121
|
init_mesh_config();
|
|
30123
30122
|
init_logger();
|
|
30123
|
+
function readNonEmptyString(value) {
|
|
30124
|
+
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
30125
|
+
}
|
|
30126
|
+
function formatCompletionMetadata(event) {
|
|
30127
|
+
const parts = [
|
|
30128
|
+
readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
|
|
30129
|
+
readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
|
|
30130
|
+
readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
|
|
30131
|
+
].filter(Boolean);
|
|
30132
|
+
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
30133
|
+
}
|
|
30124
30134
|
function setupMeshEventForwarding(components) {
|
|
30125
30135
|
components.instanceManager.onEvent((event) => {
|
|
30126
30136
|
if (event.event !== "agent:generating_completed" && event.event !== "agent:waiting_approval") return;
|
|
30127
|
-
const instanceId = event.instanceId;
|
|
30137
|
+
const instanceId = readNonEmptyString(event.instanceId);
|
|
30128
30138
|
if (!instanceId) return;
|
|
30129
30139
|
const sourceInstance = components.instanceManager.getInstance(instanceId);
|
|
30130
30140
|
if (!sourceInstance || sourceInstance.category !== "cli") return;
|
|
30131
30141
|
const state = sourceInstance.getState();
|
|
30132
|
-
const workspace = state.workspace;
|
|
30142
|
+
const workspace = readNonEmptyString(state.workspace);
|
|
30133
30143
|
if (!workspace) return;
|
|
30134
|
-
const
|
|
30135
|
-
|
|
30144
|
+
const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
|
|
30145
|
+
const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
|
|
30146
|
+
const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
|
|
30147
|
+
const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
|
|
30148
|
+
if (!meshId) return;
|
|
30136
30149
|
const allInstances = components.instanceManager.getByCategory("cli");
|
|
30137
30150
|
const coordinatorInstances = allInstances.filter((inst) => {
|
|
30138
30151
|
const instState = inst.getState();
|
|
30139
|
-
if (instState.settings?.meshCoordinatorFor !==
|
|
30152
|
+
if (instState.settings?.meshCoordinatorFor !== meshId) return false;
|
|
30140
30153
|
if (instState.instanceId === instanceId) return false;
|
|
30141
30154
|
return true;
|
|
30142
30155
|
});
|
|
30143
30156
|
if (coordinatorInstances.length === 0) return;
|
|
30144
|
-
const targetNode = mesh
|
|
30145
|
-
const
|
|
30157
|
+
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
30158
|
+
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
30159
|
+
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
30160
|
+
const metadata = formatCompletionMetadata(event);
|
|
30146
30161
|
let messageText = "";
|
|
30147
30162
|
if (event.event === "agent:generating_completed") {
|
|
30148
|
-
messageText = `[System] ${nodeLabel} has completed its task and is now idle. You may use mesh_read_chat to review its progress.`;
|
|
30163
|
+
messageText = `[System] ${nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
|
|
30149
30164
|
} else if (event.event === "agent:waiting_approval") {
|
|
30150
|
-
messageText = `[System] ${nodeLabel} is waiting for approval to proceed. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
30165
|
+
messageText = `[System] ${nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
30151
30166
|
}
|
|
30152
30167
|
if (!messageText) return;
|
|
30153
30168
|
for (const coord of coordinatorInstances) {
|