feat: vendor permission system source

This commit is contained in:
云服务部-叶林立
2026-08-19 14:35:19 +08:00
parent 198584daf8
commit 410c50a3e5
809 changed files with 157793 additions and 139 deletions
@@ -0,0 +1,55 @@
import { describe, expect, test } from "vitest";
import {
PATH_BEARING_TOOLS,
PATH_SURFACES,
READ_ONLY_PATH_BEARING_TOOLS,
} from "#src/access-intent/path-surfaces";
describe("PATH_BEARING_TOOLS", () => {
test("contains the expected tool names", () => {
for (const tool of ["read", "write", "edit", "find", "grep", "ls"]) {
expect(PATH_BEARING_TOOLS.has(tool)).toBe(true);
}
});
test("does not contain bash or mcp", () => {
expect(PATH_BEARING_TOOLS.has("bash")).toBe(false);
expect(PATH_BEARING_TOOLS.has("mcp")).toBe(false);
});
});
describe("READ_ONLY_PATH_BEARING_TOOLS", () => {
test("contains read, find, grep, ls", () => {
for (const tool of ["read", "find", "grep", "ls"]) {
expect(READ_ONLY_PATH_BEARING_TOOLS.has(tool)).toBe(true);
}
});
test("does not contain write or edit", () => {
expect(READ_ONLY_PATH_BEARING_TOOLS.has("write")).toBe(false);
expect(READ_ONLY_PATH_BEARING_TOOLS.has("edit")).toBe(false);
});
});
describe("PATH_SURFACES", () => {
test("contains the path-bearing tools plus the cross-cutting gates", () => {
for (const surface of [
"read",
"write",
"edit",
"find",
"grep",
"ls",
"external_directory",
"path",
]) {
expect(PATH_SURFACES.has(surface)).toBe(true);
}
});
test("does not contain bash or mcp", () => {
expect(PATH_SURFACES.has("bash")).toBe(false);
expect(PATH_SURFACES.has("mcp")).toBe(false);
});
});