BREAKING CHANGE(daemon): Introduce persistent log storage, numeric ProcessId type, and improved process monitoring / IPC handling
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user