Fix write tool activity mapping

This commit is contained in:
Mohamed Boudra
2026-05-25 20:59:44 +07:00
parent 53faba64ca
commit 893dd6d1fe
2 changed files with 25 additions and 0 deletions
@@ -245,6 +245,27 @@ describe("opencode tool-call mapper", () => {
});
});
it("maps completed write calls with OpenCode success text into canonical detail", () => {
const item = expectMapped(
mapOpencodeToolCall({
toolName: "write",
callId: "opencode-write-success-text",
status: "completed",
input: {
filePath: "/Users/moboudra/.paseo/worktrees/1luy0po7/cold-ladybug/dummy.txt",
content: "hello world\n",
},
output: "Wrote file successfully.",
}),
);
expect(item.detail).toEqual({
type: "write",
filePath: "/Users/moboudra/.paseo/worktrees/1luy0po7/cold-ladybug/dummy.txt",
content: "hello world\n",
});
});
it("maps skill calls to plain text detail with the loaded skill name", () => {
const item = expectMapped(
mapOpencodeToolCall({
@@ -387,6 +387,10 @@ export const ToolWriteInputSchema = z
}));
export const ToolWriteOutputSchema = z.union([
z.string().transform(() => ({
filePath: undefined,
content: undefined,
})),
z.intersection(ToolPathInputSchema, ToolWriteContentSchema).transform((value) => ({
filePath: value.filePath,
content: