fix(cli/process/logs): Reset log sequence on process restart to avoid false log gap warnings
This commit is contained in:
		@@ -3,6 +3,6 @@
 | 
			
		||||
 */
 | 
			
		||||
export const commitinfo = {
 | 
			
		||||
  name: '@git.zone/tspm',
 | 
			
		||||
  version: '5.4.1',
 | 
			
		||||
  version: '5.4.2',
 | 
			
		||||
  description: 'a no fuzz process manager'
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,7 @@ export function registerLogsCommand(smartcli: plugins.smartcli.Smartcli) {
 | 
			
		||||
      console.log('─'.repeat(60));
 | 
			
		||||
 | 
			
		||||
      let lastSeq = 0;
 | 
			
		||||
      let lastRunId: string | undefined = undefined;
 | 
			
		||||
      for (const log of response.logs) {
 | 
			
		||||
        const timestamp = new Date(log.timestamp).toLocaleTimeString();
 | 
			
		||||
        const prefix =
 | 
			
		||||
@@ -60,11 +61,18 @@ export function registerLogsCommand(smartcli: plugins.smartcli.Smartcli) {
 | 
			
		||||
              : '[SYS]';
 | 
			
		||||
        console.log(`${timestamp} ${prefix} ${log.message}`);
 | 
			
		||||
        if (log.seq !== undefined) lastSeq = Math.max(lastSeq, log.seq);
 | 
			
		||||
        if ((log as any).runId) lastRunId = (log as any).runId;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      await withStreamingLifecycle(
 | 
			
		||||
        async () => {
 | 
			
		||||
          await tspmIpcClient.subscribe(id, (log: any) => {
 | 
			
		||||
            // Reset sequence if runId changed (e.g., process restarted)
 | 
			
		||||
            if (log.runId && log.runId !== lastRunId) {
 | 
			
		||||
              console.log(`[INFO] Detected process restart (runId changed).`);
 | 
			
		||||
              lastSeq = -1;
 | 
			
		||||
              lastRunId = log.runId;
 | 
			
		||||
            }
 | 
			
		||||
            if (log.seq !== undefined && log.seq <= lastSeq) return;
 | 
			
		||||
            if (log.seq !== undefined && log.seq > lastSeq + 1) {
 | 
			
		||||
              console.log(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user