Comparing version 0.13.2 to 0.14.0
import * as openapi_typescript_fetch_dist_cjs_types from 'openapi-typescript-fetch/dist/cjs/types'; | ||
import * as fetcher from 'openapi-typescript-fetch'; | ||
import { TypedFetch, OpArgType } from 'openapi-typescript-fetch'; | ||
import { Run, RunSubmitToolOutputsParams } from 'openai/resources/beta/threads/runs/runs'; | ||
@@ -867,14 +866,2 @@ /** | ||
declare class Actions { | ||
private readonly sandbox; | ||
constructor(sandbox: Sandbox); | ||
/** | ||
* Call the required actions for the provided run and return their outputs. | ||
* | ||
* @param run OpenAI run object from `openai.beta.threads.runs.retrieve` or `openai.beta.threads.runs.retrieve.create` call that contains the names of the required actions and their arguments. | ||
* @returns The outputs of the required actions in the run. | ||
*/ | ||
run(run: Run): Promise<RunSubmitToolOutputsParams.ToolOutput[]>; | ||
} | ||
type DownloadFileFormat = 'base64' | 'blob' | 'buffer' | 'arraybuffer' | 'text'; | ||
@@ -889,7 +876,2 @@ interface SandboxOpts extends SandboxConnectionOpts { | ||
} | ||
interface Action<S extends Sandbox = Sandbox, T = { | ||
[key: string]: any; | ||
}> { | ||
(sandbox: S, args: T): string | Promise<string>; | ||
} | ||
/** | ||
@@ -933,3 +915,2 @@ * E2B cloud sandbox gives your agent a full cloud development environment that's sandboxed. | ||
readonly process: ProcessManager; | ||
readonly _actions: Map<string, Action<any, any>>; | ||
private readonly onScanPorts?; | ||
@@ -953,16 +934,2 @@ /** | ||
/** | ||
* Returns a map of added actions. | ||
* | ||
* @returns Map of added actions | ||
*/ | ||
get actions(): Map<string, Action<any, any>>; | ||
/** | ||
* OpenAI integration that can be used to get output for the actions added in the sandbox. | ||
* | ||
* @returns OpenAI integration | ||
*/ | ||
get openai(): { | ||
readonly actions: Actions; | ||
}; | ||
/** | ||
* Creates a new Sandbox from the default `base` sandbox template. | ||
@@ -1042,54 +1009,2 @@ * @returns New Sandbox | ||
/** | ||
* Add a new action. The name of the action is automatically extracted from the function name. | ||
* | ||
* You can use this action with specific integrations like OpenAI to interact with the sandbox and get output for the action. | ||
* | ||
* @param action Action handler | ||
* @returns Sandbox | ||
* | ||
* @example | ||
* ```ts | ||
* const sandbox = await Sandbox.create() | ||
* sandbox.addAction('readFile', (sandbox, args) => sandbox.filesystem.read(args.path)) | ||
* ``` | ||
*/ | ||
addAction<T = { | ||
[name: string]: any; | ||
}>(action: Action<this, T>): this; | ||
/** | ||
* Add a new action with a specified name. | ||
* | ||
* You can use this action with specific integrations like OpenAI to interact with the sandbox and get output for the action. | ||
* | ||
* @param name Action name | ||
* @param action Action handler | ||
* @returns Sandbox | ||
* | ||
* @example | ||
* ```ts | ||
* async function readFile(sandbox: Sandbox, args: any) { | ||
* return sandbox.filesystem.read(args.path) | ||
* } | ||
* | ||
* const sandbox = await Sandbox.create() | ||
* sandbox.addAction(readFile) | ||
* ``` | ||
*/ | ||
addAction<T = { | ||
[name: string]: any; | ||
}>(name: string, action: Action<this, T>): this; | ||
/** | ||
* Remove an action. | ||
* @param name Action name | ||
* @returns Sandbox | ||
* | ||
* @example | ||
* ```ts | ||
* const sandbox = await Sandbox.create() | ||
* sandbox.addAction('hello', (sandbox, args) => 'Hello World') | ||
* sandbox.removeAction('hello') | ||
* ``` | ||
*/ | ||
removeAction(name: string): this; | ||
/** | ||
* Uploads a file to the sandbox. | ||
@@ -1158,43 +1073,2 @@ * The file will be uploaded to the user's home directory with the same name. | ||
declare class Artifact<S extends DataAnalysis> { | ||
readonly path: string; | ||
readonly _sandbox: S; | ||
constructor(path: string, sandbox: S); | ||
download(): Promise<string | Blob | ArrayBuffer>; | ||
} | ||
interface RunPythonOpts<S extends DataAnalysis> extends Omit<ProcessOpts, 'cmd'> { | ||
onArtifact?: (artifact: Artifact<S>) => Promise<void> | void; | ||
} | ||
declare class DataAnalysis extends Sandbox { | ||
private static template; | ||
/** | ||
* Use `DataAnalysis.create()` instead. | ||
* | ||
* @hidden | ||
* @hide | ||
* @internal | ||
* @access protected | ||
*/ | ||
constructor(opts: SandboxOpts); | ||
/** | ||
* Creates a new Sandbox from the template. | ||
* @returns New Sandbox | ||
*/ | ||
static create(): Promise<DataAnalysis>; | ||
/** | ||
* Creates a new Sandbox from the specified options. | ||
* @param opts Sandbox options | ||
* @returns New Sandbox | ||
*/ | ||
static create(opts: SandboxOpts): Promise<DataAnalysis>; | ||
runPython(code: string, opts?: RunPythonOpts<this>): Promise<{ | ||
stdout: string; | ||
stderr: string; | ||
artifacts: Artifact<DataAnalysis>[]; | ||
}>; | ||
installPythonPackages(packageNames: string | string[]): Promise<void>; | ||
installSystemPackages(packageNames: string | string[]): Promise<void>; | ||
private installPackages; | ||
} | ||
export { APIClient, API_HOST, Action, Artifact, AuthenticationError, DataAnalysis as CodeInterpreter, CodeRuntime, CurrentWorkingDirectoryDoesntExistError, DataAnalysis, DownloadFileFormat, EnvVars, FileInfo, FilesystemEvent, FilesystemEventListener, FilesystemManager, FilesystemOperation, FilesystemWatcher, OpenPort, Process, ProcessManager, ProcessMessage, ProcessOutput, RunPythonOpts, RunningSandbox, SANDBOX_DOMAIN, Sandbox, SandboxMetadata, SandboxOpts, Terminal, TerminalManager, TerminalOutput, TimeoutError, components, Sandbox as default, paths, runCode, withAPIKey, withAccessToken }; | ||
export { APIClient, API_HOST, AuthenticationError, CodeRuntime, CurrentWorkingDirectoryDoesntExistError, DownloadFileFormat, EnvVars, FileInfo, FilesystemEvent, FilesystemEventListener, FilesystemManager, FilesystemOperation, FilesystemWatcher, OpenPort, Process, ProcessManager, ProcessMessage, ProcessOutput, RunningSandbox, SANDBOX_DOMAIN, Sandbox, SandboxMetadata, SandboxOpts, Terminal, TerminalManager, TerminalOutput, TimeoutError, components, Sandbox as default, paths, runCode, withAPIKey, withAccessToken }; |
{ | ||
"name": "e2b", | ||
"version": "0.13.2", | ||
"version": "0.14.0", | ||
"description": "E2B SDK that give agents cloud environments", | ||
@@ -25,5 +25,2 @@ "homepage": "https://e2b.dev", | ||
"types": "dist/index.d.ts", | ||
"peerDependencies": { | ||
"openai": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
@@ -37,4 +34,4 @@ "@types/node": "^18.18.6", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"dotenv": "^16.4.5", | ||
"knip": "^2.34.0", | ||
"markdown-it": "^13.0.2", | ||
"npm-check-updates": "^16.14.6", | ||
@@ -41,0 +38,0 @@ "openapi-typescript": "^5.4.1", |
@@ -25,5 +25,5 @@ <p align="center"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@e2b/sdk"> | ||
<a href="https://www.npmjs.com/package/e2b"> | ||
<img alt="Last 1 month downloads for the Python SDK" loading="lazy" width="200" height="20" decoding="async" data-nimg="1" | ||
style="color:transparent;width:auto;height:100%" src="https://img.shields.io/npm/dm/%40e2b/sdk?label=NPM%20Downloads"> | ||
style="color:transparent;width:auto;height:100%" src="https://img.shields.io/npm/dm/e2b?label=NPM%20Downloads"> | ||
</a> | ||
@@ -30,0 +30,0 @@ </h4> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
399032
4786