@dmsdc-ai/aigentry-telepty 0.1.82 → 0.1.83
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/daemon.js +31 -1
- package/package.json +1 -1
package/daemon.js
CHANGED
|
@@ -222,7 +222,20 @@ function getSessionHealthStatus(session, options = {}) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
if (session.type === 'aterm') {
|
|
225
|
-
|
|
225
|
+
const endpoint = session.deliveryEndpoint || (session.delivery && session.delivery.address);
|
|
226
|
+
if (endpoint) {
|
|
227
|
+
const isSocketPath = endpoint.startsWith('/');
|
|
228
|
+
if (isSocketPath) {
|
|
229
|
+
try {
|
|
230
|
+
fs.accessSync(endpoint, fs.constants.F_OK);
|
|
231
|
+
return 'CONNECTED';
|
|
232
|
+
} catch {
|
|
233
|
+
session.deliveryEndpoint = null;
|
|
234
|
+
if (session.delivery) session.delivery.address = null;
|
|
235
|
+
session.lastDisconnectedAt = session.lastDisconnectedAt || new Date().toISOString();
|
|
236
|
+
return 'DISCONNECTED';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
226
239
|
return 'CONNECTED';
|
|
227
240
|
}
|
|
228
241
|
if (disconnectedMs !== null && disconnectedMs >= staleMs) {
|
|
@@ -1883,6 +1896,23 @@ setInterval(() => {
|
|
|
1883
1896
|
session._idleEmitted = false;
|
|
1884
1897
|
}
|
|
1885
1898
|
|
|
1899
|
+
// Periodically verify aterm socket existence — triggers health transition
|
|
1900
|
+
if (session.type === 'aterm') {
|
|
1901
|
+
const atermEndpoint = session.deliveryEndpoint || (session.delivery && session.delivery.address);
|
|
1902
|
+
if (atermEndpoint && atermEndpoint.startsWith('/')) {
|
|
1903
|
+
try {
|
|
1904
|
+
fs.accessSync(atermEndpoint, fs.constants.F_OK);
|
|
1905
|
+
} catch {
|
|
1906
|
+
session.deliveryEndpoint = null;
|
|
1907
|
+
if (session.delivery) session.delivery.address = null;
|
|
1908
|
+
if (!session.lastDisconnectedAt) {
|
|
1909
|
+
session.lastDisconnectedAt = new Date().toISOString();
|
|
1910
|
+
}
|
|
1911
|
+
console.log(`[SWEEP] aterm socket gone for ${id}: ${atermEndpoint}`);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1886
1916
|
if (healthStatus === 'STALE' && !session._staleEmitted) {
|
|
1887
1917
|
session._staleEmitted = true;
|
|
1888
1918
|
emitSessionLifecycleEvent('session_stale', id, session, {
|