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

@ -12,7 +12,7 @@
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"e2b": "^0.16.2-beta.47", "e2b": "^1.0.5",
"express": "^4.19.2", "express": "^4.19.2",
"jzip": "^1.0.0", "jzip": "^1.0.0",
"rate-limiter-flexible": "^5.0.3", "rate-limiter-flexible": "^5.0.3",
@ -44,25 +44,25 @@
} }
}, },
"node_modules/@bufbuild/protobuf": { "node_modules/@bufbuild/protobuf": {
"version": "1.10.0", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.2.tgz",
"integrity": "sha512-QDdVFLoN93Zjg36NoQPZfsVH9tZew7wKDKyV5qRdj8ntT4wQCOradQjRaTdwMhWUYsgKsvCINKKm87FdEk96Ag==" "integrity": "sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A=="
}, },
"node_modules/@connectrpc/connect": { "node_modules/@connectrpc/connect": {
"version": "1.4.0", "version": "2.0.0-rc.3",
"resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.4.0.tgz", "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-2.0.0-rc.3.tgz",
"integrity": "sha512-vZeOkKaAjyV4+RH3+rJZIfDFJAfr+7fyYr6sLDKbYX3uuTVszhFe9/YKf5DNqrDb5cKdKVlYkGn6DTDqMitAnA==", "integrity": "sha512-ARBt64yEyKbanyRETTjcjJuHr2YXorzQo0etyS5+P6oSeW8xEuzajA9g+zDnMcj1hlX2dQE93foIWQGfpru7gQ==",
"peerDependencies": { "peerDependencies": {
"@bufbuild/protobuf": "^1.4.2" "@bufbuild/protobuf": "^2.2.0"
} }
}, },
"node_modules/@connectrpc/connect-web": { "node_modules/@connectrpc/connect-web": {
"version": "1.4.0", "version": "2.0.0-rc.3",
"resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.4.0.tgz", "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-2.0.0-rc.3.tgz",
"integrity": "sha512-13aO4psFbbm7rdOFGV0De2Za64DY/acMspgloDlcOKzLPPs0yZkhp1OOzAQeiAIr7BM/VOHIA3p8mF0inxCYTA==", "integrity": "sha512-w88P8Lsn5CCsA7MFRl2e6oLY4J/5toiNtJns/YJrlyQaWOy3RO8pDgkz+iIkG98RPMhj2thuBvsd3Cn4DKKCkw==",
"peerDependencies": { "peerDependencies": {
"@bufbuild/protobuf": "^1.4.2", "@bufbuild/protobuf": "^2.2.0",
"@connectrpc/connect": "1.4.0" "@connectrpc/connect": "2.0.0-rc.3"
} }
}, },
"node_modules/@cspotcode/source-map-support": { "node_modules/@cspotcode/source-map-support": {
@ -783,13 +783,13 @@
} }
}, },
"node_modules/e2b": { "node_modules/e2b": {
"version": "0.16.2-beta.47", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/e2b/-/e2b-0.16.2-beta.47.tgz", "resolved": "https://registry.npmjs.org/e2b/-/e2b-1.0.5.tgz",
"integrity": "sha512-tMPDYLMD+8+JyLPrsWft3NHBhK5YKOFOXzKMwpOKR5KvXOkd1silkArDwplmBUzN/eG/uRzWdtHZs9mHUQ5b9g==", "integrity": "sha512-0c2xqNQfVcVBmETsd1bXWCYaN3iVl7m81dJVcjB7O2/c15A7t0s/FkydcZGzVvfZchj40/1f09AdjGX6nk1eNQ==",
"dependencies": { "dependencies": {
"@bufbuild/protobuf": "^1.10.0", "@bufbuild/protobuf": "^2.2.2",
"@connectrpc/connect": "^1.4.0", "@connectrpc/connect": "2.0.0-rc.3",
"@connectrpc/connect-web": "^1.4.0", "@connectrpc/connect-web": "2.0.0-rc.3",
"compare-versions": "^6.1.0", "compare-versions": "^6.1.0",
"openapi-fetch": "^0.9.7", "openapi-fetch": "^0.9.7",
"platform": "^1.3.6" "platform": "^1.3.6"

View File

@ -14,7 +14,7 @@
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"e2b": "^0.16.2-beta.47", "e2b": "^1.0.5",
"express": "^4.19.2", "express": "^4.19.2",
"jzip": "^1.0.0", "jzip": "^1.0.0",
"rate-limiter-flexible": "^5.0.3", "rate-limiter-flexible": "^5.0.3",

View File

@ -188,7 +188,7 @@ export class FileManager {
// Watch a directory for changes // Watch a directory for changes
async watchDirectory(directory: string): Promise<WatchHandle | undefined> { async watchDirectory(directory: string): Promise<WatchHandle | undefined> {
try { try {
const handle = await this.sandbox.files.watch( const handle = await this.sandbox.files.watchDir(
directory, directory,
async (event: FilesystemEvent) => { async (event: FilesystemEvent) => {
try { try {
@ -341,7 +341,7 @@ export class FileManager {
) )
} }
}, },
{ timeout: 0 } { timeoutMs: 0 }
) )
this.fileWatchers.push(handle) this.fileWatchers.push(handle)
return handle return handle
@ -595,7 +595,7 @@ export class FileManager {
async closeWatchers() { async closeWatchers() {
await Promise.all( await Promise.all(
this.fileWatchers.map(async (handle: WatchHandle) => { 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 // Terminal class to manage a pseudo-terminal (PTY) in a sandbox environment
export class Terminal { 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 private sandbox: Sandbox // Reference to the sandbox environment
// Constructor initializes the Terminal with a sandbox // Constructor initializes the Terminal with a sandbox
@ -24,7 +24,7 @@ export class Terminal {
this.pty = await this.sandbox.pty.create({ this.pty = await this.sandbox.pty.create({
rows, rows,
cols, cols,
timeout: 0, timeoutMs: 0,
onData: (data: Uint8Array) => { onData: (data: Uint8Array) => {
onData(new TextDecoder().decode(data)) // Convert received data to string and pass to handler onData(new TextDecoder().decode(data)) // Convert received data to string and pass to handler
}, },