@adhdev/daemon-standalone 0.7.16 → 0.7.17
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 +27 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CFr5TK-K.js +68 -0
- package/public/index.html +1 -1
- package/public/assets/index-BWW2S6O1.js +0 -68
package/dist/index.js
CHANGED
|
@@ -34399,6 +34399,7 @@ var StandaloneServer = class {
|
|
|
34399
34399
|
console.log(`[WS] Client connected (total: ${this.clients.size})`);
|
|
34400
34400
|
const status = this.getStatus();
|
|
34401
34401
|
ws.send(JSON.stringify({ type: "status", data: status }));
|
|
34402
|
+
void this.pushWsRuntimeSnapshots(ws);
|
|
34402
34403
|
ws.on("message", async (raw) => {
|
|
34403
34404
|
try {
|
|
34404
34405
|
const msg = JSON.parse(raw.toString());
|
|
@@ -34442,6 +34443,32 @@ var StandaloneServer = class {
|
|
|
34442
34443
|
daemonMode: false
|
|
34443
34444
|
});
|
|
34444
34445
|
}
|
|
34446
|
+
async pushWsRuntimeSnapshots(ws) {
|
|
34447
|
+
if (!this.components || !this.sessionHostEndpoint || ws.readyState !== import_ws2.WebSocket.OPEN) return;
|
|
34448
|
+
const client = new SessionHostClient({ endpoint: this.sessionHostEndpoint || void 0 });
|
|
34449
|
+
await client.connect();
|
|
34450
|
+
try {
|
|
34451
|
+
const states = this.components.instanceManager.collectAllStates();
|
|
34452
|
+
for (const state of states) {
|
|
34453
|
+
const sessionId = typeof state?.instanceId === "string" ? state.instanceId : "";
|
|
34454
|
+
if (!sessionId || state?.category !== "cli") continue;
|
|
34455
|
+
const snapshot = await client.request({
|
|
34456
|
+
type: "get_snapshot",
|
|
34457
|
+
payload: { sessionId }
|
|
34458
|
+
});
|
|
34459
|
+
if (!snapshot.success || !snapshot.result || ws.readyState !== import_ws2.WebSocket.OPEN) continue;
|
|
34460
|
+
ws.send(JSON.stringify({
|
|
34461
|
+
type: "runtime_snapshot",
|
|
34462
|
+
sessionId,
|
|
34463
|
+
...snapshot.result
|
|
34464
|
+
}));
|
|
34465
|
+
}
|
|
34466
|
+
} catch {
|
|
34467
|
+
} finally {
|
|
34468
|
+
await client.close().catch(() => {
|
|
34469
|
+
});
|
|
34470
|
+
}
|
|
34471
|
+
}
|
|
34445
34472
|
getStatus(snapshot = this.buildSharedSnapshot()) {
|
|
34446
34473
|
const cfgSnap = loadConfig();
|
|
34447
34474
|
return {
|