Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

remove WriteData type in js-sdk

0div502c414ce42d
diff --git a/packages/js-sdk/src/index.ts b/packages/js-sdk/src/index.ts
index 05f304c0e..17e6e59d8 100644
--- a/packages/js-sdk/src/index.ts
+++ b/packages/js-sdk/src/index.ts
@@ -15,7 +15,7 @@ export {
export type { Logger } from './logs'
export { FileType } from './sandbox/filesystem'
-export type { EntryInfo, Filesystem, WriteData } from './sandbox/filesystem'
+export type { EntryInfo, Filesystem } from './sandbox/filesystem'
export { FilesystemEventType } from './sandbox/filesystem/watchHandle'
export type { FilesystemEvent, WatchHandle } from './sandbox/filesystem/watchHandle'
@@ -38,8 +38,6 @@ export type {
Pty,
} from './sandbox/commands'
-export type { Pty } from './sandbox/pty'
-
export type { SandboxOpts } from './sandbox'
export type { SandboxInfo } from './sandbox/sandboxApi'
export { Sandbox }
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index c330b88cc..68f8c3c4b 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -54,11 +54,9 @@ export const enum FileType {
DIR = 'dir',
}
-export type WriteData = string | ArrayBuffer | Blob | ReadableStream
-
export type WriteEntry = {
path: string
- data: WriteData
+ data: string | ArrayBuffer | Blob | ReadableStream
}
function mapFileType(fileType: FsFileType) {
@@ -227,11 +225,11 @@ export class Filesystem {
*
* @returns information about the written file
*/
- async write(path: string, data: WriteData, opts?: FilesystemRequestOpts): Promise<EntryInfo>
+ async write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<EntryInfo>
async write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<EntryInfo[]>
async write(
pathOrFiles: string | WriteEntry[],
- dataOrOpts?: WriteData | FilesystemRequestOpts,
+ dataOrOpts?: string | ArrayBuffer | Blob | ReadableStream | FilesystemRequestOpts,
opts?: FilesystemRequestOpts
): Promise<EntryInfo | EntryInfo[]> {
if (typeof pathOrFiles !== 'string' && !Array.isArray(pathOrFiles)) {
@@ -249,7 +247,7 @@ export class Filesystem {
? {
path: pathOrFiles,
writeOpts: opts as FilesystemRequestOpts,
- writeFiles: [{ data: dataOrOpts as WriteData }],
+ writeFiles: [{ data: dataOrOpts as string | ArrayBuffer | Blob | ReadableStream }],
}
: { path: undefined, writeOpts: dataOrOpts as FilesystemRequestOpts, writeFiles: pathOrFiles as WriteEntry[] }
@@ -462,7 +460,10 @@ export class Filesystem {
async watchDir(
path: string,
onEvent: (event: FilesystemEvent) => void | Promise<void>,
- opts?: WatchOpts
+ opts?: FilesystemRequestOpts & {
+ timeout?: number
+ onExit?: (err?: Error) => void | Promise<void>
+ }
): Promise<WatchHandle> {
const requestTimeoutMs = opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs