refactor(permission-system): simplify policy and autoreview flow

This commit is contained in:
云服务部-叶林立
2026-09-03 02:01:06 +08:00
parent 180da95ab7
commit 6e7effa792
112 changed files with 911 additions and 10346 deletions
@@ -154,35 +154,6 @@ describe("shell-tool alias gating (#574)", () => {
);
});
it("gates an aliased tool's workdir and its relative tokens via external_directory", async () => {
const { handler, events } = makeHandler({
shellTools: execShellTools,
tools: ["exec_command"],
session: {
checkPermission: makeSurfaceCheck(
{ external_directory: { state: "deny", matchedPattern: "*" } },
{ state: "allow" },
),
},
});
// workdir /etc is outside the cwd; the relative token resolves against it.
await handler.handleToolCall(
makeToolCallEvent("exec_command", {
input: { cmd: "cat ../secret.txt", workdir: "/etc" },
}),
makeCtx(),
);
const decisions = getDecisionEvents(events);
expect(decisions).toContainEqual(
expect.objectContaining({
surface: "external_directory",
result: "deny",
resolution: "policy_deny",
}),
);
});
it("floors an indirection wrapper (sudo) in an aliased command to ask (#490)", async () => {
const { handler, events } = makeHandler({