@claxedo/sandbox-manager 0.7.0 → 0.10.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.
Files changed (70) hide show
  1. package/README.md +245 -42
  2. package/dist/checkpoint-manager.d.ts +29 -4
  3. package/dist/checkpoint-manager.mjs +133 -24
  4. package/dist/command.d.ts +9 -2
  5. package/dist/command.mjs +8 -8
  6. package/dist/contract.d.ts +687 -0
  7. package/dist/driver-billing.d.ts +29 -0
  8. package/dist/driver-catalog.d.ts +43 -58
  9. package/dist/driver-catalog.mjs +192 -229
  10. package/dist/drivers/boat-client.d.ts +95 -0
  11. package/dist/drivers/boat-named-snapshots.d.ts +31 -0
  12. package/dist/drivers/boat-template.d.ts +49 -0
  13. package/dist/drivers/boat-template.mjs +1196 -0
  14. package/dist/drivers/boat.d.ts +64 -0
  15. package/dist/drivers/boat.mjs +990 -0
  16. package/dist/drivers/cloudflare.d.ts +5 -8
  17. package/dist/drivers/cloudflare.mjs +364 -213
  18. package/dist/drivers/docker.d.ts +4 -3
  19. package/dist/drivers/docker.mjs +244 -165
  20. package/dist/drivers/local-brokering.d.ts +14 -0
  21. package/dist/drivers/local-brokering.mjs +1029 -0
  22. package/dist/drivers/modal.d.ts +4 -7
  23. package/dist/drivers/modal.mjs +220 -155
  24. package/dist/drivers/transient-error.d.ts +13 -0
  25. package/dist/drivers/vercel.d.ts +21 -23
  26. package/dist/drivers/vercel.mjs +279 -169
  27. package/dist/egress-policy.d.ts +134 -0
  28. package/dist/egress-warnings.d.ts +22 -0
  29. package/dist/garbage-collect.d.ts +14 -0
  30. package/dist/hosted-network-policy.d.ts +11 -4
  31. package/dist/hosted-network-policy.mjs +221 -4
  32. package/dist/image-name.d.ts +12 -2
  33. package/dist/image-name.mjs +43 -0
  34. package/dist/image.d.ts +1 -20
  35. package/dist/image.mjs +11 -66
  36. package/dist/index.d.ts +8 -533
  37. package/dist/index.mjs +1420 -315
  38. package/dist/json.d.ts +13 -0
  39. package/dist/lease-failure.d.ts +173 -0
  40. package/dist/lease-lifecycle.d.ts +65 -0
  41. package/dist/lease-retry-wait.d.ts +8 -0
  42. package/dist/lease-start.d.ts +21 -0
  43. package/dist/lease-types.d.ts +15 -5
  44. package/dist/manager.d.ts +2 -0
  45. package/dist/runtime-env.d.ts +15 -2
  46. package/dist/runtime-env.mjs +50 -1
  47. package/dist/runtime-snapshot.d.ts +49 -0
  48. package/dist/runtime-version.d.ts +9 -0
  49. package/dist/runtime-version.mjs +2 -0
  50. package/dist/service-url-exposure.d.ts +1 -3
  51. package/dist/service-url-exposure.mjs +1 -26
  52. package/dist/start-fresh.d.ts +17 -0
  53. package/dist/start-telemetry.d.ts +37 -0
  54. package/dist/stores/memory.d.ts +1 -1
  55. package/dist/stores/memory.mjs +65 -54
  56. package/package.json +67 -81
  57. package/dist/daytona-allow-list.d.ts +0 -16
  58. package/dist/daytona-allow-list.mjs +0 -11
  59. package/dist/drivers/box.d.ts +0 -52
  60. package/dist/drivers/box.mjs +0 -499
  61. package/dist/drivers/cloudflare-egress.d.ts +0 -40
  62. package/dist/drivers/cloudflare-egress.mjs +0 -113
  63. package/dist/drivers/daytona.d.ts +0 -127
  64. package/dist/drivers/daytona.mjs +0 -541
  65. package/dist/drivers/exe.d.ts +0 -26
  66. package/dist/drivers/exe.mjs +0 -469
  67. package/dist/drivers/fetch-bridge.d.ts +0 -10
  68. package/dist/drivers/fetch-bridge.mjs +0 -111
  69. package/dist/lease-policy.d.ts +0 -48
  70. package/dist/lease-policy.mjs +0 -280
