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
@@ -128,8 +128,6 @@ export function makeToolRegistry(
): ToolRegistry {
return {
getAll: vi.fn().mockReturnValue([{ name: "read" }, { name: "bash" }]),
getActive: vi.fn().mockReturnValue(["read", "bash"]),
setActive: vi.fn(),
...overrides,
};
}
@@ -212,7 +210,7 @@ export function makeBashCommandCheck(opts: {
*
* The `session` override bag maps to the real collaborators:
* - `checkPermission` → applied to `permissionManager.checkPermission`
* - `getActiveSkillEntries`, `getInfrastructureReadDirs`, `getToolPreviewLimits`
* - `getActiveSkillEntries`, `getToolPreviewLimits`
* → applied as vi.spyOn overrides on the real session
* - `resolveAgentName` → applied as a vi.spyOn override on the real session
*
@@ -283,11 +281,6 @@ export function makeHandler(overrides?: {
so.getActiveSkillEntries,
);
}
if (so?.getInfrastructureReadDirs) {
vi.spyOn(session, "getInfrastructureReadDirs").mockImplementation(
so.getInfrastructureReadDirs,
);
}
if (so?.getToolPreviewLimits) {
vi.spyOn(session, "getToolPreviewLimits").mockImplementation(
so.getToolPreviewLimits,