@b4run/testing 0.8.28
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 +21 -0
- package/README.md +51 -0
- package/dist/aimock-runner.d.ts +48 -0
- package/dist/aimock-runner.d.ts.map +1 -0
- package/dist/aimock-runner.js +81 -0
- package/dist/checkpointer-conformance.d.ts +43 -0
- package/dist/checkpointer-conformance.d.ts.map +1 -0
- package/dist/checkpointer-conformance.js +381 -0
- package/dist/fake-embedder.d.ts +9 -0
- package/dist/fake-embedder.d.ts.map +1 -0
- package/dist/fake-embedder.js +38 -0
- package/dist/fixture-builder.d.ts +29 -0
- package/dist/fixture-builder.d.ts.map +1 -0
- package/dist/fixture-builder.js +43 -0
- package/dist/fixture-file.d.ts +14 -0
- package/dist/fixture-file.d.ts.map +1 -0
- package/dist/fixture-file.js +49 -0
- package/dist/harness.d.ts +35 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +211 -0
- package/dist/http-inject.d.ts +22 -0
- package/dist/http-inject.d.ts.map +1 -0
- package/dist/http-inject.js +55 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/matchers.d.ts +56 -0
- package/dist/matchers.d.ts.map +1 -0
- package/dist/matchers.js +262 -0
- package/dist/memory-conformance.d.ts +13 -0
- package/dist/memory-conformance.d.ts.map +1 -0
- package/dist/memory-conformance.js +1333 -0
- package/dist/memory.d.ts +11 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +20 -0
- package/dist/middleware-harness.d.ts +11 -0
- package/dist/middleware-harness.d.ts.map +1 -0
- package/dist/middleware-harness.js +35 -0
- package/dist/permissions-conformance.d.ts +24 -0
- package/dist/permissions-conformance.d.ts.map +1 -0
- package/dist/permissions-conformance.js +156 -0
- package/dist/record-fixtures.d.ts +21 -0
- package/dist/record-fixtures.d.ts.map +1 -0
- package/dist/record-fixtures.js +31 -0
- package/dist/record.d.ts +12 -0
- package/dist/record.d.ts.map +1 -0
- package/dist/record.js +22 -0
- package/dist/regex-safety.d.ts +2 -0
- package/dist/regex-safety.d.ts.map +1 -0
- package/dist/regex-safety.js +66 -0
- package/dist/run-result.d.ts +111 -0
- package/dist/run-result.d.ts.map +1 -0
- package/dist/run-result.js +287 -0
- package/dist/subprocess.d.ts +25 -0
- package/dist/subprocess.d.ts.map +1 -0
- package/dist/subprocess.js +223 -0
- package/dist/thread-access-harness.d.ts +40 -0
- package/dist/thread-access-harness.d.ts.map +1 -0
- package/dist/thread-access-harness.js +42 -0
- package/dist/threads-conformance.d.ts +18 -0
- package/dist/threads-conformance.d.ts.map +1 -0
- package/dist/threads-conformance.js +315 -0
- package/dist/tool-harness.d.ts +16 -0
- package/dist/tool-harness.d.ts.map +1 -0
- package/dist/tool-harness.js +25 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/workspace-harness.d.ts +15 -0
- package/dist/workspace-harness.d.ts.map +1 -0
- package/dist/workspace-harness.js +43 -0
- package/package.json +71 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PermissionsStore } from "@b4run/permissions";
|
|
2
|
+
import type { WorkspaceFs } from "@b4run/sdk";
|
|
3
|
+
export interface WorkspaceHarness {
|
|
4
|
+
readonly fs: WorkspaceFs;
|
|
5
|
+
readonly dir: string;
|
|
6
|
+
read(path: string): Promise<string>;
|
|
7
|
+
write(path: string, content: string): Promise<void>;
|
|
8
|
+
close(): Promise<void>;
|
|
9
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkspaceHarnessOptions {
|
|
12
|
+
readonly permissions?: PermissionsStore;
|
|
13
|
+
}
|
|
14
|
+
export declare function createWorkspaceHarness(opts?: WorkspaceHarnessOptions): Promise<WorkspaceHarness>;
|
|
15
|
+
//# sourceMappingURL=workspace-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-harness.d.ts","sourceRoot":"","sources":["../src/workspace-harness.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAA;CACxC;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,CAAC,EAAE,uBAAuB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAqC3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { createWorkspaceFs } from "@b4run/core";
|
|
6
|
+
import { localFilesystem } from "@b4run/workspace/node";
|
|
7
|
+
export async function createWorkspaceHarness(opts) {
|
|
8
|
+
const root = await mkdtemp(join(tmpdir(), "b4-ws-harness-"));
|
|
9
|
+
const workspaceRoot = join(root, "workspace");
|
|
10
|
+
await mkdir(workspaceRoot, { recursive: true });
|
|
11
|
+
// Gate canonicalizes the root; realpath so inside-paths classify correctly.
|
|
12
|
+
const canonicalRoot = realpathSync(workspaceRoot);
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
const fs = createWorkspaceFs({
|
|
15
|
+
workspaceRoot: canonicalRoot,
|
|
16
|
+
backend: localFilesystem(),
|
|
17
|
+
permissions: opts?.permissions,
|
|
18
|
+
signal: controller.signal,
|
|
19
|
+
interruptCapable: false,
|
|
20
|
+
});
|
|
21
|
+
let closed = false;
|
|
22
|
+
const close = async () => {
|
|
23
|
+
if (closed)
|
|
24
|
+
return;
|
|
25
|
+
closed = true;
|
|
26
|
+
controller.abort();
|
|
27
|
+
await rm(root, { force: true, recursive: true });
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
fs,
|
|
31
|
+
dir: canonicalRoot,
|
|
32
|
+
async read(path) {
|
|
33
|
+
return await readFile(join(canonicalRoot, path), "utf8");
|
|
34
|
+
},
|
|
35
|
+
async write(path, content) {
|
|
36
|
+
const abs = join(canonicalRoot, path);
|
|
37
|
+
await mkdir(dirname(abs), { recursive: true });
|
|
38
|
+
await writeFile(abs, content, "utf8");
|
|
39
|
+
},
|
|
40
|
+
close,
|
|
41
|
+
[Symbol.asyncDispose]: close,
|
|
42
|
+
};
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@b4run/testing",
|
|
3
|
+
"version": "0.8.28",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"description": "Deterministic harnesses, fixtures, and matchers for testing B4.run agent applications.",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"b4",
|
|
10
|
+
"typescript",
|
|
11
|
+
"ai-agents",
|
|
12
|
+
"testing",
|
|
13
|
+
"fixtures",
|
|
14
|
+
"llm"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/cacheplane/b4run/tree/main/packages/testing#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/cacheplane/b4run.git",
|
|
20
|
+
"directory": "packages/testing"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/cacheplane/b4run/issues"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=24.0.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@copilotkit/aimock": "^1.37.4",
|
|
43
|
+
"@b4run/memory": "0.8.28"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@b4run/core": "0.8.28",
|
|
47
|
+
"@b4run/cli": "0.8.28",
|
|
48
|
+
"@b4run/sdk": "0.8.28",
|
|
49
|
+
"@b4run/workspace": "0.8.28"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@langchain/langgraph-checkpoint": "^1.1.3",
|
|
53
|
+
"@testcontainers/postgresql": "^12.0.4",
|
|
54
|
+
"@types/node": "26.1.2",
|
|
55
|
+
"zod": "^4.4.3",
|
|
56
|
+
"@b4run/config-typescript": "0.8.28",
|
|
57
|
+
"@b4run/cli": "0.8.28",
|
|
58
|
+
"@b4run/langchain": "0.8.28",
|
|
59
|
+
"@b4run/core": "0.8.28",
|
|
60
|
+
"@b4run/permissions": "0.8.28",
|
|
61
|
+
"@b4run/sqlite-storage": "0.8.28",
|
|
62
|
+
"@b4run/sdk": "0.8.28",
|
|
63
|
+
"@b4run/workspace": "0.8.28"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsc -b tsconfig.build.json",
|
|
67
|
+
"lint": "biome check --config-path ../config-biome/biome.json --vcs-enabled=true --vcs-client-kind=git --vcs-use-ignore-file=true --vcs-root=../../ package.json src test tsconfig.json tsconfig.build.json tsconfig.contracts.json vitest.config.ts",
|
|
68
|
+
"test": "vitest --run --config vitest.config.ts --passWithNoTests",
|
|
69
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.contracts.json"
|
|
70
|
+
}
|
|
71
|
+
}
|