@@ -1,47 +1,50 @@
1
- // src/hosted-network-policy.ts
2
- var SANDBOX_MODEL_PROVIDER_HOSTS = [
3
- "api.anthropic.com",
4
- "api.openai.com",
5
- "generativelanguage.googleapis.com",
6
- "openrouter.ai",
7
- // Model catalog + engine config, fetched on runner startup.
8
- "models.dev",
9
- "opencode.ai"
10
- ];
11
- var SANDBOX_PACKAGE_REGISTRY_HOSTS = [
12
- "registry.npmjs.org",
13
- "nodejs.org",
14
- "pypi.org",
15
- "files.pythonhosted.org",
16
- "crates.io",
17
- "static.crates.io",
18
- "index.crates.io",
19
- "proxy.golang.org",
20
- "sum.golang.org"
21
- ];
22
- var SANDBOX_BASELINE_EGRESS_HOSTS = [
23
- ...SANDBOX_MODEL_PROVIDER_HOSTS,
24
- ...SANDBOX_PACKAGE_REGISTRY_HOSTS
25
- ];
26
-
27
- // src/index.ts
1
+ // src/contract.ts
2
+ function sandboxLeaseHeldHost(lease) {
3
+ return lease?.sandboxId !== void 0 && (lease.status === "stopped" || lease.status === "unavailable") ? lease : void 0;
4
+ }
28
5
  function applySandboxLeasePatch(current, patch, updatedAt) {
29
6
  return {
30
7
  ...current,
31
8
  ...patch.status === void 0 ? {} : { status: patch.status },
32
- ...patch.sandboxId === void 0 ? {} : { sandboxId: patch.sandboxId },
33
- ...patch.url === void 0 ? {} : { url: patch.url },
34
- ...patch.hostId === void 0 ? {} : { hostId: patch.hostId },
35
- ...patch.driverResourceId === void 0 ? {} : { driverResourceId: patch.driverResourceId },
36
9
  ...patch.retryCount === void 0 ? {} : { retryCount: patch.retryCount },
37
10
  ...patch.lastHeartbeatAt === void 0 ? {} : { lastHeartbeatAt: patch.lastHeartbeatAt },
38
11
  ...patch.lastActivityAt === void 0 ? {} : { lastActivityAt: patch.lastActivityAt },
39
- ...patch.labels === void 0 ? {} : { labels: patch.labels },
12
+ ...patch.lastHealthFailureAt === void 0 ? {} : { lastHealthFailureAt: patch.lastHealthFailureAt },
40
13
  ...patch.nextRetryAt === void 0 ? {} : { nextRetryAt: patch.nextRetryAt ?? void 0 },
41
14
  ...patch.lastError === void 0 ? {} : { lastError: patch.lastError ?? void 0 },
42
15
  ...patch.checkpoint === void 0 ? {} : { checkpoint: patch.checkpoint ?? void 0 },
43
- ...patch.persistence === void 0 ? {} : { persistence: patch.persistence ?? void 0 },
44
16
  ...patch.restore === void 0 ? {} : { restore: patch.restore ?? void 0 },
17
+ ...patch.start === void 0 ? {} : { start: patch.start },
18
+ updatedAt
19
+ };
20
+ }
21
+ function applySandboxLeaseFailure(current, error, nextRetryAt, failedAt) {
22
+ return {
23
+ ...current,
24
+ status: "unavailable",
25
+ retryCount: current.retryCount + 1,
26
+ lastError: error,
27
+ nextRetryAt,
28
+ lastHealthFailureAt: failedAt,
29
+ updatedAt: failedAt,
30
+ ...current.start ? { start: { ...current.start, failures: [...current.start.failures ?? [], { epoch: current.epoch, failedAt, error }] } } : {}
31
+ };
32
+ }
33
+ function applySandboxProvisionedTarget(current, target, updatedAt) {
34
+ const sameTarget = current.status === "ready" && current.url === target.url && current.sandboxId === target.sandboxId && current.hostId === target.hostId && current.driverResourceId === target.driverResourceId;
35
+ return {
36
+ ...current,
37
+ status: target.url === void 0 ? "acquiring" : "ready",
38
+ routingId: sameTarget && current.routingId ? current.routingId : crypto.randomUUID(),
39
+ sandboxId: target.sandboxId,
40
+ url: target.url,
41
+ hostId: target.hostId,
42
+ driverResourceId: target.driverResourceId,
43
+ labels: target.labels,
44
+ ...target.persistence === void 0 ? {} : { persistence: target.persistence },
45
+ retryCount: 0,
46
+ nextRetryAt: void 0,
47
+ lastError: void 0,
45
48
  updatedAt
46
49
  };
47
50
  }
