Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add endpoint for status page

Vasek Mlejnsky85f23faf70a2
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 394ac820b..2dcf135bc 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -36,6 +36,7 @@
"autoprefixer": "^10.4.7",
"class-variance-authority": "^0.7.0",
"clsx": "^1.2.1",
+ "e2b": "^0.13.1",
"fast-glob": "^3.3.0",
"flexsearch": "^0.7.31",
"framer-motion": "7.8.1",
diff --git a/apps/docs/src/app/api/status/route.ts b/apps/docs/src/app/api/status/route.ts
new file mode 100644
index 000000000..138383e52
--- /dev/null
+++ b/apps/docs/src/app/api/status/route.ts
@@ -0,0 +1,27 @@
+import { Sandbox } from 'e2b'
+
+export const dynamic = 'force-dynamic' // static by default, unless reading the request
+export const runtime = 'nodejs'
+
+export async function GET() {
+ try {
+ console.log('Creating sandbox...')
+ // E2B_DOMAIN = e2b-api.com
+ const sandbox = await Sandbox.create({
+ onStdout: (data) => {
+ console.log('sandbox stdout:', data)
+ },
+ onStderr: (data) => {
+ console.error('sandbox stderr:', data)
+ },
+ })
+ console.log(`Sandbox '${sandbox.id}' created`)
+ return new Response(`Sandbox '${sandbox.id}' created`, { status: 200 })
+ } catch (error) {
+ console.log(error)
+ console.error('Error creating sandbox')
+ console.error(error)
+ return new Response(error.statusText || 'Error creating sandbox', { status: error.status || 500 })
+ }
+}
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index dd3acc102..0187bc153 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,10 +17,10 @@ importers:
devDependencies:
'@typescript-eslint/eslint-plugin':
specifier: ^6.7.2
- version: 6.7.2(@typescript-eslint/[email protected])([email protected])([email protected])
+ version: 6.7.2(@typescript-eslint/[email protected])([email protected])([email protected])
'@typescript-eslint/parser':
specifier: ^6.7.2
changeset:
specifier: ^0.2.6
version: 0.2.6
@@ -105,6 +105,9 @@ importers:
clsx:
specifier: ^1.2.1
version: 1.2.1
+ e2b:
+ specifier: ^0.13.1
+ version: 0.13.1([email protected])
fast-glob:
specifier: ^3.3.0
version: 3.3.1
@@ -3031,7 +3034,7 @@ packages:
'@types/node': 18.18.6
dev: true
- /@typescript-eslint/[email protected](@typescript-eslint/[email protected])([email protected])([email protected]):
+ /@typescript-eslint/[email protected](@typescript-eslint/[email protected])([email protected])([email protected]):
resolution: {integrity: sha512-ooaHxlmSgZTM6CHYAFRlifqh1OAr3PAQEwi7lhYhaegbnXrnh7CDcHmc3+ihhbQC7H0i4JF0psI5ehzkF6Yl6Q==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -3043,10 +3046,10 @@ packages:
optional: true
dependencies:
'@eslint-community/regexpp': 4.8.1
- '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
'@typescript-eslint/scope-manager': 6.7.2
- '@typescript-eslint/type-utils': 6.7.2([email protected])([email protected])
- '@typescript-eslint/utils': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/type-utils': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/utils': 6.7.2([email protected])([email protected])
'@typescript-eslint/visitor-keys': 6.7.2
debug: 4.3.4
eslint: 8.49.0
@@ -3054,8 +3057,8 @@ packages:
ignore: 5.2.4
natural-compare: 1.4.0
semver: 7.5.4
- ts-api-utils: 1.0.3([email protected])
- typescript: 5.4.3
+ ts-api-utils: 1.0.3([email protected])
+ typescript: 5.4.5
transitivePeerDependencies:
- supports-color
dev: true
@@ -3110,7 +3113,7 @@ packages:
- supports-color
dev: true
resolution: {integrity: sha512-KA3E4ox0ws+SPyxQf9iSI25R6b4Ne78ORhNHeVKrPQnoYsb9UhieoiRoJgrzgEeKGOXhcY1i8YtOeCHHTDa6Fw==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -3122,11 +3125,11 @@ packages:
dependencies:
'@typescript-eslint/scope-manager': 6.7.2
'@typescript-eslint/types': 6.7.2
- '@typescript-eslint/typescript-estree': 6.7.2([email protected])
+ '@typescript-eslint/typescript-estree': 6.7.2([email protected])
'@typescript-eslint/visitor-keys': 6.7.2
debug: 4.3.4
eslint: 8.49.0
- typescript: 5.4.3
+ typescript: 5.4.5
transitivePeerDependencies:
- supports-color
dev: true
@@ -3176,7 +3179,7 @@ packages:
'@typescript-eslint/visitor-keys': 6.8.0
dev: true
resolution: {integrity: sha512-36F4fOYIROYRl0qj95dYKx6kybddLtsbmPIYNK0OBeXv2j9L5nZ17j9jmfy+bIDHKQgn2EZX+cofsqi8NPATBQ==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -3186,12 +3189,12 @@ packages:
typescript:
optional: true
dependencies:
- '@typescript-eslint/typescript-estree': 6.7.2([email protected])
- '@typescript-eslint/utils': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/typescript-estree': 6.7.2([email protected])
+ '@typescript-eslint/utils': 6.7.2([email protected])([email protected])
debug: 4.3.4
eslint: 8.49.0
- ts-api-utils: 1.0.3([email protected])
- typescript: 5.4.3
+ ts-api-utils: 1.0.3([email protected])
+ typescript: 5.4.5
transitivePeerDependencies:
- supports-color
dev: true
@@ -3274,7 +3277,7 @@ packages:
- supports-color
dev: true
- /@typescript-eslint/[email protected]([email protected]):
+ /@typescript-eslint/[email protected]([email protected]):
resolution: {integrity: sha512-kiJKVMLkoSciGyFU0TOY0fRxnp9qq1AzVOHNeN1+B9erKFCJ4Z8WdjAkKQPP+b1pWStGFqezMLltxO+308dJTQ==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -3289,8 +3292,8 @@ packages:
globby: 11.1.0
is-glob: 4.0.3
semver: 7.5.4
- ts-api-utils: 1.0.3([email protected])
- typescript: 5.4.3
+ ts-api-utils: 1.0.3([email protected])
+ typescript: 5.4.5
transitivePeerDependencies:
- supports-color
dev: true
@@ -3335,7 +3338,7 @@ packages:
- typescript
dev: true
resolution: {integrity: sha512-ZCcBJug/TS6fXRTsoTkgnsvyWSiXwMNiPzBUani7hDidBdj1779qwM1FIAmpH4lvlOZNF3EScsxxuGifjpLSWQ==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@@ -3346,7 +3349,7 @@ packages:
'@types/semver': 7.5.2
'@typescript-eslint/scope-manager': 6.7.2
'@typescript-eslint/types': 6.7.2
- '@typescript-eslint/typescript-estree': 6.7.2([email protected])
+ '@typescript-eslint/typescript-estree': 6.7.2([email protected])
eslint: 8.49.0
semver: 7.5.4
transitivePeerDependencies:
@@ -4871,6 +4874,24 @@ packages:
utf-8-validate: 6.0.3
dev: false
+ resolution: {integrity: sha512-JHm3FUaGNzErrhbD8YrRLZO5pOPGUSm8b9HeEWqutgPmIgVg8v2x/9/8t0Wepwyzep2zmNU+lVQrEB8HlFNjHQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ openai: ^4.17.4
+ dependencies:
+ isomorphic-ws: 5.0.0([email protected])
+ normalize-path: 3.0.0
+ openai: 4.17.4
+ openapi-typescript-fetch: 1.1.3
+ path-browserify: 1.0.1
+ platform: 1.3.6
+ optionalDependencies:
+ bufferutil: 4.0.8
+ utf-8-validate: 6.0.3
+ dev: false
+
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@@ -5262,7 +5283,7 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
- '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
debug: 3.2.7
eslint: 8.49.0
eslint-import-resolver-node: 0.3.9
@@ -5280,7 +5301,7 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
- '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
+ '@typescript-eslint/parser': 6.7.2([email protected])([email protected])
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.3
array.prototype.flat: 1.3.2
@@ -5374,7 +5395,7 @@ packages:
'@typescript-eslint/eslint-plugin':
optional: true
dependencies:
- '@typescript-eslint/eslint-plugin': 6.7.2(@typescript-eslint/[email protected])([email protected])([email protected])
+ '@typescript-eslint/eslint-plugin': 6.7.2(@typescript-eslint/[email protected])([email protected])([email protected])
eslint: 8.49.0
eslint-rule-composer: 0.3.0
dev: true
@@ -10543,13 +10564,13 @@ packages:
typescript: 5.2.2
dev: true
resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==}
engines: {node: '>=16.13.0'}
peerDependencies:
typescript: '>=4.2.0'
dependencies:
- typescript: 5.4.3
+ typescript: 5.4.5
dev: true
@@ -10793,6 +10814,12 @@ packages:
hasBin: true
dev: true
+ resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+ dev: true
+
resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==}
dev: true