chore: upgrade E2B to latest version

This commit is contained in:
James Murdza
2024-11-17 10:07:18 -05:00
parent 10104c31b9
commit 6b4fbe6a13
4 changed files with 26 additions and 26 deletions

View File

@ -188,7 +188,7 @@ export class FileManager {
// Watch a directory for changes
async watchDirectory(directory: string): Promise<WatchHandle | undefined> {
try {
const handle = await this.sandbox.files.watch(
const handle = await this.sandbox.files.watchDir(
directory,
async (event: FilesystemEvent) => {
try {
@ -341,7 +341,7 @@ export class FileManager {
)
}
},
{ timeout: 0 }
{ timeoutMs: 0 }
)
this.fileWatchers.push(handle)
return handle
@ -595,7 +595,7 @@ export class FileManager {
async closeWatchers() {
await Promise.all(
this.fileWatchers.map(async (handle: WatchHandle) => {
await handle.close()
await handle.stop()
})
)
}

View File

@ -1,8 +1,8 @@
import { ProcessHandle, Sandbox } from "e2b"
import { CommandHandle, Sandbox } from "e2b"
// Terminal class to manage a pseudo-terminal (PTY) in a sandbox environment
export class Terminal {
private pty: ProcessHandle | undefined // Holds the PTY process handle
private pty: CommandHandle | undefined // Holds the PTY process handle
private sandbox: Sandbox // Reference to the sandbox environment
// Constructor initializes the Terminal with a sandbox
@ -24,7 +24,7 @@ export class Terminal {
this.pty = await this.sandbox.pty.create({
rows,
cols,
timeout: 0,
timeoutMs: 0,
onData: (data: Uint8Array) => {
onData(new TextDecoder().decode(data)) // Convert received data to string and pass to handler
},