Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
merge beta
0div834f84c8bb01
diff --cc packages/js-sdk/src/sandbox/filesystem/index.tsindex e2516dd30,eae381ff9..7195b6bca--- a/packages/js-sdk/src/sandbox/filesystem/index.ts+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts@@@ -129,27 -141,23 +129,38 @@@ export class Filesystemreturn res.data}+ /**+ * Writes content to a file on the path.+ * When writing to a file that doesn't exist, the file will get created.+ * When writing to a file that already exists, the file will get overwritten.+ * When writing to a file that's in a directory that doesn't exist, the directory will get created.+ *+ * @param path Path to a new file. For example '/dirA/dirB/newFile.txt' when creating 'newFile.txt'+ * @param data Data to write to a new file+ * @param opts Options for the request+ * @returns Information about the written file+ */+ async write(path: string, data: WriteData, opts?: FilesystemRequestOpts): Promise<EntryInfo>+ async write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<EntryInfo[]>async write(- path: string,- data: string | ArrayBuffer | Blob | ReadableStream,+ pathOrFiles: string | WriteEntry[],+ dataOrOpts?: WriteData | FilesystemRequestOpts,opts?: FilesystemRequestOpts- ): Promise<EntryInfo> {- const blob = await new Response(data).blob()+ ): Promise<EntryInfo | EntryInfo[]> {+ if (typeof pathOrFiles === 'string' && Array.isArray(dataOrOpts)) {+ throw new Error('Cannot specify path with array of files')+ }++ const { path, writeOpts, writeFiles } =+ typeof pathOrFiles === 'string'+ ? {+ path: pathOrFiles,+ writeOpts: opts as FilesystemRequestOpts,+ writeFiles: [{ data: dataOrOpts as WriteData }],+ }+ : { path: undefined, writeOpts: dataOrOpts as FilesystemRequestOpts, writeFiles: pathOrFiles as WriteEntry[] }++ const blobs = await Promise.all(writeFiles.map((f) => new Response(f.data).blob()))const res = await this.envdApi.api.POST('/files', {params: {