@adhdev/daemon-core 0.9.77-rc.30 → 0.9.77-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 +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +3 -0
- package/package.json +1 -1
- package/src/mesh/mesh-work-queue.ts +12 -5
package/dist/index.js
CHANGED
|
@@ -1004,6 +1004,7 @@ function enqueueTask(meshId, message, opts) {
|
|
|
1004
1004
|
message,
|
|
1005
1005
|
status: "pending",
|
|
1006
1006
|
targetNodeId: opts?.targetNodeId,
|
|
1007
|
+
targetSessionId: opts?.targetSessionId,
|
|
1007
1008
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1008
1009
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1009
1010
|
};
|
|
@@ -1021,9 +1022,12 @@ function getQueue(meshId, opts) {
|
|
|
1021
1022
|
}
|
|
1022
1023
|
function claimNextTask(meshId, nodeId, sessionId) {
|
|
1023
1024
|
const queue = readQueue(meshId);
|
|
1024
|
-
let targetIdx = queue.findIndex((q) => q.status === "pending" && q.
|
|
1025
|
+
let targetIdx = queue.findIndex((q) => q.status === "pending" && q.targetSessionId === sessionId);
|
|
1025
1026
|
if (targetIdx === -1) {
|
|
1026
|
-
targetIdx = queue.findIndex((q) => q.status === "pending" && !q.
|
|
1027
|
+
targetIdx = queue.findIndex((q) => q.status === "pending" && q.targetNodeId === nodeId && !q.targetSessionId);
|
|
1028
|
+
}
|
|
1029
|
+
if (targetIdx === -1) {
|
|
1030
|
+
targetIdx = queue.findIndex((q) => q.status === "pending" && !q.targetNodeId && !q.targetSessionId);
|
|
1027
1031
|
}
|
|
1028
1032
|
if (targetIdx === -1) return null;
|
|
1029
1033
|
const entry = queue[targetIdx];
|