@daytona/sdk 0.161.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +180 -0
  2. package/package.json +56 -0
  3. package/src/CodeInterpreter.d.ts +94 -0
  4. package/src/CodeInterpreter.js +297 -0
  5. package/src/CodeInterpreter.js.map +1 -0
  6. package/src/ComputerUse.d.ts +538 -0
  7. package/src/ComputerUse.js +808 -0
  8. package/src/ComputerUse.js.map +1 -0
  9. package/src/Daytona.d.ts +340 -0
  10. package/src/Daytona.js +538 -0
  11. package/src/Daytona.js.map +1 -0
  12. package/src/FileSystem.d.ts +326 -0
  13. package/src/FileSystem.js +412 -0
  14. package/src/FileSystem.js.map +1 -0
  15. package/src/Git.d.ts +202 -0
  16. package/src/Git.js +326 -0
  17. package/src/Git.js.map +1 -0
  18. package/src/Image.d.ts +264 -0
  19. package/src/Image.js +546 -0
  20. package/src/Image.js.map +1 -0
  21. package/src/LspServer.d.ts +171 -0
  22. package/src/LspServer.js +258 -0
  23. package/src/LspServer.js.map +1 -0
  24. package/src/ObjectStorage.d.ts +78 -0
  25. package/src/ObjectStorage.js +199 -0
  26. package/src/ObjectStorage.js.map +1 -0
  27. package/src/Process.d.ts +490 -0
  28. package/src/Process.js +790 -0
  29. package/src/Process.js.map +1 -0
  30. package/src/PtyHandle.d.ts +154 -0
  31. package/src/PtyHandle.js +416 -0
  32. package/src/PtyHandle.js.map +1 -0
  33. package/src/Sandbox.d.ts +425 -0
  34. package/src/Sandbox.js +776 -0
  35. package/src/Sandbox.js.map +1 -0
  36. package/src/Snapshot.d.ts +139 -0
  37. package/src/Snapshot.js +248 -0
  38. package/src/Snapshot.js.map +1 -0
  39. package/src/Volume.d.ts +83 -0
  40. package/src/Volume.js +119 -0
  41. package/src/Volume.js.map +1 -0
  42. package/src/code-toolbox/SandboxJsCodeToolbox.d.ts +5 -0
  43. package/src/code-toolbox/SandboxJsCodeToolbox.js +20 -0
  44. package/src/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  45. package/src/code-toolbox/SandboxPythonCodeToolbox.d.ts +11 -0
  46. package/src/code-toolbox/SandboxPythonCodeToolbox.js +359 -0
  47. package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  48. package/src/code-toolbox/SandboxTsCodeToolbox.d.ts +5 -0
  49. package/src/code-toolbox/SandboxTsCodeToolbox.js +29 -0
  50. package/src/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  51. package/src/errors/DaytonaError.d.ts +31 -0
  52. package/src/errors/DaytonaError.js +51 -0
  53. package/src/errors/DaytonaError.js.map +1 -0
  54. package/src/index.d.ts +21 -0
  55. package/src/index.js +45 -0
  56. package/src/index.js.map +1 -0
  57. package/src/types/Charts.d.ts +151 -0
  58. package/src/types/Charts.js +46 -0
  59. package/src/types/Charts.js.map +1 -0
  60. package/src/types/CodeInterpreter.d.ts +76 -0
  61. package/src/types/CodeInterpreter.js +7 -0
  62. package/src/types/CodeInterpreter.js.map +1 -0
  63. package/src/types/ExecuteResponse.d.ts +25 -0
  64. package/src/types/ExecuteResponse.js +7 -0
  65. package/src/types/ExecuteResponse.js.map +1 -0
  66. package/src/types/Pty.d.ts +47 -0
  67. package/src/types/Pty.js +7 -0
  68. package/src/types/Pty.js.map +1 -0
  69. package/src/utils/ArtifactParser.d.ts +13 -0
  70. package/src/utils/ArtifactParser.js +55 -0
  71. package/src/utils/ArtifactParser.js.map +1 -0
  72. package/src/utils/Binary.d.ts +38 -0
  73. package/src/utils/Binary.js +168 -0
  74. package/src/utils/Binary.js.map +1 -0
  75. package/src/utils/FileTransfer.d.ts +14 -0
  76. package/src/utils/FileTransfer.js +216 -0
  77. package/src/utils/FileTransfer.js.map +1 -0
  78. package/src/utils/Import.d.ts +97 -0
  79. package/src/utils/Import.js +79 -0
  80. package/src/utils/Import.js.map +1 -0
  81. package/src/utils/Multipart.d.ts +26 -0
  82. package/src/utils/Multipart.js +113 -0
  83. package/src/utils/Multipart.js.map +1 -0
  84. package/src/utils/Runtime.d.ts +43 -0
  85. package/src/utils/Runtime.js +95 -0
  86. package/src/utils/Runtime.js.map +1 -0
  87. package/src/utils/Stream.d.ts +19 -0
  88. package/src/utils/Stream.js +364 -0
  89. package/src/utils/Stream.js.map +1 -0
  90. package/src/utils/WebSocket.d.ts +9 -0
  91. package/src/utils/WebSocket.js +26 -0
  92. package/src/utils/WebSocket.js.map +1 -0
  93. package/src/utils/otel.decorator.d.ts +82 -0
  94. package/src/utils/otel.decorator.js +141 -0
  95. package/src/utils/otel.decorator.js.map +1 -0
