@cryptiklemur/lattice 5.13.3 → 5.13.4
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.
|
@@ -46,6 +46,7 @@ function createMessageQueue(label) {
|
|
|
46
46
|
let waiting = null;
|
|
47
47
|
let ended = false;
|
|
48
48
|
let readCount = 0;
|
|
49
|
+
const readWaiters = new Map();
|
|
49
50
|
return {
|
|
50
51
|
push: function (msg) {
|
|
51
52
|
if (waiting) {
|
|
@@ -68,10 +69,22 @@ function createMessageQueue(label) {
|
|
|
68
69
|
resolve({ value: undefined, done: true });
|
|
69
70
|
}
|
|
70
71
|
},
|
|
72
|
+
waitForRead: function (n) {
|
|
73
|
+
if (readCount >= n)
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
return new Promise(function (resolve) {
|
|
76
|
+
readWaiters.set(n, resolve);
|
|
77
|
+
});
|
|
78
|
+
},
|
|
71
79
|
[Symbol.asyncIterator]: function () {
|
|
72
80
|
return {
|
|
73
81
|
next: function () {
|
|
74
82
|
readCount++;
|
|
83
|
+
const waiter = readWaiters.get(readCount);
|
|
84
|
+
if (waiter) {
|
|
85
|
+
readWaiters.delete(readCount);
|
|
86
|
+
waiter();
|
|
87
|
+
}
|
|
75
88
|
if (queue.length > 0) {
|
|
76
89
|
log.chat("MQ[%s] read #%d: from buffer (remaining=%d)", label || "?", readCount, queue.length - 1);
|
|
77
90
|
return Promise.resolve({ value: queue.shift(), done: false });
|
|
@@ -703,7 +716,14 @@ export function startChatStream(options) {
|
|
|
703
716
|
catch (initErr) {
|
|
704
717
|
log.chat("Session %s SDK initialization FAILED: %O", sessionId, initErr);
|
|
705
718
|
}
|
|
706
|
-
|
|
719
|
+
if (shouldResume) {
|
|
720
|
+
log.chat("Session %s waiting for SDK read #2 before pushing message", sessionId);
|
|
721
|
+
await mq.waitForRead(2);
|
|
722
|
+
log.chat("Session %s SDK read #2 triggered, pushing first message", sessionId);
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
log.chat("Session %s pushing first message to queue", sessionId);
|
|
726
|
+
}
|
|
707
727
|
mq.push(firstMsg);
|
|
708
728
|
let retrying = false;
|
|
709
729
|
const TURN_TIMEOUT_MS = 30000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptiklemur/lattice",
|
|
3
|
-
"version": "5.13.
|
|
3
|
+
"version": "5.13.4",
|
|
4
4
|
"description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aaron Scherer <me@aaronscherer.me>",
|