fix(daemon): Ensure robust process shutdown and improve logs/subscriber diagnostics

This commit is contained in:
2025-08-31 00:01:50 +00:00
parent 4160b3f031
commit b3087831e2
7 changed files with 98 additions and 17 deletions

View File

@@ -144,6 +144,13 @@ export function registerLogsCommand(smartcli: plugins.smartcli.Smartcli) {
await withStreamingLifecycle(
async () => {
// Optional: debug subscribers if requested via env (hidden)
if (process.env.TSPM_DEBUG === 'true') {
try {
const subInfo = await tspmIpcClient.request('logs:subscribers' as any, { id });
console.log(`[DEBUG] Subscribers for logs.${id}: ${subInfo.count} (${(subInfo.subscribers||[]).join(',')})`);
} catch {}
}
await tspmIpcClient.subscribe(id, (log: any) => {
// Reset sequence if runId changed (e.g., process restarted)
if (log.runId && log.runId !== lastRunId) {