@@ -63,7 +66,7 @@ function createMemoryLeaseStore(seed = []) {
63
66
  retryAfterMs: Math.max(0, input.staleAfterMs - (now - current.updatedAt))
64
67
  };
65
68
  }
66
- const resumable = current?.status === "stopped";
69
+ const held = sandboxLeaseHeldHost(current);
67
70
  const next = {
68
71
  workspaceId,
69
72
  homeRegion: current?.homeRegion ?? input.homeRegion,
@@ -73,38 +76,43 @@ function createMemoryLeaseStore(seed = []) {
73
76
  retryCount: current?.retryCount ?? 0,
74
77
  createdAt: current?.createdAt ?? now,
75
78
  updatedAt: now,
76
- sandboxId: resumable ? current.sandboxId : void 0,
77
- url: resumable ? current.url : void 0,
78
- hostId: resumable ? current.hostId : void 0,
79
- driverResourceId: resumable ? current.driverResourceId : void 0,
80
- lastHeartbeatAt: resumable ? current.lastHeartbeatAt : void 0,
81
- lastActivityAt: resumable ? current.lastActivityAt : void 0,
82
- labels: resumable ? current.labels : void 0,
79
+ sandboxId: held?.sandboxId,
80
+ url: held?.url,
81
+ hostId: held?.hostId,
82
+ driverResourceId: held?.driverResourceId,
83
+ lastHeartbeatAt: held?.lastHeartbeatAt,
84
+ lastActivityAt: held?.lastActivityAt,
85
+ labels: held ? held.labels : input.labels,
86
+ machineClass: input.machineClass ?? held?.machineClass,
83
87
  checkpoint: current?.checkpoint,
84
88
  persistence: current?.persistence,
85
- restore: current?.restore
89
+ restore: current?.restore,
90
+ start: input.start
86
91
  };
87
92
  leases.set(workspaceId, next);
88
93
  return { acquired: true, lease: next };
89
94
  },
