BREAKING CHANGE(daemon): Introduce persistent log storage, numeric ProcessId type, and improved process monitoring / IPC handling

This commit is contained in:
2025-08-30 13:47:14 +00:00
parent e507b75c40
commit 538f282b62
16 changed files with 589 additions and 167 deletions

View File

@@ -1,5 +1,7 @@
import * as plugins from './plugins.js';
import * as paths from '../paths.js';
import { toProcessId } from '../shared/protocol/id.js';
import type { ProcessId } from '../shared/protocol/id.js';
import type {
IpcMethodMap,
@@ -144,26 +146,28 @@ export class TspmIpcClient {
* Subscribe to log updates for a specific process
*/
public async subscribe(
processId: string,
processId: ProcessId | number | string,
handler: (log: any) => void,
): Promise<void> {
if (!this.ipcClient || !this.isConnected) {
throw new Error('Not connected to daemon');
}
const topic = `logs.${processId}`;
const id = toProcessId(processId);
const topic = `logs.${id}`;
await this.ipcClient.subscribe(`topic:${topic}`, handler);
}
/**
* Unsubscribe from log updates for a specific process
*/
public async unsubscribe(processId: string): Promise<void> {
public async unsubscribe(processId: ProcessId | number | string): Promise<void> {
if (!this.ipcClient || !this.isConnected) {
throw new Error('Not connected to daemon');
}
const topic = `logs.${processId}`;
const id = toProcessId(processId);
const topic = `logs.${id}`;
await this.ipcClient.unsubscribe(`topic:${topic}`);
}