TypeScript SDK excludes in-progress file change status from streamed events
Description
The TypeScript SDK types FileChangeItem.status as only "completed" | "failed", but streamed item.started events can contain "in_progress". This prevents a type-checked consumer from explicitly handling the start of a patch.
Reproduction
With @openai/[email protected], TypeScript 5.9, and @modelcontextprotocol/sdk installed, type-check:
import type { ThreadEvent } from "@openai/codex-sdk";
export function onEvent(event: ThreadEvent) {
if (event.type === "item.started" && event.item.type === "file_change") {
if (event.item.status === "in_progress") console.log("Applying patch");
}
}
tsc --noEmit --strict --module NodeNext --moduleResolution NodeNext --target ES2022 repro.mts reports TS2367: the types have no overlap.
I also ran runStreamed() against the 0.167.2 CLI with an isolated local mock Responses provider that returned an apply_patch tool call. It emitted a file_change item with status: "in_progress" on item.started, followed by the same item with status: "completed" on item.completed; the patch created the expected test file. No external model was required.
Current main (6bfdc75) maps the in-progress status, while the SDK type excludes it.
Suggested fix
Add "in_progress" to PatchApplyStatus, update the comment that says file changes are emitted only as completed events, and cover the started event in an SDK streaming/type test.
I also reproduced this on macOS with CLI 0.169.0-alpha.11.1. A local mock Responses server requested an apply_patch call in a temporary workspace. Through thread.runStreamed(), the CLI emitted an item.started event with type: "file_change" and status: "in_progress".
The fork adds "in_progress" to PatchApplyStatus. Its regression checks that the CLI emits the started event and that its status satisfies the public FileChangeItem type. The type assertion failed against d8d840d and passes with the fix. Fix and regression test on my fork.