@capybara-hq/testing 0.1.0-rc.1 → 0.1.0-rc.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/dist/dual-replica.d.ts +6 -5
- package/dist/dual-replica.js +3 -1
- package/dist/fake-e2b.d.ts +2 -1
- package/dist/replica-runner.js +1 -1
- package/package.json +4 -4
package/dist/dual-replica.d.ts
CHANGED
|
@@ -13,14 +13,15 @@ export interface DualReplicaOptions {
|
|
|
13
13
|
/** 部署级插件配置,按插件名索引。 */
|
|
14
14
|
extensionConfig?: Record<string, unknown>;
|
|
15
15
|
/**
|
|
16
|
-
* The bootstrap step (package ecosystem spec §7): every replica's kernel gets `
|
|
16
|
+
* The bootstrap step (package ecosystem spec §7): every replica's kernel gets `bootstrap: { dir }`
|
|
17
17
|
* and `bootstrapManifest: manifest`, so the replicas run it at start (once across them, under the
|
|
18
|
-
* advisory lock) before loading extensions, as
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* advisory lock) before loading extensions, as `capybara start` does. `dir` is the optional
|
|
19
|
+
* offline directory (its `*.tgz` files are matched to the entries by sha512); the other entries
|
|
20
|
+
* are downloaded from `packages.npmRegistry` (set it in `config`, e.g. to a
|
|
21
|
+
* `startFakeNpmRegistry`). Build both with the kernel tests' `bootstrapFixture` helper.
|
|
21
22
|
*/
|
|
22
23
|
bootstrap?: {
|
|
23
|
-
dir
|
|
24
|
+
dir?: string;
|
|
24
25
|
manifest: BootstrapManifest;
|
|
25
26
|
};
|
|
26
27
|
/**
|
package/dist/dual-replica.js
CHANGED
|
@@ -167,7 +167,9 @@ export async function createDualReplicaHarness(opts) {
|
|
|
167
167
|
masterKey: randomBytes(32).toString("base64"),
|
|
168
168
|
extensions: opts.extensions,
|
|
169
169
|
...(opts.bootstrap !== undefined && {
|
|
170
|
-
|
|
170
|
+
bootstrap: {
|
|
171
|
+
...(opts.bootstrap.dir !== undefined && { dir: resolve(opts.bootstrap.dir) }),
|
|
172
|
+
},
|
|
171
173
|
bootstrapManifest: opts.bootstrap.manifest,
|
|
172
174
|
}),
|
|
173
175
|
// 副本进程的 cwd 不是调用方的 cwd,相对路径必须先按调用方 cwd 绝对化再经 IPC 传过去
|
package/dist/fake-e2b.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A programmable fake E2B (for the tests of the sandbox-e2b plugin in capybara-hq/plugins), following
|
|
3
|
+
* the `e2b` JS SDK 2.58.0 and the E2B docs (checked 2026-10-21):
|
|
3
4
|
*
|
|
4
5
|
* - **控制面 API**(请求头 `X-API-KEY`,不符 → 401 `{code, message}`):
|
|
5
6
|
* `POST /v2/sandboxes`(建沙箱,回 201 `{sandboxID, templateID, envdVersion, envdAccessToken, domain}`)、
|
package/dist/replica-runner.js
CHANGED
|
@@ -29,7 +29,7 @@ async function startKernel(c) {
|
|
|
29
29
|
const config = KernelConfigSchema.parse(deepMerge(base, c.overrides));
|
|
30
30
|
kernel = await createKernel(config, {
|
|
31
31
|
resolveFrom: c.resolveFrom,
|
|
32
|
-
...(c.
|
|
32
|
+
...(c.bootstrap !== undefined && { bootstrap: c.bootstrap }),
|
|
33
33
|
...(c.bootstrapManifest !== undefined && { bootstrapManifest: c.bootstrapManifest }),
|
|
34
34
|
});
|
|
35
35
|
await kernel.start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/testing",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.2",
|
|
4
4
|
"description": "Test helpers for Capybara: test containers, dual-replica harness and fake third-party servers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"tsx": "^4.23.15",
|
|
48
48
|
"ws": "^8.22.0",
|
|
49
49
|
"zod": "^4.6.7",
|
|
50
|
-
"@capybara-hq/kernel": "^0.1.0-rc.
|
|
50
|
+
"@capybara-hq/kernel": "^0.1.0-rc.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/pg": "^8.23.1",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vitest": "^5.0.5",
|
|
59
|
-
"@capybara-hq/plugin-
|
|
60
|
-
"@capybara-hq/plugin-
|
|
59
|
+
"@capybara-hq/plugin-tools": "^0.1.0-rc.2",
|
|
60
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"@capybara-hq/plugin-tools": {
|