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
2 changes: 1 addition & 1 deletion src/responses/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function buildTools(tools: unknown[] | undefined): OcxTool[] | undefined {
out.push({
name: t.name,
description: (t.description as string) ?? "",
parameters: { type: "object", properties: { input: { type: "string", description: "Raw tool input (verbatim body, e.g. the apply_patch envelope)." } }, required: ["input"] },
parameters: { type: "object", properties: { input: { type: "string", description: "Raw tool input. For apply_patch, begin exactly with `*** Begin Patch` (no trailing `***`), then use its standard patch envelope." } }, required: ["input"] },
freeform: true,
});
}
Expand Down
20 changes: 20 additions & 0 deletions tests/responses-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ import { describe, expect, test } from "bun:test";
import { parseRequest } from "../src/responses/parser";

describe("Responses parser", () => {
test("describes the exact apply_patch freeform envelope", () => {
const parsed = parseRequest({
model: "xai/grok-4.5",
input: "Update a file",
tools: [{ type: "custom", name: "apply_patch", description: "Apply a patch" }],
});

expect(parsed.context.tools?.[0]).toMatchObject({
name: "apply_patch",
freeform: true,
parameters: {
properties: {
input: {
description: expect.stringContaining("begin exactly with `*** Begin Patch`"),
},
},
},
});
});

test("preserves assistant message phase when replaying Responses output", () => {
const parsed = parseRequest({
model: "kiro/gpt-5.6-sol",
Expand Down
Loading