@adhdev/daemon-standalone 0.9.77-rc.27 → 0.9.77-rc.29
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/package.json
CHANGED
|
@@ -57474,9 +57474,10 @@ async function ipcDispatchToRemoteAgent(ctx, node, args) {
|
|
|
57474
57474
|
let resolvedProviderType = args.providerType?.trim() || providerPriorityList[0] || "";
|
|
57475
57475
|
if (!sessionId) {
|
|
57476
57476
|
try {
|
|
57477
|
-
const
|
|
57478
|
-
const
|
|
57479
|
-
const
|
|
57477
|
+
const relayResult = await transport.meshCommand(daemonId, "get_status_metadata", {});
|
|
57478
|
+
const innerResult = relayResult?.result ?? relayResult;
|
|
57479
|
+
const statusObj = innerResult?.status ?? innerResult;
|
|
57480
|
+
const sessions = Array.isArray(statusObj?.sessions) ? statusObj.sessions : [];
|
|
57480
57481
|
const meshSessions = sessions.filter(
|
|
57481
57482
|
(s) => s?.settings?.meshNodeFor === ctx.mesh.id || s?.settings?.meshNodeId === node.id || s?.settings?.launchedByCoordinator === true
|
|
57482
57483
|
);
|
|
@@ -57938,22 +57939,38 @@ async function meshListNodes(ctx) {
|
|
|
57938
57939
|
async function meshEnqueueTask(ctx, args) {
|
|
57939
57940
|
try {
|
|
57940
57941
|
const task = enqueueTask(ctx.mesh.id, args.message);
|
|
57941
|
-
if (isLocalTransport(ctx.transport)) {
|
|
57942
|
+
if (isLocalTransport(ctx.transport) && !(ctx.transport instanceof IpcTransport)) {
|
|
57942
57943
|
ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57943
57944
|
});
|
|
57944
|
-
|
|
57945
|
-
|
|
57946
|
-
|
|
57947
|
-
|
|
57948
|
-
|
|
57949
|
-
|
|
57950
|
-
|
|
57951
|
-
|
|
57952
|
-
|
|
57953
|
-
|
|
57954
|
-
}
|
|
57955
|
-
|
|
57945
|
+
return JSON.stringify({ success: true, taskId: task.id, status: task.status });
|
|
57946
|
+
}
|
|
57947
|
+
if (ctx.transport instanceof IpcTransport) {
|
|
57948
|
+
ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57949
|
+
});
|
|
57950
|
+
const dispatchPromises = [];
|
|
57951
|
+
for (const node of ctx.mesh.nodes) {
|
|
57952
|
+
const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
|
|
57953
|
+
if (isLocalNode || !node.daemonId) continue;
|
|
57954
|
+
dispatchPromises.push(
|
|
57955
|
+
ipcDispatchToRemoteAgent(ctx, node, { message: args.message }).then((result) => {
|
|
57956
|
+
if (result.success) {
|
|
57957
|
+
try {
|
|
57958
|
+
appendLedgerEntry(ctx.mesh.id, {
|
|
57959
|
+
kind: "task_dispatched",
|
|
57960
|
+
nodeId: node.id,
|
|
57961
|
+
sessionId: result.sessionId,
|
|
57962
|
+
payload: { message: args.message, via: "p2p_direct", taskId: task.id }
|
|
57963
|
+
});
|
|
57964
|
+
} catch {
|
|
57965
|
+
}
|
|
57966
|
+
}
|
|
57967
|
+
}).catch(() => {
|
|
57968
|
+
})
|
|
57969
|
+
);
|
|
57956
57970
|
}
|
|
57971
|
+
Promise.all(dispatchPromises).catch(() => {
|
|
57972
|
+
});
|
|
57973
|
+
return JSON.stringify({ success: true, taskId: task.id, status: task.status });
|
|
57957
57974
|
}
|
|
57958
57975
|
return JSON.stringify({ success: true, taskId: task.id, status: task.status });
|
|
57959
57976
|
} catch (e) {
|