@slock-ai/daemon 0.28.1-alpha.2 → 0.28.1-alpha.3
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 +24 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -896,6 +896,11 @@ function summarizeCrash(code, signal) {
|
|
|
896
896
|
if (typeof code === "number") return `exit code ${code}`;
|
|
897
897
|
return "unknown exit";
|
|
898
898
|
}
|
|
899
|
+
function isMissingResumeSession(ap) {
|
|
900
|
+
if (ap.driver.id !== "claude") return false;
|
|
901
|
+
if (!ap.sessionId) return false;
|
|
902
|
+
return /No conversation found with session ID/i.test(ap.lastRuntimeError || "");
|
|
903
|
+
}
|
|
899
904
|
function getMessageDeliveryText(supportsStdinNotification) {
|
|
900
905
|
return supportsStdinNotification ? "New messages will be delivered to you automatically via stdin." : "The daemon will automatically restart you when new messages arrive.";
|
|
901
906
|
}
|
|
@@ -1113,6 +1118,25 @@ Note: While you are busy, you may receive [System notification: ...] messages ab
|
|
|
1113
1118
|
this.idleAgentConfigs.delete(agentId);
|
|
1114
1119
|
const reason = formatCrashReason(finalCode, finalSignal, ap);
|
|
1115
1120
|
const summary = summarizeCrash(finalCode, finalSignal);
|
|
1121
|
+
if (isMissingResumeSession(ap)) {
|
|
1122
|
+
const staleSessionId = ap.sessionId;
|
|
1123
|
+
const restartConfig = { ...ap.config, sessionId: null };
|
|
1124
|
+
console.warn(
|
|
1125
|
+
`[Agent ${agentId}] Stored Claude session ${staleSessionId} is unavailable locally; falling back to cold start`
|
|
1126
|
+
);
|
|
1127
|
+
this.broadcastActivity(
|
|
1128
|
+
agentId,
|
|
1129
|
+
"working",
|
|
1130
|
+
"Stored Claude session missing; cold-starting a new session\u2026",
|
|
1131
|
+
[{ kind: "text", text: `Stored Claude session ${staleSessionId} was not found locally. Falling back to a cold start.` }]
|
|
1132
|
+
);
|
|
1133
|
+
this.startAgent(agentId, restartConfig).catch((err) => {
|
|
1134
|
+
console.error(`[Agent ${agentId}] Cold start recovery failed:`, err);
|
|
1135
|
+
this.sendToServer({ type: "agent:status", agentId, status: "inactive" });
|
|
1136
|
+
this.broadcastActivity(agentId, "offline", `Crashed (${summary})`);
|
|
1137
|
+
});
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1116
1140
|
console.error(`[Agent ${agentId}] Process crashed (${reason}) \u2014 marking inactive`);
|
|
1117
1141
|
this.sendToServer({ type: "agent:status", agentId, status: "inactive" });
|
|
1118
1142
|
this.broadcastActivity(agentId, "offline", `Crashed (${summary})`);
|