From 76d346461e1fbe84e45fc5f0712ceefbf431e0ac Mon Sep 17 00:00:00 2001 From: Trevor Creech Date: Fri, 16 May 2025 12:33:05 -0700 Subject: [PATCH] chore: update openai sdk and types --- codex-cli/package.json | 2 +- .../components/chat/terminal-chat-response-item.tsx | 10 ++++------ codex-cli/src/utils/agent/agent-loop.ts | 12 +++--------- pnpm-lock.yaml | 8 ++++---- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/codex-cli/package.json b/codex-cli/package.json index 524e40655d..67f2d10a1b 100644 --- a/codex-cli/package.json +++ b/codex-cli/package.json @@ -42,7 +42,7 @@ "marked-terminal": "^7.3.0", "meow": "^13.2.0", "open": "^10.1.0", - "openai": "^4.95.1", + "openai": "^4.99.0", "package-manager-detector": "^1.2.0", "react": "^18.2.0", "shell-quote": "^1.8.2", diff --git a/codex-cli/src/components/chat/terminal-chat-response-item.tsx b/codex-cli/src/components/chat/terminal-chat-response-item.tsx index bab4aa317f..5d386132dd 100644 --- a/codex-cli/src/components/chat/terminal-chat-response-item.tsx +++ b/codex-cli/src/components/chat/terminal-chat-response-item.tsx @@ -3,6 +3,8 @@ import type { TerminalRendererOptions } from "marked-terminal"; import type { ResponseFunctionToolCallItem, ResponseFunctionToolCallOutputItem, + ResponseLocalShellCallItem, + ResponseLocalShellCallOutputItem, ResponseInputMessageItem, ResponseItem, ResponseOutputMessage, @@ -42,11 +44,9 @@ export default function TerminalChatResponseItem({ fileOpener={fileOpener} /> ); - // @ts-expect-error new item types aren't in SDK yet case "local_shell_call": case "function_call": return ; - // @ts-expect-error new item types aren't in SDK yet case "local_shell_call_output": case "function_call_output": return ( @@ -171,8 +171,7 @@ function TerminalChatResponseMessage({ function TerminalChatResponseToolCall({ message, }: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - message: ResponseFunctionToolCallItem | any; + message: ResponseFunctionToolCallItem | ResponseLocalShellCallItem; }) { let workdir: string | undefined; let cmdReadableText: string | undefined; @@ -202,8 +201,7 @@ function TerminalChatResponseToolCallOutput({ message, fullStdout, }: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - message: ResponseFunctionToolCallOutputItem | any; + message: ResponseFunctionToolCallOutputItem | ResponseLocalShellCallOutputItem; fullStdout: boolean; }) { const { output, metadata } = parseToolCallOutput(message.output); diff --git a/codex-cli/src/utils/agent/agent-loop.ts b/codex-cli/src/utils/agent/agent-loop.ts index 9198e7fd1c..3627fd9dd0 100644 --- a/codex-cli/src/utils/agent/agent-loop.ts +++ b/codex-cli/src/utils/agent/agent-loop.ts @@ -4,6 +4,7 @@ import type { AppConfig } from "../config.js"; import type { ResponseEvent } from "../responses.js"; import type { ResponseFunctionToolCall, + ResponseLocalShellCall, ResponseInputItem, ResponseItem, ResponseCreateParams, @@ -110,7 +111,6 @@ const shellFunctionTool: FunctionTool = { }; const localShellTool: Tool = { - //@ts-expect-error - waiting on sdk type: "local_shell", }; @@ -468,8 +468,7 @@ export class AgentLoop { } private async handleLocalShellCall( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - item: any, + item: ResponseLocalShellCall, ): Promise> { // If the agent has been canceled in the meantime we should not perform any // additional work. Returning an empty array ensures that we neither execute @@ -480,8 +479,7 @@ export class AgentLoop { return []; } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const outputItem: any = { + const outputItem: ResponseInputItem.LocalShellCallOutput = { type: "local_shell_call_output", // `call_id` is mandatory – ensure we never send `undefined` which would // trigger the "No tool output found…" 400 from the API. @@ -726,7 +724,6 @@ export class AgentLoop { if ( (item as ResponseInputItem).type === "function_call" || (item as ResponseInputItem).type === "reasoning" || - //@ts-expect-error - waiting on sdk (item as ResponseInputItem).type === "local_shell_call" || ((item as ResponseInputItem).type === "message" && // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -1579,13 +1576,10 @@ export class AgentLoop { // eslint-disable-next-line no-await-in-loop const result = await this.handleFunctionCall(item); turnInput.push(...result); - //@ts-expect-error - waiting on sdk } else if (item.type === "local_shell_call") { - //@ts-expect-error - waiting on sdk if (alreadyProcessedResponses.has(item.id)) { continue; } - //@ts-expect-error - waiting on sdk alreadyProcessedResponses.add(item.id); // eslint-disable-next-line no-await-in-loop const result = await this.handleLocalShellCall(item); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 00b8f63e27..9a9bae9467 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: ^10.1.0 version: 10.1.1 openai: - specifier: ^4.95.1 - version: 4.95.1(ws@8.18.1)(zod@3.24.3) + specifier: ^4.99.0 + version: 4.99.0(ws@8.18.1)(zod@3.24.3) package-manager-detector: specifier: ^1.2.0 version: 1.2.0 @@ -1836,7 +1836,7 @@ packages: resolution: {integrity: sha512-zy1wx4+P3PfhXSEPJNtZmJXfhkkIaxU1VauWIrDZw1O7uJRDRJtKr9n3Ic4NgbA16KyOxOXO2ng9gYwCdXuSXA==} engines: {node: '>=18'} - openai@4.95.1: + openai@4.99.0: resolution: {integrity: sha512-IqJy+ymeW+k/Wq+2YVN3693OQMMcODRtHEYOlz263MdUwnN/Dwdl9c2EXSxLLtGEHkSHAfvzpDMHI5MaWJKXjQ==} hasBin: true peerDependencies: @@ -4254,7 +4254,7 @@ snapshots: is-inside-container: 1.0.0 is-wsl: 3.1.0 - openai@4.95.1(ws@8.18.1)(zod@3.24.3): + openai@4.99.0(ws@8.18.1)(zod@3.24.3): dependencies: '@types/node': 18.19.86 '@types/node-fetch': 2.6.12