fix: restore Anthropic OAuth tool dispatch
This commit is contained in:
@@ -28,9 +28,9 @@ describe("Agent-specific tool filtering", () => {
|
||||
});
|
||||
|
||||
const toolNames = tools.map((t) => t.name);
|
||||
expect(toolNames).toContain("Read");
|
||||
expect(toolNames).toContain("Write");
|
||||
expect(toolNames).not.toContain("Bash");
|
||||
expect(toolNames).toContain("read");
|
||||
expect(toolNames).toContain("write");
|
||||
expect(toolNames).not.toContain("bash");
|
||||
});
|
||||
|
||||
it("should keep global tool policy when agent only sets tools.elevated", () => {
|
||||
@@ -62,9 +62,9 @@ describe("Agent-specific tool filtering", () => {
|
||||
});
|
||||
|
||||
const toolNames = tools.map((t) => t.name);
|
||||
expect(toolNames).toContain("Bash");
|
||||
expect(toolNames).toContain("Read");
|
||||
expect(toolNames).not.toContain("Write");
|
||||
expect(toolNames).toContain("bash");
|
||||
expect(toolNames).toContain("read");
|
||||
expect(toolNames).not.toContain("write");
|
||||
});
|
||||
|
||||
it("should apply agent-specific tool policy", () => {
|
||||
@@ -95,10 +95,10 @@ describe("Agent-specific tool filtering", () => {
|
||||
});
|
||||
|
||||
const toolNames = tools.map((t) => t.name);
|
||||
expect(toolNames).toContain("Read");
|
||||
expect(toolNames).not.toContain("Bash");
|
||||
expect(toolNames).not.toContain("Write");
|
||||
expect(toolNames).not.toContain("Edit");
|
||||
expect(toolNames).toContain("read");
|
||||
expect(toolNames).not.toContain("bash");
|
||||
expect(toolNames).not.toContain("write");
|
||||
expect(toolNames).not.toContain("edit");
|
||||
});
|
||||
|
||||
it("should allow different tool policies for different agents", () => {
|
||||
@@ -130,9 +130,9 @@ describe("Agent-specific tool filtering", () => {
|
||||
agentDir: "/tmp/agent-main",
|
||||
});
|
||||
const mainToolNames = mainTools.map((t) => t.name);
|
||||
expect(mainToolNames).toContain("Bash");
|
||||
expect(mainToolNames).toContain("Write");
|
||||
expect(mainToolNames).toContain("Edit");
|
||||
expect(mainToolNames).toContain("bash");
|
||||
expect(mainToolNames).toContain("write");
|
||||
expect(mainToolNames).toContain("edit");
|
||||
|
||||
// family agent: restricted
|
||||
const familyTools = createClawdbotCodingTools({
|
||||
@@ -142,10 +142,10 @@ describe("Agent-specific tool filtering", () => {
|
||||
agentDir: "/tmp/agent-family",
|
||||
});
|
||||
const familyToolNames = familyTools.map((t) => t.name);
|
||||
expect(familyToolNames).toContain("Read");
|
||||
expect(familyToolNames).not.toContain("Bash");
|
||||
expect(familyToolNames).not.toContain("Write");
|
||||
expect(familyToolNames).not.toContain("Edit");
|
||||
expect(familyToolNames).toContain("read");
|
||||
expect(familyToolNames).not.toContain("bash");
|
||||
expect(familyToolNames).not.toContain("write");
|
||||
expect(familyToolNames).not.toContain("edit");
|
||||
});
|
||||
|
||||
it("should prefer agent-specific tool policy over global", () => {
|
||||
@@ -176,7 +176,7 @@ describe("Agent-specific tool filtering", () => {
|
||||
const toolNames = tools.map((t) => t.name);
|
||||
// Agent policy overrides global: browser is allowed again
|
||||
expect(toolNames).toContain("browser");
|
||||
expect(toolNames).not.toContain("Bash");
|
||||
expect(toolNames).not.toContain("bash");
|
||||
expect(toolNames).not.toContain("process");
|
||||
});
|
||||
|
||||
@@ -247,9 +247,9 @@ describe("Agent-specific tool filtering", () => {
|
||||
// Agent policy should be applied first, then sandbox
|
||||
// Agent allows only "read", sandbox allows ["read", "write", "bash"]
|
||||
// Result: only "read" (most restrictive wins)
|
||||
expect(toolNames).toContain("Read");
|
||||
expect(toolNames).not.toContain("Bash");
|
||||
expect(toolNames).not.toContain("Write");
|
||||
expect(toolNames).toContain("read");
|
||||
expect(toolNames).not.toContain("bash");
|
||||
expect(toolNames).not.toContain("write");
|
||||
});
|
||||
|
||||
it("should run bash synchronously when process is denied", async () => {
|
||||
@@ -265,7 +265,7 @@ describe("Agent-specific tool filtering", () => {
|
||||
workspaceDir: "/tmp/test-main",
|
||||
agentDir: "/tmp/agent-main",
|
||||
});
|
||||
const bash = tools.find((tool) => tool.name === "Bash");
|
||||
const bash = tools.find((tool) => tool.name === "bash");
|
||||
expect(bash).toBeDefined();
|
||||
|
||||
const result = await bash?.execute("call1", {
|
||||
|
||||
Reference in New Issue
Block a user