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
@@ -223,34 +223,6 @@ describe("handleToolCall decision events — confirmation_unavailable", () => {
});
});
// ── infrastructure_auto_allowed path ──────────────────────────────────────
describe("handleToolCall decision events — infrastructure_auto_allowed", () => {
it("emits allow with infrastructure_auto_allowed for Pi infra reads", async () => {
const infraDir = "/test/agent";
const { handler, events } = makeHandler({
session: {
checkPermission: vi.fn().mockReturnValue(makeCheckResult()),
getInfrastructureReadDirs: vi.fn().mockReturnValue([infraDir]),
},
});
const event = makeToolCallEvent("read", {
input: { path: `${infraDir}/some-file.json` },
});
await handler.handleToolCall(event, makeCtx());
const decisions = getDecisionEvents(events);
const infraEvents = decisions.filter(
(e) => e.resolution === "infrastructure_auto_allowed",
);
expect(infraEvents).toHaveLength(1);
expect(infraEvents[0]).toMatchObject({
result: "allow",
resolution: "infrastructure_auto_allowed",
});
});
});
// ── auto_approved path (yolo mode) ───────────────────────────────────