@@ -42,6 +42,30 @@ export class Process extends APIResource {
4242 return this . _client . post ( path `/browsers/${ id } /process/${ processID } /kill` , { body, ...options } ) ;
4343 }
4444
45+ /**
46+ * Resize a PTY-backed process terminal
47+ *
48+ * @example
49+ * ```ts
50+ * const response = await client.browsers.process.resize(
51+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
52+ * {
53+ * id: 'id',
54+ * cols: 1,
55+ * rows: 1,
56+ * },
57+ * );
58+ * ```
59+ */
60+ resize (
61+ processID : string ,
62+ params : ProcessResizeParams ,
63+ options ?: RequestOptions ,
64+ ) : APIPromise < ProcessResizeResponse > {
65+ const { id, ...body } = params ;
66+ return this . _client . post ( path `/browsers/${ id } /process/${ processID } /resize` , { body, ...options } ) ;
67+ }
68+
4569 /**
4670 * Execute a command asynchronously
4771 *
@@ -156,6 +180,16 @@ export interface ProcessKillResponse {
156180 ok : boolean ;
157181}
158182
183+ /**
184+ * Generic OK response.
185+ */
186+ export interface ProcessResizeResponse {
187+ /**
188+ * Indicates success.
189+ */
190+ ok : boolean ;
191+ }
192+
159193/**
160194 * Information about a spawned process.
161195 */
@@ -285,12 +319,34 @@ export interface ProcessKillParams {
285319 signal : 'TERM' | 'KILL' | 'INT' | 'HUP' ;
286320}
287321
322+ export interface ProcessResizeParams {
323+ /**
324+ * Path param: Browser session ID
325+ */
326+ id : string ;
327+
328+ /**
329+ * Body param: New terminal columns.
330+ */
331+ cols : number ;
332+
333+ /**
334+ * Body param: New terminal rows.
335+ */
336+ rows : number ;
337+ }
338+
288339export interface ProcessSpawnParams {
289340 /**
290341 * Executable or shell command to run.
291342 */
292343 command : string ;
293344
345+ /**
346+ * Allocate a pseudo-terminal (PTY) for interactive shells.
347+ */
348+ allocate_tty ?: boolean ;
349+
294350 /**
295351 * Command arguments.
296352 */
@@ -306,6 +362,11 @@ export interface ProcessSpawnParams {
306362 */
307363 as_user ?: string | null ;
308364
365+ /**
366+ * Initial terminal columns. Only used when allocate_tty is true.
367+ */
368+ cols ?: number ;
369+
309370 /**
310371 * Working directory (absolute path) to run the command in.
311372 */
@@ -316,6 +377,11 @@ export interface ProcessSpawnParams {
316377 */
317378 env ?: { [ key : string ] : string } ;
318379
380+ /**
381+ * Initial terminal rows. Only used when allocate_tty is true.
382+ */
383+ rows ?: number ;
384+
319385 /**
320386 * Maximum execution time in seconds.
321387 */
@@ -352,12 +418,14 @@ export declare namespace Process {
352418 export {
353419 type ProcessExecResponse as ProcessExecResponse ,
354420 type ProcessKillResponse as ProcessKillResponse ,
421+ type ProcessResizeResponse as ProcessResizeResponse ,
355422 type ProcessSpawnResponse as ProcessSpawnResponse ,
356423 type ProcessStatusResponse as ProcessStatusResponse ,
357424 type ProcessStdinResponse as ProcessStdinResponse ,
358425 type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse ,
359426 type ProcessExecParams as ProcessExecParams ,
360427 type ProcessKillParams as ProcessKillParams ,
428+ type ProcessResizeParams as ProcessResizeParams ,
361429 type ProcessSpawnParams as ProcessSpawnParams ,
362430 type ProcessStatusParams as ProcessStatusParams ,
363431 type ProcessStdinParams as ProcessStdinParams ,
0 commit comments