instar 0.24.6 → 0.24.8
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/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +79 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/core/types.d.ts +41 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/lifeline/ServerSupervisor.d.ts +4 -0
- package/dist/lifeline/ServerSupervisor.d.ts.map +1 -1
- package/dist/lifeline/ServerSupervisor.js +25 -2
- package/dist/lifeline/ServerSupervisor.js.map +1 -1
- package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
- package/dist/lifeline/TelegramLifeline.js +23 -0
- package/dist/lifeline/TelegramLifeline.js.map +1 -1
- package/dist/monitoring/SessionMonitor.d.ts +8 -0
- package/dist/monitoring/SessionMonitor.d.ts.map +1 -1
- package/dist/monitoring/SessionMonitor.js +16 -0
- package/dist/monitoring/SessionMonitor.js.map +1 -1
- package/dist/monitoring/SessionRecovery.d.ts.map +1 -1
- package/dist/monitoring/SessionRecovery.js +2 -0
- package/dist/monitoring/SessionRecovery.js.map +1 -1
- package/dist/monitoring/SessionWatchdog.d.ts.map +1 -1
- package/dist/monitoring/SessionWatchdog.js +2 -0
- package/dist/monitoring/SessionWatchdog.js.map +1 -1
- package/dist/monitoring/TelemetryCollector.d.ts +33 -0
- package/dist/monitoring/TelemetryCollector.d.ts.map +1 -1
- package/dist/monitoring/TelemetryCollector.js +35 -0
- package/dist/monitoring/TelemetryCollector.js.map +1 -1
- package/dist/monitoring/TriageOrchestrator.d.ts +9 -0
- package/dist/monitoring/TriageOrchestrator.d.ts.map +1 -1
- package/dist/monitoring/TriageOrchestrator.js +45 -1
- package/dist/monitoring/TriageOrchestrator.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +3 -3
- package/upgrades/0.24.5.md +35 -0
- package/upgrades/0.24.7.md +24 -0
- package/upgrades/0.24.8.md +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyPH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAskCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+vFtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -48,6 +48,7 @@ import { SessionWatchdog } from '../monitoring/SessionWatchdog.js';
|
|
|
48
48
|
import { StallTriageNurse } from '../monitoring/StallTriageNurse.js';
|
|
49
49
|
import { TriageOrchestrator } from '../monitoring/TriageOrchestrator.js';
|
|
50
50
|
import { SessionMonitor } from '../monitoring/SessionMonitor.js';
|
|
51
|
+
import { SessionRecovery } from '../monitoring/SessionRecovery.js';
|
|
51
52
|
import { MultiMachineCoordinator } from '../core/MultiMachineCoordinator.js';
|
|
52
53
|
import { GitSyncManager } from '../core/GitSync.js';
|
|
53
54
|
import { ProjectMapper } from '../core/ProjectMapper.js';
|
|
@@ -1719,6 +1720,29 @@ export async function startServer(options) {
|
|
|
1719
1720
|
return { interventionsTotal: 0, interventionsByLevel: {}, recoveries: 0, sessionDeaths: 0, llmGateOverrides: 0 };
|
|
1720
1721
|
return watchdog.getStats(sinceMs);
|
|
1721
1722
|
},
|
|
1723
|
+
// Session recovery stats — lazy getter (declared later in scope via `let`)
|
|
1724
|
+
getRecoveryStats: (_sinceMs) => {
|
|
1725
|
+
return { attempts: { stall: 0, crash: 0, errorLoop: 0 }, successes: { stall: 0, crash: 0, errorLoop: 0 } };
|
|
1726
|
+
},
|
|
1727
|
+
// Triage orchestrator stats — lazy getter (declared later in scope via `let`)
|
|
1728
|
+
getTriageStats: (_sinceMs) => {
|
|
1729
|
+
return { activations: 0, heuristicResolutions: 0, llmResolutions: 0, failures: 0, actionCounts: {} };
|
|
1730
|
+
},
|
|
1731
|
+
// Notification batcher stats — lazy getter
|
|
1732
|
+
getNotificationStats: () => {
|
|
1733
|
+
if (!notificationBatcher)
|
|
1734
|
+
return { flushed: 0, suppressed: 0, summaryQueueSize: 0, digestQueueSize: 0 };
|
|
1735
|
+
const s = notificationBatcher.getStats();
|
|
1736
|
+
return { flushed: s.totalFlushed, suppressed: s.totalSuppressed, summaryQueueSize: s.summaryQueueSize, digestQueueSize: s.digestQueueSize };
|
|
1737
|
+
},
|
|
1738
|
+
// Process staleness stats — lazy getter
|
|
1739
|
+
getStalenessStats: () => {
|
|
1740
|
+
const pi = ProcessIntegrity.getInstance();
|
|
1741
|
+
if (!pi)
|
|
1742
|
+
return { versionMismatch: false, driftCount: 0 };
|
|
1743
|
+
const drifts = staleGuard.checkAll();
|
|
1744
|
+
return { versionMismatch: pi.versionMismatch, driftCount: drifts.length };
|
|
1745
|
+
},
|
|
1722
1746
|
});
|
|
1723
1747
|
telemetryHeartbeat.setCollector(collector);
|
|
1724
1748
|
console.log(pc.green(' Baseline telemetry collector wired'));
|
|
@@ -2450,6 +2474,42 @@ export async function startServer(options) {
|
|
|
2450
2474
|
};
|
|
2451
2475
|
console.log(pc.green(' Triage Orchestrator enabled (replaces Stall Triage Nurse for stall detection)'));
|
|
2452
2476
|
}
|
|
2477
|
+
// SessionRecovery — fast mechanical recovery (JSONL analysis, no LLM)
|
|
2478
|
+
let sessionRecovery;
|
|
2479
|
+
if (telegram) {
|
|
2480
|
+
sessionRecovery = new SessionRecovery({ enabled: true, projectDir: config.projectDir }, {
|
|
2481
|
+
isSessionAlive: (name) => sessionManager.isSessionAlive(name),
|
|
2482
|
+
getPanePid: (name) => {
|
|
2483
|
+
try {
|
|
2484
|
+
const tmux = detectTmuxPath();
|
|
2485
|
+
if (!tmux)
|
|
2486
|
+
return null;
|
|
2487
|
+
const pid = execFileSync(tmux, ['list-panes', '-t', `=${name}:`, '-F', '#{pane_pid}'], { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
2488
|
+
return /^\d+$/.test(pid) ? parseInt(pid, 10) : null;
|
|
2489
|
+
}
|
|
2490
|
+
catch {
|
|
2491
|
+
return null;
|
|
2492
|
+
}
|
|
2493
|
+
},
|
|
2494
|
+
killSession: (name) => {
|
|
2495
|
+
try {
|
|
2496
|
+
const tmux = detectTmuxPath();
|
|
2497
|
+
if (!tmux)
|
|
2498
|
+
return;
|
|
2499
|
+
execFileSync(tmux, ['kill-session', '-t', `=${name}`], { encoding: 'utf-8' });
|
|
2500
|
+
}
|
|
2501
|
+
catch { /* may already be dead */ }
|
|
2502
|
+
},
|
|
2503
|
+
respawnSession: async (topicId, _sessionName, recoveryPrompt) => {
|
|
2504
|
+
const targetSession = telegram.getSessionForTopic(topicId);
|
|
2505
|
+
if (!targetSession)
|
|
2506
|
+
return;
|
|
2507
|
+
await respawnSessionForTopic(sessionManager, telegram, targetSession, topicId, undefined, topicMemory, undefined, recoveryPrompt, { silent: true });
|
|
2508
|
+
},
|
|
2509
|
+
sendToTopic: async (topicId, message) => { await telegram.sendToTopic(topicId, message); },
|
|
2510
|
+
});
|
|
2511
|
+
console.log(pc.green(' Session Recovery enabled (mechanical fast-path)'));
|
|
2512
|
+
}
|
|
2453
2513
|
// SessionMonitor — proactive session health monitoring
|
|
2454
2514
|
let sessionMonitor;
|
|
2455
2515
|
if (telegram) {
|
|
@@ -2478,6 +2538,7 @@ export async function startServer(options) {
|
|
|
2478
2538
|
return { resolved: result.resolved };
|
|
2479
2539
|
}
|
|
2480
2540
|
: undefined,
|
|
2541
|
+
sessionRecovery,
|
|
2481
2542
|
}, config.monitoring.sessionMonitor);
|
|
2482
2543
|
sessionMonitor.start();
|
|
2483
2544
|
console.log(pc.green(' Session Monitor enabled'));
|
|
@@ -3456,6 +3517,24 @@ export async function startServer(options) {
|
|
|
3456
3517
|
alertTopicId,
|
|
3457
3518
|
});
|
|
3458
3519
|
}
|
|
3520
|
+
// Periodic housekeeping — calls orphaned cleanup methods every 6 hours.
|
|
3521
|
+
// These methods exist on their respective classes but were never scheduled.
|
|
3522
|
+
const HOUSEKEEPING_INTERVAL_MS = 6 * 60 * 60 * 1000;
|
|
3523
|
+
setInterval(() => {
|
|
3524
|
+
try {
|
|
3525
|
+
triageOrchestrator?.cleanup();
|
|
3526
|
+
}
|
|
3527
|
+
catch { /* best-effort */ }
|
|
3528
|
+
try {
|
|
3529
|
+
sessionRecovery?.cleanup();
|
|
3530
|
+
}
|
|
3531
|
+
catch { /* best-effort */ }
|
|
3532
|
+
try {
|
|
3533
|
+
messageStore?.cleanup();
|
|
3534
|
+
}
|
|
3535
|
+
catch { /* best-effort */ }
|
|
3536
|
+
console.log('[Housekeeping] Periodic cleanup completed');
|
|
3537
|
+
}, HOUSEKEEPING_INTERVAL_MS);
|
|
3459
3538
|
// Start tunnel AFTER server is listening (with retry on failure)
|
|
3460
3539
|
if (tunnel) {
|
|
3461
3540
|
tunnel.enableAutoReconnect();
|