fix: restore Anthropic OAuth tool dispatch
This commit is contained in:
@@ -170,8 +170,7 @@ describe("createClawdbotCodingTools", () => {
|
||||
|
||||
it("includes bash and process tools", () => {
|
||||
const tools = createClawdbotCodingTools();
|
||||
// NOTE: bash/read/write/edit are capitalized to bypass Anthropic OAuth blocking
|
||||
expect(tools.some((tool) => tool.name === "Bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "process")).toBe(true);
|
||||
});
|
||||
|
||||
@@ -213,9 +212,8 @@ describe("createClawdbotCodingTools", () => {
|
||||
expect(names.has("sessions_send")).toBe(false);
|
||||
expect(names.has("sessions_spawn")).toBe(false);
|
||||
|
||||
// NOTE: bash/read/write/edit are capitalized to bypass Anthropic OAuth blocking
|
||||
expect(names.has("Read")).toBe(true);
|
||||
expect(names.has("Bash")).toBe(true);
|
||||
expect(names.has("read")).toBe(true);
|
||||
expect(names.has("bash")).toBe(true);
|
||||
expect(names.has("process")).toBe(true);
|
||||
});
|
||||
|
||||
@@ -234,14 +232,12 @@ describe("createClawdbotCodingTools", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
// Tool names are capitalized for OAuth compatibility
|
||||
expect(tools.map((tool) => tool.name)).toEqual(["Read"]);
|
||||
expect(tools.map((tool) => tool.name)).toEqual(["read"]);
|
||||
});
|
||||
|
||||
it("keeps read tool image metadata intact", async () => {
|
||||
const tools = createClawdbotCodingTools();
|
||||
// NOTE: read is capitalized to bypass Anthropic OAuth blocking
|
||||
const readTool = tools.find((tool) => tool.name === "Read");
|
||||
const readTool = tools.find((tool) => tool.name === "read");
|
||||
expect(readTool).toBeDefined();
|
||||
|
||||
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-read-"));
|
||||
@@ -281,8 +277,7 @@ describe("createClawdbotCodingTools", () => {
|
||||
|
||||
it("returns text content without image blocks for text files", async () => {
|
||||
const tools = createClawdbotCodingTools();
|
||||
// NOTE: read is capitalized to bypass Anthropic OAuth blocking
|
||||
const readTool = tools.find((tool) => tool.name === "Read");
|
||||
const readTool = tools.find((tool) => tool.name === "read");
|
||||
expect(readTool).toBeDefined();
|
||||
|
||||
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-read-"));
|
||||
@@ -337,10 +332,8 @@ describe("createClawdbotCodingTools", () => {
|
||||
},
|
||||
};
|
||||
const tools = createClawdbotCodingTools({ sandbox });
|
||||
// NOTE: bash/read are capitalized to bypass Anthropic OAuth blocking
|
||||
// Policy matching is case-insensitive, so allow: ["bash"] matches tool named "Bash"
|
||||
expect(tools.some((tool) => tool.name === "Bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "Read")).toBe(false);
|
||||
expect(tools.some((tool) => tool.name === "bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "read")).toBe(false);
|
||||
expect(tools.some((tool) => tool.name === "browser")).toBe(false);
|
||||
});
|
||||
|
||||
@@ -370,18 +363,16 @@ describe("createClawdbotCodingTools", () => {
|
||||
},
|
||||
};
|
||||
const tools = createClawdbotCodingTools({ sandbox });
|
||||
// NOTE: read/write/edit are capitalized to bypass Anthropic OAuth blocking
|
||||
expect(tools.some((tool) => tool.name === "Read")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "Write")).toBe(false);
|
||||
expect(tools.some((tool) => tool.name === "Edit")).toBe(false);
|
||||
expect(tools.some((tool) => tool.name === "read")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "write")).toBe(false);
|
||||
expect(tools.some((tool) => tool.name === "edit")).toBe(false);
|
||||
});
|
||||
|
||||
it("filters tools by agent tool policy even without sandbox", () => {
|
||||
const tools = createClawdbotCodingTools({
|
||||
config: { tools: { deny: ["browser"] } },
|
||||
});
|
||||
// NOTE: bash is capitalized to bypass Anthropic OAuth blocking
|
||||
expect(tools.some((tool) => tool.name === "Bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "bash")).toBe(true);
|
||||
expect(tools.some((tool) => tool.name === "browser")).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user