@@ -0,0 +1,490 @@
1
+ import { Configuration, ProcessApi, Command, Session, SessionExecuteRequest, SessionExecuteResponse as ApiSessionExecuteResponse, PtySessionInfo } from '@daytonaio/toolbox-api-client';
2
+ import { SandboxCodeToolbox } from './Sandbox';
3
+ import { ExecuteResponse } from './types/ExecuteResponse';
4
+ import { PtyHandle } from './PtyHandle';
5
+ import { PtyCreateOptions, PtyConnectOptions } from './types/Pty';
6
+ export declare const STDOUT_PREFIX_BYTES: Uint8Array<ArrayBuffer>;
7
+ export declare const STDERR_PREFIX_BYTES: Uint8Array<ArrayBuffer>;
8
+ export declare const MAX_PREFIX_LEN: number;
9
+ /**
10
+ * Parameters for code execution.
11
+ */
12
+ export declare class CodeRunParams {
13
+ /**
14
+ * Command line arguments
15
+ */
16
+ argv?: string[];
17
+ /**
18
+ * Environment variables
19
+ */
20
+ env?: Record<string, string>;
21
+ }
22
+ export interface SessionExecuteResponse extends ApiSessionExecuteResponse {
23
+ stdout?: string;
24
+ stderr?: string;
25
+ }
26
+ export interface SessionCommandLogsResponse {
27
+ output?: string;
28
+ stdout?: string;
29
+ stderr?: string;
30
+ }
31
+ /**
32
+ * Handles process and code execution within a Sandbox.
33
+ *
34
+ * @class
35
+ */
36
+ export declare class Process {
37
+ private readonly clientConfig;
38
+ private readonly codeToolbox;
39
+ private readonly apiClient;
40
+ private readonly getPreviewToken;
41
+ constructor(clientConfig: Configuration, codeToolbox: SandboxCodeToolbox, apiClient: ProcessApi, getPreviewToken: () => Promise<string>);
42
+ /**
43
+ * Executes a shell command in the Sandbox.
44
+ *
45
+ * @param {string} command - Shell command to execute
46
+ * @param {string} [cwd] - Working directory for command execution. If not specified, uses the sandbox working directory.
47
+ * @param {Record<string, string>} [env] - Environment variables to set for the command
48
+ * @param {number} [timeout] - Maximum time in seconds to wait for the command to complete.
49
+ * @returns {Promise<ExecuteResponse>} Command execution results containing:
50
+ * - exitCode: The command's exit status
51
+ * - result: Standard output from the command
52
+ * - artifacts: ExecutionArtifacts object containing `stdout` (same as result) and `charts` (matplotlib charts metadata)
53
+ *
54
+ * @example
55
+ * // Simple command
56
+ * const response = await process.executeCommand('echo "Hello"');
57
+ * console.log(response.artifacts.stdout); // Prints: Hello
58
+ *
59
+ * @example
60
+ * // Command with working directory
61
+ * const result = await process.executeCommand('ls', 'workspace/src');
62
+ *
63
+ * @example
64
+ * // Command with timeout
65
+ * const result = await process.executeCommand('sleep 10', undefined, 5);
66
+ */
67
+ executeCommand(command: string, cwd?: string, env?: Record<string, string>, timeout?: number): Promise<ExecuteResponse>;
68
+ /**
69
+ * Executes code in the Sandbox using the appropriate language runtime.
70
+ *
71
+ * @param {string} code - Code to execute
72
+ * @param {CodeRunParams} params - Parameters for code execution
73
+ * @param {number} [timeout] - Maximum time in seconds to wait for execution to complete
74
+ * @returns {Promise<ExecuteResponse>} Code execution results containing:
75
+ * - exitCode: The execution's exit status
76
+ * - result: Standard output from the code
77
+ * - artifacts: ExecutionArtifacts object containing `stdout` (same as result) and `charts` (matplotlib charts metadata)
78
+ *
79
+ * @example
80
+ * // Run TypeScript code
81
+ * const response = await process.codeRun(`
82
+ * const x = 10;
83
+ * const y = 20;
84
+ * console.log(\`Sum: \${x + y}\`);
85
+ * `);
86
+ * console.log(response.artifacts.stdout); // Prints: Sum: 30
87
+ *
88
+ * @example
89
+ * // Run Python code with matplotlib
90
+ * const response = await process.codeRun(`
91
+ * import matplotlib.pyplot as plt
92
+ * import numpy as np
93
+ *
94
+ * x = np.linspace(0, 10, 30)
95
+ * y = np.sin(x)
96
+ *
97
+ * plt.figure(figsize=(8, 5))
98
+ * plt.plot(x, y, 'b-', linewidth=2)
99
+ * plt.title('Line Chart')
100
+ * plt.xlabel('X-axis (seconds)')
101
+ * plt.ylabel('Y-axis (amplitude)')
102
+ * plt.grid(True)
103
+ * plt.show()
104
+ * `);
105
+ *
106
+ * if (response.artifacts?.charts) {
107
+ * const chart = response.artifacts.charts[0];
108
+ *
109
+ * console.log(`Type: ${chart.type}`);
110
+ * console.log(`Title: ${chart.title}`);
111
+ * if (chart.type === ChartType.LINE) {
112
+ * const lineChart = chart as LineChart
113
+ * console.log('X Label:', lineChart.x_label)
114
+ * console.log('Y Label:', lineChart.y_label)
115
+ * console.log('X Ticks:', lineChart.x_ticks)
116
+ * console.log('Y Ticks:', lineChart.y_ticks)
117
+ * console.log('X Tick Labels:', lineChart.x_tick_labels)
118
+ * console.log('Y Tick Labels:', lineChart.y_tick_labels)
119
+ * console.log('X Scale:', lineChart.x_scale)
120
+ * console.log('Y Scale:', lineChart.y_scale)
121
+ * console.log('Elements:')
122
+ * console.dir(lineChart.elements, { depth: null })
123
+ * }
124
+ * }
125
+ */
126
+ codeRun(code: string, params?: CodeRunParams, timeout?: number): Promise<ExecuteResponse>;
127
+ /**
128
+ * Creates a new long-running background session in the Sandbox.
129
+ *
130
+ * Sessions are background processes that maintain state between commands, making them ideal for
131
+ * scenarios requiring multiple related commands or persistent environment setup. You can run
132
+ * long-running commands and monitor process status.
133
+ *
134
+ * @param {string} sessionId - Unique identifier for the new session
135
+ * @returns {Promise<void>}
136
+ *
137
+ * @example
138
+ * // Create a new session
139
+ * const sessionId = 'my-session';
140
+ * await process.createSession(sessionId);
141
+ * const session = await process.getSession(sessionId);
142
+ * // Do work...
143
+ * await process.deleteSession(sessionId);
144
+ */
145
+ createSession(sessionId: string): Promise<void>;
146
+ /**
147
+ * Get a session in the sandbox.
148
+ *
149
+ * @param {string} sessionId - Unique identifier of the session to retrieve
150
+ * @returns {Promise<Session>} Session information including:
151
+ * - sessionId: The session's unique identifier
152
+ * - commands: List of commands executed in the session
153
+ *
154
+ * @example
155
+ * const session = await process.getSession('my-session');
156
+ * session.commands.forEach(cmd => {
157
+ * console.log(`Command: ${cmd.command}`);
158
+ * });
159
+ */
160
+ getSession(sessionId: string): Promise<Session>;
161
+ /**
162
+ * Get the sandbox entrypoint session
163
+ *
164
+ * @returns {Promise<Session>} Entrypoint session information including:
165
+ * - sessionId: The entrypoint session's unique identifier
166
+ * - commands: List of commands executed in the entrypoint session
167
+ *
168
+ * @example
169
+ * const session = await process.getEntrypointSession();
170
+ * session.commands.forEach(cmd => {
171
+ * console.log(`Command: ${cmd.command}`);
172
+ * });
173
+ */
174
+ getEntrypointSession(): Promise<Session>;
175
+ /**
176
+ * Gets information about a specific command executed in a session.
177
+ *
178
+ * @param {string} sessionId - Unique identifier of the session
179
+ * @param {string} commandId - Unique identifier of the command
180
+ * @returns {Promise<Command>} Command information including:
181
+ * - id: The command's unique identifier
182
+ * - command: The executed command string
183
+ * - exitCode: Command's exit status (if completed)
184
+ *
185
+ * @example
186
+ * const cmd = await process.getSessionCommand('my-session', 'cmd-123');
187
+ * if (cmd.exitCode === 0) {
188
+ * console.log(`Command ${cmd.command} completed successfully`);
189
+ * }
190
+ */
191
+ getSessionCommand(sessionId: string, commandId: string): Promise<Command>;
192
+ /**
193
+ * Executes a command in an existing session.
194
+ *
195
+ * @param {string} sessionId - Unique identifier of the session to use
196
+ * @param {SessionExecuteRequest} req - Command execution request containing:
197
+ * - command: The command to execute
198
+ * - runAsync: Whether to execute asynchronously
199
+ * - suppressInputEcho: Whether to suppress input echo. Default is `false`.
200
+ * @param {number} timeout - Timeout in seconds
201
+ * @returns {Promise<SessionExecuteResponse>} Command execution results containing:
202
+ * - cmdId: Unique identifier for the executed command
203
+ * - output: Combined command output (stdout and stderr) (if synchronous execution)
204
+ * - stdout: Standard output from the command
205
+ * - stderr: Standard error from the command
206
+ * - exitCode: Command exit status (if synchronous execution)
207
+ *
208
+ * @example
209
+ * // Execute commands in sequence, maintaining state
210
+ * const sessionId = 'my-session';
211
+ *
212
+ * // Change directory
213
+ * await process.executeSessionCommand(sessionId, {
214
+ * command: 'cd /home/daytona'
215
+ * });
216
+ *
217
+ * // Run command in new directory
218
+ * const result = await process.executeSessionCommand(sessionId, {
219
+ * command: 'pwd'
220
+ * });
221
+ * console.log('[STDOUT]:', result.stdout);
222
+ * console.log('[STDERR]:', result.stderr);
223
+ */
224
+ executeSessionCommand(sessionId: string, req: SessionExecuteRequest, timeout?: number): Promise<SessionExecuteResponse>;
225
+ /**
226
+ * Get the logs for a command executed in a session.
227
+ *
228
+ * @param {string} sessionId - Unique identifier of the session
229
+ * @param {string} commandId - Unique identifier of the command
230
+ * @returns {Promise<SessionCommandLogsResponse>} Command logs containing: output (combined stdout and stderr), stdout and stderr
231
+ *
232
+ * @example
233
+ * const logs = await process.getSessionCommandLogs('my-session', 'cmd-123');
234
+ * console.log('[STDOUT]:', logs.stdout);
235
+ * console.log('[STDERR]:', logs.stderr);
236
+ */
237
+ getSessionCommandLogs(sessionId: string, commandId: string): Promise<SessionCommandLogsResponse>;
238
+ /**
239
+ * Asynchronously retrieve and process the logs for a command executed in a session as they become available.
240
+ *
241
+ * @param {string} sessionId - Unique identifier of the session
242
+ * @param {string} commandId - Unique identifier of the command
243
+ * @param {function} onStdout - Callback function to handle stdout log chunks
244
+ * @param {function} onStderr - Callback function to handle stderr log chunks
245
+ * @returns {Promise<void>}
246
+ *
247
+ * @example
248
+ * const logs = await process.getSessionCommandLogs('my-session', 'cmd-123', (chunk) => {
249
+ * console.log('[STDOUT]:', chunk);
250
+ * }, (chunk) => {
251
+ * console.log('[STDERR]:', chunk);
252
+ * });
253
+ */
254
+ getSessionCommandLogs(sessionId: string, commandId: string, onStdout: (chunk: string) => void, onStderr: (chunk: string) => void): Promise<void>;
255
+ /**
256
+ * Get the logs for the sandbox entrypoint session.
257
+ *
258
+ * @returns {Promise<SessionCommandLogsResponse>} Command logs containing: output (combined stdout and stderr), stdout and stderr
259
+ *
260
+ * @example
261
+ * const logs = await process.getEntrypointLogs();
262
+ * console.log('[STDOUT]:', logs.stdout);
263
+ * console.log('[STDERR]:', logs.stderr);
264
+ */
265
+ getEntrypointLogs(): Promise<SessionCommandLogsResponse>;
266
+ /**
267
+ * Asynchronously retrieve and process the logs for the entrypoint session as they become available.
268
+ *
269
+ * @param {function} onStdout - Callback function to handle stdout log chunks
270
+ * @param {function} onStderr - Callback function to handle stderr log chunks
271
+ * @returns {Promise<void>}
272
+ *
273
+ * @example
274
+ * const logs = await process.getEntrypointLogs((chunk) => {
275
+ * console.log('[STDOUT]:', chunk);
276
+ * }, (chunk) => {
277
+ * console.log('[STDERR]:', chunk);
278
+ * });
279
+ */
280
+ getEntrypointLogs(onStdout: (chunk: string) => void, onStderr: (chunk: string) => void): Promise<void>;
281
+ /**
282
+ * Sends input data to a command executed in a session.
283
+ *
284
+ * @param {string} sessionId - Unique identifier of the session
285
+ * @param {string} commandId - Unique identifier of the command
286
+ * @param {string} data - Input data to send
287
+ * @returns {Promise<void>}
288
+ */
289
+ sendSessionCommandInput(sessionId: string, commandId: string, data: string): Promise<void>;
290
+ /**
291
+ * Lists all active sessions in the Sandbox.
292
+ *
293
+ * @returns {Promise<Session[]>} Array of active sessions
294
+ *
295
+ * @example
296
+ * const sessions = await process.listSessions();
297
+ * sessions.forEach(session => {
298
+ * console.log(`Session ${session.sessionId}:`);
299
+ * session.commands.forEach(cmd => {
300
+ * console.log(`- ${cmd.command} (${cmd.exitCode})`);
301
+ * });
302
+ * });
303
+ */
304
+ listSessions(): Promise<Session[]>;
305
+ /**
306
+ * Delete a session from the Sandbox.
307
+ *
308
+ * @param {string} sessionId - Unique identifier of the session to delete
309
+ * @returns {Promise<void>}
310
+ *
311
+ * @example
312
+ * // Clean up a completed session
313
+ * await process.deleteSession('my-session');
314
+ */
315
+ deleteSession(sessionId: string): Promise<void>;
316
+ /**
317
+ * Create a new PTY (pseudo-terminal) session in the sandbox.
318
+ *
319
+ * Creates an interactive terminal session that can execute commands and handle user input.
320
+ * The PTY session behaves like a real terminal, supporting features like command history.
321
+ *
322
+ * @param {PtyCreateOptions & PtyConnectOptions} options - PTY session configuration including creation and connection options
323
+ * @returns {Promise<PtyHandle>} PTY handle for managing the session
324
+ *
325
+ * @example
326
+ * // Create a PTY session with custom configuration
327
+ * const ptyHandle = await process.createPty({
328
+ * id: 'my-interactive-session',
329
+ * cwd: '/workspace',
330
+ * envs: { TERM: 'xterm-256color', LANG: 'en_US.UTF-8' },
331
+ * cols: 120,
332
+ * rows: 30,
333
+ * onData: (data) => {
334
+ * // Handle terminal output
335
+ * const text = new TextDecoder().decode(data);
336
+ * process.stdout.write(text);
337
+ * },
338
+ * });
339
+ *
340
+ * // Wait for connection to be established
341
+ * await ptyHandle.waitForConnection();
342
+ *
343
+ * // Send commands to the terminal
344
+ * await ptyHandle.sendInput('ls -la\n');
345
+ * await ptyHandle.sendInput('echo "Hello, PTY!"\n');
346
+ * await ptyHandle.sendInput('exit\n');
347
+ *
348
+ * // Wait for completion and get result
349
+ * const result = await ptyHandle.wait();
350
+ * console.log(`PTY session completed with exit code: ${result.exitCode}`);
351
+ *
352
+ * // Clean up
353
+ * await ptyHandle.disconnect();
354
+ */
355
+ createPty(options?: PtyCreateOptions & PtyConnectOptions): Promise<PtyHandle>;
356
+ /**
357
+ * Connect to an existing PTY session in the sandbox.
358
+ *
359
+ * Establishes a WebSocket connection to an existing PTY session, allowing you to
360
+ * interact with a previously created terminal session.
361
+ *
362
+ * @param {string} sessionId - ID of the PTY session to connect to
363
+ * @param {PtyConnectOptions} options - Options for the connection including data handler
364
+ * @returns {Promise<PtyHandle>} PTY handle for managing the session
365
+ *
366
+ * @example
367
+ * // Connect to an existing PTY session
368
+ * const handle = await process.connectPty('my-session', {
369
+ * onData: (data) => {
370
+ * // Handle terminal output
371
+ * const text = new TextDecoder().decode(data);
372
+ * process.stdout.write(text);
373
+ * },
374
+ * });
375
+ *
376
+ * // Wait for connection to be established
377
+ * await handle.waitForConnection();
378
+ *
379
+ * // Send commands to the existing session
380
+ * await handle.sendInput('pwd\n');
381
+ * await handle.sendInput('ls -la\n');
382
+ * await handle.sendInput('exit\n');
383
+ *
384
+ * // Wait for completion
385
+ * const result = await handle.wait();
386
+ * console.log(`Session exited with code: ${result.exitCode}`);
387
+ *
388
+ * // Clean up
389
+ * await handle.disconnect();
390
+ */
391
+ connectPty(sessionId: string, options?: PtyConnectOptions): Promise<PtyHandle>;
392
+ /**
393
+ * List all PTY sessions in the sandbox.
394
+ *
395
+ * Retrieves information about all PTY sessions, both active and inactive,
396
+ * that have been created in this sandbox.
397
+ *
398
+ * @returns {Promise<PtySessionInfo[]>} Array of PTY session information
399
+ *
400
+ * @example
401
+ * // List all PTY sessions
402
+ * const sessions = await process.listPtySessions();
403
+ *
404
+ * for (const session of sessions) {
405
+ * console.log(`Session ID: ${session.id}`);
406
+ * console.log(`Active: ${session.active}`);
407
+ * console.log(`Created: ${session.createdAt}`);
408
+ * }
409
+ * console.log('---');
410
+ * }
411
+ */
412
+ listPtySessions(): Promise<PtySessionInfo[]>;
413
+ /**
414
+ * Get detailed information about a specific PTY session.
415
+ *
416
+ * Retrieves comprehensive information about a PTY session including its current state,
417
+ * configuration, and metadata.
418
+ *
419
+ * @param {string} sessionId - ID of the PTY session to retrieve information for
420
+ * @returns {Promise<PtySessionInfo>} PTY session information
421
+ *
422
+ * @throws {Error} If the PTY session doesn't exist
423
+ *
424
+ * @example
425
+ * // Get details about a specific PTY session
426
+ * const session = await process.getPtySessionInfo('my-session');
427
+ *
428
+ * console.log(`Session ID: ${session.id}`);
429
+ * console.log(`Active: ${session.active}`);
430
+ * console.log(`Working Directory: ${session.cwd}`);
431
+ * console.log(`Terminal Size: ${session.cols}x${session.rows}`);
432
+ *
433
+ * if (session.processId) {
434
+ * console.log(`Process ID: ${session.processId}`);
435
+ * }
436
+ */
437
+ getPtySessionInfo(sessionId: string): Promise<PtySessionInfo>;
438
+ /**
439
+ * Kill a PTY session and terminate its associated process.
440
+ *
441
+ * Forcefully terminates the PTY session and cleans up all associated resources.
442
+ * This will close any active connections and kill the underlying shell process.
443
+ *
444
+ * @param {string} sessionId - ID of the PTY session to kill
445
+ * @returns {Promise<void>}
446
+ *
447
+ * @throws {Error} If the PTY session doesn't exist or cannot be killed
448
+ *
449
+ * @note This operation is irreversible. Any unsaved work in the terminal session will be lost.
450
+ *
451
+ * @example
452
+ * // Kill a specific PTY session
453
+ * await process.killPtySession('my-session');
454
+ *
455
+ * // Verify the session is no longer active
456
+ * try {
457
+ * const info = await process.getPtySessionInfo('my-session');
458
+ * console.log(`Session still exists but active: ${info.active}`);
459
+ * } catch (error) {
460
+ * console.log('Session has been completely removed');
461
+ * }
462
+ */
463
+ killPtySession(sessionId: string): Promise<void>;
464
+ /**
465
+ * Resize a PTY session's terminal dimensions.
466
+ *
467
+ * Changes the terminal size of an active PTY session. This is useful when the
468
+ * client terminal is resized or when you need to adjust the display for different
469
+ * output requirements.
470
+ *
471
+ * @param {string} sessionId - ID of the PTY session to resize
472
+ * @param {number} cols - New number of terminal columns
473
+ * @param {number} rows - New number of terminal rows
474
+ * @returns {Promise<PtySessionInfo>} Updated session information reflecting the new terminal size
475
+ *
476
+ * @throws {Error} If the PTY session doesn't exist or resize operation fails
477
+ *
478
+ * @note The resize operation will send a SIGWINCH signal to the shell process,
479
+ * allowing terminal applications to adapt to the new size.
480
+ *
481
+ * @example
482
+ * // Resize a PTY session to a larger terminal
483
+ * const updatedInfo = await process.resizePtySession('my-session', 150, 40);
484
+ * console.log(`Terminal resized to ${updatedInfo.cols}x${updatedInfo.rows}`);
485
+ *
486
+ * // You can also use the PtyHandle's resize method
487
+ * await ptyHandle.resize(150, 40); // cols, rows
488
+ */
489
+ resizePtySession(sessionId: string, cols: number, rows: number): Promise<PtySessionInfo>;
490
+ }