@@ -27,18 +27,18 @@ import {
2727 createKernel ,
2828 allowAllChildProcess ,
2929 allowAllEnv ,
30- } from '../../../kernel /src/index.ts' ;
30+ } from '../../../secure-exec-core /src/kernel /index.ts' ;
3131import type {
3232 Kernel ,
3333 RuntimeDriver ,
3434 KernelInterface ,
3535 DriverProcess ,
3636 ProcessContext ,
37- } from '../../../kernel /src/index.ts' ;
38- import type { VirtualFileSystem } from '../../../kernel /src/vfs.ts' ;
39- import { TerminalHarness } from '../../../kernel /test/terminal-harness.ts' ;
40- import { InMemoryFileSystem } from '../../../os/ browser/src/index .ts' ;
41- import { createNodeRuntime } from '../../../runtime/node/ src/index .ts' ;
37+ } from '../../../secure-exec-core /src/kernel /index.ts' ;
38+ import type { VirtualFileSystem } from '../../../secure-exec-core /src/kernel /vfs.ts' ;
39+ import { TerminalHarness } from '../../../secure-exec-core /test/kernel /terminal-harness.ts' ;
40+ import { InMemoryFileSystem } from '../../../secure-exec- browser/src/os-filesystem .ts' ;
41+ import { createNodeRuntime } from '../../../secure-exec-nodejs/ src/kernel-runtime .ts' ;
4242import {
4343 createMockLlmServer ,
4444 type MockLlmServerHandle ,
@@ -634,6 +634,41 @@ describe.skipIf(skipReason)('OpenCode interactive PTY E2E (sandbox)', () => {
634634 60_000 ,
635635 ) ;
636636
637+ it (
638+ 'PTY resize — OpenCode TUI re-renders for new dimensions' ,
639+ async ( { skip } ) => {
640+ if ( sandboxSkip ) skip ( ) ;
641+
642+ mockServer . reset ( [
643+ { type : 'text' , text : 'placeholder' } ,
644+ { type : 'text' , text : 'placeholder' } ,
645+ ] ) ;
646+
647+ harness = createOpenCodeHarness ( {
648+ mockPort : mockServer . port ,
649+ } ) ;
650+
651+ // Wait for TUI to boot
652+ await harness . waitFor ( 'Ask anything' , 1 , 30_000 ) ;
653+
654+ const screenBefore = harness . screenshotTrimmed ( ) ;
655+
656+ // Resize PTY to wider terminal and resize xterm to match
657+ harness . shell . resize ( 120 , 40 ) ;
658+ harness . term . resize ( 120 , 40 ) ;
659+
660+ // Wait for OpenCode to process SIGWINCH and re-render
661+ await new Promise ( ( r ) => setTimeout ( r , 1_500 ) ) ;
662+
663+ const screenAfter = harness . screenshotTrimmed ( ) ;
664+ // OpenCode TUI should still show its UI elements after resize
665+ expect ( screenAfter ) . toMatch ( / A s k a n y t h i n g | c t r l \+ [ a - z ] / i) ;
666+ // Screen should not be blank/garbled
667+ expect ( screenAfter . length ) . toBeGreaterThan ( 0 ) ;
668+ } ,
669+ 45_000 ,
670+ ) ;
671+
637672 it (
638673 'exit cleanly — Ctrl+C twice, OpenCode exits and PTY closes' ,
639674 async ( { skip } ) => {
0 commit comments