|
|
@@ -432,6 +432,39 @@ describe('BashTerminalBackend startup rollback', () => {
|
|
|
const timedOut = new BashTerminalBackend(ctx, { ...config(), shellDialect: 'pwsh' }, async () => terminalHandle(), () => sessionFor('timeout'))
|
|
|
await expect(timedOut.spawn(spec(agent(ctx)))).rejects.toThrow('did not reach readiness before startup timeout')
|
|
|
})
|
|
|
+
|
|
|
+ it('forwards the spawn signal into the pwsh bootstrap sends', async () => {
|
|
|
+ const ctx = new Context()
|
|
|
+ await ctx.plugin(EmptySandbox)
|
|
|
+ await ctx.plugin(SandboxPolicyService, { mode: 'danger-full-access', workspaceRoot: '/workspace' })
|
|
|
+ const sends: TerminalSendRequest[] = []
|
|
|
+ const session = {
|
|
|
+ motd: '',
|
|
|
+ startSend: (request: TerminalSendRequest) => {
|
|
|
+ sends.push(request)
|
|
|
+ return {
|
|
|
+ done: Promise.resolve({
|
|
|
+ viewport: 'dsh> ', waitReason: 'stdin_read' as const,
|
|
|
+ sessionStatus: { kind: 'running' as const }, truncated: false,
|
|
|
+ }),
|
|
|
+ readOutput: () => ({ delta: '', truncated: false }),
|
|
|
+ cancel: () => false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ read: () => ({ text: '', totalLines: 0, lineBegin: 0, lineEnd: 0, truncated: false }),
|
|
|
+ } as unknown as LocalPtySession
|
|
|
+ const backend = new BashTerminalBackend(
|
|
|
+ ctx,
|
|
|
+ { ...config(), shellDialect: 'pwsh', shellPath: 'pwsh' },
|
|
|
+ async () => terminalHandle(),
|
|
|
+ () => session,
|
|
|
+ )
|
|
|
+ const signal = new AbortController().signal
|
|
|
+ const spawned = await backend.spawn({ ...spec(agent(ctx)), signal })
|
|
|
+ expect(spawned.motd).toBe('dsh> ')
|
|
|
+ expect(sends).toHaveLength(1)
|
|
|
+ expect(sends[0]?.signal).toBe(signal)
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
describe('terminal-bash plugin shape', () => {
|