@tickernelz/paperclip-pro-plugin-e2b 2026.925.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +41 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +4 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +50 -0
- package/dist/manifest.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +394 -0
- package/dist/plugin.js.map +1 -0
- package/dist/worker.d.ts +3 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +5 -0
- package/dist/worker.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Paperclip AI
|
|
4
|
+
Copyright (c) 2026 Zhafron Adani Kautsar (paperclip-pro fork modifications)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# `@tickernelz/paperclip-pro-plugin-e2b`
|
|
2
|
+
|
|
3
|
+
Published E2B sandbox provider plugin for Paperclip.
|
|
4
|
+
|
|
5
|
+
This package lives in the Paperclip monorepo, but it is intentionally excluded from the root `pnpm` workspace and shaped to publish and install like a standalone npm package. That means operators can install it from the Plugins page by package name, and the host will fetch its transitive dependencies at install time without adding lockfile churn to the Paperclip repo.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
From a Paperclip instance, install:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
@tickernelz/paperclip-pro-plugin-e2b
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The host plugin installer runs `npm install` into the managed plugin directory, so package dependencies such as `e2b` are pulled in during installation.
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
Configure E2B from `Instance Settings -> Environments`, not from the plugin's plugin page.
|
|
20
|
+
|
|
21
|
+
- Put the E2B API key on the sandbox environment itself.
|
|
22
|
+
- When you save an environment, Paperclip stores pasted API keys as company secrets.
|
|
23
|
+
- `E2B_API_KEY` remains an optional host-level fallback when an environment omits the key.
|
|
24
|
+
|
|
25
|
+
## Local development
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd packages/plugins/sandbox-providers/e2b
|
|
29
|
+
pnpm install --ignore-workspace --no-lockfile
|
|
30
|
+
pnpm build
|
|
31
|
+
pnpm test
|
|
32
|
+
pnpm typecheck
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
These commands assume the repo root has already been installed once so the local `@tickernelz/paperclip-pro-plugin-sdk` workspace package is available to the compiler during development.
|
|
36
|
+
|
|
37
|
+
## Package layout
|
|
38
|
+
|
|
39
|
+
- `src/manifest.ts` declares the sandbox-provider driver metadata
|
|
40
|
+
- `src/plugin.ts` implements the environment lifecycle hooks
|
|
41
|
+
- `paperclipPlugin.manifest` and `paperclipPlugin.worker` point the host at the built plugin entrypoints in `dist/`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAKtF,QAAA,MAAM,QAAQ,EAAE,yBAiDf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const PLUGIN_ID = "paperclip.e2b-sandbox-provider";
|
|
2
|
+
const PLUGIN_VERSION = "0.1.0";
|
|
3
|
+
const manifest = {
|
|
4
|
+
id: PLUGIN_ID,
|
|
5
|
+
apiVersion: 1,
|
|
6
|
+
version: PLUGIN_VERSION,
|
|
7
|
+
displayName: "E2B Sandbox Provider",
|
|
8
|
+
description: "First-party sandbox provider plugin that provisions E2B cloud sandboxes as Paperclip execution environments.",
|
|
9
|
+
author: "Paperclip",
|
|
10
|
+
categories: ["automation"],
|
|
11
|
+
capabilities: ["environment.drivers.register"],
|
|
12
|
+
entrypoints: {
|
|
13
|
+
worker: "./dist/worker.js",
|
|
14
|
+
},
|
|
15
|
+
environmentDrivers: [
|
|
16
|
+
{
|
|
17
|
+
driverKey: "e2b",
|
|
18
|
+
kind: "sandbox_provider",
|
|
19
|
+
displayName: "E2B Cloud Sandbox",
|
|
20
|
+
description: "Provisions E2B cloud sandboxes with configurable templates, timeouts, and lease reuse.",
|
|
21
|
+
configSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
template: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "E2B sandbox template name. Defaults to base when omitted.",
|
|
27
|
+
default: "base",
|
|
28
|
+
},
|
|
29
|
+
apiKey: {
|
|
30
|
+
type: "string",
|
|
31
|
+
format: "secret-ref",
|
|
32
|
+
description: "Environment-specific E2B API key. Paste a key or an existing Paperclip secret reference; saved environments store pasted values as company secrets. Falls back to E2B_API_KEY if omitted.",
|
|
33
|
+
},
|
|
34
|
+
timeoutMs: {
|
|
35
|
+
type: "number",
|
|
36
|
+
description: "Sandbox lifetime in milliseconds, refreshed on each command. Defaults to 1 hour. Raise this if your runs commonly idle longer than the default between commands.",
|
|
37
|
+
default: 3600000,
|
|
38
|
+
},
|
|
39
|
+
reuseLease: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
description: "Whether to pause and reuse sandboxes across runs.",
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
export default manifest;
|
|
50
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,gCAAgC,CAAC;AACnD,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,MAAM,QAAQ,GAA8B;IAC1C,EAAE,EAAE,SAAS;IACb,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,8GAA8G;IAChH,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,YAAY,EAAE,CAAC,8BAA8B,CAAC;IAC9C,WAAW,EAAE;QACX,MAAM,EAAE,kBAAkB;KAC3B;IACD,kBAAkB,EAAE;QAClB;YACE,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,wFAAwF;YAC1F,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2DAA2D;wBACxE,OAAO,EAAE,MAAM;qBAChB;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE,YAAY;wBACpB,WAAW,EACT,2LAA2L;qBAC9L;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,kKAAkK;wBACpK,OAAO,EAAE,OAAO;qBACjB;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,mDAAmD;wBAChE,OAAO,EAAE,KAAK;qBACf;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAsNA,QAAA,MAAM,MAAM,gEAiQV,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { CommandExitError, Sandbox, SandboxNotFoundError, TimeoutError, } from "e2b";
|
|
4
|
+
import { definePlugin } from "@tickernelz/paperclip-pro-plugin-sdk";
|
|
5
|
+
function parseDriverConfig(raw) {
|
|
6
|
+
const template = typeof raw.template === "string" && raw.template.trim().length > 0
|
|
7
|
+
? raw.template.trim()
|
|
8
|
+
: "base";
|
|
9
|
+
const timeoutMs = Number(raw.timeoutMs ?? 3_600_000);
|
|
10
|
+
return {
|
|
11
|
+
template,
|
|
12
|
+
apiKey: typeof raw.apiKey === "string" && raw.apiKey.trim().length > 0 ? raw.apiKey.trim() : null,
|
|
13
|
+
timeoutMs: Number.isFinite(timeoutMs) ? Math.trunc(timeoutMs) : 3_600_000,
|
|
14
|
+
reuseLease: raw.reuseLease === true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function resolveApiKey(config) {
|
|
18
|
+
if (config.apiKey) {
|
|
19
|
+
return config.apiKey;
|
|
20
|
+
}
|
|
21
|
+
const envApiKey = process.env.E2B_API_KEY?.trim() ?? "";
|
|
22
|
+
if (!envApiKey) {
|
|
23
|
+
throw new Error("E2B sandbox environments require an API key in config or E2B_API_KEY.");
|
|
24
|
+
}
|
|
25
|
+
return envApiKey;
|
|
26
|
+
}
|
|
27
|
+
async function createSandbox(config) {
|
|
28
|
+
const options = {
|
|
29
|
+
apiKey: resolveApiKey(config),
|
|
30
|
+
timeoutMs: config.timeoutMs,
|
|
31
|
+
metadata: {
|
|
32
|
+
paperclipProvider: "e2b",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
return await Sandbox.create(config.template, options);
|
|
36
|
+
}
|
|
37
|
+
function formatErrorMessage(error) {
|
|
38
|
+
return error instanceof Error ? error.message : String(error);
|
|
39
|
+
}
|
|
40
|
+
function readTimeoutStream(error, key) {
|
|
41
|
+
const record = error;
|
|
42
|
+
const direct = record[key];
|
|
43
|
+
if (typeof direct === "string" && direct.length > 0)
|
|
44
|
+
return direct;
|
|
45
|
+
const nested = record.result?.[key];
|
|
46
|
+
if (typeof nested === "string")
|
|
47
|
+
return nested;
|
|
48
|
+
return typeof direct === "string" ? direct : "";
|
|
49
|
+
}
|
|
50
|
+
function buildTimeoutExecuteResult(error) {
|
|
51
|
+
const stdout = readTimeoutStream(error, "stdout");
|
|
52
|
+
const stderrOutput = readTimeoutStream(error, "stderr");
|
|
53
|
+
const message = error.message.trim();
|
|
54
|
+
const stderr = stderrOutput.length > 0
|
|
55
|
+
? message.length > 0 && !stderrOutput.includes(message)
|
|
56
|
+
? `${stderrOutput}${stderrOutput.endsWith("\n") ? "" : "\n"}${message}\n`
|
|
57
|
+
: stderrOutput
|
|
58
|
+
: message.length > 0
|
|
59
|
+
? `${message}\n`
|
|
60
|
+
: "";
|
|
61
|
+
return {
|
|
62
|
+
exitCode: null,
|
|
63
|
+
timedOut: true,
|
|
64
|
+
stdout,
|
|
65
|
+
stderr,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async function ensureSandboxWorkspace(sandbox, remoteCwd) {
|
|
69
|
+
await sandbox.commands.run(`mkdir -p ${shellQuote(remoteCwd)}`);
|
|
70
|
+
}
|
|
71
|
+
async function resolveSandboxWorkingDirectory(sandbox) {
|
|
72
|
+
const result = await sandbox.commands.run("pwd");
|
|
73
|
+
const cwd = result.stdout.trim();
|
|
74
|
+
const remoteCwd = path.posix.join(cwd.length > 0 ? cwd : "/", "paperclip-workspace");
|
|
75
|
+
await ensureSandboxWorkspace(sandbox, remoteCwd);
|
|
76
|
+
return remoteCwd;
|
|
77
|
+
}
|
|
78
|
+
async function connectSandbox(config, providerLeaseId) {
|
|
79
|
+
return await Sandbox.connect(providerLeaseId, {
|
|
80
|
+
apiKey: resolveApiKey(config),
|
|
81
|
+
timeoutMs: config.timeoutMs,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async function connectForCleanup(config, providerLeaseId) {
|
|
85
|
+
try {
|
|
86
|
+
return await connectSandbox(config, providerLeaseId);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error instanceof SandboxNotFoundError)
|
|
90
|
+
return null;
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function leaseMetadata(input) {
|
|
95
|
+
return {
|
|
96
|
+
provider: "e2b",
|
|
97
|
+
shellCommand: "bash",
|
|
98
|
+
template: input.config.template,
|
|
99
|
+
timeoutMs: input.config.timeoutMs,
|
|
100
|
+
reuseLease: input.config.reuseLease,
|
|
101
|
+
sandboxId: input.sandbox.sandboxId,
|
|
102
|
+
sandboxDomain: input.sandbox.sandboxDomain,
|
|
103
|
+
remoteCwd: input.remoteCwd,
|
|
104
|
+
resumedLease: input.resumedLease,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function shellQuote(value) {
|
|
108
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
109
|
+
}
|
|
110
|
+
function isValidShellEnvKey(value) {
|
|
111
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value);
|
|
112
|
+
}
|
|
113
|
+
// Source the user's login profiles before exec so commands run with the same
|
|
114
|
+
// PATH the user sees in an interactive shell. e2b's `sandbox.commands.run`
|
|
115
|
+
// otherwise spawns a non-login, non-interactive shell whose PATH does not
|
|
116
|
+
// include npm-globals or anything else the template installs via
|
|
117
|
+
// .profile/.bashrc — which makes the hello probe fail with
|
|
118
|
+
// `exec: <cli>: not found` even when the binary is on disk. The wrapper no
|
|
119
|
+
// longer sources `nvm.sh`; the sandbox image supplies `node` on the PATH.
|
|
120
|
+
function buildLoginShellScript(input) {
|
|
121
|
+
const env = input.env ?? {};
|
|
122
|
+
for (const key of Object.keys(env)) {
|
|
123
|
+
if (!isValidShellEnvKey(key)) {
|
|
124
|
+
throw new Error(`Invalid sandbox environment variable key: ${key}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const envArgs = Object.entries(env)
|
|
128
|
+
.filter((entry) => typeof entry[1] === "string")
|
|
129
|
+
.map(([key, value]) => `${key}=${shellQuote(value)}`);
|
|
130
|
+
const commandParts = [shellQuote(input.command), ...input.args.map(shellQuote)].join(" ");
|
|
131
|
+
const execLine = envArgs.length > 0
|
|
132
|
+
? `exec env ${envArgs.join(" ")} ${commandParts}`
|
|
133
|
+
: `exec ${commandParts}`;
|
|
134
|
+
return [
|
|
135
|
+
'if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1 || true; fi',
|
|
136
|
+
'if [ -f "$HOME/.profile" ]; then . "$HOME/.profile" >/dev/null 2>&1 || true; fi',
|
|
137
|
+
// .bash_profile typically sources .bashrc itself; only source .bashrc
|
|
138
|
+
// directly when no .bash_profile exists to avoid re-running idempotency-
|
|
139
|
+
// sensitive setup (nvm, PATH prepends) twice on templates that wire
|
|
140
|
+
// .bash_profile -> .bashrc.
|
|
141
|
+
'if [ -f "$HOME/.bash_profile" ]; then . "$HOME/.bash_profile" >/dev/null 2>&1 || true; elif [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" >/dev/null 2>&1 || true; fi',
|
|
142
|
+
'if [ -f "$HOME/.zprofile" ]; then . "$HOME/.zprofile" >/dev/null 2>&1 || true; fi',
|
|
143
|
+
execLine,
|
|
144
|
+
].join(" && ");
|
|
145
|
+
}
|
|
146
|
+
async function killSandboxBestEffort(sandbox, reason) {
|
|
147
|
+
await sandbox.kill().catch((error) => {
|
|
148
|
+
console.warn(`Failed to kill E2B sandbox during ${reason}: ${formatErrorMessage(error)}`);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
async function releaseSandboxBestEffort(sandbox, reuseLease) {
|
|
152
|
+
if (!reuseLease) {
|
|
153
|
+
await killSandboxBestEffort(sandbox, "lease release");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
await sandbox.pause();
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
console.warn(`Failed to pause E2B sandbox during lease release: ${formatErrorMessage(error)}. Attempting kill instead.`);
|
|
161
|
+
await killSandboxBestEffort(sandbox, "lease release fallback cleanup");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const plugin = definePlugin({
|
|
165
|
+
async setup(ctx) {
|
|
166
|
+
ctx.logger.info("E2B sandbox provider plugin ready");
|
|
167
|
+
},
|
|
168
|
+
async onHealth() {
|
|
169
|
+
return { status: "ok", message: "E2B sandbox provider plugin healthy" };
|
|
170
|
+
},
|
|
171
|
+
async onEnvironmentValidateConfig(params) {
|
|
172
|
+
const config = parseDriverConfig(params.config);
|
|
173
|
+
const errors = [];
|
|
174
|
+
if (typeof params.config.template === "string" && params.config.template.trim().length === 0) {
|
|
175
|
+
errors.push("E2B sandbox environments require a template.");
|
|
176
|
+
}
|
|
177
|
+
if (config.timeoutMs < 1 || config.timeoutMs > 86_400_000) {
|
|
178
|
+
errors.push("timeoutMs must be between 1 and 86400000.");
|
|
179
|
+
}
|
|
180
|
+
if (errors.length > 0) {
|
|
181
|
+
return { ok: false, errors };
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
ok: true,
|
|
185
|
+
normalizedConfig: { ...config },
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
async onEnvironmentProbe(params) {
|
|
189
|
+
const config = parseDriverConfig(params.config);
|
|
190
|
+
try {
|
|
191
|
+
const sandbox = await createSandbox(config);
|
|
192
|
+
try {
|
|
193
|
+
await sandbox.setTimeout(config.timeoutMs);
|
|
194
|
+
const remoteCwd = await resolveSandboxWorkingDirectory(sandbox);
|
|
195
|
+
return {
|
|
196
|
+
ok: true,
|
|
197
|
+
summary: `Connected to E2B sandbox template ${config.template}.`,
|
|
198
|
+
metadata: {
|
|
199
|
+
provider: "e2b",
|
|
200
|
+
template: config.template,
|
|
201
|
+
timeoutMs: config.timeoutMs,
|
|
202
|
+
reuseLease: config.reuseLease,
|
|
203
|
+
sandboxId: sandbox.sandboxId,
|
|
204
|
+
sandboxDomain: sandbox.sandboxDomain,
|
|
205
|
+
remoteCwd,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
await sandbox.kill().catch(() => undefined);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
215
|
+
return {
|
|
216
|
+
ok: false,
|
|
217
|
+
summary: `E2B sandbox probe failed for template ${config.template}.`,
|
|
218
|
+
metadata: {
|
|
219
|
+
provider: "e2b",
|
|
220
|
+
template: config.template,
|
|
221
|
+
timeoutMs: config.timeoutMs,
|
|
222
|
+
reuseLease: config.reuseLease,
|
|
223
|
+
error: message,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
async onEnvironmentAcquireLease(params) {
|
|
229
|
+
const config = parseDriverConfig(params.config);
|
|
230
|
+
const sandbox = await createSandbox(config);
|
|
231
|
+
try {
|
|
232
|
+
await sandbox.setTimeout(config.timeoutMs);
|
|
233
|
+
const remoteCwd = await resolveSandboxWorkingDirectory(sandbox);
|
|
234
|
+
return {
|
|
235
|
+
providerLeaseId: sandbox.sandboxId,
|
|
236
|
+
metadata: leaseMetadata({ config, sandbox, remoteCwd, resumedLease: false }),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
await sandbox.kill().catch(() => undefined);
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
async onEnvironmentResumeLease(params) {
|
|
245
|
+
const config = parseDriverConfig(params.config);
|
|
246
|
+
try {
|
|
247
|
+
const sandbox = await connectSandbox(config, params.providerLeaseId);
|
|
248
|
+
try {
|
|
249
|
+
await sandbox.setTimeout(config.timeoutMs);
|
|
250
|
+
const remoteCwd = await resolveSandboxWorkingDirectory(sandbox);
|
|
251
|
+
return {
|
|
252
|
+
providerLeaseId: sandbox.sandboxId,
|
|
253
|
+
metadata: leaseMetadata({ config, sandbox, remoteCwd, resumedLease: true }),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
await sandbox.kill().catch(() => undefined);
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (error instanceof SandboxNotFoundError) {
|
|
263
|
+
return { providerLeaseId: null, metadata: { expired: true } };
|
|
264
|
+
}
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
async onEnvironmentReleaseLease(params) {
|
|
269
|
+
if (!params.providerLeaseId)
|
|
270
|
+
return;
|
|
271
|
+
const config = parseDriverConfig(params.config);
|
|
272
|
+
const sandbox = await connectForCleanup(config, params.providerLeaseId);
|
|
273
|
+
if (!sandbox)
|
|
274
|
+
return;
|
|
275
|
+
await releaseSandboxBestEffort(sandbox, config.reuseLease);
|
|
276
|
+
},
|
|
277
|
+
async onEnvironmentDestroyLease(params) {
|
|
278
|
+
if (!params.providerLeaseId)
|
|
279
|
+
return;
|
|
280
|
+
const config = parseDriverConfig(params.config);
|
|
281
|
+
const sandbox = await connectForCleanup(config, params.providerLeaseId);
|
|
282
|
+
if (!sandbox)
|
|
283
|
+
return;
|
|
284
|
+
await killSandboxBestEffort(sandbox, "lease destroy");
|
|
285
|
+
},
|
|
286
|
+
async onEnvironmentRealizeWorkspace(params) {
|
|
287
|
+
const config = parseDriverConfig(params.config);
|
|
288
|
+
const remoteCwd = typeof params.lease.metadata?.remoteCwd === "string" &&
|
|
289
|
+
params.lease.metadata.remoteCwd.trim().length > 0
|
|
290
|
+
? params.lease.metadata.remoteCwd.trim()
|
|
291
|
+
: params.workspace.remotePath ?? params.workspace.localPath ?? "/paperclip-workspace";
|
|
292
|
+
if (params.lease.providerLeaseId) {
|
|
293
|
+
const sandbox = await connectSandbox(config, params.lease.providerLeaseId);
|
|
294
|
+
await ensureSandboxWorkspace(sandbox, remoteCwd);
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
cwd: remoteCwd,
|
|
298
|
+
metadata: {
|
|
299
|
+
provider: "e2b",
|
|
300
|
+
remoteCwd,
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
},
|
|
304
|
+
async onEnvironmentExecute(params) {
|
|
305
|
+
if (!params.lease.providerLeaseId) {
|
|
306
|
+
return {
|
|
307
|
+
exitCode: 1,
|
|
308
|
+
timedOut: false,
|
|
309
|
+
stdout: "",
|
|
310
|
+
stderr: "No provider lease ID available for execution.",
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
const config = parseDriverConfig(params.config);
|
|
314
|
+
const sandbox = await connectSandbox(config, params.lease.providerLeaseId);
|
|
315
|
+
// Refresh the sandbox death clock on every command. E2B's `timeoutMs` is
|
|
316
|
+
// the absolute sandbox lifetime from create/connect; without this, a run
|
|
317
|
+
// longer than `config.timeoutMs` will have its sandbox killed mid-command
|
|
318
|
+
// and the next call throws "Sandbox is probably not running anymore".
|
|
319
|
+
// The refresh is best-effort: the sandbox is already healthy at this
|
|
320
|
+
// point, so a transient API error on setTimeout should not block the
|
|
321
|
+
// command from running. Worst case the existing lifetime stands.
|
|
322
|
+
try {
|
|
323
|
+
await sandbox.setTimeout(config.timeoutMs);
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
// ignore — keep going with the existing sandbox lifetime
|
|
327
|
+
}
|
|
328
|
+
const baseCommand = buildLoginShellScript({
|
|
329
|
+
command: params.command,
|
|
330
|
+
args: params.args ?? [],
|
|
331
|
+
env: params.env,
|
|
332
|
+
});
|
|
333
|
+
const timeoutMs = params.timeoutMs ?? config.timeoutMs;
|
|
334
|
+
// For commands with stdin, stage the payload to a temp file inside the
|
|
335
|
+
// sandbox and shell-redirect it. Streaming stdin via `sendStdin` raced
|
|
336
|
+
// with fast-failing commands (the process exits before the RPC lands),
|
|
337
|
+
// and the previous code awaited a foreground `run` before sending stdin
|
|
338
|
+
// at all, so the data was never delivered. The staged-file approach
|
|
339
|
+
// keeps execution synchronous, avoids the race, and is unaffected by
|
|
340
|
+
// whether the command exits in microseconds or minutes.
|
|
341
|
+
let stagedStdinPath = null;
|
|
342
|
+
if (params.stdin != null) {
|
|
343
|
+
stagedStdinPath = `/tmp/paperclip-stdin-${randomUUID()}`;
|
|
344
|
+
try {
|
|
345
|
+
await sandbox.files.write(stagedStdinPath, params.stdin);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
// Best-effort cleanup in case the write partially succeeded; ignore
|
|
349
|
+
// remove failures so the original error is what propagates.
|
|
350
|
+
await sandbox.files.remove(stagedStdinPath).catch(() => undefined);
|
|
351
|
+
throw error;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const command = stagedStdinPath
|
|
355
|
+
? `${baseCommand} < ${shellQuote(stagedStdinPath)}`
|
|
356
|
+
: baseCommand;
|
|
357
|
+
try {
|
|
358
|
+
// Env is interpolated into the script via `exec env KEY=val …` after
|
|
359
|
+
// profile sourcing so user-configured env wins over anything profiles
|
|
360
|
+
// export. No need to pass `envs:` separately.
|
|
361
|
+
const result = await sandbox.commands.run(command, {
|
|
362
|
+
cwd: params.cwd,
|
|
363
|
+
timeoutMs,
|
|
364
|
+
});
|
|
365
|
+
return {
|
|
366
|
+
exitCode: result.exitCode,
|
|
367
|
+
timedOut: false,
|
|
368
|
+
stdout: result.stdout,
|
|
369
|
+
stderr: result.stderr,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
if (error instanceof CommandExitError) {
|
|
374
|
+
return {
|
|
375
|
+
exitCode: error.exitCode,
|
|
376
|
+
timedOut: false,
|
|
377
|
+
stdout: error.stdout,
|
|
378
|
+
stderr: error.stderr,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
if (error instanceof TimeoutError) {
|
|
382
|
+
return buildTimeoutExecuteResult(error);
|
|
383
|
+
}
|
|
384
|
+
throw error;
|
|
385
|
+
}
|
|
386
|
+
finally {
|
|
387
|
+
if (stagedStdinPath) {
|
|
388
|
+
await sandbox.files.remove(stagedStdinPath).catch(() => undefined);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
export default plugin;
|
|
394
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,oBAAoB,EACpB,YAAY,GACb,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAwBpE,SAAS,iBAAiB,CAAC,GAA4B;IACrD,MAAM,QAAQ,GAAG,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACjF,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;QACrB,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;IACrD,OAAO;QACL,QAAQ;QACR,MAAM,EAAE,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;QACjG,SAAS,EAAE,MAAM,CAAC,Q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CAAC,MAAM;iBACrB,CAAC;YACJ,CAAC;YACD,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;gBAClC,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,IAAI,eAAe,EAAE,CAAC;gBACpB,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,eAAe,MAAM,CAAC"}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,eAAe,MAAM,CAAC;AACtB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tickernelz/paperclip-pro-plugin-e2b",
|
|
3
|
+
"version": "2026.925.0",
|
|
4
|
+
"description": "E2B sandbox provider plugin for Paperclip environments",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/tickernelz/paperclip-pro",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/tickernelz/paperclip-pro/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/tickernelz/paperclip-pro",
|
|
13
|
+
"directory": "packages/plugins/sandbox-providers/e2b"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"paperclipPlugin": {
|
|
31
|
+
"manifest": "./dist/manifest.js",
|
|
32
|
+
"worker": "./dist/worker.js"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"paperclip",
|
|
36
|
+
"plugin",
|
|
37
|
+
"sandbox",
|
|
38
|
+
"e2b"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"e2b": "^2.19.0",
|
|
42
|
+
"@tickernelz/paperclip-pro-plugin-sdk": "2026.925.0"
|
|
43
|
+
}
|
|
44
|
+
}
|