@hotcell/daemon 0.1.0 → 0.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -10,9 +10,10 @@
10
10
  *
11
11
  * Prereqs: a daemon whose environment has SBX_PROVIDER_KEY_OPENROUTER, Docker
12
12
  * (container driver), and internet egress for the gateway itself.
13
- * Env: SBX_ENDPOINT (default http://127.0.0.1:4750), SBX_API_KEY (if auth on),
14
- * SBX_E2E_MODEL (OpenRouter slug; default anthropic/claude-3.5-haiku),
15
- * SBX_E2E_EXPECT — "completion" (default; needs a real provider key) or
13
+ * Env: HOTCELL_ENDPOINT (default http://127.0.0.1:4750), HOTCELL_API_KEY (if auth on),
14
+ * HOTCELL_E2E_MODEL (OpenRouter slug), HOTCELL_E2E_HARNESS — "claude-code"
15
+ * (default) or "opencode" (any OpenRouter model, e.g. Kimi K2.5),
16
+ * HOTCELL_E2E_EXPECT — "completion" (default; needs a real provider key) or
16
17
  * "auth-fail": run with a dummy key and accept the provider's auth error
17
18
  * as proof the whole chain works (sandbox → token env → headless Claude
18
19
  * Code → gateway → key injection → real provider), minus the billing.
@@ -21,9 +22,11 @@
21
22
  import assert from "node:assert/strict";
22
23
  import { HotcellClient } from "@hotcell/sdk";
23
24
  async function main() {
24
- const endpoint = process.env.SBX_ENDPOINT ?? "http://127.0.0.1:4750";
25
- const model = process.env.SBX_E2E_MODEL ?? "anthropic/claude-3.5-haiku";
26
- const client = new HotcellClient({ endpoint, apiKey: process.env.SBX_API_KEY });
25
+ const endpoint = process.env.HOTCELL_ENDPOINT ?? process.env.SBX_ENDPOINT ?? "http://127.0.0.1:4750";
26
+ const harness = process.env.HOTCELL_E2E_HARNESS ?? "claude-code";
27
+ const model = process.env.HOTCELL_E2E_MODEL ??
28
+ (harness === "opencode" ? "openrouter/moonshotai/kimi-k2.5" : "anthropic/claude-3.5-haiku");
29
+ const client = new HotcellClient({ endpoint, apiKey: process.env.HOTCELL_API_KEY ?? process.env.SBX_API_KEY });
27
30
  let passed = 0;
28
31
  const ok = (l) => {
29
32
  passed++;
@@ -43,34 +46,44 @@ async function main() {
43
46
  assert.match(wiring.stdout, /tok=set/, "egress token not injected");
44
47
  assert.ok(!/sk-or-/.test(wiring.stdout), "a real provider key leaked into the sandbox env");
45
48
  ok("egress env wired: gateway base URL + token (no real key in the sandbox)");
46
- console.error("[e2e] installing @anthropic-ai/claude-code in the sandbox (~1-2 min)…");
47
- const install = await sandbox.exec("npm install -g @anthropic-ai/claude-code --no-fund --no-audit 2>&1 | tail -2 && claude --version");
49
+ const installCmd = harness === "opencode"
50
+ ? // OpenCode reads the openrouter provider from its config; point its
51
+ // baseURL at the gateway with the egress token as the "key".
52
+ `npm install -g opencode-ai --no-fund --no-audit 2>&1 | tail -1 && mkdir -p ~/.config/opencode && ` +
53
+ `printf '{"provider":{"openrouter":{"options":{"baseURL":"%s/v1","apiKey":"%s"}}}}' ` +
54
+ `"$OPENROUTER_BASE_URL" "$OPENROUTER_API_KEY" > ~/.config/opencode/opencode.json && opencode --version`
55
+ : "npm install -g @anthropic-ai/claude-code --no-fund --no-audit 2>&1 | tail -2 && claude --version";
56
+ console.error(`[e2e] installing ${harness} in the sandbox (~1-2 min)…`);
57
+ const install = await sandbox.exec(installCmd);
48
58
  assert.equal(install.exitCode, 0, `install failed:\n${install.stdout}\n${install.stderr}`);
49
- ok(`headless harness installed: claude ${install.stdout.trim().split("\n").pop()}`);
50
- console.error("[e2e] running headless Claude Code through the gateway…");
51
- const run = await sandbox.exec([
52
- // Claude Code → gateway → openrouter.ai/api/v1/messages, per OpenRouter's
53
- // Claude Code integration guide: base URL swap, token as auth, blank the
54
- // real-key var so nothing conflicts, model pinned to a cheap Anthropic slug.
55
- `export ANTHROPIC_BASE_URL="$OPENROUTER_BASE_URL"`,
56
- `export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"`,
57
- `export ANTHROPIC_API_KEY=""`,
58
- `export ANTHROPIC_DEFAULT_HAIKU_MODEL="${model}"`,
59
- `export DISABLE_TELEMETRY=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`,
60
- `export HOME=/root IS_SANDBOX=1`,
61
- `claude -p "Reply with exactly: SBX_E2E_OK" --model haiku 2>&1`,
62
- ].join(" && "));
63
- const expect = process.env.SBX_E2E_EXPECT ?? "completion";
59
+ ok(`headless harness installed: ${harness} ${install.stdout.trim().split("\n").pop()}`);
60
+ console.error(`[e2e] running headless ${harness} through the gateway…`);
61
+ const run = await sandbox.exec(harness === "opencode"
62
+ ? `export HOME=/root && opencode run -m "${model}" --dangerously-skip-permissions "Reply with exactly: HOTCELL_E2E_OK" 2>&1`
63
+ :
64
+ [
65
+ // Claude Code → gateway → openrouter.ai/api/v1/messages, per OpenRouter's
66
+ // Claude Code integration guide: base URL swap, token as auth, blank the
67
+ // real-key var so nothing conflicts, model pinned to a cheap Anthropic slug.
68
+ `export ANTHROPIC_BASE_URL="$OPENROUTER_BASE_URL"`,
69
+ `export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"`,
70
+ `export ANTHROPIC_API_KEY=""`,
71
+ `export ANTHROPIC_DEFAULT_HAIKU_MODEL="${model}"`,
72
+ `export DISABLE_TELEMETRY=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`,
73
+ `export HOME=/root IS_SANDBOX=1`,
74
+ `claude -p "Reply with exactly: HOTCELL_E2E_OK" --model haiku 2>&1`,
75
+ ].join(" && "));
76
+ const expect = process.env.HOTCELL_E2E_EXPECT ?? "completion";
64
77
  if (expect === "auth-fail") {
65
78
  // Dummy-key mode: the provider rejecting our injected key IS the proof —
66
79
  // the request left headless Claude Code, crossed the gateway, had the
67
80
  // (dummy) real key injected, and reached the provider over the internet.
68
81
  assert.match(run.stdout, /401|unauthori[sz]ed|invalid.*(key|token)|authentication/i, `expected a provider auth error, got:\n${run.stdout.slice(-800)}`);
69
- ok("★ headless Claude Code → gateway → real provider (auth error as expected with a dummy key)");
82
+ ok(`★ headless ${harness} → gateway → real provider (auth error as expected with a dummy key)`);
70
83
  }
71
84
  else {
72
- assert.match(run.stdout, /SBX_E2E_OK/, `no completion came back through the gateway:\n${run.stdout.slice(-800)}`);
73
- ok("★ headless Claude Code completed a real prompt through the egress gateway");
85
+ assert.match(run.stdout, /HOTCELL_E2E_OK/, `no completion came back through the gateway:\n${run.stdout.slice(-800)}`);
86
+ ok(`★ headless ${harness} completed a real prompt through the egress gateway`);
74
87
  }
75
88
  // The gateway metered the traffic: provider calls on the record.
76
89
  const metrics = await sandbox.metrics();
@@ -1 +1 @@
1
- {"version":3,"file":"e2e-harness.js","sourceRoot":"","sources":["../src/e2e-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAE3D,KAAK,UAAU,IAAI;IACjB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,uBAAuB,CAAC;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,4BAA4B,CAAC;IACxE,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IAEhF,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE;QACvB,MAAM,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE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O,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAC5D,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,oEAAoE,CAAC,CAAC;QAC1G,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC"}
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotcell/daemon",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "hotcell sandbox daemon: containers + Firecracker/Apple-VZ microVMs, egress credential gateway",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "type": "git",
28
28
  "url": "git+https://github.com/sinameraji/hotcell.git"
29
29
  },
30
- "homepage": "https://hotcell-bw3.pages.dev",
30
+ "homepage": "https://hotcell.sh",
31
31
  "bugs": {
32
32
  "url": "https://github.com/sinameraji/hotcell/issues"
33
33
  },
@@ -1 +0,0 @@
1
- export {};
package/dist/smoke-vz.js DELETED
@@ -1,161 +0,0 @@
1
- /**
2
- * Apple VZ parity smoke. Boots an in-process daemon backed by the **Apple VZ
3
- * microVM driver** (`SBX_DRIVER=applevz`) and drives the full sandbox surface
4
- * through the daemon's HTTP/SSE stack via the public TypeScript SDK — the same
5
- * `npm run smoke` exercises against the container driver. This is the plan's
6
- * parity gate: the *same* end-to-end flow must work on both drivers, proving the
7
- * driver abstraction holds from REST → SSE → SDK down to a real microVM.
8
- *
9
- * Unlike `applevz-check.ts` (which calls the driver directly), this goes through
10
- * the daemon server, the preview proxy, and the SDK — so it covers the
11
- * integration the direct check doesn't. Needs a Mac with the VZ helper + guest
12
- * artifacts built (`npm run build:vz`, `build:agent`, `build-guest.sh`).
13
- *
14
- * Usage: npm run smoke:vz
15
- */
16
- import { mkdtemp, rm } from "node:fs/promises";
17
- import { tmpdir, homedir } from "node:os";
18
- import { join } from "node:path";
19
- import { BackupRegistry } from "./backups.js";
20
- import { Capacity } from "./capacity.js";
21
- import { loadConfig } from "./config.js";
22
- import { DriverRouter } from "./driver/router.js";
23
- import { MetricsHistory } from "./metrics.js";
24
- import { SandboxStore } from "./store.js";
25
- import { createApiServer } from "./api/server.js";
26
- import { createProxyServer } from "./proxy/server.js";
27
- import { SbxClient } from "@sbx/sdk";
28
- async function main() {
29
- // Force the VZ driver + isolated ports/state so the run leaves nothing behind
30
- // and never collides with a dev daemon on the default ports.
31
- process.env.SBX_DRIVER = "applevz";
32
- const config = loadConfig();
33
- config.driver = "applevz";
34
- config.port = 4790;
35
- config.proxyPort = 4791;
36
- config.backupDir = await mkdtemp(join(tmpdir(), "sbx-vz-backups-"));
37
- const dbDir = await mkdtemp(join(tmpdir(), "sbx-vz-db-"));
38
- config.dbPath = join(dbDir, "state.db");
39
- config.vzStateDir = await mkdtemp(join(tmpdir(), "sbx-vz-state-"));
40
- config.vzImageCacheDir = join(homedir(), ".sbx", "vz", "images"); // stable cache
41
- const store = new SandboxStore(config.dbPath);
42
- const driver = new DriverRouter(config, store, config.driver);
43
- const backups = new BackupRegistry(config.backupDir);
44
- const history = new MetricsHistory(config.metricsHistory);
45
- const capacity = new Capacity(store, config, null, history);
46
- const server = createApiServer({ config, driver, store, backups, history, capacity });
47
- await new Promise((r) => server.listen(config.port, config.host, r));
48
- const proxy = createProxyServer({ config, driver, store });
49
- await new Promise((r) => proxy.listen(config.proxyPort, config.proxyHost, r));
50
- const endpoint = `http://${config.host}:${config.port}`;
51
- const proxyEndpoint = `http://${config.proxyHost}:${config.proxyPort}`;
52
- const client = new SbxClient({ endpoint });
53
- let passed = 0;
54
- const ok = (l) => {
55
- passed++;
56
- console.error(` ✓ ${l}`);
57
- };
58
- const assert = (cond, msg) => {
59
- if (!cond)
60
- throw new Error(msg);
61
- };
62
- let sandbox;
63
- try {
64
- // 1. Health + info: the daemon reports the VZ driver.
65
- const health = await client.health();
66
- assert(health.ok, "daemon health not ok");
67
- const info = await client.info();
68
- assert(info.driver === "applevz", `expected driver=applevz, got ${info.driver}`);
69
- ok(`daemon up on the applevz driver (${endpoint})`);
70
- // 2. Create a microVM sandbox (Alpine base — fast, no image conversion).
71
- sandbox = await client.getSandbox(undefined, { image: "base" });
72
- ok(`created microVM sandbox ${sandbox.id}`);
73
- // 3. exec streams stdout/exit over SSE and runs in a real arm64 Linux VM.
74
- const uname = await sandbox.exec("echo hi-from-vm && uname -sm");
75
- assert(uname.exitCode === 0, `exec exit ${uname.exitCode}`);
76
- assert(/hi-from-vm/.test(uname.stdout), "exec stdout missing");
77
- assert(/Linux aarch64/.test(uname.stdout), "not a real arm64 Linux VM");
78
- ok(`exec over SSE → ${uname.stdout.trim().replace(/\n/g, " | ")}`);
79
- // 4. Files: write/read/mkdir/list through REST.
80
- await sandbox.writeFile("/workspace/hello.txt", "vz-files");
81
- assert((await sandbox.readFile("/workspace/hello.txt")) === "vz-files", "readFile mismatch");
82
- await sandbox.mkdir("/workspace/sub");
83
- const files = await sandbox.listFiles("/workspace");
84
- assert(files.some((f) => f.name === "hello.txt"), "listFiles missing file");
85
- assert(files.some((f) => f.name === "sub" && f.isDirectory), "listFiles missing dir");
86
- ok("files: write / read / mkdir / list");
87
- // 5. Sandbox env + session cwd persistence.
88
- await sandbox.setEnvVars({ SBX_VZ_SMOKE: "env-ok" });
89
- const envOut = await sandbox.exec("echo $SBX_VZ_SMOKE");
90
- assert(/env-ok/.test(envOut.stdout), "sandbox env not applied");
91
- const session = await sandbox.createSession({ cwd: "/workspace/sub" });
92
- await session.exec("echo cwd-marker > here.txt");
93
- const cwdRead = await sandbox.readFile("/workspace/sub/here.txt");
94
- assert(/cwd-marker/.test(cwdRead), "session cwd not honored");
95
- ok("env applied + session cwd persists");
96
- // 6. Background process + port readiness + preview proxy fetch.
97
- const proc = await sandbox.startProcess("while true; do printf 'HTTP/1.0 200 OK\\r\\n\\r\\nvz-preview-ok' | nc -l -p 9000 2>/dev/null; done");
98
- assert(Number.isFinite(proc.pid), "startProcess returned no pid");
99
- const ready = await sandbox.waitForPort(9000, { timeoutMs: 8000 });
100
- assert(ready, "port 9000 never became ready");
101
- await sandbox.exposePort(9000);
102
- const preview = await fetch(`${proxyEndpoint}/_sbx/${sandbox.id}/9000/`);
103
- const previewBody = await preview.text();
104
- assert(/vz-preview-ok/.test(previewBody), `preview proxy did not serve: ${previewBody.slice(0, 60)}`);
105
- ok("background process → waitForPort → preview proxy round-trip");
106
- // 7. watch: open the stream, create a file, see the event. The SDK watch is
107
- // an async generator; calling return() closes the underlying SSE stream.
108
- const watchGen = sandbox.watch("/workspace", { intervalMs: 200 });
109
- let sawWatch = false;
110
- const watching = (async () => {
111
- for await (const ev of watchGen) {
112
- if (/watched\.txt/.test(ev.path)) {
113
- sawWatch = true;
114
- break;
115
- }
116
- }
117
- })().catch(() => { });
118
- await new Promise((r) => setTimeout(r, 500));
119
- await sandbox.writeFile("/workspace/watched.txt", "x");
120
- for (let i = 0; i < 30 && !sawWatch; i++)
121
- await new Promise((r) => setTimeout(r, 100));
122
- await watchGen.return(undefined); // unblock + close the stream if still pending
123
- await watching;
124
- assert(sawWatch, "watch never reported the new file");
125
- ok("watch streamed a create event");
126
- // 8. Backup → mutate → restore → rollback.
127
- await sandbox.writeFile("/workspace/keep.txt", "in-backup");
128
- const backup = await sandbox.createBackup();
129
- await sandbox.writeFile("/workspace/keep.txt", "MUTATED");
130
- await sandbox.restoreBackup(backup.backupId);
131
- assert((await sandbox.readFile("/workspace/keep.txt")) === "in-backup", "restore did not roll back");
132
- ok("backup → mutate → restore → rollback");
133
- // 9. Metrics: the sampler/stats path reports usage through the daemon.
134
- const metrics = await sandbox.metrics();
135
- assert(metrics.live ? metrics.live.memBytes > 0 : true, "live metrics memBytes should be > 0");
136
- ok(`metrics endpoint served (live mem ${metrics.live ? (metrics.live.memBytes / 1e6).toFixed(0) + "MB" : "n/a"})`);
137
- // 10. Persistence across stop/start (cold resume; workspace survives).
138
- await sandbox.stop();
139
- await sandbox.start();
140
- assert((await sandbox.readFile("/workspace/keep.txt")) === "in-backup", "workspace lost across stop/start");
141
- ok("workspace persists across stop/start");
142
- console.error(`\n[smoke-vz] passed — ${passed} checks (full surface on the applevz driver)`);
143
- return 0;
144
- }
145
- catch (err) {
146
- console.error(`[smoke-vz] FAILED: ${err instanceof Error ? err.message : String(err)}`);
147
- return 1;
148
- }
149
- finally {
150
- if (sandbox)
151
- await sandbox.destroy().catch(() => { });
152
- await new Promise((r) => proxy.close(() => r()));
153
- await new Promise((r) => server.close(() => r()));
154
- store.close();
155
- await rm(config.backupDir, { recursive: true, force: true }).catch(() => { });
156
- await rm(dbDir, { recursive: true, force: true }).catch(() => { });
157
- await rm(config.vzStateDir, { recursive: true, force: true }).catch(() => { });
158
- }
159
- }
160
- main().then((code) => process.exit(code));
161
- //# sourceMappingURL=smoke-vz.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smoke-vz.js","sourceRoot":"","sources":["../src/smoke-vz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,I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