Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/permission/gate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ const AUTO_ALLOWED_TOOLS = new Set([
"search_agents",
"spawn_agent",
"wait_agents",
"list_agents",
"send_input",
"interrupt_agent",
"close_agent",
"resume_agent",
"read_agent_trace",
]);

export interface PermissionGateOptions {
Expand Down
36 changes: 36 additions & 0 deletions src/permission/permission.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1553,13 +1553,49 @@ describe("createPermissionGate", () => {
"search_agents",
"spawn_agent",
"wait_agents",
"list_agents",
"send_input",
"interrupt_agent",
"close_agent",
"resume_agent",
"read_agent_trace",
]) {
const verdict = await gate.evaluate({ id: "c", name, arguments: {} });
expect(verdict.allowed).toBe(true);
}
expect(asked).toBe(0);
});

test("ask mode prompts for fleet continuation tools", async () => {
let asked = 0;
let approval = false;
const gate = createPermissionGate({
approvals: [],
requestApproval: async () => {
asked++;
return { allow: approval };
},
interactive: true,
skipPermissions: false,
reactorGated: false,
auto: false,
});
const tools = [
"list_agents",
"send_input",
"interrupt_agent",
"close_agent",
"resume_agent",
"read_agent_trace",
];
for (const [index, name] of tools.entries()) {
approval = index % 2 === 0;
const verdict = await gate.evaluate({ id: "c", name, arguments: {} });
expect(verdict.allowed).toBe(approval);
}
expect(asked).toBe(tools.length);
});

// manage_tasks's handler has no side effect — the task list is mutated
// earlier by the director, before this tool ever executes — so denying it
// cannot undo anything. It auto-allows unconditionally, not just in auto
Expand Down
Loading