@deepseek-ai/dsh-e2b 0.1.2-rc.1 → 0.1.3-alpha.2

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/lib/index.js CHANGED
@@ -3,6 +3,32 @@ import { posix } from "node:path";
3
3
  import { Service } from "@deepseek-ai/cordis";
4
4
  import z from "@deepseek-ai/schemastery";
5
5
  import { CommandExitError, FileNotFoundError, FileType, FileType as FileType$1, Sandbox, Sandbox as Sandbox$1, SandboxNotFoundError, SandboxNotFoundError as SandboxNotFoundError$1 } from "e2b";
6
+ import { proxyRouteFor } from "@deepseek-ai/dsh-http-proxy";
7
+ //#region lib/types/api-url.js
8
+ /**
9
+ * The E2B control-plane URL, derived the way the SDK derives it.
10
+ * @module @deepseek-ai/dsh-e2b/src/api-url.ts
11
+ */
12
+ /** The SDK's own default control-plane domain; `E2B_DOMAIN` overrides it there and here alike. */
13
+ const E2B_DEFAULT_DOMAIN = "e2b.app";
14
+ /** The debug control plane the SDK substitutes, on loopback and plain HTTP. */
15
+ const E2B_DEBUG_API_URL = "http://localhost:3000";
16
+ /**
17
+ * The control-plane URL the SDK will actually call, derived the way the SDK derives it: an explicit
18
+ * `E2B_API_URL` first, then the debug substitute, then the domain default. Choosing a proxy for
19
+ * anything else would pick the wrong scheme's proxy, ignore a bypass entry naming the real host, and
20
+ * — for the loopback debug plane — hand a proxy the control-plane traffic and its API key.
21
+ *
22
+ * @param env - the process environment to read; overridable so tests need no ambient state.
23
+ * @returns the absolute control-plane URL.
24
+ */
25
+ function e2bApiUrl(env = process.env) {
26
+ const explicit = env.E2B_API_URL;
27
+ if (explicit !== void 0 && explicit !== "") return explicit;
28
+ if ((env.E2B_DEBUG ?? "false").toLowerCase() === "true") return E2B_DEBUG_API_URL;
29
+ return `https://api.${env.E2B_DOMAIN ?? E2B_DEFAULT_DOMAIN}`;
30
+ }
31
+ //#endregion
6
32
  //#region lib/types/index.js
7
33
  /**
8
34
  * Shared ownership of one E2B sandbox. Capability adapters await the same SDK
@@ -92,11 +118,13 @@ var E2BRuntime = class extends Service {
92
118
  if (!Number.isFinite(this.config.timeoutMs) || this.config.timeoutMs <= 0) throw new Error("dsh-e2b: timeoutMs must be a positive finite number");
93
119
  }
94
120
  async open() {
121
+ const route = proxyRouteFor(new URL(e2bApiUrl()));
95
122
  const sandbox = await Sandbox$1.create({
96
123
  apiKey: this.config.apiKey,
97
124
  timeoutMs: this.config.timeoutMs,
98
125
  secure: true,
99
- lifecycle: { onTimeout: "kill" }
126
+ lifecycle: { onTimeout: "kill" },
127
+ ...route.proxied ? { proxy: route.proxy } : {}
100
128
  });
101
129
  try {
102
130
  await sandbox.files.makeDir(this.cwd);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The E2B control-plane URL, derived the way the SDK derives it.
3
+ * @module @deepseek-ai/dsh-e2b/src/api-url.ts
4
+ */
5
+ /**
6
+ * The control-plane URL the SDK will actually call, derived the way the SDK derives it: an explicit
7
+ * `E2B_API_URL` first, then the debug substitute, then the domain default. Choosing a proxy for
8
+ * anything else would pick the wrong scheme's proxy, ignore a bypass entry naming the real host, and
9
+ * — for the loopback debug plane — hand a proxy the control-plane traffic and its API key.
10
+ *
11
+ * @param env - the process environment to read; overridable so tests need no ambient state.
12
+ * @returns the absolute control-plane URL.
13
+ */
14
+ export declare function e2bApiUrl(env?: NodeJS.ProcessEnv): string;
15
+ //# sourceMappingURL=api-url.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-e2b",
3
3
  "description": "Shared E2B sandbox lifecycle for DeepSeek Harness provider adapters",
4
- "version": "0.1.2-rc.1",
4
+ "version": "0.1.3-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,6 +27,7 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
+ "@deepseek-ai/dsh-http-proxy": "^0.1.3-alpha.2",
30
31
  "@deepseek-ai/cordis": "^4.0.2"
31
32
  },
32
33
  "dependencies": {
@@ -34,19 +35,21 @@
34
35
  "@deepseek-ai/schemastery": "^3.18.2"
35
36
  },
36
37
  "devDependencies": {
37
- "@deepseek-ai/dsh-agent": "^0.1.2-rc.1",
38
- "@deepseek-ai/dsh-app-boot": "^0.1.2-rc.1",
39
38
  "@deepseek-ai/cordis": "^4.0.2",
40
- "@deepseek-ai/dsh-bash-local": "^0.1.2-rc.1",
41
- "@deepseek-ai/dsh-fs-e2b": "^0.1.2-rc.1",
42
- "@deepseek-ai/dsh-loader-smoke": "^0.1.2-rc.1",
43
- "@deepseek-ai/dsh-lsp": "^0.1.2-rc.1",
44
- "@deepseek-ai/dsh-lsp-stdio": "^0.1.2-rc.1",
45
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.2-rc.1",
46
- "@deepseek-ai/dsh-session": "^0.1.2-rc.1",
47
- "@deepseek-ai/dsh-session-projection": "^0.1.2-rc.1",
48
- "@deepseek-ai/dsh-subprocess-e2b": "^0.1.2-rc.1",
49
- "@deepseek-ai/dsh-terminal": "^0.1.2-rc.1",
50
- "@deepseek-ai/dsh-terminal-bash": "^0.1.2-rc.1"
39
+ "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
40
+ "@deepseek-ai/dsh-app-boot": "^0.1.3-alpha.2",
41
+ "@deepseek-ai/dsh-bash-local": "^0.1.3-alpha.2",
42
+ "@deepseek-ai/dsh-fs-e2b": "^0.1.3-alpha.2",
43
+ "@deepseek-ai/dsh-lsp-stdio": "^0.1.3-alpha.2",
44
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
45
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
46
+ "@deepseek-ai/dsh-session-projection": "^0.1.3-alpha.2",
47
+ "@deepseek-ai/dsh-terminal": "^0.1.3-alpha.2",
48
+ "@deepseek-ai/dsh-subprocess-e2b": "^0.1.3-alpha.2",
49
+ "@deepseek-ai/dsh-terminal-bash": "^0.1.3-alpha.2",
50
+ "@deepseek-ai/dsh-launch-environment": "^0.1.3-alpha.2",
51
+ "@deepseek-ai/dsh-http-proxy": "^0.1.3-alpha.2",
52
+ "@deepseek-ai/dsh-lsp": "^0.1.3-alpha.2",
53
+ "@deepseek-ai/dsh-loader-smoke": "^0.1.3-alpha.2"
51
54
  }
52
55
  }