@cryptiklemur/lattice 5.13.4 → 5.13.5

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.
@@ -716,14 +716,7 @@ export function startChatStream(options) {
716
716
  catch (initErr) {
717
717
  log.chat("Session %s SDK initialization FAILED: %O", sessionId, initErr);
718
718
  }
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
- }
719
+ log.chat("Session %s pushing first message to queue", sessionId);
727
720
  mq.push(firstMsg);
728
721
  let retrying = false;
729
722
  const TURN_TIMEOUT_MS = 30000;
@@ -759,11 +752,20 @@ export function startChatStream(options) {
759
752
  clearTimeout(turnTimer);
760
753
  const errMsg = err instanceof Error ? err.message : String(err);
761
754
  log.chat("Session %s stream error: %s", sessionId, errMsg);
762
- if (errMsg.includes("aborted") || errMsg.includes("AbortError")) {
763
- log.chat("Session %s stream aborted", sessionId);
755
+ const retryCount = options._retryCount || 0;
756
+ const canRetry = shouldResume && retryCount < 1;
757
+ if ((errMsg.includes("aborted") || errMsg.includes("AbortError")) && canRetry && !sessionStream.sawNewTurnContent) {
758
+ log.chat("Session %s stream aborted after resume with no new content, retrying (attempt %d)", sessionId, retryCount + 1);
759
+ retrying = true;
760
+ }
761
+ else if (errMsg.includes("aborted") || errMsg.includes("AbortError")) {
762
+ log.chat("Session %s stream aborted (sawContent=%s)", sessionId, String(sessionStream.sawNewTurnContent));
763
+ if (!sessionStream.sawNewTurnContent) {
764
+ sendTo(sessionStream.clientId, { type: "chat:error", message: "Failed to get a response. Try sending your message again or start a new session." });
765
+ }
764
766
  }
765
- else if (errMsg.includes("Sent before connected") && shouldResume) {
766
- log.chat("Session %s WebSocket not ready after resume, retrying in 500ms", sessionId);
767
+ else if (errMsg.includes("Sent before connected") && canRetry) {
768
+ log.chat("Session %s WebSocket not ready after resume, retrying (attempt %d)", sessionId, retryCount + 1);
767
769
  retrying = true;
768
770
  }
769
771
  else {
@@ -777,9 +779,10 @@ export function startChatStream(options) {
777
779
  sessionStreams.delete(sessionId);
778
780
  persistStreamState();
779
781
  if (retrying) {
780
- log.chat("Session %s cleaning up for retry", sessionId);
782
+ const retryCount = (options._retryCount || 0) + 1;
783
+ log.chat("Session %s cleaning up for retry #%d", sessionId, retryCount);
781
784
  await new Promise(function (resolve) { setTimeout(resolve, 500); });
782
- startChatStream(options);
785
+ startChatStream({ ...options, _retryCount: retryCount });
783
786
  return;
784
787
  }
785
788
  broadcast({ type: "session:busy", sessionId, busy: false }, sessionStream.clientId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "5.13.4",
3
+ "version": "5.13.5",
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>",