90
- async update(workspaceId, expectedEpoch, patch) {
95
+ async recordTarget(workspaceId, expectedEpoch, target) {
96
+ const current = leases.get(workspaceId);
97
+ if (!current || current.epoch !== expectedEpoch) return void 0;
98
+ if (current.status === "stopped" || current.status === "destroyed") return void 0;
99
+ const next = applySandboxProvisionedTarget(current, target, Date.now());
100
+ leases.set(workspaceId, next);
101
+ return next;
102
+ },
103
+ async update(workspaceId, expectedEpoch, patch, expectedStatus) {
91
104
  const current = leases.get(workspaceId);
92
- if (!current || current.epoch !== expectedEpoch) return;
105
+ if (!current || current.epoch !== expectedEpoch) return void 0;
106
+ if (expectedStatus !== void 0 && current.status !== expectedStatus) return void 0;
93
107
  const next = applySandboxLeasePatch(current, patch, Date.now());
94
108
  leases.set(workspaceId, next);
95
109
  return next;
96
110
  },
97
111
  async recordFailure(workspaceId, expectedEpoch, error, nextRetryAt) {
98
112
  const current = leases.get(workspaceId);
99
- if (!current || current.epoch !== expectedEpoch) return;
100
- const next = {
101
- ...current,
102
- status: "unavailable",
103
- retryCount: current.retryCount + 1,
104
- lastError: error,
105
- nextRetryAt,
106
- updatedAt: Date.now()
107
- };
113
+ if (!current || current.epoch !== expectedEpoch) return void 0;
114
+ if (current.status === "stopped" || current.status === "destroyed") return void 0;
115
+ const next = applySandboxLeaseFailure(current, error, nextRetryAt, Date.now());
108
116
  leases.set(workspaceId, next);
109
117
  return next;
110
118
  },
@@ -126,6 +134,7 @@ function sandboxLease(input) {
126
134
  homeRegion: input.homeRegion ?? "us-east",
127
135
  driver: input.driver ?? "test",
128
136
  epoch: input.epoch ?? 1,
137
+ routingId: input.routingId,
129
138
  status: input.status ?? "ready",
130
139
  retryCount: input.retryCount ?? 0,
131
140
  createdAt: input.createdAt ?? Date.now(),
@@ -141,7 +150,9 @@ function sandboxLease(input) {
141
150
  labels: input.labels,
142
151
  checkpoint: input.checkpoint,
143
152
  persistence: input.persistence,
144
- restore: input.restore
153
+ restore: input.restore,
154
+ start: input.start,
155
+ machineClass: input.machineClass
145
156
  };
146
157
  }
147
158
  export {
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
- "name": "@claxedo/sandbox-manager",
3
- "version": "0.7.0",
4
2
  "type": "module",
5
- "description": "Sandbox lifecycle manager with epoch-based leases and pluggable drivers for Daytona, Modal, Vercel Sandbox, Cloudflare, Box, and Docker",
3
+ "description": "Sandbox lifecycle manager with epoch-based leases and pluggable drivers for Modal, Vercel Sandbox, Cloudflare, Boat, and Docker",
6
4
  "license": "MIT",
7
5
  "repository": {
8
6
  "type": "git",
@@ -12,163 +10,148 @@
12
10
  "keywords": [
13
11
  "claxedo",
14
12
  "sandbox",
15
- "daytona",
16
13
  "modal",
17
14
  "vercel",
18
15
  "cloudflare",
19
16
  "docker",
20
- "box",
17
+ "boat",
21
18
  "agents"
22
19
  ],
23
20
  "main": "./dist/index.mjs",
24
21
  "types": "./dist/index.d.ts",
25
22
  "exports": {
26
23
  ".": {
24
+ "development": "./src/index.ts",
25
+ "bun": "./src/index.ts",
27
26
  "types": "./dist/index.d.ts",
28
- "bun": "./dist/index.mjs",
29
- "development": "./dist/index.mjs",
30
27
  "import": "./dist/index.mjs",
31
28
  "default": "./dist/index.mjs"
32
29
  },
33
30
  "./command": {
31
+ "development": "./src/command.ts",
32
+ "bun": "./src/command.ts",
34
33
  "types": "./dist/command.d.ts",
35
- "bun": "./dist/command.mjs",
36
- "development": "./dist/command.mjs",
37
34
  "import": "./dist/command.mjs",
38
35
  "default": "./dist/command.mjs"
39
36
  },
40
37
  "./constants": {
38
+ "development": "./src/constants.ts",
39
+ "bun": "./src/constants.ts",
41
40
  "types": "./dist/constants.d.ts",
42
- "bun": "./dist/constants.mjs",
43
- "development": "./dist/constants.mjs",
44
41
  "import": "./dist/constants.mjs",
45
42
  "default": "./dist/constants.mjs"
46
43
  },
47
44
  "./checkpoint-manager": {
45
+ "development": "./src/checkpoint-manager.ts",
46
+ "bun": "./src/checkpoint-manager.ts",
48
47
  "types": "./dist/checkpoint-manager.d.ts",
49
- "bun": "./dist/checkpoint-manager.mjs",
50
- "development": "./dist/checkpoint-manager.mjs",
51
48
  "import": "./dist/checkpoint-manager.mjs",
52
49
  "default": "./dist/checkpoint-manager.mjs"
53
50
  },
54
51
  "./defaults": {
52
+ "development": "./src/defaults.ts",
53
+ "bun": "./src/defaults.ts",
55
54
  "types": "./dist/defaults.d.ts",
56
- "bun": "./dist/defaults.mjs",
57
- "development": "./dist/defaults.mjs",
58
55
  "import": "./dist/defaults.mjs",
59
56
  "default": "./dist/defaults.mjs"
60
57
  },
61
58
  "./driver-catalog": {
59
+ "development": "./src/driver-catalog.ts",
60
+ "bun": "./src/driver-catalog.ts",
62
61
  "types": "./dist/driver-catalog.d.ts",
63
- "bun": "./dist/driver-catalog.mjs",
64
- "development": "./dist/driver-catalog.mjs",
65
62
  "import": "./dist/driver-catalog.mjs",
66
63
  "default": "./dist/driver-catalog.mjs"
67
64
  },
68
- "./drivers/box": {
69
- "types": "./dist/drivers/box.d.ts",
70
- "bun": "./dist/drivers/box.mjs",
71
- "development": "./dist/drivers/box.mjs",
72
- "import": "./dist/drivers/box.mjs",
73
- "default": "./dist/drivers/box.mjs"
65
+ "./drivers/boat": {
66
+ "development": "./src/drivers/boat.ts",
67
+ "bun": "./src/drivers/boat.ts",
68
+ "types": "./dist/drivers/boat.d.ts",
69
+ "import": "./dist/drivers/boat.mjs",
70
+ "default": "./dist/drivers/boat.mjs"
74
71
  },
75
- "./drivers/exe": {
76
- "types": "./dist/drivers/exe.d.ts",
77
- "bun": "./dist/drivers/exe.mjs",
78
- "development": "./dist/drivers/exe.mjs",
79
- "import": "./dist/drivers/exe.mjs",
80
- "default": "./dist/drivers/exe.mjs"
72
+ "./drivers/boat-template": {
73
+ "development": "./src/drivers/boat-template.ts",
74
+ "bun": "./src/drivers/boat-template.ts",
75
+ "types": "./dist/drivers/boat-template.d.ts",
76
+ "import": "./dist/drivers/boat-template.mjs",
77
+ "default": "./dist/drivers/boat-template.mjs"
81
78
  },
82
79
  "./drivers/cloudflare": {
80
+ "development": "./src/drivers/cloudflare.ts",
81
+ "bun": "./src/drivers/cloudflare.ts",
83
82
  "types": "./dist/drivers/cloudflare.d.ts",
84
- "bun": "./dist/drivers/cloudflare.mjs",
85
- "development": "./dist/drivers/cloudflare.mjs",
86
83
  "import": "./dist/drivers/cloudflare.mjs",
87
84
  "default": "./dist/drivers/cloudflare.mjs"
88
85
  },
89
- "./drivers/daytona": {
90
- "types": "./dist/drivers/daytona.d.ts",
91
- "bun": "./dist/drivers/daytona.mjs",
92
- "development": "./dist/drivers/daytona.mjs",
93
- "import": "./dist/drivers/daytona.mjs",
94
- "default": "./dist/drivers/daytona.mjs"
95
- },
96
86
  "./drivers/docker": {
87
+ "development": "./src/drivers/docker.ts",
88
+ "bun": "./src/drivers/docker.ts",
97
89
  "types": "./dist/drivers/docker.d.ts",
98
- "bun": "./dist/drivers/docker.mjs",
99
- "development": "./dist/drivers/docker.mjs",
100
90
  "import": "./dist/drivers/docker.mjs",
101
91
  "default": "./dist/drivers/docker.mjs"
102
92
  },
103
- "./drivers/fetch-bridge": {
104
- "types": "./dist/drivers/fetch-bridge.d.ts",
105
- "bun": "./dist/drivers/fetch-bridge.mjs",
106
- "development": "./dist/drivers/fetch-bridge.mjs",
107
- "import": "./dist/drivers/fetch-bridge.mjs",
108
- "default": "./dist/drivers/fetch-bridge.mjs"
93
+ "./drivers/local-brokering": {
94
+ "development": "./src/drivers/local-brokering.ts",
95
+ "bun": "./src/drivers/local-brokering.ts",
96
+ "types": "./dist/drivers/local-brokering.d.ts",
97
+ "import": "./dist/drivers/local-brokering.mjs",
98
+ "default": "./dist/drivers/local-brokering.mjs"
109
99
  },
110
100
  "./drivers/modal": {
101
+ "development": "./src/drivers/modal.ts",
102
+ "bun": "./src/drivers/modal.ts",
111
103
  "types": "./dist/drivers/modal.d.ts",
112
- "bun": "./dist/drivers/modal.mjs",
113
- "development": "./dist/drivers/modal.mjs",
114
104
  "import": "./dist/drivers/modal.mjs",
115
105
  "default": "./dist/drivers/modal.mjs"
116
106
  },
117
107
  "./drivers/vercel": {
108
+ "development": "./src/drivers/vercel.ts",
109
+ "bun": "./src/drivers/vercel.ts",
118
110
  "types": "./dist/drivers/vercel.d.ts",
119
- "bun": "./dist/drivers/vercel.mjs",
120
- "development": "./dist/drivers/vercel.mjs",
121
111
  "import": "./dist/drivers/vercel.mjs",
122
112
  "default": "./dist/drivers/vercel.mjs"
123
113
  },
124
114
  "./image": {
115
+ "development": "./src/image.ts",
116
+ "bun": "./src/image.ts",
125
117
  "types": "./dist/image.d.ts",
126
- "bun": "./dist/image.mjs",
127
- "development": "./dist/image.mjs",
128
118
  "import": "./dist/image.mjs",
129
119
  "default": "./dist/image.mjs"
130
120
  },
131
- "./lease-policy": {
132
- "types": "./dist/lease-policy.d.ts",
133
- "bun": "./dist/lease-policy.mjs",
134
- "development": "./dist/lease-policy.mjs",
135
- "import": "./dist/lease-policy.mjs",
136
- "default": "./dist/lease-policy.mjs"
121
+ "./image-name": {
122
+ "development": "./src/image-name.ts",
123
+ "bun": "./src/image-name.ts",
124
+ "types": "./dist/image-name.d.ts",
125
+ "import": "./dist/image-name.mjs",
126
+ "default": "./dist/image-name.mjs"
137
127
  },
138
128
  "./lease-types": {
129
+ "development": "./src/lease-types.ts",
130
+ "bun": "./src/lease-types.ts",
139
131
  "types": "./dist/lease-types.d.ts",
140
- "bun": "./dist/lease-types.mjs",
141
- "development": "./dist/lease-types.mjs",
142
132
  "import": "./dist/lease-types.mjs",
143
133
  "default": "./dist/lease-types.mjs"
144
134
  },
145
135
  "./runtime-env": {
136
+ "development": "./src/runtime-env.ts",
137
+ "bun": "./src/runtime-env.ts",
146
138
  "types": "./dist/runtime-env.d.ts",
147
- "bun": "./dist/runtime-env.mjs",
148
- "development": "./dist/runtime-env.mjs",
149
139
  "import": "./dist/runtime-env.mjs",
150
140
  "default": "./dist/runtime-env.mjs"
151
141
  },
152
142
  "./service-url-exposure": {
143
+ "development": "./src/service-url-exposure.ts",
144
+ "bun": "./src/service-url-exposure.ts",
153
145
  "types": "./dist/service-url-exposure.d.ts",
154
- "bun": "./dist/service-url-exposure.mjs",
155
- "development": "./dist/service-url-exposure.mjs",
156
146
  "import": "./dist/service-url-exposure.mjs",
157
147
  "default": "./dist/service-url-exposure.mjs"
158
148
  },
159
149
  "./stores/memory": {
150
+ "development": "./src/stores/memory.ts",
151
+ "bun": "./src/stores/memory.ts",
160
152
  "types": "./dist/stores/memory.d.ts",
161
- "bun": "./dist/stores/memory.mjs",
162
- "development": "./dist/stores/memory.mjs",
163
153
  "import": "./dist/stores/memory.mjs",
164
154
  "default": "./dist/stores/memory.mjs"
165
- },
166
- "./drivers/cloudflare-egress": {
167
- "types": "./dist/drivers/cloudflare-egress.d.ts",
168
- "bun": "./dist/drivers/cloudflare-egress.mjs",
169
- "development": "./dist/drivers/cloudflare-egress.mjs",
170
- "import": "./dist/drivers/cloudflare-egress.mjs",
171
- "default": "./dist/drivers/cloudflare-egress.mjs"
172
155
  }
173
156
  },
174
157
  "files": [
@@ -179,23 +162,26 @@
179
162
  "publishConfig": {
180
163
  "access": "public"
181
164
  },
182
- "dependencies": {
183
- "@daytona/sdk": "0.192.0",
184
- "@vercel/sandbox": "1.10.2",
185
- "modal": "0.7.5"
186
- },
165
+ "name": "@claxedo/sandbox-manager",
166
+ "version": "0.10.0",
187
167
  "scripts": {
188
- "build": "tsx scripts/build.ts",
168
+ "build": "bun scripts/build.ts",
189
169
  "prepublishOnly": "npm run build",
190
170
  "typecheck": "tsc --noEmit -p tsconfig.json",
191
- "test": "mkdir -p .artifacts/unit && bun test src --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml"
171
+ "live:boat": "bun scripts/boat-live-check.ts",
172
+ "test": "mkdir -p .artifacts/unit && node ../../script/test-deadline.mjs bun test src --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml"
173
+ },
174
+ "dependencies": {
175
+ "@claxedo/helpers": "0.2.0",
176
+ "@claxedo/sandbox-contract": "0.10.0",
177
+ "@vercel/sandbox": "3.3.0",
178
+ "modal": "0.10.1"
192
179
  },
193
180
  "devDependencies": {
194
181
  "@tsconfig/node-lts": "22.0.4",
195
182
  "@types/bun": "1.3.13",
196
183
  "@types/node": "24.12.2",
197
184
  "esbuild": "0.25.12",
198
- "tsx": "4.22.3",
199
185
  "typescript": "catalog:",
200
186
  "vitest": "2.1.9"
201
187
  }
@@ -1,16 +0,0 @@
1
- /**
2
- * Format CIDRs for Daytona SDK `networkAllowList` parameter.
3
- * Daytona currently accepts at most 10 entries.
4
- */
5
- export declare function formatDaytonaAllowList(cidrs: string[]): string;
6
- /**
7
- * Format hostnames for Daytona SDK `domainAllowList` parameter.
8
- *
9
- * Deliberately does NOT truncate, unlike the CIDR formatter above. Silently
10
- * dropping entries from an egress allowlist is the worst of both worlds: the
11
- * sandbox stays contained, but it loses reachability the caller believed it
12
- * granted and nothing anywhere says so. Daytona documents no cap on
13
- * `domainAllowList`; if one exists, an over-long list fails the create call
14
- * loudly, which is the outcome we want.
15
- */
16
- export declare function formatDaytonaDomainAllowList(hosts: string[]): string;
@@ -1,11 +0,0 @@
1
- // src/daytona-allow-list.ts
2
- function formatDaytonaAllowList(cidrs) {
3
- return cidrs.slice(0, 10).join(",");
4
- }
5
- function formatDaytonaDomainAllowList(hosts) {
6
- return [...new Set(hosts)].join(",");
7
- }
8
- export {
9
- formatDaytonaAllowList,
10
- formatDaytonaDomainAllowList
11
- };
@@ -1,52 +0,0 @@
1
- import type { SandboxDriver, SandboxDriverEnsureInput } from "..";
2
- export type BoxApiBox = {
3
- id: string;
4
- name?: string;
5
- state: string;
6
- url?: string | null;
7
- ip?: string | null;
8
- subdomain?: string | null;
9
- createdAt?: string | null;
10
- };
11
- export type BoxCommandResult = {
12
- stdout?: string;
13
- stderr?: string;
14
- exitCode?: number;
15
- };
16
- export type BoxFetch = (input: string, init?: RequestInit) => Promise<Response>;
17
- export type BoxSandboxDriverOptions = {
18
- apiKey: string;
19
- baseUrl?: string;
20
- image?: string;
21
- runtimePort?: number;
22
- runtimeCommand?: string;
23
- workspaceDir?: string;
24
- runner?: string;
25
- /** Container name used for the runtime container inside the box. */
26
- containerName?: string;
27
- /**
28
- * Box auto-archives after this many seconds of inactivity. `null` (default)
29
- * disables auto-archival so the SandboxManager owns the lifecycle; a number
30
- * lets Box reclaim idle boxes to save cost.
31
- */
32
- ttlSeconds?: number | null;
33
- /**
34
- * Optional `docker login` before the pull, for a private runtime registry
35
- * (the default image lives on ghcr.io). Omit for public images.
36
- */
37
- registryAuth?: {
38
- server: string;
39
- username: string;
40
- password: string;
41
- };
42
- env?: (input: SandboxDriverEnsureInput, host: {
43
- id: string;
44
- }) => Record<string, string> | Promise<Record<string, string>>;
45
- provisionTimeoutMs?: number;
46
- provisionIntervalMs?: number;
47
- healthTimeoutMs?: number;
48
- healthIntervalMs?: number;
49
- operationTimeoutMs?: number;
50
- fetchImpl?: BoxFetch;
51
- };
52
- export declare function createBoxSandboxDriver(options: BoxSandboxDriverOptions): SandboxDriver;