diff --git a/src/plugin/pty/session-lifecycle.ts b/src/plugin/pty/session-lifecycle.ts index 6927998b..344ce11e 100644 --- a/src/plugin/pty/session-lifecycle.ts +++ b/src/plugin/pty/session-lifecycle.ts @@ -212,6 +212,7 @@ export class SessionLifecycleManager { command: session.command, args: session.args, workdir: session.workdir, + parentSessionId: session.parentSessionId, status: session.status, notifyOnExit: session.notifyOnExit, timeoutSeconds: session.timeoutSeconds, diff --git a/src/plugin/pty/types.ts b/src/plugin/pty/types.ts index 698ffe25..b73ff978 100644 --- a/src/plugin/pty/types.ts +++ b/src/plugin/pty/types.ts @@ -33,6 +33,7 @@ export interface PTYSessionInfo { command: string args: string[] workdir: string + parentSessionId: string status: PTYStatus notifyOnExit: boolean timeoutSeconds?: number diff --git a/test/pty-tools.test.ts b/test/pty-tools.test.ts index e15083ac..ee937bfc 100644 --- a/test/pty-tools.test.ts +++ b/test/pty-tools.test.ts @@ -17,6 +17,7 @@ describe('PTY Tools', () => { command: opts.command, args: opts.args || [], workdir: opts.workdir || '/tmp', + parentSessionId: opts.parentSessionId, pid: 12345, status: 'running', notifyOnExit: opts.notifyOnExit ?? false, @@ -135,6 +136,7 @@ describe('PTY Tools', () => { command: 'echo', args: ['hello'], workdir: '/tmp', + parentSessionId: 'parent-session-id', status: 'running', notifyOnExit: false, timeoutSeconds: undefined, @@ -190,6 +192,7 @@ describe('PTY Tools', () => { command: 'echo', args: ['hello'], workdir: '/tmp', + parentSessionId: 'parent-session-id', status: 'running', notifyOnExit: true, timeoutSeconds: undefined, @@ -297,6 +300,7 @@ describe('PTY Tools', () => { pid: 12345, lineCount: 10, workdir: '/tmp', + parentSessionId: 'parent-session-id', createdAt: new Date('2023-01-01T00:00:00Z').toISOString(), }, ] diff --git a/test/types.test.ts b/test/types.test.ts index f4736299..9505921f 100644 --- a/test/types.test.ts +++ b/test/types.test.ts @@ -34,6 +34,7 @@ describe('Web Types', () => { createdAt: new Date().toISOString(), args: ['hello'], workdir: '/home/user', + parentSessionId: 'ses_test', }, ] @@ -73,6 +74,7 @@ describe('Web Types', () => { createdAt: new Date().toISOString(), args: ['Hello, World!'], workdir: '/home/user', + parentSessionId: 'ses_test', } expect(session.id).toBe('pty_12345') @@ -99,6 +101,7 @@ describe('Web Types', () => { createdAt: new Date('2026-01-21T10:00:00.000Z').toISOString(), args: ['Hello, World!'], workdir: '/home/user', + parentSessionId: 'ses_test', } expect(session.exitCode).toBeUndefined() diff --git a/test/web-permissions.test.ts b/test/web-permissions.test.ts index 0a425c61..8d6d6e76 100644 --- a/test/web-permissions.test.ts +++ b/test/web-permissions.test.ts @@ -33,6 +33,7 @@ function buildSpawnInfo(overrides: Partial = {}): PTYSessionInfo command: 'echo', args: ['blocked'], workdir: process.cwd(), + parentSessionId: 'ses_test', status: 'running', notifyOnExit: false, timedOut: false, diff --git a/test/web-server.test.ts b/test/web-server.test.ts index 991bed31..167d4d8c 100644 --- a/test/web-server.test.ts +++ b/test/web-server.test.ts @@ -135,6 +135,7 @@ describe('Web Server', () => { expect(sessionData.id).toBe(session.id) expect(sessionData.command).toBe('bash') expect(sessionData.args).toEqual([]) + expect(sessionData.parentSessionId).toBe('test') }, 200) it('should return 404 for non-existent session', async () => {