Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@e2b/code-interpreter

Package Overview
Dependencies
Maintainers
0
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e2b/code-interpreter - npm Package Compare versions

Comparing version 0.0.9-beta.14 to 0.0.9-beta.15

201

dist/index.js

@@ -277,2 +277,14 @@ "use strict";

// src/codeInterpreter.ts
function formatRequestTimeoutError(error) {
if (error instanceof Error && error.name === "AbortError") {
return new import_e2b2.TimeoutError("Request timed out \u2014 the 'requestTimeoutMs' option can be used to increase this timeout");
}
return error;
}
function formatExecutionTimeoutError(error) {
if (error instanceof Error && error.name === "AbortError") {
return new import_e2b2.TimeoutError("Execution timed out \u2014 the 'timeoutMs' option can be used to increase this timeout");
}
return error;
}
function readLines(stream) {

@@ -321,46 +333,53 @@ return __asyncGenerator(this, null, function* () {

}, requestTimeout) : void 0;
const res = yield fetch(`${this.url}/execute`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
code,
context_id: opts == null ? void 0 : opts.kernelID
}),
keepalive: true
});
const error = yield extractError(res);
if (error) {
throw error;
}
if (!res.body) {
throw new Error(`Not response body: ${res.statusText} ${yield res == null ? void 0 : res.text()}`);
}
clearTimeout(reqTimer);
const bodyTimeout = (_b = opts == null ? void 0 : opts.timeoutMs) != null ? _b : _JupyterExtension.execTimeoutMs;
const bodyTimer = bodyTimeout ? setTimeout(() => {
controller.abort();
}, bodyTimeout) : void 0;
const execution = new Execution();
try {
const res = yield fetch(`${this.url}/execute`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
code,
context_id: opts == null ? void 0 : opts.kernelID
}),
signal: controller.signal,
keepalive: true
});
const error2 = yield extractError(res);
if (error2) {
throw error2;
}
if (!res.body) {
throw new Error(`Not response body: ${res.statusText} ${yield res == null ? void 0 : res.text()}`);
}
clearTimeout(reqTimer);
const bodyTimeout = (_b = opts == null ? void 0 : opts.timeoutMs) != null ? _b : _JupyterExtension.execTimeoutMs;
const bodyTimer = bodyTimeout ? setTimeout(() => {
controller.abort();
}, bodyTimeout) : void 0;
const execution = new Execution();
try {
for (var iter = __forAwait(readLines(res.body)), more, temp, error2; more = !(temp = yield iter.next()).done; more = false) {
const chunk = temp.value;
yield parseOutput(execution, chunk, opts == null ? void 0 : opts.onStdout, opts == null ? void 0 : opts.onStderr, opts == null ? void 0 : opts.onResult);
}
} catch (temp) {
error2 = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
for (var iter = __forAwait(readLines(res.body)), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const chunk = temp.value;
yield parseOutput(execution, chunk, opts == null ? void 0 : opts.onStdout, opts == null ? void 0 : opts.onStderr, opts == null ? void 0 : opts.onResult);
}
} catch (temp) {
error = [temp];
} finally {
if (error2)
throw error2[0];
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
} catch (error3) {
throw formatExecutionTimeoutError(error3);
} finally {
clearTimeout(bodyTimer);
}
} finally {
clearTimeout(bodyTimer);
return execution;
} catch (error2) {
throw formatRequestTimeoutError(error2);
}
return execution;
});

@@ -374,20 +393,24 @@ }

} = {}) {
const res = yield fetch(`${this.url}/contexts`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: kernelName,
cwd
}),
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
try {
const res = yield fetch(`${this.url}/contexts`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: kernelName,
cwd
}),
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
}
const data = yield res.json();
return data.id;
} catch (error) {
throw formatRequestTimeoutError(error);
}
const data = yield res.json();
return data.id;
});

@@ -400,14 +423,18 @@ }

} = {}) {
kernelID = kernelID || _JupyterExtension.defaultKernelID;
const res = yield fetch(`${this.url}/contexts/${kernelID}/restart`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
try {
kernelID = kernelID || _JupyterExtension.defaultKernelID;
const res = yield fetch(`${this.url}/contexts/${kernelID}/restart`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
}
} catch (error) {
throw formatRequestTimeoutError(error);
}

@@ -421,11 +448,15 @@ });

} = {}) {
kernelID = kernelID || _JupyterExtension.defaultKernelID;
const res = yield fetch(`${this.url}/contexts/${kernelID}`, {
method: "DELETE",
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
try {
kernelID = kernelID || _JupyterExtension.defaultKernelID;
const res = yield fetch(`${this.url}/contexts/${kernelID}`, {
method: "DELETE",
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
}
} catch (error) {
throw formatRequestTimeoutError(error);
}

@@ -438,11 +469,15 @@ });

} = {}) {
const res = yield fetch(`${this.url}/contexts`, {
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
try {
const res = yield fetch(`${this.url}/contexts`, {
keepalive: true,
signal: this.connectionConfig.getSignal(requestTimeoutMs)
});
const error = yield extractError(res);
if (error) {
throw error;
}
return (yield res.json()).map((kernel) => ({ kernelID: kernel.id, name: kernel.name }));
} catch (error) {
throw formatRequestTimeoutError(error);
}
return (yield res.json()).map((kernel) => ({ kernelID: kernel.id, name: kernel.name }));
});

@@ -449,0 +484,0 @@ }

{
"name": "@e2b/code-interpreter",
"version": "0.0.9-beta.14",
"version": "0.0.9-beta.15",
"description": "E2B Code Interpreter - Stateful code execution",

@@ -5,0 +5,0 @@ "homepage": "https://e2b.dev",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc