diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index 62d2ffae3..d9ee0f608 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -1434,7 +1434,6 @@ dependencies = [ "codex-chatgpt", "codex-cloud-requirements", "codex-core", - "codex-execpolicy", "codex-feedback", "codex-file-search", "codex-login", @@ -1449,7 +1448,6 @@ dependencies = [ "codex-utils-json-to-toml", "core_test_support", "futures", - "os_info", "owo-colors", "pretty_assertions", "rmcp", diff --git a/codex-rs/app-server-protocol/schema/typescript/AddConversationListenerParams.ts b/codex-rs/app-server-protocol/schema/typescript/AddConversationListenerParams.ts deleted file mode 100644 index 6441bed68..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AddConversationListenerParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type AddConversationListenerParams = { conversationId: ThreadId, experimentalRawEvents: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AddConversationSubscriptionResponse.ts b/codex-rs/app-server-protocol/schema/typescript/AddConversationSubscriptionResponse.ts deleted file mode 100644 index f7e34ef65..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AddConversationSubscriptionResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AddConversationSubscriptionResponse = { subscriptionId: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentMessageContent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentMessageContent.ts deleted file mode 100644 index dc2cfb77e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentMessageContent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentMessageContent = { "type": "Text", text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentMessageContentDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentMessageContentDeltaEvent.ts deleted file mode 100644 index 1473a4f2b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentMessageContentDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentMessageContentDeltaEvent = { thread_id: string, turn_id: string, item_id: string, delta: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentMessageDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentMessageDeltaEvent.ts deleted file mode 100644 index 1e12d85fb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentMessageDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentMessageDeltaEvent = { delta: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentMessageEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentMessageEvent.ts deleted file mode 100644 index b32680055..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentMessageEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MessagePhase } from "./MessagePhase"; - -export type AgentMessageEvent = { message: string, phase: MessagePhase | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentMessageItem.ts b/codex-rs/app-server-protocol/schema/typescript/AgentMessageItem.ts deleted file mode 100644 index ee67a3e23..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentMessageItem.ts +++ /dev/null @@ -1,21 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentMessageContent } from "./AgentMessageContent"; -import type { MessagePhase } from "./MessagePhase"; - -/** - * Assistant-authored message payload used in turn-item streams. - * - * `phase` is optional because not all providers/models emit it. Consumers - * should use it when present, but retain legacy completion semantics when it - * is `None`. - */ -export type AgentMessageItem = { id: string, content: Array, -/** - * Optional phase metadata carried through from `ResponseItem::Message`. - * - * This is currently used by TUI rendering to distinguish mid-turn - * commentary from a final answer and avoid status-indicator jitter. - */ -phase?: MessagePhase, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentReasoningDeltaEvent.ts deleted file mode 100644 index fc2c22193..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentReasoningDeltaEvent = { delta: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentReasoningEvent.ts deleted file mode 100644 index bf0062cd4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentReasoningEvent = { text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentDeltaEvent.ts deleted file mode 100644 index fcfa816f5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentReasoningRawContentDeltaEvent = { delta: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentEvent.ts deleted file mode 100644 index 364c27822..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningRawContentEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentReasoningRawContentEvent = { text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningSectionBreakEvent.ts b/codex-rs/app-server-protocol/schema/typescript/AgentReasoningSectionBreakEvent.ts deleted file mode 100644 index 604aceed9..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentReasoningSectionBreakEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type AgentReasoningSectionBreakEvent = { item_id: string, summary_index: bigint, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/AgentStatus.ts b/codex-rs/app-server-protocol/schema/typescript/AgentStatus.ts deleted file mode 100644 index ddf6789c7..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AgentStatus.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Agent lifecycle status, derived from emitted events. - */ -export type AgentStatus = "pending_init" | "running" | { "completed": string | null } | { "errored": string } | "shutdown" | "not_found"; diff --git a/codex-rs/app-server-protocol/schema/typescript/ApplyPatchApprovalRequestEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ApplyPatchApprovalRequestEvent.ts deleted file mode 100644 index 0c53cf50b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ApplyPatchApprovalRequestEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileChange } from "./FileChange"; - -export type ApplyPatchApprovalRequestEvent = { -/** - * Responses API call id for the associated patch apply call, if available. - */ -call_id: string, -/** - * Turn ID that this patch belongs to. - * Uses `#[serde(default)]` for backwards compatibility with older senders. - */ -turn_id: string, changes: { [key in string]?: FileChange }, -/** - * Optional explanatory reason (e.g. request for extra write access). - */ -reason: string | null, -/** - * When set, the agent is asking the user to allow writes under this root for the remainder of the session. - */ -grant_root: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationParams.ts b/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationParams.ts deleted file mode 100644 index 61fbcc9fc..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type ArchiveConversationParams = { conversationId: ThreadId, rolloutPath: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationResponse.ts b/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationResponse.ts deleted file mode 100644 index 24900592b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ArchiveConversationResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ArchiveConversationResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/AskForApproval.ts b/codex-rs/app-server-protocol/schema/typescript/AskForApproval.ts deleted file mode 100644 index 227eb44e7..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AskForApproval.ts +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RejectConfig } from "./RejectConfig"; - -/** - * Determines the conditions under which the user is consulted to approve - * running the command proposed by Codex. - */ -export type AskForApproval = "untrusted" | "on-failure" | "on-request" | { "reject": RejectConfig } | "never"; diff --git a/codex-rs/app-server-protocol/schema/typescript/AuthStatusChangeNotification.ts b/codex-rs/app-server-protocol/schema/typescript/AuthStatusChangeNotification.ts deleted file mode 100644 index 17cb442fe..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/AuthStatusChangeNotification.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AuthMode } from "./AuthMode"; - -/** - * Deprecated notification. Use AccountUpdatedNotification instead. - */ -export type AuthStatusChangeNotification = { authMethod: AuthMode | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/BackgroundEventEvent.ts b/codex-rs/app-server-protocol/schema/typescript/BackgroundEventEvent.ts deleted file mode 100644 index 236b1dd88..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/BackgroundEventEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type BackgroundEventEvent = { message: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ByteRange.ts b/codex-rs/app-server-protocol/schema/typescript/ByteRange.ts deleted file mode 100644 index ab36a79ac..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ByteRange.ts +++ /dev/null @@ -1,13 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ByteRange = { -/** - * Start byte offset (inclusive) within the UTF-8 text buffer. - */ -start: number, -/** - * End byte offset (exclusive) within the UTF-8 text buffer. - */ -end: number, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CallToolResult.ts b/codex-rs/app-server-protocol/schema/typescript/CallToolResult.ts deleted file mode 100644 index e7a471d46..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CallToolResult.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The server's response to a tool call. - */ -export type CallToolResult = { content: Array, structuredContent?: JsonValue, isError?: boolean, _meta?: JsonValue, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptParams.ts b/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptParams.ts deleted file mode 100644 index dae8e8c78..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptParams.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CancelLoginChatGptParams = { loginId: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptResponse.ts b/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptResponse.ts deleted file mode 100644 index 004e6f8ea..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CancelLoginChatGptResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CancelLoginChatGptResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts index 970764400..f6df83b6e 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts @@ -1,26 +1,12 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AddConversationListenerParams } from "./AddConversationListenerParams"; -import type { ArchiveConversationParams } from "./ArchiveConversationParams"; -import type { CancelLoginChatGptParams } from "./CancelLoginChatGptParams"; -import type { ExecOneOffCommandParams } from "./ExecOneOffCommandParams"; -import type { ForkConversationParams } from "./ForkConversationParams"; import type { FuzzyFileSearchParams } from "./FuzzyFileSearchParams"; import type { GetAuthStatusParams } from "./GetAuthStatusParams"; import type { GetConversationSummaryParams } from "./GetConversationSummaryParams"; import type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams"; import type { InitializeParams } from "./InitializeParams"; -import type { InterruptConversationParams } from "./InterruptConversationParams"; -import type { ListConversationsParams } from "./ListConversationsParams"; -import type { LoginApiKeyParams } from "./LoginApiKeyParams"; -import type { NewConversationParams } from "./NewConversationParams"; -import type { RemoveConversationListenerParams } from "./RemoveConversationListenerParams"; import type { RequestId } from "./RequestId"; -import type { ResumeConversationParams } from "./ResumeConversationParams"; -import type { SendUserMessageParams } from "./SendUserMessageParams"; -import type { SendUserTurnParams } from "./SendUserTurnParams"; -import type { SetDefaultModelParams } from "./SetDefaultModelParams"; import type { AppsListParams } from "./v2/AppsListParams"; import type { CancelLoginAccountParams } from "./v2/CancelLoginAccountParams"; import type { CommandExecParams } from "./v2/CommandExecParams"; @@ -61,4 +47,4 @@ import type { WindowsSandboxSetupStartParams } from "./v2/WindowsSandboxSetupSta /** * Request from the client to the server. */ -export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/remote/list", id: RequestId, params: SkillsRemoteReadParams, } | { "method": "skills/remote/export", id: RequestId, params: SkillsRemoteWriteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "newConversation", id: RequestId, params: NewConversationParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "listConversations", id: RequestId, params: ListConversationsParams, } | { "method": "resumeConversation", id: RequestId, params: ResumeConversationParams, } | { "method": "forkConversation", id: RequestId, params: ForkConversationParams, } | { "method": "archiveConversation", id: RequestId, params: ArchiveConversationParams, } | { "method": "sendUserMessage", id: RequestId, params: SendUserMessageParams, } | { "method": "sendUserTurn", id: RequestId, params: SendUserTurnParams, } | { "method": "interruptConversation", id: RequestId, params: InterruptConversationParams, } | { "method": "addConversationListener", id: RequestId, params: AddConversationListenerParams, } | { "method": "removeConversationListener", id: RequestId, params: RemoveConversationListenerParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "loginApiKey", id: RequestId, params: LoginApiKeyParams, } | { "method": "loginChatGpt", id: RequestId, params: undefined, } | { "method": "cancelLoginChatGpt", id: RequestId, params: CancelLoginChatGptParams, } | { "method": "logoutChatGpt", id: RequestId, params: undefined, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "getUserSavedConfig", id: RequestId, params: undefined, } | { "method": "setDefaultModel", id: RequestId, params: SetDefaultModelParams, } | { "method": "getUserAgent", id: RequestId, params: undefined, } | { "method": "userInfo", id: RequestId, params: undefined, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, } | { "method": "execOneOffCommand", id: RequestId, params: ExecOneOffCommandParams, }; +export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/remote/list", id: RequestId, params: SkillsRemoteReadParams, } | { "method": "skills/remote/export", id: RequestId, params: SkillsRemoteWriteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CodexErrorInfo.ts b/codex-rs/app-server-protocol/schema/typescript/CodexErrorInfo.ts deleted file mode 100644 index 522b91ce2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CodexErrorInfo.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Codex errors that we expose to clients. - */ -export type CodexErrorInfo = "context_window_exceeded" | "usage_limit_exceeded" | "server_overloaded" | { "http_connection_failed": { http_status_code: number | null, } } | { "response_stream_connection_failed": { http_status_code: number | null, } } | "internal_server_error" | "unauthorized" | "bad_request" | "sandbox_error" | { "response_stream_disconnected": { http_status_code: number | null, } } | { "response_too_many_failed_attempts": { http_status_code: number | null, } } | "thread_rollback_failed" | "other"; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionBeginEvent.ts deleted file mode 100644 index 710974199..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionBeginEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentInteractionBeginEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, -/** - * Prompt sent from the sender to the receiver. Can be empty to prevent CoT - * leaking at the beginning. - */ -prompt: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionEndEvent.ts deleted file mode 100644 index 5458e06dc..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentInteractionEndEvent.ts +++ /dev/null @@ -1,36 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentInteractionEndEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, -/** - * Optional nickname assigned to the receiver agent. - */ -receiver_agent_nickname?: string | null, -/** - * Optional role assigned to the receiver agent. - */ -receiver_agent_role?: string | null, -/** - * Prompt sent from the sender to the receiver. Can be empty to prevent CoT - * leaking at the beginning. - */ -prompt: string, -/** - * Last known status of the receiver agent reported to the sender agent. - */ -status: AgentStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentRef.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentRef.ts deleted file mode 100644 index cae7bf88b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentRef.ts +++ /dev/null @@ -1,18 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentRef = { -/** - * Thread ID of the receiver/new agent. - */ -thread_id: ThreadId, -/** - * Optional nickname assigned to an AgentControl-spawned sub-agent. - */ -agent_nickname?: string | null, -/** - * Optional role (agent_role) assigned to an AgentControl-spawned sub-agent. - */ -agent_role?: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnBeginEvent.ts deleted file mode 100644 index a86598e20..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnBeginEvent.ts +++ /dev/null @@ -1,19 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentSpawnBeginEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Initial prompt sent to the agent. Can be empty to prevent CoT leaking at the - * beginning. - */ -prompt: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnEndEvent.ts deleted file mode 100644 index 34753c8e0..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentSpawnEndEvent.ts +++ /dev/null @@ -1,36 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentSpawnEndEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the newly spawned agent, if it was created. - */ -new_thread_id: ThreadId | null, -/** - * Optional nickname assigned to the new agent. - */ -new_agent_nickname?: string | null, -/** - * Optional role assigned to the new agent. - */ -new_agent_role?: string | null, -/** - * Initial prompt sent to the agent. Can be empty to prevent CoT leaking at the - * beginning. - */ -prompt: string, -/** - * Last known status of the new agent reported to the sender agent. - */ -status: AgentStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabAgentStatusEntry.ts b/codex-rs/app-server-protocol/schema/typescript/CollabAgentStatusEntry.ts deleted file mode 100644 index 286d19423..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabAgentStatusEntry.ts +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { ThreadId } from "./ThreadId"; - -export type CollabAgentStatusEntry = { -/** - * Thread ID of the receiver/new agent. - */ -thread_id: ThreadId, -/** - * Optional nickname assigned to an AgentControl-spawned sub-agent. - */ -agent_nickname?: string | null, -/** - * Optional role (agent_role) assigned to an AgentControl-spawned sub-agent. - */ -agent_role?: string | null, -/** - * Last known status of the agent. - */ -status: AgentStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabCloseBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabCloseBeginEvent.ts deleted file mode 100644 index 355d59523..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabCloseBeginEvent.ts +++ /dev/null @@ -1,18 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type CollabCloseBeginEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabCloseEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabCloseEndEvent.ts deleted file mode 100644 index 171886f1e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabCloseEndEvent.ts +++ /dev/null @@ -1,32 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { ThreadId } from "./ThreadId"; - -export type CollabCloseEndEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, -/** - * Optional nickname assigned to the receiver agent. - */ -receiver_agent_nickname?: string | null, -/** - * Optional role assigned to the receiver agent. - */ -receiver_agent_role?: string | null, -/** - * Last known status of the receiver agent reported to the sender agent before - * the close. - */ -status: AgentStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabResumeBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabResumeBeginEvent.ts deleted file mode 100644 index e6c1c3d5c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabResumeBeginEvent.ts +++ /dev/null @@ -1,26 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type CollabResumeBeginEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, -/** - * Optional nickname assigned to the receiver agent. - */ -receiver_agent_nickname?: string | null, -/** - * Optional role assigned to the receiver agent. - */ -receiver_agent_role?: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabResumeEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabResumeEndEvent.ts deleted file mode 100644 index caf970ec2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabResumeEndEvent.ts +++ /dev/null @@ -1,32 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { ThreadId } from "./ThreadId"; - -export type CollabResumeEndEvent = { -/** - * Identifier for the collab tool call. - */ -call_id: string, -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receiver. - */ -receiver_thread_id: ThreadId, -/** - * Optional nickname assigned to the receiver agent. - */ -receiver_agent_nickname?: string | null, -/** - * Optional role assigned to the receiver agent. - */ -receiver_agent_role?: string | null, -/** - * Last known status of the receiver agent reported to the sender agent after - * resume. - */ -status: AgentStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabWaitingBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabWaitingBeginEvent.ts deleted file mode 100644 index f2f07f87e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabWaitingBeginEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CollabAgentRef } from "./CollabAgentRef"; -import type { ThreadId } from "./ThreadId"; - -export type CollabWaitingBeginEvent = { -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * Thread ID of the receivers. - */ -receiver_thread_ids: Array, -/** - * Optional nicknames/roles for receivers. - */ -receiver_agents?: Array, -/** - * ID of the waiting call. - */ -call_id: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CollabWaitingEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/CollabWaitingEndEvent.ts deleted file mode 100644 index 929d59c61..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CollabWaitingEndEvent.ts +++ /dev/null @@ -1,24 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentStatus } from "./AgentStatus"; -import type { CollabAgentStatusEntry } from "./CollabAgentStatusEntry"; -import type { ThreadId } from "./ThreadId"; - -export type CollabWaitingEndEvent = { -/** - * Thread ID of the sender. - */ -sender_thread_id: ThreadId, -/** - * ID of the waiting call. - */ -call_id: string, -/** - * Optional receiver metadata paired with final statuses. - */ -agent_statuses?: Array, -/** - * Last known status of the receiver agents reported to the sender agent. - */ -statuses: { [key in ThreadId]?: AgentStatus }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ContextCompactedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ContextCompactedEvent.ts deleted file mode 100644 index 538ca7a1b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ContextCompactedEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ContextCompactedEvent = null; diff --git a/codex-rs/app-server-protocol/schema/typescript/ContextCompactionItem.ts b/codex-rs/app-server-protocol/schema/typescript/ContextCompactionItem.ts deleted file mode 100644 index dc3ab6388..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ContextCompactionItem.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ContextCompactionItem = { id: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CreditsSnapshot.ts b/codex-rs/app-server-protocol/schema/typescript/CreditsSnapshot.ts deleted file mode 100644 index 737bf99be..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CreditsSnapshot.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CreditsSnapshot = { has_credits: boolean, unlimited: boolean, balance: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/CustomPrompt.ts b/codex-rs/app-server-protocol/schema/typescript/CustomPrompt.ts deleted file mode 100644 index 96fe75e96..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/CustomPrompt.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CustomPrompt = { name: string, path: string, content: string, description: string | null, argument_hint: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/DeprecationNoticeEvent.ts b/codex-rs/app-server-protocol/schema/typescript/DeprecationNoticeEvent.ts deleted file mode 100644 index c1a7d8131..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/DeprecationNoticeEvent.ts +++ /dev/null @@ -1,13 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type DeprecationNoticeEvent = { -/** - * Concise summary of what is deprecated. - */ -summary: string, -/** - * Optional extra guidance, such as migration steps or rationale. - */ -details: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallOutputContentItem.ts b/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallOutputContentItem.ts deleted file mode 100644 index 8f432109d..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallOutputContentItem.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type DynamicToolCallOutputContentItem = { "type": "inputText", text: string, } | { "type": "inputImage", imageUrl: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallRequest.ts b/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallRequest.ts deleted file mode 100644 index 94b0c65c6..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallRequest.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -export type DynamicToolCallRequest = { callId: string, turnId: string, tool: string, arguments: JsonValue, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallResponseEvent.ts deleted file mode 100644 index 442c0ce6f..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/DynamicToolCallResponseEvent.ts +++ /dev/null @@ -1,39 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputContentItem"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type DynamicToolCallResponseEvent = { -/** - * Identifier for the corresponding DynamicToolCallRequest. - */ -call_id: string, -/** - * Turn ID that this dynamic tool call belongs to. - */ -turn_id: string, -/** - * Dynamic tool name. - */ -tool: string, -/** - * Dynamic tool call arguments. - */ -arguments: JsonValue, -/** - * Dynamic tool response content items. - */ -content_items: Array, -/** - * Whether the tool call succeeded. - */ -success: boolean, -/** - * Optional error text when the tool call failed before producing a response. - */ -error: string | null, -/** - * The duration of the dynamic tool call. - */ -duration: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ElicitationRequestEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ElicitationRequestEvent.ts deleted file mode 100644 index 045e304bd..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ElicitationRequestEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ElicitationRequestEvent = { server_name: string, id: string | number, message: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ErrorEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ErrorEvent.ts deleted file mode 100644 index fafde767e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ErrorEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CodexErrorInfo } from "./CodexErrorInfo"; - -export type ErrorEvent = { message: string, codex_error_info: CodexErrorInfo | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts b/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts deleted file mode 100644 index 5ccbe1e69..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts +++ /dev/null @@ -1,82 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentMessageContentDeltaEvent } from "./AgentMessageContentDeltaEvent"; -import type { AgentMessageDeltaEvent } from "./AgentMessageDeltaEvent"; -import type { AgentMessageEvent } from "./AgentMessageEvent"; -import type { AgentReasoningDeltaEvent } from "./AgentReasoningDeltaEvent"; -import type { AgentReasoningEvent } from "./AgentReasoningEvent"; -import type { AgentReasoningRawContentDeltaEvent } from "./AgentReasoningRawContentDeltaEvent"; -import type { AgentReasoningRawContentEvent } from "./AgentReasoningRawContentEvent"; -import type { AgentReasoningSectionBreakEvent } from "./AgentReasoningSectionBreakEvent"; -import type { ApplyPatchApprovalRequestEvent } from "./ApplyPatchApprovalRequestEvent"; -import type { BackgroundEventEvent } from "./BackgroundEventEvent"; -import type { CollabAgentInteractionBeginEvent } from "./CollabAgentInteractionBeginEvent"; -import type { CollabAgentInteractionEndEvent } from "./CollabAgentInteractionEndEvent"; -import type { CollabAgentSpawnBeginEvent } from "./CollabAgentSpawnBeginEvent"; -import type { CollabAgentSpawnEndEvent } from "./CollabAgentSpawnEndEvent"; -import type { CollabCloseBeginEvent } from "./CollabCloseBeginEvent"; -import type { CollabCloseEndEvent } from "./CollabCloseEndEvent"; -import type { CollabResumeBeginEvent } from "./CollabResumeBeginEvent"; -import type { CollabResumeEndEvent } from "./CollabResumeEndEvent"; -import type { CollabWaitingBeginEvent } from "./CollabWaitingBeginEvent"; -import type { CollabWaitingEndEvent } from "./CollabWaitingEndEvent"; -import type { ContextCompactedEvent } from "./ContextCompactedEvent"; -import type { DeprecationNoticeEvent } from "./DeprecationNoticeEvent"; -import type { DynamicToolCallRequest } from "./DynamicToolCallRequest"; -import type { DynamicToolCallResponseEvent } from "./DynamicToolCallResponseEvent"; -import type { ElicitationRequestEvent } from "./ElicitationRequestEvent"; -import type { ErrorEvent } from "./ErrorEvent"; -import type { ExecApprovalRequestEvent } from "./ExecApprovalRequestEvent"; -import type { ExecCommandBeginEvent } from "./ExecCommandBeginEvent"; -import type { ExecCommandEndEvent } from "./ExecCommandEndEvent"; -import type { ExecCommandOutputDeltaEvent } from "./ExecCommandOutputDeltaEvent"; -import type { ExitedReviewModeEvent } from "./ExitedReviewModeEvent"; -import type { GetHistoryEntryResponseEvent } from "./GetHistoryEntryResponseEvent"; -import type { ItemCompletedEvent } from "./ItemCompletedEvent"; -import type { ItemStartedEvent } from "./ItemStartedEvent"; -import type { ListCustomPromptsResponseEvent } from "./ListCustomPromptsResponseEvent"; -import type { ListRemoteSkillsResponseEvent } from "./ListRemoteSkillsResponseEvent"; -import type { ListSkillsResponseEvent } from "./ListSkillsResponseEvent"; -import type { McpListToolsResponseEvent } from "./McpListToolsResponseEvent"; -import type { McpStartupCompleteEvent } from "./McpStartupCompleteEvent"; -import type { McpStartupUpdateEvent } from "./McpStartupUpdateEvent"; -import type { McpToolCallBeginEvent } from "./McpToolCallBeginEvent"; -import type { McpToolCallEndEvent } from "./McpToolCallEndEvent"; -import type { ModelRerouteEvent } from "./ModelRerouteEvent"; -import type { PatchApplyBeginEvent } from "./PatchApplyBeginEvent"; -import type { PatchApplyEndEvent } from "./PatchApplyEndEvent"; -import type { PlanDeltaEvent } from "./PlanDeltaEvent"; -import type { RawResponseItemEvent } from "./RawResponseItemEvent"; -import type { RealtimeConversationClosedEvent } from "./RealtimeConversationClosedEvent"; -import type { RealtimeConversationRealtimeEvent } from "./RealtimeConversationRealtimeEvent"; -import type { RealtimeConversationStartedEvent } from "./RealtimeConversationStartedEvent"; -import type { ReasoningContentDeltaEvent } from "./ReasoningContentDeltaEvent"; -import type { ReasoningRawContentDeltaEvent } from "./ReasoningRawContentDeltaEvent"; -import type { RemoteSkillDownloadedEvent } from "./RemoteSkillDownloadedEvent"; -import type { RequestUserInputEvent } from "./RequestUserInputEvent"; -import type { ReviewRequest } from "./ReviewRequest"; -import type { SessionConfiguredEvent } from "./SessionConfiguredEvent"; -import type { StreamErrorEvent } from "./StreamErrorEvent"; -import type { TerminalInteractionEvent } from "./TerminalInteractionEvent"; -import type { ThreadNameUpdatedEvent } from "./ThreadNameUpdatedEvent"; -import type { ThreadRolledBackEvent } from "./ThreadRolledBackEvent"; -import type { TokenCountEvent } from "./TokenCountEvent"; -import type { TurnAbortedEvent } from "./TurnAbortedEvent"; -import type { TurnCompleteEvent } from "./TurnCompleteEvent"; -import type { TurnDiffEvent } from "./TurnDiffEvent"; -import type { TurnStartedEvent } from "./TurnStartedEvent"; -import type { UndoCompletedEvent } from "./UndoCompletedEvent"; -import type { UndoStartedEvent } from "./UndoStartedEvent"; -import type { UpdatePlanArgs } from "./UpdatePlanArgs"; -import type { UserMessageEvent } from "./UserMessageEvent"; -import type { ViewImageToolCallEvent } from "./ViewImageToolCallEvent"; -import type { WarningEvent } from "./WarningEvent"; -import type { WebSearchBeginEvent } from "./WebSearchBeginEvent"; -import type { WebSearchEndEvent } from "./WebSearchEndEvent"; - -/** - * Response event from the agent - * NOTE: Make sure none of these values have optional types, as it will mess up the extension code-gen. - */ -export type EventMsg = { "type": "error" } & ErrorEvent | { "type": "warning" } & WarningEvent | { "type": "realtime_conversation_started" } & RealtimeConversationStartedEvent | { "type": "realtime_conversation_realtime" } & RealtimeConversationRealtimeEvent | { "type": "realtime_conversation_closed" } & RealtimeConversationClosedEvent | { "type": "model_reroute" } & ModelRerouteEvent | { "type": "context_compacted" } & ContextCompactedEvent | { "type": "thread_rolled_back" } & ThreadRolledBackEvent | { "type": "task_started" } & TurnStartedEvent | { "type": "task_complete" } & TurnCompleteEvent | { "type": "token_count" } & TokenCountEvent | { "type": "agent_message" } & AgentMessageEvent | { "type": "user_message" } & UserMessageEvent | { "type": "agent_message_delta" } & AgentMessageDeltaEvent | { "type": "agent_reasoning" } & AgentReasoningEvent | { "type": "agent_reasoning_delta" } & AgentReasoningDeltaEvent | { "type": "agent_reasoning_raw_content" } & AgentReasoningRawContentEvent | { "type": "agent_reasoning_raw_content_delta" } & AgentReasoningRawContentDeltaEvent | { "type": "agent_reasoning_section_break" } & AgentReasoningSectionBreakEvent | { "type": "session_configured" } & SessionConfiguredEvent | { "type": "thread_name_updated" } & ThreadNameUpdatedEvent | { "type": "mcp_startup_update" } & McpStartupUpdateEvent | { "type": "mcp_startup_complete" } & McpStartupCompleteEvent | { "type": "mcp_tool_call_begin" } & McpToolCallBeginEvent | { "type": "mcp_tool_call_end" } & McpToolCallEndEvent | { "type": "web_search_begin" } & WebSearchBeginEvent | { "type": "web_search_end" } & WebSearchEndEvent | { "type": "exec_command_begin" } & ExecCommandBeginEvent | { "type": "exec_command_output_delta" } & ExecCommandOutputDeltaEvent | { "type": "terminal_interaction" } & TerminalInteractionEvent | { "type": "exec_command_end" } & ExecCommandEndEvent | { "type": "view_image_tool_call" } & ViewImageToolCallEvent | { "type": "exec_approval_request" } & ExecApprovalRequestEvent | { "type": "request_user_input" } & RequestUserInputEvent | { "type": "dynamic_tool_call_request" } & DynamicToolCallRequest | { "type": "dynamic_tool_call_response" } & DynamicToolCallResponseEvent | { "type": "elicitation_request" } & ElicitationRequestEvent | { "type": "apply_patch_approval_request" } & ApplyPatchApprovalRequestEvent | { "type": "deprecation_notice" } & DeprecationNoticeEvent | { "type": "background_event" } & BackgroundEventEvent | { "type": "undo_started" } & UndoStartedEvent | { "type": "undo_completed" } & UndoCompletedEvent | { "type": "stream_error" } & StreamErrorEvent | { "type": "patch_apply_begin" } & PatchApplyBeginEvent | { "type": "patch_apply_end" } & PatchApplyEndEvent | { "type": "turn_diff" } & TurnDiffEvent | { "type": "get_history_entry_response" } & GetHistoryEntryResponseEvent | { "type": "mcp_list_tools_response" } & McpListToolsResponseEvent | { "type": "list_custom_prompts_response" } & ListCustomPromptsResponseEvent | { "type": "list_skills_response" } & ListSkillsResponseEvent | { "type": "list_remote_skills_response" } & ListRemoteSkillsResponseEvent | { "type": "remote_skill_downloaded" } & RemoteSkillDownloadedEvent | { "type": "skills_update_available" } | { "type": "plan_update" } & UpdatePlanArgs | { "type": "turn_aborted" } & TurnAbortedEvent | { "type": "shutdown_complete" } | { "type": "entered_review_mode" } & ReviewRequest | { "type": "exited_review_mode" } & ExitedReviewModeEvent | { "type": "raw_response_item" } & RawResponseItemEvent | { "type": "item_started" } & ItemStartedEvent | { "type": "item_completed" } & ItemCompletedEvent | { "type": "agent_message_content_delta" } & AgentMessageContentDeltaEvent | { "type": "plan_delta" } & PlanDeltaEvent | { "type": "reasoning_content_delta" } & ReasoningContentDeltaEvent | { "type": "reasoning_raw_content_delta" } & ReasoningRawContentDeltaEvent | { "type": "collab_agent_spawn_begin" } & CollabAgentSpawnBeginEvent | { "type": "collab_agent_spawn_end" } & CollabAgentSpawnEndEvent | { "type": "collab_agent_interaction_begin" } & CollabAgentInteractionBeginEvent | { "type": "collab_agent_interaction_end" } & CollabAgentInteractionEndEvent | { "type": "collab_waiting_begin" } & CollabWaitingBeginEvent | { "type": "collab_waiting_end" } & CollabWaitingEndEvent | { "type": "collab_close_begin" } & CollabCloseBeginEvent | { "type": "collab_close_end" } & CollabCloseEndEvent | { "type": "collab_resume_begin" } & CollabResumeBeginEvent | { "type": "collab_resume_end" } & CollabResumeEndEvent; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecApprovalRequestEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ExecApprovalRequestEvent.ts deleted file mode 100644 index cc1340090..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecApprovalRequestEvent.ts +++ /dev/null @@ -1,62 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ExecPolicyAmendment } from "./ExecPolicyAmendment"; -import type { NetworkApprovalContext } from "./NetworkApprovalContext"; -import type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment"; -import type { ParsedCommand } from "./ParsedCommand"; -import type { PermissionProfile } from "./PermissionProfile"; -import type { ReviewDecision } from "./ReviewDecision"; - -export type ExecApprovalRequestEvent = { -/** - * Identifier for the associated command execution item. - */ -call_id: string, -/** - * Identifier for this specific approval callback. - * - * When absent, the approval is for the command item itself (`call_id`). - * This is present for subcommand approvals (via execve intercept). - */ -approval_id?: string, -/** - * Turn ID that this command belongs to. - * Uses `#[serde(default)]` for backwards compatibility. - */ -turn_id: string, -/** - * The command to be executed. - */ -command: Array, -/** - * The command's working directory. - */ -cwd: string, -/** - * Optional human-readable reason for the approval (e.g. retry without sandbox). - */ -reason: string | null, -/** - * Optional network context for a blocked request that can be approved. - */ -network_approval_context?: NetworkApprovalContext, -/** - * Proposed execpolicy amendment that can be applied to allow future runs. - */ -proposed_execpolicy_amendment?: ExecPolicyAmendment, -/** - * Proposed network policy amendments (for example allow/deny this host in future). - */ -proposed_network_policy_amendments?: Array, -/** - * Optional additional filesystem permissions requested for this command. - */ -additional_permissions?: PermissionProfile, -/** - * Ordered list of decisions the client may present for this prompt. - * - * When absent, clients should derive the legacy default set from the - * other fields on this request. - */ -available_decisions?: Array, parsed_cmd: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecCommandBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ExecCommandBeginEvent.ts deleted file mode 100644 index a9b4bc939..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecCommandBeginEvent.ts +++ /dev/null @@ -1,35 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ExecCommandSource } from "./ExecCommandSource"; -import type { ParsedCommand } from "./ParsedCommand"; - -export type ExecCommandBeginEvent = { -/** - * Identifier so this can be paired with the ExecCommandEnd event. - */ -call_id: string, -/** - * Identifier for the underlying PTY process (when available). - */ -process_id?: string, -/** - * Turn ID that this command belongs to. - */ -turn_id: string, -/** - * The command to be executed. - */ -command: Array, -/** - * The command's working directory if not the default cwd for the agent. - */ -cwd: string, parsed_cmd: Array, -/** - * Where the command originated. Defaults to Agent for backward compatibility. - */ -source: ExecCommandSource, -/** - * Raw input sent to a unified exec session (if this is an interaction event). - */ -interaction_input?: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecCommandEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ExecCommandEndEvent.ts deleted file mode 100644 index 0bfc41ea8..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecCommandEndEvent.ts +++ /dev/null @@ -1,64 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ExecCommandSource } from "./ExecCommandSource"; -import type { ExecCommandStatus } from "./ExecCommandStatus"; -import type { ParsedCommand } from "./ParsedCommand"; - -export type ExecCommandEndEvent = { -/** - * Identifier for the ExecCommandBegin that finished. - */ -call_id: string, -/** - * Identifier for the underlying PTY process (when available). - */ -process_id?: string, -/** - * Turn ID that this command belongs to. - */ -turn_id: string, -/** - * The command that was executed. - */ -command: Array, -/** - * The command's working directory if not the default cwd for the agent. - */ -cwd: string, parsed_cmd: Array, -/** - * Where the command originated. Defaults to Agent for backward compatibility. - */ -source: ExecCommandSource, -/** - * Raw input sent to a unified exec session (if this is an interaction event). - */ -interaction_input?: string, -/** - * Captured stdout - */ -stdout: string, -/** - * Captured stderr - */ -stderr: string, -/** - * Captured aggregated output - */ -aggregated_output: string, -/** - * The command's exit code. - */ -exit_code: number, -/** - * The duration of the command execution. - */ -duration: string, -/** - * Formatted output from the command, as seen by the model. - */ -formatted_output: string, -/** - * Completion status for this command execution. - */ -status: ExecCommandStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecCommandOutputDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ExecCommandOutputDeltaEvent.ts deleted file mode 100644 index 0930bdd82..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecCommandOutputDeltaEvent.ts +++ /dev/null @@ -1,18 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ExecOutputStream } from "./ExecOutputStream"; - -export type ExecCommandOutputDeltaEvent = { -/** - * Identifier for the ExecCommandBegin that produced this chunk. - */ -call_id: string, -/** - * Which stream produced this chunk. - */ -stream: ExecOutputStream, -/** - * Raw bytes from the stream (may not be valid UTF-8). - */ -chunk: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecCommandSource.ts b/codex-rs/app-server-protocol/schema/typescript/ExecCommandSource.ts deleted file mode 100644 index b665441bc..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecCommandSource.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExecCommandSource = "agent" | "user_shell" | "unified_exec_startup" | "unified_exec_interaction"; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecCommandStatus.ts b/codex-rs/app-server-protocol/schema/typescript/ExecCommandStatus.ts deleted file mode 100644 index d8d91fb19..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecCommandStatus.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExecCommandStatus = "completed" | "failed" | "declined"; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandParams.ts b/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandParams.ts deleted file mode 100644 index ca28ad775..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SandboxPolicy } from "./SandboxPolicy"; - -export type ExecOneOffCommandParams = { command: Array, timeoutMs: bigint | null, cwd: string | null, sandboxPolicy: SandboxPolicy | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandResponse.ts b/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandResponse.ts deleted file mode 100644 index ff43ec4ca..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecOneOffCommandResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExecOneOffCommandResponse = { exitCode: number, stdout: string, stderr: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExecOutputStream.ts b/codex-rs/app-server-protocol/schema/typescript/ExecOutputStream.ts deleted file mode 100644 index 96aa74483..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExecOutputStream.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExecOutputStream = "stdout" | "stderr"; diff --git a/codex-rs/app-server-protocol/schema/typescript/ExitedReviewModeEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ExitedReviewModeEvent.ts deleted file mode 100644 index 7271f07a3..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ExitedReviewModeEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReviewOutputEvent } from "./ReviewOutputEvent"; - -export type ExitedReviewModeEvent = { review_output: ReviewOutputEvent | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/FileSystemPermissions.ts b/codex-rs/app-server-protocol/schema/typescript/FileSystemPermissions.ts deleted file mode 100644 index aedf84de8..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/FileSystemPermissions.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "./AbsolutePathBuf"; - -export type FileSystemPermissions = { read: Array | null, write: Array | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ForkConversationParams.ts b/codex-rs/app-server-protocol/schema/typescript/ForkConversationParams.ts deleted file mode 100644 index 4ca548fbf..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ForkConversationParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { NewConversationParams } from "./NewConversationParams"; -import type { ThreadId } from "./ThreadId"; - -export type ForkConversationParams = { path: string | null, conversationId: ThreadId | null, overrides: NewConversationParams | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ForkConversationResponse.ts b/codex-rs/app-server-protocol/schema/typescript/ForkConversationResponse.ts deleted file mode 100644 index 80d6e7947..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ForkConversationResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EventMsg } from "./EventMsg"; -import type { ThreadId } from "./ThreadId"; - -export type ForkConversationResponse = { conversationId: ThreadId, model: string, initialMessages: Array | null, rolloutPath: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/GetHistoryEntryResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/GetHistoryEntryResponseEvent.ts deleted file mode 100644 index d46019c1d..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/GetHistoryEntryResponseEvent.ts +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HistoryEntry } from "./HistoryEntry"; - -export type GetHistoryEntryResponseEvent = { offset: number, log_id: bigint, -/** - * The entry at the requested offset, if available and parseable. - */ -entry: HistoryEntry | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/GetUserAgentResponse.ts b/codex-rs/app-server-protocol/schema/typescript/GetUserAgentResponse.ts deleted file mode 100644 index a74aba5da..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/GetUserAgentResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type GetUserAgentResponse = { userAgent: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/GetUserSavedConfigResponse.ts b/codex-rs/app-server-protocol/schema/typescript/GetUserSavedConfigResponse.ts deleted file mode 100644 index f8dcf2e67..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/GetUserSavedConfigResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { UserSavedConfig } from "./UserSavedConfig"; - -export type GetUserSavedConfigResponse = { config: UserSavedConfig, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/HistoryEntry.ts b/codex-rs/app-server-protocol/schema/typescript/HistoryEntry.ts deleted file mode 100644 index da5bc37c2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/HistoryEntry.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type HistoryEntry = { conversation_id: string, ts: bigint, text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/InputItem.ts b/codex-rs/app-server-protocol/schema/typescript/InputItem.ts deleted file mode 100644 index 3ac72d31d..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/InputItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TextElement } from "./TextElement"; - -export type InputItem = { "type": "text", "data": { text: string, -/** - * UI-defined spans within `text` used to render or persist special elements. - */ -text_elements: Array, } } | { "type": "image", "data": { image_url: string, } } | { "type": "localImage", "data": { path: string, } }; diff --git a/codex-rs/app-server-protocol/schema/typescript/InterruptConversationParams.ts b/codex-rs/app-server-protocol/schema/typescript/InterruptConversationParams.ts deleted file mode 100644 index 8db162c97..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/InterruptConversationParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type InterruptConversationParams = { conversationId: ThreadId, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/InterruptConversationResponse.ts b/codex-rs/app-server-protocol/schema/typescript/InterruptConversationResponse.ts deleted file mode 100644 index 375604eef..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/InterruptConversationResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TurnAbortReason } from "./TurnAbortReason"; - -export type InterruptConversationResponse = { abortReason: TurnAbortReason, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ItemCompletedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ItemCompletedEvent.ts deleted file mode 100644 index 97de348df..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ItemCompletedEvent.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; -import type { TurnItem } from "./TurnItem"; - -export type ItemCompletedEvent = { thread_id: ThreadId, turn_id: string, item: TurnItem, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ItemStartedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ItemStartedEvent.ts deleted file mode 100644 index e82f78f96..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ItemStartedEvent.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; -import type { TurnItem } from "./TurnItem"; - -export type ItemStartedEvent = { thread_id: ThreadId, turn_id: string, item: TurnItem, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ListConversationsParams.ts b/codex-rs/app-server-protocol/schema/typescript/ListConversationsParams.ts deleted file mode 100644 index 27c9f3172..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ListConversationsParams.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ListConversationsParams = { pageSize: number | null, cursor: string | null, modelProviders: Array | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ListConversationsResponse.ts b/codex-rs/app-server-protocol/schema/typescript/ListConversationsResponse.ts deleted file mode 100644 index 0e26443a5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ListConversationsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ConversationSummary } from "./ConversationSummary"; - -export type ListConversationsResponse = { items: Array, nextCursor: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ListCustomPromptsResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ListCustomPromptsResponseEvent.ts deleted file mode 100644 index 9ebb43afb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ListCustomPromptsResponseEvent.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CustomPrompt } from "./CustomPrompt"; - -/** - * Response payload for `Op::ListCustomPrompts`. - */ -export type ListCustomPromptsResponseEvent = { custom_prompts: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ListRemoteSkillsResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ListRemoteSkillsResponseEvent.ts deleted file mode 100644 index e3b277f4d..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ListRemoteSkillsResponseEvent.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RemoteSkillSummary } from "./RemoteSkillSummary"; - -/** - * Response payload for `Op::ListRemoteSkills`. - */ -export type ListRemoteSkillsResponseEvent = { skills: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ListSkillsResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ListSkillsResponseEvent.ts deleted file mode 100644 index efdd54759..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ListSkillsResponseEvent.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SkillsListEntry } from "./SkillsListEntry"; - -/** - * Response payload for `Op::ListSkills`. - */ -export type ListSkillsResponseEvent = { skills: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyParams.ts b/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyParams.ts deleted file mode 100644 index 3638553d3..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyParams.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type LoginApiKeyParams = { apiKey: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyResponse.ts b/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyResponse.ts deleted file mode 100644 index a67347aeb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/LoginApiKeyResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type LoginApiKeyResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/LoginChatGptCompleteNotification.ts b/codex-rs/app-server-protocol/schema/typescript/LoginChatGptCompleteNotification.ts deleted file mode 100644 index 82c07bfa2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/LoginChatGptCompleteNotification.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Deprecated in favor of AccountLoginCompletedNotification. - */ -export type LoginChatGptCompleteNotification = { loginId: string, success: boolean, error: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/LoginChatGptResponse.ts b/codex-rs/app-server-protocol/schema/typescript/LoginChatGptResponse.ts deleted file mode 100644 index 414728011..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/LoginChatGptResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type LoginChatGptResponse = { loginId: string, authUrl: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/LogoutChatGptResponse.ts b/codex-rs/app-server-protocol/schema/typescript/LogoutChatGptResponse.ts deleted file mode 100644 index ad5dbd910..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/LogoutChatGptResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type LogoutChatGptResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/MacOsPermissions.ts b/codex-rs/app-server-protocol/schema/typescript/MacOsPermissions.ts deleted file mode 100644 index 5c0792412..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/MacOsPermissions.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MacOsAutomationValue } from "./MacOsAutomationValue"; -import type { MacOsPreferencesValue } from "./MacOsPreferencesValue"; - -export type MacOsPermissions = { preferences: MacOsPreferencesValue | null, automations: MacOsAutomationValue | null, accessibility: boolean | null, calendar: boolean | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpAuthStatus.ts b/codex-rs/app-server-protocol/schema/typescript/McpAuthStatus.ts deleted file mode 100644 index 919ae85fd..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpAuthStatus.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type McpAuthStatus = "unsupported" | "not_logged_in" | "bearer_token" | "o_auth"; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpInvocation.ts b/codex-rs/app-server-protocol/schema/typescript/McpInvocation.ts deleted file mode 100644 index 5b7103a60..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpInvocation.ts +++ /dev/null @@ -1,18 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -export type McpInvocation = { -/** - * Name of the MCP server as defined in the config. - */ -server: string, -/** - * Name of the tool as given by the MCP server. - */ -tool: string, -/** - * Arguments to the tool call. - */ -arguments: JsonValue | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpListToolsResponseEvent.ts b/codex-rs/app-server-protocol/schema/typescript/McpListToolsResponseEvent.ts deleted file mode 100644 index 945959431..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpListToolsResponseEvent.ts +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { McpAuthStatus } from "./McpAuthStatus"; -import type { Resource } from "./Resource"; -import type { ResourceTemplate } from "./ResourceTemplate"; -import type { Tool } from "./Tool"; - -export type McpListToolsResponseEvent = { -/** - * Fully qualified tool name -> tool definition. - */ -tools: { [key in string]?: Tool }, -/** - * Known resources grouped by server name. - */ -resources: { [key in string]?: Array }, -/** - * Known resource templates grouped by server name. - */ -resource_templates: { [key in string]?: Array }, -/** - * Authentication status for each configured MCP server. - */ -auth_statuses: { [key in string]?: McpAuthStatus }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpStartupCompleteEvent.ts b/codex-rs/app-server-protocol/schema/typescript/McpStartupCompleteEvent.ts deleted file mode 100644 index 67354adfb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpStartupCompleteEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { McpStartupFailure } from "./McpStartupFailure"; - -export type McpStartupCompleteEvent = { ready: Array, failed: Array, cancelled: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpStartupFailure.ts b/codex-rs/app-server-protocol/schema/typescript/McpStartupFailure.ts deleted file mode 100644 index b12009b15..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpStartupFailure.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type McpStartupFailure = { server: string, error: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpStartupStatus.ts b/codex-rs/app-server-protocol/schema/typescript/McpStartupStatus.ts deleted file mode 100644 index 48c08226f..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpStartupStatus.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type McpStartupStatus = { "state": "starting" } | { "state": "ready" } | { "state": "failed", error: string, } | { "state": "cancelled" }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpStartupUpdateEvent.ts b/codex-rs/app-server-protocol/schema/typescript/McpStartupUpdateEvent.ts deleted file mode 100644 index ecfe7d551..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpStartupUpdateEvent.ts +++ /dev/null @@ -1,14 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { McpStartupStatus } from "./McpStartupStatus"; - -export type McpStartupUpdateEvent = { -/** - * Server name being started. - */ -server: string, -/** - * Current startup status. - */ -status: McpStartupStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpToolCallBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/McpToolCallBeginEvent.ts deleted file mode 100644 index feb7ca7c2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpToolCallBeginEvent.ts +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { McpInvocation } from "./McpInvocation"; - -export type McpToolCallBeginEvent = { -/** - * Identifier so this can be paired with the McpToolCallEnd event. - */ -call_id: string, invocation: McpInvocation, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/McpToolCallEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/McpToolCallEndEvent.ts deleted file mode 100644 index 0ca82b2bc..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/McpToolCallEndEvent.ts +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallToolResult } from "./CallToolResult"; -import type { McpInvocation } from "./McpInvocation"; - -export type McpToolCallEndEvent = { -/** - * Identifier for the corresponding McpToolCallBegin that finished. - */ -call_id: string, invocation: McpInvocation, duration: string, -/** - * Result of the tool call. Note this could be an error. - */ -result: { Ok : CallToolResult } | { Err : string }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ModelRerouteEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ModelRerouteEvent.ts deleted file mode 100644 index 23a4e1efb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ModelRerouteEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ModelRerouteReason } from "./ModelRerouteReason"; - -export type ModelRerouteEvent = { from_model: string, to_model: string, reason: ModelRerouteReason, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ModelRerouteReason.ts b/codex-rs/app-server-protocol/schema/typescript/ModelRerouteReason.ts deleted file mode 100644 index f5e1abf1e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ModelRerouteReason.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ModelRerouteReason = "high_risk_cyber_activity"; diff --git a/codex-rs/app-server-protocol/schema/typescript/NetworkAccess.ts b/codex-rs/app-server-protocol/schema/typescript/NetworkAccess.ts deleted file mode 100644 index f259e67b9..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/NetworkAccess.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Represents whether outbound network access is available to the agent. - */ -export type NetworkAccess = "restricted" | "enabled"; diff --git a/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalContext.ts b/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalContext.ts deleted file mode 100644 index b4b78e473..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalContext.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { NetworkApprovalProtocol } from "./NetworkApprovalProtocol"; - -export type NetworkApprovalContext = { host: string, protocol: NetworkApprovalProtocol, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalProtocol.ts b/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalProtocol.ts deleted file mode 100644 index a33eab566..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/NetworkApprovalProtocol.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type NetworkApprovalProtocol = "http" | "https" | "socks5_tcp" | "socks5_udp"; diff --git a/codex-rs/app-server-protocol/schema/typescript/NewConversationParams.ts b/codex-rs/app-server-protocol/schema/typescript/NewConversationParams.ts deleted file mode 100644 index e1113c27e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/NewConversationParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AskForApproval } from "./AskForApproval"; -import type { SandboxMode } from "./SandboxMode"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type NewConversationParams = { model: string | null, modelProvider: string | null, profile: string | null, cwd: string | null, approvalPolicy: AskForApproval | null, sandbox: SandboxMode | null, config: { [key in string]?: JsonValue } | null, baseInstructions: string | null, developerInstructions: string | null, compactPrompt: string | null, includeApplyPatchTool: boolean | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/NewConversationResponse.ts b/codex-rs/app-server-protocol/schema/typescript/NewConversationResponse.ts deleted file mode 100644 index 608c2ac11..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/NewConversationResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ThreadId } from "./ThreadId"; - -export type NewConversationResponse = { conversationId: ThreadId, model: string, reasoningEffort: ReasoningEffort | null, rolloutPath: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PatchApplyBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/PatchApplyBeginEvent.ts deleted file mode 100644 index 19ff0d575..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PatchApplyBeginEvent.ts +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileChange } from "./FileChange"; - -export type PatchApplyBeginEvent = { -/** - * Identifier so this can be paired with the PatchApplyEnd event. - */ -call_id: string, -/** - * Turn ID that this patch belongs to. - * Uses `#[serde(default)]` for backwards compatibility. - */ -turn_id: string, -/** - * If true, there was no ApplyPatchApprovalRequest for this patch. - */ -auto_approved: boolean, -/** - * The changes to be applied. - */ -changes: { [key in string]?: FileChange }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PatchApplyEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/PatchApplyEndEvent.ts deleted file mode 100644 index 9dacb00e4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PatchApplyEndEvent.ts +++ /dev/null @@ -1,36 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileChange } from "./FileChange"; -import type { PatchApplyStatus } from "./PatchApplyStatus"; - -export type PatchApplyEndEvent = { -/** - * Identifier for the PatchApplyBegin that finished. - */ -call_id: string, -/** - * Turn ID that this patch belongs to. - * Uses `#[serde(default)]` for backwards compatibility. - */ -turn_id: string, -/** - * Captured stdout (summary printed by apply_patch). - */ -stdout: string, -/** - * Captured stderr (parser errors, IO failures, etc.). - */ -stderr: string, -/** - * Whether the patch was applied successfully. - */ -success: boolean, -/** - * The changes that were applied (mirrors PatchApplyBeginEvent::changes). - */ -changes: { [key in string]?: FileChange }, -/** - * Completion status for this patch application. - */ -status: PatchApplyStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PatchApplyStatus.ts b/codex-rs/app-server-protocol/schema/typescript/PatchApplyStatus.ts deleted file mode 100644 index 721fcd9b1..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PatchApplyStatus.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type PatchApplyStatus = "completed" | "failed" | "declined"; diff --git a/codex-rs/app-server-protocol/schema/typescript/PermissionProfile.ts b/codex-rs/app-server-protocol/schema/typescript/PermissionProfile.ts deleted file mode 100644 index bfc0de27b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PermissionProfile.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileSystemPermissions } from "./FileSystemPermissions"; -import type { MacOsPermissions } from "./MacOsPermissions"; - -export type PermissionProfile = { network: boolean | null, file_system: FileSystemPermissions | null, macos: MacOsPermissions | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PlanDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/PlanDeltaEvent.ts deleted file mode 100644 index f2ff58844..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PlanDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type PlanDeltaEvent = { thread_id: string, turn_id: string, item_id: string, delta: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PlanItem.ts b/codex-rs/app-server-protocol/schema/typescript/PlanItem.ts deleted file mode 100644 index 909ab40e6..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PlanItem.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type PlanItem = { id: string, text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/PlanItemArg.ts b/codex-rs/app-server-protocol/schema/typescript/PlanItemArg.ts deleted file mode 100644 index a9c8acfa7..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/PlanItemArg.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { StepStatus } from "./StepStatus"; - -export type PlanItemArg = { step: string, status: StepStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/Profile.ts b/codex-rs/app-server-protocol/schema/typescript/Profile.ts deleted file mode 100644 index 53d16e4a3..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/Profile.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AskForApproval } from "./AskForApproval"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ReasoningSummary } from "./ReasoningSummary"; -import type { Verbosity } from "./Verbosity"; - -export type Profile = { model: string | null, modelProvider: string | null, approvalPolicy: AskForApproval | null, modelReasoningEffort: ReasoningEffort | null, modelReasoningSummary: ReasoningSummary | null, modelVerbosity: Verbosity | null, chatgptBaseUrl: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RateLimitSnapshot.ts b/codex-rs/app-server-protocol/schema/typescript/RateLimitSnapshot.ts deleted file mode 100644 index 8604128b4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RateLimitSnapshot.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CreditsSnapshot } from "./CreditsSnapshot"; -import type { PlanType } from "./PlanType"; -import type { RateLimitWindow } from "./RateLimitWindow"; - -export type RateLimitSnapshot = { limit_id: string | null, limit_name: string | null, primary: RateLimitWindow | null, secondary: RateLimitWindow | null, credits: CreditsSnapshot | null, plan_type: PlanType | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RateLimitWindow.ts b/codex-rs/app-server-protocol/schema/typescript/RateLimitWindow.ts deleted file mode 100644 index 4a85062bf..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RateLimitWindow.ts +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RateLimitWindow = { -/** - * Percentage (0-100) of the window that has been consumed. - */ -used_percent: number, -/** - * Rolling window duration, in minutes. - */ -window_minutes: number | null, -/** - * Unix timestamp (seconds since epoch) when the window resets. - */ -resets_at: number | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RawResponseItemEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RawResponseItemEvent.ts deleted file mode 100644 index 62dd4f001..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RawResponseItemEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ResponseItem } from "./ResponseItem"; - -export type RawResponseItemEvent = { item: ResponseItem, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReadOnlyAccess.ts b/codex-rs/app-server-protocol/schema/typescript/ReadOnlyAccess.ts deleted file mode 100644 index c01bdd37c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReadOnlyAccess.ts +++ /dev/null @@ -1,19 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "./AbsolutePathBuf"; - -/** - * Determines how read-only file access is granted inside a restricted - * sandbox. - */ -export type ReadOnlyAccess = { "type": "restricted", -/** - * Include built-in platform read roots required for basic process - * execution. - */ -include_platform_defaults: boolean, -/** - * Additional absolute roots that should be readable. - */ -readable_roots?: Array, } | { "type": "full-access" }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeAudioFrame.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeAudioFrame.ts deleted file mode 100644 index 99c0c1063..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeAudioFrame.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RealtimeAudioFrame = { data: string, sample_rate: number, num_channels: number, samples_per_channel: number | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationClosedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationClosedEvent.ts deleted file mode 100644 index c73e6833a..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationClosedEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RealtimeConversationClosedEvent = { reason: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationRealtimeEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationRealtimeEvent.ts deleted file mode 100644 index 4ff24a828..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationRealtimeEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RealtimeEvent } from "./RealtimeEvent"; - -export type RealtimeConversationRealtimeEvent = { payload: RealtimeEvent, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationStartedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationStartedEvent.ts deleted file mode 100644 index f2894fcb1..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeConversationStartedEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RealtimeConversationStartedEvent = { session_id: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeEvent.ts deleted file mode 100644 index 8286f34ca..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeEvent.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RealtimeAudioFrame } from "./RealtimeAudioFrame"; -import type { RealtimeHandoffRequested } from "./RealtimeHandoffRequested"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type RealtimeEvent = { "SessionUpdated": { session_id: string, instructions: string | null, } } | { "AudioOut": RealtimeAudioFrame } | { "ConversationItemAdded": JsonValue } | { "ConversationItemDone": { item_id: string, } } | { "HandoffRequested": RealtimeHandoffRequested } | { "Error": string }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffMessage.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffMessage.ts deleted file mode 100644 index 39b77cfdf..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffMessage.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RealtimeHandoffMessage = { role: string, text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffRequested.ts b/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffRequested.ts deleted file mode 100644 index f3426706a..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RealtimeHandoffRequested.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RealtimeHandoffMessage } from "./RealtimeHandoffMessage"; - -export type RealtimeHandoffRequested = { handoff_id: string, item_id: string, input_transcript: string, messages: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReasoningContentDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ReasoningContentDeltaEvent.ts deleted file mode 100644 index 70dfc01d2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReasoningContentDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ReasoningContentDeltaEvent = { thread_id: string, turn_id: string, item_id: string, delta: string, summary_index: bigint, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReasoningItem.ts b/codex-rs/app-server-protocol/schema/typescript/ReasoningItem.ts deleted file mode 100644 index 80bcb65fd..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReasoningItem.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ReasoningItem = { id: string, summary_text: Array, raw_content: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReasoningRawContentDeltaEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ReasoningRawContentDeltaEvent.ts deleted file mode 100644 index ef3a792ca..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReasoningRawContentDeltaEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ReasoningRawContentDeltaEvent = { thread_id: string, turn_id: string, item_id: string, delta: string, content_index: bigint, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RejectConfig.ts b/codex-rs/app-server-protocol/schema/typescript/RejectConfig.ts deleted file mode 100644 index 320f1096b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RejectConfig.ts +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RejectConfig = { -/** - * Reject approval prompts related to sandbox escalation. - */ -sandbox_approval: boolean, -/** - * Reject prompts triggered by execpolicy `prompt` rules. - */ -rules: boolean, -/** - * Reject MCP elicitation prompts. - */ -mcp_elicitations: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RemoteSkillDownloadedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RemoteSkillDownloadedEvent.ts deleted file mode 100644 index 83082f2a5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RemoteSkillDownloadedEvent.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Response payload for `Op::DownloadRemoteSkill`. - */ -export type RemoteSkillDownloadedEvent = { id: string, name: string, path: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RemoteSkillSummary.ts b/codex-rs/app-server-protocol/schema/typescript/RemoteSkillSummary.ts deleted file mode 100644 index 7bf57b3b0..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RemoteSkillSummary.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RemoteSkillSummary = { id: string, name: string, description: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RemoveConversationListenerParams.ts b/codex-rs/app-server-protocol/schema/typescript/RemoveConversationListenerParams.ts deleted file mode 100644 index e9628b634..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RemoveConversationListenerParams.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RemoveConversationListenerParams = { subscriptionId: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RemoveConversationSubscriptionResponse.ts b/codex-rs/app-server-protocol/schema/typescript/RemoveConversationSubscriptionResponse.ts deleted file mode 100644 index 8053d7e4b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RemoveConversationSubscriptionResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RemoveConversationSubscriptionResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputEvent.ts b/codex-rs/app-server-protocol/schema/typescript/RequestUserInputEvent.ts deleted file mode 100644 index 8ea6453de..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputEvent.ts +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RequestUserInputQuestion } from "./RequestUserInputQuestion"; - -export type RequestUserInputEvent = { -/** - * Responses API call id for the associated tool call, if available. - */ -call_id: string, -/** - * Turn ID that this request belongs to. - * Uses `#[serde(default)]` for backwards compatibility. - */ -turn_id: string, questions: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestion.ts b/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestion.ts deleted file mode 100644 index 2a68f7b4c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestion.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RequestUserInputQuestionOption } from "./RequestUserInputQuestionOption"; - -export type RequestUserInputQuestion = { id: string, header: string, question: string, isOther: boolean, isSecret: boolean, options: Array | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestionOption.ts b/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestionOption.ts deleted file mode 100644 index b2d2a0db4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/RequestUserInputQuestionOption.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RequestUserInputQuestionOption = { label: string, description: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ResumeConversationParams.ts b/codex-rs/app-server-protocol/schema/typescript/ResumeConversationParams.ts deleted file mode 100644 index f2fe9d47c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ResumeConversationParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { NewConversationParams } from "./NewConversationParams"; -import type { ResponseItem } from "./ResponseItem"; -import type { ThreadId } from "./ThreadId"; - -export type ResumeConversationParams = { path: string | null, conversationId: ThreadId | null, history: Array | null, overrides: NewConversationParams | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ResumeConversationResponse.ts b/codex-rs/app-server-protocol/schema/typescript/ResumeConversationResponse.ts deleted file mode 100644 index 1af5b6859..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ResumeConversationResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EventMsg } from "./EventMsg"; -import type { ThreadId } from "./ThreadId"; - -export type ResumeConversationResponse = { conversationId: ThreadId, model: string, initialMessages: Array | null, rolloutPath: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewCodeLocation.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewCodeLocation.ts deleted file mode 100644 index 752589fe5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewCodeLocation.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReviewLineRange } from "./ReviewLineRange"; - -/** - * Location of the code related to a review finding. - */ -export type ReviewCodeLocation = { absolute_file_path: string, line_range: ReviewLineRange, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewFinding.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewFinding.ts deleted file mode 100644 index e7c96bd17..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewFinding.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReviewCodeLocation } from "./ReviewCodeLocation"; - -/** - * A single review finding describing an observed issue or recommendation. - */ -export type ReviewFinding = { title: string, body: string, confidence_score: number, priority: number, code_location: ReviewCodeLocation, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewLineRange.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewLineRange.ts deleted file mode 100644 index c57ec6ed6..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewLineRange.ts +++ /dev/null @@ -1,8 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Inclusive line range in a file associated with the finding. - */ -export type ReviewLineRange = { start: number, end: number, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewOutputEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewOutputEvent.ts deleted file mode 100644 index c45747424..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewOutputEvent.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReviewFinding } from "./ReviewFinding"; - -/** - * Structured review result produced by a child review session. - */ -export type ReviewOutputEvent = { findings: Array, overall_correctness: string, overall_explanation: string, overall_confidence_score: number, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewRequest.ts deleted file mode 100644 index 1e9b8ad2e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewRequest.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReviewTarget } from "./ReviewTarget"; - -/** - * Review request sent to the review session. - */ -export type ReviewRequest = { target: ReviewTarget, user_facing_hint?: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ReviewTarget.ts b/codex-rs/app-server-protocol/schema/typescript/ReviewTarget.ts deleted file mode 100644 index a79f1e993..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ReviewTarget.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ReviewTarget = { "type": "uncommittedChanges" } | { "type": "baseBranch", branch: string, } | { "type": "commit", sha: string, -/** - * Optional human-readable label (e.g., commit subject) for UIs. - */ -title: string | null, } | { "type": "custom", instructions: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SandboxMode.ts b/codex-rs/app-server-protocol/schema/typescript/SandboxMode.ts deleted file mode 100644 index b8cf4326b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SandboxMode.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access"; diff --git a/codex-rs/app-server-protocol/schema/typescript/SandboxPolicy.ts b/codex-rs/app-server-protocol/schema/typescript/SandboxPolicy.ts deleted file mode 100644 index 743ad2222..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SandboxPolicy.ts +++ /dev/null @@ -1,44 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "./AbsolutePathBuf"; -import type { NetworkAccess } from "./NetworkAccess"; -import type { ReadOnlyAccess } from "./ReadOnlyAccess"; - -/** - * Determines execution restrictions for model shell commands. - */ -export type SandboxPolicy = { "type": "danger-full-access" } | { "type": "read-only", -/** - * Read access granted while running under this policy. - */ -access?: ReadOnlyAccess, } | { "type": "external-sandbox", -/** - * Whether the external sandbox permits outbound network traffic. - */ -network_access: NetworkAccess, } | { "type": "workspace-write", -/** - * Additional folders (beyond cwd and possibly TMPDIR) that should be - * writable from within the sandbox. - */ -writable_roots?: Array, -/** - * Read access granted while running under this policy. - */ -read_only_access?: ReadOnlyAccess, -/** - * When set to `true`, outbound network access is allowed. `false` by - * default. - */ -network_access: boolean, -/** - * When set to `true`, will NOT include the per-user `TMPDIR` - * environment variable among the default writable roots. Defaults to - * `false`. - */ -exclude_tmpdir_env_var: boolean, -/** - * When set to `true`, will NOT include the `/tmp` among the default - * writable roots on UNIX. Defaults to `false`. - */ -exclude_slash_tmp: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SandboxSettings.ts b/codex-rs/app-server-protocol/schema/typescript/SandboxSettings.ts deleted file mode 100644 index 94139b0e5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SandboxSettings.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "./AbsolutePathBuf"; - -export type SandboxSettings = { writableRoots: Array, networkAccess: boolean | null, excludeTmpdirEnvVar: boolean | null, excludeSlashTmp: boolean | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SendUserMessageParams.ts b/codex-rs/app-server-protocol/schema/typescript/SendUserMessageParams.ts deleted file mode 100644 index 6aee538eb..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SendUserMessageParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InputItem } from "./InputItem"; -import type { ThreadId } from "./ThreadId"; - -export type SendUserMessageParams = { conversationId: ThreadId, items: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SendUserMessageResponse.ts b/codex-rs/app-server-protocol/schema/typescript/SendUserMessageResponse.ts deleted file mode 100644 index 1a03e043a..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SendUserMessageResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SendUserMessageResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/SendUserTurnParams.ts b/codex-rs/app-server-protocol/schema/typescript/SendUserTurnParams.ts deleted file mode 100644 index 063191649..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SendUserTurnParams.ts +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AskForApproval } from "./AskForApproval"; -import type { InputItem } from "./InputItem"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ReasoningSummary } from "./ReasoningSummary"; -import type { SandboxPolicy } from "./SandboxPolicy"; -import type { ServiceTier } from "./ServiceTier"; -import type { ThreadId } from "./ThreadId"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type SendUserTurnParams = { conversationId: ThreadId, items: Array, cwd: string, approvalPolicy: AskForApproval, sandboxPolicy: SandboxPolicy, model: string, serviceTier?: ServiceTier | null | null, effort: ReasoningEffort | null, summary: ReasoningSummary, -/** - * Optional JSON Schema used to constrain the final assistant message for this turn. - */ -outputSchema: JsonValue | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SendUserTurnResponse.ts b/codex-rs/app-server-protocol/schema/typescript/SendUserTurnResponse.ts deleted file mode 100644 index cffd0ac39..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SendUserTurnResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SendUserTurnResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts index 43345d909..d7f70d355 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts @@ -1,11 +1,8 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AuthStatusChangeNotification } from "./AuthStatusChangeNotification"; import type { FuzzyFileSearchSessionCompletedNotification } from "./FuzzyFileSearchSessionCompletedNotification"; import type { FuzzyFileSearchSessionUpdatedNotification } from "./FuzzyFileSearchSessionUpdatedNotification"; -import type { LoginChatGptCompleteNotification } from "./LoginChatGptCompleteNotification"; -import type { SessionConfiguredNotification } from "./SessionConfiguredNotification"; import type { AccountLoginCompletedNotification } from "./v2/AccountLoginCompletedNotification"; import type { AccountRateLimitsUpdatedNotification } from "./v2/AccountRateLimitsUpdatedNotification"; import type { AccountUpdatedNotification } from "./v2/AccountUpdatedNotification"; @@ -51,4 +48,4 @@ import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldW /** * Notification sent from the server to the client. */ -export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification } | { "method": "authStatusChange", "params": AuthStatusChangeNotification } | { "method": "loginChatGptComplete", "params": LoginChatGptCompleteNotification } | { "method": "sessionConfigured", "params": SessionConfiguredNotification }; +export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredEvent.ts b/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredEvent.ts deleted file mode 100644 index b4696a0e4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredEvent.ts +++ /dev/null @@ -1,58 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AskForApproval } from "./AskForApproval"; -import type { EventMsg } from "./EventMsg"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { SandboxPolicy } from "./SandboxPolicy"; -import type { ServiceTier } from "./ServiceTier"; -import type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime"; -import type { ThreadId } from "./ThreadId"; - -export type SessionConfiguredEvent = { session_id: ThreadId, forked_from_id: ThreadId | null, -/** - * Optional user-facing thread name (may be unset). - */ -thread_name?: string, -/** - * Tell the client what model is being queried. - */ -model: string, model_provider_id: string, service_tier: ServiceTier | null, -/** - * When to escalate for approval for execution - */ -approval_policy: AskForApproval, -/** - * How to sandbox commands executed in the system - */ -sandbox_policy: SandboxPolicy, -/** - * Working directory that should be treated as the *root* of the - * session. - */ -cwd: string, -/** - * The effort the model is putting into reasoning about the user's request. - */ -reasoning_effort: ReasoningEffort | null, -/** - * Identifier of the history log file (inode on Unix, 0 otherwise). - */ -history_log_id: bigint, -/** - * Current number of entries in the history log. - */ -history_entry_count: number, -/** - * Optional initial messages (as events) for resumed sessions. - * When present, UIs can use these to seed the history. - */ -initial_messages: Array | null, -/** - * Runtime proxy bind addresses, when the managed proxy was started for this session. - */ -network_proxy?: SessionNetworkProxyRuntime, -/** - * Path in which the rollout is stored. Can be `None` for ephemeral threads - */ -rollout_path: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredNotification.ts b/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredNotification.ts deleted file mode 100644 index 0fd5edcb3..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SessionConfiguredNotification.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EventMsg } from "./EventMsg"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ServiceTier } from "./ServiceTier"; -import type { ThreadId } from "./ThreadId"; - -export type SessionConfiguredNotification = { sessionId: ThreadId, model: string, serviceTier: ServiceTier | null, reasoningEffort: ReasoningEffort | null, historyLogId: bigint, historyEntryCount: number, initialMessages: Array | null, rolloutPath: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SessionNetworkProxyRuntime.ts b/codex-rs/app-server-protocol/schema/typescript/SessionNetworkProxyRuntime.ts deleted file mode 100644 index 3f0c6d857..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SessionNetworkProxyRuntime.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SessionNetworkProxyRuntime = { http_addr: string, socks_addr: string, admin_addr: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelParams.ts b/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelParams.ts deleted file mode 100644 index b9e4e7d90..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReasoningEffort } from "./ReasoningEffort"; - -export type SetDefaultModelParams = { model: string | null, reasoningEffort: ReasoningEffort | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelResponse.ts b/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelResponse.ts deleted file mode 100644 index 1639601e0..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SetDefaultModelResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SetDefaultModelResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillDependencies.ts b/codex-rs/app-server-protocol/schema/typescript/SkillDependencies.ts deleted file mode 100644 index e2dd4f424..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillDependencies.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SkillToolDependency } from "./SkillToolDependency"; - -export type SkillDependencies = { tools: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillErrorInfo.ts b/codex-rs/app-server-protocol/schema/typescript/SkillErrorInfo.ts deleted file mode 100644 index 6eaf035d8..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillErrorInfo.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SkillErrorInfo = { path: string, message: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillInterface.ts b/codex-rs/app-server-protocol/schema/typescript/SkillInterface.ts deleted file mode 100644 index 30250b938..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillInterface.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SkillInterface = { display_name?: string, short_description?: string, icon_small?: string, icon_large?: string, brand_color?: string, default_prompt?: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillMetadata.ts b/codex-rs/app-server-protocol/schema/typescript/SkillMetadata.ts deleted file mode 100644 index 088abc406..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillMetadata.ts +++ /dev/null @@ -1,12 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SkillDependencies } from "./SkillDependencies"; -import type { SkillInterface } from "./SkillInterface"; -import type { SkillScope } from "./SkillScope"; - -export type SkillMetadata = { name: string, description: string, -/** - * Legacy short_description from SKILL.md. Prefer SKILL.json interface.short_description. - */ -short_description?: string, interface?: SkillInterface, dependencies?: SkillDependencies, path: string, scope: SkillScope, enabled: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillScope.ts b/codex-rs/app-server-protocol/schema/typescript/SkillScope.ts deleted file mode 100644 index 997006f5b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillScope.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SkillScope = "user" | "repo" | "system" | "admin"; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillToolDependency.ts b/codex-rs/app-server-protocol/schema/typescript/SkillToolDependency.ts deleted file mode 100644 index a5da45e17..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillToolDependency.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SkillToolDependency = { type: string, value: string, description?: string, transport?: string, command?: string, url?: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/SkillsListEntry.ts b/codex-rs/app-server-protocol/schema/typescript/SkillsListEntry.ts deleted file mode 100644 index 3f46c98a4..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/SkillsListEntry.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SkillErrorInfo } from "./SkillErrorInfo"; -import type { SkillMetadata } from "./SkillMetadata"; - -export type SkillsListEntry = { cwd: string, skills: Array, errors: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/StepStatus.ts b/codex-rs/app-server-protocol/schema/typescript/StepStatus.ts deleted file mode 100644 index 8494a76e0..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/StepStatus.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type StepStatus = "pending" | "in_progress" | "completed"; diff --git a/codex-rs/app-server-protocol/schema/typescript/StreamErrorEvent.ts b/codex-rs/app-server-protocol/schema/typescript/StreamErrorEvent.ts deleted file mode 100644 index b88993a34..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/StreamErrorEvent.ts +++ /dev/null @@ -1,12 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CodexErrorInfo } from "./CodexErrorInfo"; - -export type StreamErrorEvent = { message: string, codex_error_info: CodexErrorInfo | null, -/** - * Optional details about the underlying stream failure (often the same - * human-readable message that is surfaced as the terminal error if retries - * are exhausted). - */ -additional_details: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TerminalInteractionEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TerminalInteractionEvent.ts deleted file mode 100644 index 5f300e6ca..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TerminalInteractionEvent.ts +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TerminalInteractionEvent = { -/** - * Identifier for the ExecCommandBegin that produced this chunk. - */ -call_id: string, -/** - * Process id associated with the running command. - */ -process_id: string, -/** - * Stdin sent to the running session. - */ -stdin: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TextElement.ts b/codex-rs/app-server-protocol/schema/typescript/TextElement.ts deleted file mode 100644 index 8841d0049..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TextElement.ts +++ /dev/null @@ -1,14 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ByteRange } from "./ByteRange"; - -export type TextElement = { -/** - * Byte range in the parent `text` buffer that this element occupies. - */ -byteRange: ByteRange, -/** - * Optional human-readable placeholder for the element, displayed in the UI. - */ -placeholder: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ThreadNameUpdatedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ThreadNameUpdatedEvent.ts deleted file mode 100644 index 639e29f9d..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ThreadNameUpdatedEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreadId } from "./ThreadId"; - -export type ThreadNameUpdatedEvent = { thread_id: ThreadId, thread_name?: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ThreadRolledBackEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ThreadRolledBackEvent.ts deleted file mode 100644 index 30bc64c9c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ThreadRolledBackEvent.ts +++ /dev/null @@ -1,9 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ThreadRolledBackEvent = { -/** - * Number of user turns that were removed from context. - */ -num_turns: number, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TokenCountEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TokenCountEvent.ts deleted file mode 100644 index f58b57464..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TokenCountEvent.ts +++ /dev/null @@ -1,7 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RateLimitSnapshot } from "./RateLimitSnapshot"; -import type { TokenUsageInfo } from "./TokenUsageInfo"; - -export type TokenCountEvent = { info: TokenUsageInfo | null, rate_limits: RateLimitSnapshot | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TokenUsage.ts b/codex-rs/app-server-protocol/schema/typescript/TokenUsage.ts deleted file mode 100644 index 41186b25b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TokenUsage.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TokenUsage = { input_tokens: number, cached_input_tokens: number, output_tokens: number, reasoning_output_tokens: number, total_tokens: number, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TokenUsageInfo.ts b/codex-rs/app-server-protocol/schema/typescript/TokenUsageInfo.ts deleted file mode 100644 index cb15de42e..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TokenUsageInfo.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TokenUsage } from "./TokenUsage"; - -export type TokenUsageInfo = { total_token_usage: TokenUsage, last_token_usage: TokenUsage, model_context_window: number | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/Tools.ts b/codex-rs/app-server-protocol/schema/typescript/Tools.ts deleted file mode 100644 index 038702296..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/Tools.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type Tools = { webSearch: boolean | null, viewImage: boolean | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnAbortReason.ts b/codex-rs/app-server-protocol/schema/typescript/TurnAbortReason.ts deleted file mode 100644 index f07cde629..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnAbortReason.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TurnAbortReason = "interrupted" | "replaced" | "review_ended"; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnAbortedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TurnAbortedEvent.ts deleted file mode 100644 index 0b4e9075b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnAbortedEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TurnAbortReason } from "./TurnAbortReason"; - -export type TurnAbortedEvent = { turn_id: string | null, reason: TurnAbortReason, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnCompleteEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TurnCompleteEvent.ts deleted file mode 100644 index 6987d59f9..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnCompleteEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TurnCompleteEvent = { turn_id: string, last_agent_message: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnDiffEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TurnDiffEvent.ts deleted file mode 100644 index 52e3df09b..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnDiffEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TurnDiffEvent = { unified_diff: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnItem.ts b/codex-rs/app-server-protocol/schema/typescript/TurnItem.ts deleted file mode 100644 index 0f2ea12a2..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnItem.ts +++ /dev/null @@ -1,11 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AgentMessageItem } from "./AgentMessageItem"; -import type { ContextCompactionItem } from "./ContextCompactionItem"; -import type { PlanItem } from "./PlanItem"; -import type { ReasoningItem } from "./ReasoningItem"; -import type { UserMessageItem } from "./UserMessageItem"; -import type { WebSearchItem } from "./WebSearchItem"; - -export type TurnItem = { "type": "UserMessage" } & UserMessageItem | { "type": "AgentMessage" } & AgentMessageItem | { "type": "Plan" } & PlanItem | { "type": "Reasoning" } & ReasoningItem | { "type": "WebSearch" } & WebSearchItem | { "type": "ContextCompaction" } & ContextCompactionItem; diff --git a/codex-rs/app-server-protocol/schema/typescript/TurnStartedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/TurnStartedEvent.ts deleted file mode 100644 index 14c0d7670..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/TurnStartedEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ModeKind } from "./ModeKind"; - -export type TurnStartedEvent = { turn_id: string, model_context_window: bigint | null, collaboration_mode_kind: ModeKind, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UndoCompletedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/UndoCompletedEvent.ts deleted file mode 100644 index 2d94e2e18..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UndoCompletedEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type UndoCompletedEvent = { success: boolean, message: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UndoStartedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/UndoStartedEvent.ts deleted file mode 100644 index 712082adf..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UndoStartedEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type UndoStartedEvent = { message: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UpdatePlanArgs.ts b/codex-rs/app-server-protocol/schema/typescript/UpdatePlanArgs.ts deleted file mode 100644 index 61613fcb5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UpdatePlanArgs.ts +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PlanItemArg } from "./PlanItemArg"; - -export type UpdatePlanArgs = { -/** - * Arguments for the `update_plan` todo/checklist tool (not plan mode). - */ -explanation: string | null, plan: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UserInfoResponse.ts b/codex-rs/app-server-protocol/schema/typescript/UserInfoResponse.ts deleted file mode 100644 index 3d257a1c5..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UserInfoResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type UserInfoResponse = { allegedUserEmail: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UserInput.ts b/codex-rs/app-server-protocol/schema/typescript/UserInput.ts deleted file mode 100644 index e6a9c3a58..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UserInput.ts +++ /dev/null @@ -1,16 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TextElement } from "./TextElement"; - -/** - * User input - */ -export type UserInput = { "type": "text", text: string, -/** - * UI-defined spans within `text` that should be treated as special elements. - * These are byte ranges into the UTF-8 `text` buffer and are used to render - * or persist rich input markers (e.g., image placeholders) across history - * and resume without mutating the literal text. - */ -text_elements: Array, } | { "type": "image", image_url: string, } | { "type": "local_image", path: string, } | { "type": "skill", name: string, path: string, } | { "type": "mention", name: string, path: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UserMessageEvent.ts b/codex-rs/app-server-protocol/schema/typescript/UserMessageEvent.ts deleted file mode 100644 index 2fde364d6..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UserMessageEvent.ts +++ /dev/null @@ -1,22 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TextElement } from "./TextElement"; - -export type UserMessageEvent = { message: string, -/** - * Image URLs sourced from `UserInput::Image`. These are safe - * to replay in legacy UI history events and correspond to images sent to - * the model. - */ -images: Array | null, -/** - * Local file paths sourced from `UserInput::LocalImage`. These are kept so - * the UI can reattach images when editing history, and should not be sent - * to the model or treated as API-ready URLs. - */ -local_images: Array, -/** - * UI-defined spans within `message` used to render or persist special elements. - */ -text_elements: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UserMessageItem.ts b/codex-rs/app-server-protocol/schema/typescript/UserMessageItem.ts deleted file mode 100644 index df856287a..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UserMessageItem.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { UserInput } from "./UserInput"; - -export type UserMessageItem = { id: string, content: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/UserSavedConfig.ts b/codex-rs/app-server-protocol/schema/typescript/UserSavedConfig.ts deleted file mode 100644 index e70107f31..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/UserSavedConfig.ts +++ /dev/null @@ -1,14 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AskForApproval } from "./AskForApproval"; -import type { ForcedLoginMethod } from "./ForcedLoginMethod"; -import type { Profile } from "./Profile"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ReasoningSummary } from "./ReasoningSummary"; -import type { SandboxMode } from "./SandboxMode"; -import type { SandboxSettings } from "./SandboxSettings"; -import type { Tools } from "./Tools"; -import type { Verbosity } from "./Verbosity"; - -export type UserSavedConfig = { approvalPolicy: AskForApproval | null, sandboxMode: SandboxMode | null, sandboxSettings: SandboxSettings | null, forcedChatgptWorkspaceId: string | null, forcedLoginMethod: ForcedLoginMethod | null, model: string | null, modelReasoningEffort: ReasoningEffort | null, modelReasoningSummary: ReasoningSummary | null, modelVerbosity: Verbosity | null, tools: Tools | null, profile: string | null, profiles: { [key in string]?: Profile }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ViewImageToolCallEvent.ts b/codex-rs/app-server-protocol/schema/typescript/ViewImageToolCallEvent.ts deleted file mode 100644 index 76541a773..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/ViewImageToolCallEvent.ts +++ /dev/null @@ -1,13 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ViewImageToolCallEvent = { -/** - * Identifier for the originating tool call. - */ -call_id: string, -/** - * Local filesystem path provided to the tool. - */ -path: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/WarningEvent.ts b/codex-rs/app-server-protocol/schema/typescript/WarningEvent.ts deleted file mode 100644 index 35ec40f7c..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/WarningEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type WarningEvent = { message: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/WebSearchBeginEvent.ts b/codex-rs/app-server-protocol/schema/typescript/WebSearchBeginEvent.ts deleted file mode 100644 index 4a8d88191..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/WebSearchBeginEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type WebSearchBeginEvent = { call_id: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/WebSearchEndEvent.ts b/codex-rs/app-server-protocol/schema/typescript/WebSearchEndEvent.ts deleted file mode 100644 index 5b8b67c28..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/WebSearchEndEvent.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { WebSearchAction } from "./WebSearchAction"; - -export type WebSearchEndEvent = { call_id: string, query: string, action: WebSearchAction, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/WebSearchItem.ts b/codex-rs/app-server-protocol/schema/typescript/WebSearchItem.ts deleted file mode 100644 index 46b140651..000000000 --- a/codex-rs/app-server-protocol/schema/typescript/WebSearchItem.ts +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE! DO NOT MODIFY BY HAND! - -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { WebSearchAction } from "./WebSearchAction"; - -export type WebSearchItem = { id: string, query: string, action: WebSearchAction, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/index.ts b/codex-rs/app-server-protocol/schema/typescript/index.ts index 81e08b159..fa1284843 100644 --- a/codex-rs/app-server-protocol/schema/typescript/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/index.ts @@ -1,81 +1,21 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! export type { AbsolutePathBuf } from "./AbsolutePathBuf"; -export type { AddConversationListenerParams } from "./AddConversationListenerParams"; -export type { AddConversationSubscriptionResponse } from "./AddConversationSubscriptionResponse"; -export type { AgentMessageContent } from "./AgentMessageContent"; -export type { AgentMessageContentDeltaEvent } from "./AgentMessageContentDeltaEvent"; -export type { AgentMessageDeltaEvent } from "./AgentMessageDeltaEvent"; -export type { AgentMessageEvent } from "./AgentMessageEvent"; -export type { AgentMessageItem } from "./AgentMessageItem"; -export type { AgentReasoningDeltaEvent } from "./AgentReasoningDeltaEvent"; -export type { AgentReasoningEvent } from "./AgentReasoningEvent"; -export type { AgentReasoningRawContentDeltaEvent } from "./AgentReasoningRawContentDeltaEvent"; -export type { AgentReasoningRawContentEvent } from "./AgentReasoningRawContentEvent"; -export type { AgentReasoningSectionBreakEvent } from "./AgentReasoningSectionBreakEvent"; -export type { AgentStatus } from "./AgentStatus"; export type { ApplyPatchApprovalParams } from "./ApplyPatchApprovalParams"; -export type { ApplyPatchApprovalRequestEvent } from "./ApplyPatchApprovalRequestEvent"; export type { ApplyPatchApprovalResponse } from "./ApplyPatchApprovalResponse"; -export type { ArchiveConversationParams } from "./ArchiveConversationParams"; -export type { ArchiveConversationResponse } from "./ArchiveConversationResponse"; -export type { AskForApproval } from "./AskForApproval"; export type { AuthMode } from "./AuthMode"; -export type { AuthStatusChangeNotification } from "./AuthStatusChangeNotification"; -export type { BackgroundEventEvent } from "./BackgroundEventEvent"; -export type { ByteRange } from "./ByteRange"; -export type { CallToolResult } from "./CallToolResult"; -export type { CancelLoginChatGptParams } from "./CancelLoginChatGptParams"; -export type { CancelLoginChatGptResponse } from "./CancelLoginChatGptResponse"; export type { ClientInfo } from "./ClientInfo"; export type { ClientNotification } from "./ClientNotification"; export type { ClientRequest } from "./ClientRequest"; -export type { CodexErrorInfo } from "./CodexErrorInfo"; -export type { CollabAgentInteractionBeginEvent } from "./CollabAgentInteractionBeginEvent"; -export type { CollabAgentInteractionEndEvent } from "./CollabAgentInteractionEndEvent"; -export type { CollabAgentRef } from "./CollabAgentRef"; -export type { CollabAgentSpawnBeginEvent } from "./CollabAgentSpawnBeginEvent"; -export type { CollabAgentSpawnEndEvent } from "./CollabAgentSpawnEndEvent"; -export type { CollabAgentStatusEntry } from "./CollabAgentStatusEntry"; -export type { CollabCloseBeginEvent } from "./CollabCloseBeginEvent"; -export type { CollabCloseEndEvent } from "./CollabCloseEndEvent"; -export type { CollabResumeBeginEvent } from "./CollabResumeBeginEvent"; -export type { CollabResumeEndEvent } from "./CollabResumeEndEvent"; -export type { CollabWaitingBeginEvent } from "./CollabWaitingBeginEvent"; -export type { CollabWaitingEndEvent } from "./CollabWaitingEndEvent"; export type { CollaborationMode } from "./CollaborationMode"; export type { ContentItem } from "./ContentItem"; -export type { ContextCompactedEvent } from "./ContextCompactedEvent"; -export type { ContextCompactionItem } from "./ContextCompactionItem"; export type { ConversationGitInfo } from "./ConversationGitInfo"; export type { ConversationSummary } from "./ConversationSummary"; -export type { CreditsSnapshot } from "./CreditsSnapshot"; -export type { CustomPrompt } from "./CustomPrompt"; -export type { DeprecationNoticeEvent } from "./DeprecationNoticeEvent"; -export type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputContentItem"; -export type { DynamicToolCallRequest } from "./DynamicToolCallRequest"; -export type { DynamicToolCallResponseEvent } from "./DynamicToolCallResponseEvent"; -export type { ElicitationRequestEvent } from "./ElicitationRequestEvent"; -export type { ErrorEvent } from "./ErrorEvent"; -export type { EventMsg } from "./EventMsg"; -export type { ExecApprovalRequestEvent } from "./ExecApprovalRequestEvent"; export type { ExecCommandApprovalParams } from "./ExecCommandApprovalParams"; export type { ExecCommandApprovalResponse } from "./ExecCommandApprovalResponse"; -export type { ExecCommandBeginEvent } from "./ExecCommandBeginEvent"; -export type { ExecCommandEndEvent } from "./ExecCommandEndEvent"; -export type { ExecCommandOutputDeltaEvent } from "./ExecCommandOutputDeltaEvent"; -export type { ExecCommandSource } from "./ExecCommandSource"; -export type { ExecCommandStatus } from "./ExecCommandStatus"; -export type { ExecOneOffCommandParams } from "./ExecOneOffCommandParams"; -export type { ExecOneOffCommandResponse } from "./ExecOneOffCommandResponse"; -export type { ExecOutputStream } from "./ExecOutputStream"; export type { ExecPolicyAmendment } from "./ExecPolicyAmendment"; -export type { ExitedReviewModeEvent } from "./ExitedReviewModeEvent"; export type { FileChange } from "./FileChange"; -export type { FileSystemPermissions } from "./FileSystemPermissions"; export type { ForcedLoginMethod } from "./ForcedLoginMethod"; -export type { ForkConversationParams } from "./ForkConversationParams"; -export type { ForkConversationResponse } from "./ForkConversationResponse"; export type { FunctionCallOutputBody } from "./FunctionCallOutputBody"; export type { FunctionCallOutputContentItem } from "./FunctionCallOutputContentItem"; export type { FunctionCallOutputPayload } from "./FunctionCallOutputPayload"; @@ -88,166 +28,44 @@ export type { GetAuthStatusParams } from "./GetAuthStatusParams"; export type { GetAuthStatusResponse } from "./GetAuthStatusResponse"; export type { GetConversationSummaryParams } from "./GetConversationSummaryParams"; export type { GetConversationSummaryResponse } from "./GetConversationSummaryResponse"; -export type { GetHistoryEntryResponseEvent } from "./GetHistoryEntryResponseEvent"; -export type { GetUserAgentResponse } from "./GetUserAgentResponse"; -export type { GetUserSavedConfigResponse } from "./GetUserSavedConfigResponse"; export type { GhostCommit } from "./GhostCommit"; export type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams"; export type { GitDiffToRemoteResponse } from "./GitDiffToRemoteResponse"; export type { GitSha } from "./GitSha"; -export type { HistoryEntry } from "./HistoryEntry"; export type { InitializeCapabilities } from "./InitializeCapabilities"; export type { InitializeParams } from "./InitializeParams"; export type { InitializeResponse } from "./InitializeResponse"; -export type { InputItem } from "./InputItem"; export type { InputModality } from "./InputModality"; -export type { InterruptConversationParams } from "./InterruptConversationParams"; -export type { InterruptConversationResponse } from "./InterruptConversationResponse"; -export type { ItemCompletedEvent } from "./ItemCompletedEvent"; -export type { ItemStartedEvent } from "./ItemStartedEvent"; -export type { ListConversationsParams } from "./ListConversationsParams"; -export type { ListConversationsResponse } from "./ListConversationsResponse"; -export type { ListCustomPromptsResponseEvent } from "./ListCustomPromptsResponseEvent"; -export type { ListRemoteSkillsResponseEvent } from "./ListRemoteSkillsResponseEvent"; -export type { ListSkillsResponseEvent } from "./ListSkillsResponseEvent"; export type { LocalShellAction } from "./LocalShellAction"; export type { LocalShellExecAction } from "./LocalShellExecAction"; export type { LocalShellStatus } from "./LocalShellStatus"; -export type { LoginApiKeyParams } from "./LoginApiKeyParams"; -export type { LoginApiKeyResponse } from "./LoginApiKeyResponse"; -export type { LoginChatGptCompleteNotification } from "./LoginChatGptCompleteNotification"; -export type { LoginChatGptResponse } from "./LoginChatGptResponse"; -export type { LogoutChatGptResponse } from "./LogoutChatGptResponse"; export type { MacOsAutomationValue } from "./MacOsAutomationValue"; -export type { MacOsPermissions } from "./MacOsPermissions"; export type { MacOsPreferencesValue } from "./MacOsPreferencesValue"; -export type { McpAuthStatus } from "./McpAuthStatus"; -export type { McpInvocation } from "./McpInvocation"; -export type { McpListToolsResponseEvent } from "./McpListToolsResponseEvent"; -export type { McpStartupCompleteEvent } from "./McpStartupCompleteEvent"; -export type { McpStartupFailure } from "./McpStartupFailure"; -export type { McpStartupStatus } from "./McpStartupStatus"; -export type { McpStartupUpdateEvent } from "./McpStartupUpdateEvent"; -export type { McpToolCallBeginEvent } from "./McpToolCallBeginEvent"; -export type { McpToolCallEndEvent } from "./McpToolCallEndEvent"; export type { MessagePhase } from "./MessagePhase"; export type { ModeKind } from "./ModeKind"; -export type { ModelRerouteEvent } from "./ModelRerouteEvent"; -export type { ModelRerouteReason } from "./ModelRerouteReason"; -export type { NetworkAccess } from "./NetworkAccess"; -export type { NetworkApprovalContext } from "./NetworkApprovalContext"; -export type { NetworkApprovalProtocol } from "./NetworkApprovalProtocol"; export type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment"; export type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction"; -export type { NewConversationParams } from "./NewConversationParams"; -export type { NewConversationResponse } from "./NewConversationResponse"; export type { ParsedCommand } from "./ParsedCommand"; -export type { PatchApplyBeginEvent } from "./PatchApplyBeginEvent"; -export type { PatchApplyEndEvent } from "./PatchApplyEndEvent"; -export type { PatchApplyStatus } from "./PatchApplyStatus"; -export type { PermissionProfile } from "./PermissionProfile"; export type { Personality } from "./Personality"; -export type { PlanDeltaEvent } from "./PlanDeltaEvent"; -export type { PlanItem } from "./PlanItem"; -export type { PlanItemArg } from "./PlanItemArg"; export type { PlanType } from "./PlanType"; -export type { Profile } from "./Profile"; -export type { RateLimitSnapshot } from "./RateLimitSnapshot"; -export type { RateLimitWindow } from "./RateLimitWindow"; -export type { RawResponseItemEvent } from "./RawResponseItemEvent"; -export type { ReadOnlyAccess } from "./ReadOnlyAccess"; -export type { RealtimeAudioFrame } from "./RealtimeAudioFrame"; -export type { RealtimeConversationClosedEvent } from "./RealtimeConversationClosedEvent"; -export type { RealtimeConversationRealtimeEvent } from "./RealtimeConversationRealtimeEvent"; -export type { RealtimeConversationStartedEvent } from "./RealtimeConversationStartedEvent"; -export type { RealtimeEvent } from "./RealtimeEvent"; -export type { RealtimeHandoffMessage } from "./RealtimeHandoffMessage"; -export type { RealtimeHandoffRequested } from "./RealtimeHandoffRequested"; -export type { ReasoningContentDeltaEvent } from "./ReasoningContentDeltaEvent"; export type { ReasoningEffort } from "./ReasoningEffort"; -export type { ReasoningItem } from "./ReasoningItem"; export type { ReasoningItemContent } from "./ReasoningItemContent"; export type { ReasoningItemReasoningSummary } from "./ReasoningItemReasoningSummary"; -export type { ReasoningRawContentDeltaEvent } from "./ReasoningRawContentDeltaEvent"; export type { ReasoningSummary } from "./ReasoningSummary"; -export type { RejectConfig } from "./RejectConfig"; -export type { RemoteSkillDownloadedEvent } from "./RemoteSkillDownloadedEvent"; -export type { RemoteSkillSummary } from "./RemoteSkillSummary"; -export type { RemoveConversationListenerParams } from "./RemoveConversationListenerParams"; -export type { RemoveConversationSubscriptionResponse } from "./RemoveConversationSubscriptionResponse"; export type { RequestId } from "./RequestId"; -export type { RequestUserInputEvent } from "./RequestUserInputEvent"; -export type { RequestUserInputQuestion } from "./RequestUserInputQuestion"; -export type { RequestUserInputQuestionOption } from "./RequestUserInputQuestionOption"; export type { Resource } from "./Resource"; export type { ResourceTemplate } from "./ResourceTemplate"; export type { ResponseItem } from "./ResponseItem"; -export type { ResumeConversationParams } from "./ResumeConversationParams"; -export type { ResumeConversationResponse } from "./ResumeConversationResponse"; -export type { ReviewCodeLocation } from "./ReviewCodeLocation"; export type { ReviewDecision } from "./ReviewDecision"; -export type { ReviewFinding } from "./ReviewFinding"; -export type { ReviewLineRange } from "./ReviewLineRange"; -export type { ReviewOutputEvent } from "./ReviewOutputEvent"; -export type { ReviewRequest } from "./ReviewRequest"; -export type { ReviewTarget } from "./ReviewTarget"; -export type { SandboxMode } from "./SandboxMode"; -export type { SandboxPolicy } from "./SandboxPolicy"; -export type { SandboxSettings } from "./SandboxSettings"; -export type { SendUserMessageParams } from "./SendUserMessageParams"; -export type { SendUserMessageResponse } from "./SendUserMessageResponse"; -export type { SendUserTurnParams } from "./SendUserTurnParams"; -export type { SendUserTurnResponse } from "./SendUserTurnResponse"; export type { ServerNotification } from "./ServerNotification"; export type { ServerRequest } from "./ServerRequest"; export type { ServiceTier } from "./ServiceTier"; -export type { SessionConfiguredEvent } from "./SessionConfiguredEvent"; -export type { SessionConfiguredNotification } from "./SessionConfiguredNotification"; -export type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime"; export type { SessionSource } from "./SessionSource"; -export type { SetDefaultModelParams } from "./SetDefaultModelParams"; -export type { SetDefaultModelResponse } from "./SetDefaultModelResponse"; export type { Settings } from "./Settings"; -export type { SkillDependencies } from "./SkillDependencies"; -export type { SkillErrorInfo } from "./SkillErrorInfo"; -export type { SkillInterface } from "./SkillInterface"; -export type { SkillMetadata } from "./SkillMetadata"; -export type { SkillScope } from "./SkillScope"; -export type { SkillToolDependency } from "./SkillToolDependency"; -export type { SkillsListEntry } from "./SkillsListEntry"; -export type { StepStatus } from "./StepStatus"; -export type { StreamErrorEvent } from "./StreamErrorEvent"; export type { SubAgentSource } from "./SubAgentSource"; -export type { TerminalInteractionEvent } from "./TerminalInteractionEvent"; -export type { TextElement } from "./TextElement"; export type { ThreadId } from "./ThreadId"; -export type { ThreadNameUpdatedEvent } from "./ThreadNameUpdatedEvent"; -export type { ThreadRolledBackEvent } from "./ThreadRolledBackEvent"; -export type { TokenCountEvent } from "./TokenCountEvent"; -export type { TokenUsage } from "./TokenUsage"; -export type { TokenUsageInfo } from "./TokenUsageInfo"; export type { Tool } from "./Tool"; -export type { Tools } from "./Tools"; -export type { TurnAbortReason } from "./TurnAbortReason"; -export type { TurnAbortedEvent } from "./TurnAbortedEvent"; -export type { TurnCompleteEvent } from "./TurnCompleteEvent"; -export type { TurnDiffEvent } from "./TurnDiffEvent"; -export type { TurnItem } from "./TurnItem"; -export type { TurnStartedEvent } from "./TurnStartedEvent"; -export type { UndoCompletedEvent } from "./UndoCompletedEvent"; -export type { UndoStartedEvent } from "./UndoStartedEvent"; -export type { UpdatePlanArgs } from "./UpdatePlanArgs"; -export type { UserInfoResponse } from "./UserInfoResponse"; -export type { UserInput } from "./UserInput"; -export type { UserMessageEvent } from "./UserMessageEvent"; -export type { UserMessageItem } from "./UserMessageItem"; -export type { UserSavedConfig } from "./UserSavedConfig"; export type { Verbosity } from "./Verbosity"; -export type { ViewImageToolCallEvent } from "./ViewImageToolCallEvent"; -export type { WarningEvent } from "./WarningEvent"; export type { WebSearchAction } from "./WebSearchAction"; -export type { WebSearchBeginEvent } from "./WebSearchBeginEvent"; -export type { WebSearchEndEvent } from "./WebSearchEndEvent"; -export type { WebSearchItem } from "./WebSearchItem"; export type { WebSearchMode } from "./WebSearchMode"; export * as v2 from "./v2"; diff --git a/codex-rs/app-server-protocol/src/export.rs b/codex-rs/app-server-protocol/src/export.rs index 78d550727..2802a8748 100644 --- a/codex-rs/app-server-protocol/src/export.rs +++ b/codex-rs/app-server-protocol/src/export.rs @@ -45,36 +45,9 @@ const SPECIAL_DEFINITIONS: &[&str] = &[ "ServerRequest", ]; const FLAT_V2_SHARED_DEFINITIONS: &[&str] = &["ClientRequest", "EventMsg", "ServerNotification"]; -const V1_CLIENT_REQUEST_METHODS: &[&str] = &[ - "newConversation", - "getConversationSummary", - "listConversations", - "resumeConversation", - "forkConversation", - "archiveConversation", - "sendUserMessage", - "sendUserTurn", - "interruptConversation", - "addConversationListener", - "removeConversationListener", - "gitDiffToRemote", - "loginApiKey", - "loginChatGpt", - "cancelLoginChatGpt", - "logoutChatGpt", - "getAuthStatus", - "getUserSavedConfig", - "setDefaultModel", - "getUserAgent", - "userInfo", - "execOneOffCommand", -]; -const EXCLUDED_SERVER_NOTIFICATION_METHODS_FOR_JSON: &[&str] = &[ - "authStatusChange", - "loginChatGptComplete", - "sessionConfigured", - "rawResponseItem/completed", -]; +const V1_CLIENT_REQUEST_METHODS: &[&str] = + &["getConversationSummary", "gitDiffToRemote", "getAuthStatus"]; +const EXCLUDED_SERVER_NOTIFICATION_METHODS_FOR_JSON: &[&str] = &["rawResponseItem/completed"]; #[derive(Clone)] pub struct GeneratedSchema { diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index f63ebd37a..98efcdd29 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -403,95 +403,19 @@ client_request_definitions! { }, /// DEPRECATED APIs below - NewConversation { - params: v1::NewConversationParams, - response: v1::NewConversationResponse, - }, GetConversationSummary { params: v1::GetConversationSummaryParams, response: v1::GetConversationSummaryResponse, }, - /// List recorded Codex conversations (rollouts) with optional pagination and search. - ListConversations { - params: v1::ListConversationsParams, - response: v1::ListConversationsResponse, - }, - /// Resume a recorded Codex conversation from a rollout file. - ResumeConversation { - params: v1::ResumeConversationParams, - response: v1::ResumeConversationResponse, - }, - /// Fork a recorded Codex conversation into a new session. - ForkConversation { - params: v1::ForkConversationParams, - response: v1::ForkConversationResponse, - }, - ArchiveConversation { - params: v1::ArchiveConversationParams, - response: v1::ArchiveConversationResponse, - }, - SendUserMessage { - params: v1::SendUserMessageParams, - response: v1::SendUserMessageResponse, - }, - SendUserTurn { - params: v1::SendUserTurnParams, - response: v1::SendUserTurnResponse, - }, - InterruptConversation { - params: v1::InterruptConversationParams, - response: v1::InterruptConversationResponse, - }, - AddConversationListener { - params: v1::AddConversationListenerParams, - response: v1::AddConversationSubscriptionResponse, - }, - RemoveConversationListener { - params: v1::RemoveConversationListenerParams, - response: v1::RemoveConversationSubscriptionResponse, - }, GitDiffToRemote { params: v1::GitDiffToRemoteParams, response: v1::GitDiffToRemoteResponse, }, - LoginApiKey { - params: v1::LoginApiKeyParams, - response: v1::LoginApiKeyResponse, - }, - LoginChatGpt { - params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, - response: v1::LoginChatGptResponse, - }, - // DEPRECATED in favor of CancelLoginAccount - CancelLoginChatGpt { - params: v1::CancelLoginChatGptParams, - response: v1::CancelLoginChatGptResponse, - }, - LogoutChatGpt { - params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, - response: v1::LogoutChatGptResponse, - }, /// DEPRECATED in favor of GetAccount GetAuthStatus { params: v1::GetAuthStatusParams, response: v1::GetAuthStatusResponse, }, - GetUserSavedConfig { - params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, - response: v1::GetUserSavedConfigResponse, - }, - SetDefaultModel { - params: v1::SetDefaultModelParams, - response: v1::SetDefaultModelResponse, - }, - GetUserAgent { - params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, - response: v1::GetUserAgentResponse, - }, - UserInfo { - params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, - response: v1::UserInfoResponse, - }, FuzzyFileSearch { params: FuzzyFileSearchParams, response: FuzzyFileSearchResponse, @@ -511,11 +435,6 @@ client_request_definitions! { params: FuzzyFileSearchSessionStopParams, response: FuzzyFileSearchSessionStopResponse, }, - /// Execute a command (argv vector) under the server's sandbox. - ExecOneOffCommand { - params: v1::ExecOneOffCommandParams, - response: v1::ExecOneOffCommandResponse, - }, } /// Generates an `enum ServerRequest` where each variant is a request that the @@ -882,12 +801,6 @@ server_notification_definitions! { #[strum(serialize = "account/login/completed")] AccountLoginCompleted(v2::AccountLoginCompletedNotification), - /// DEPRECATED NOTIFICATIONS below - AuthStatusChange(v1::AuthStatusChangeNotification), - - /// Deprecated: use `account/login/completed` instead. - LoginChatGptComplete(v1::LoginChatGptCompleteNotification), - SessionConfigured(v1::SessionConfiguredNotification), } client_notification_definitions! { @@ -901,7 +814,6 @@ mod tests { use codex_protocol::ThreadId; use codex_protocol::account::PlanType; use codex_protocol::parse_command::ParsedCommand; - use codex_protocol::protocol::AskForApproval; use codex_utils_absolute_path::AbsolutePathBuf; use pretty_assertions::assert_eq; use serde_json::json; @@ -912,37 +824,19 @@ mod tests { } #[test] - fn serialize_new_conversation() -> Result<()> { - let request = ClientRequest::NewConversation { + fn serialize_get_conversation_summary() -> Result<()> { + let request = ClientRequest::GetConversationSummary { request_id: RequestId::Integer(42), - params: v1::NewConversationParams { - model: Some("gpt-5.1-codex-max".to_string()), - model_provider: None, - profile: None, - cwd: None, - approval_policy: Some(AskForApproval::OnRequest), - sandbox: None, - config: None, - base_instructions: None, - developer_instructions: None, - compact_prompt: None, - include_apply_patch_tool: None, + params: v1::GetConversationSummaryParams::ThreadId { + conversation_id: ThreadId::from_string("67e55044-10b1-426f-9247-bb680e5fe0c8")?, }, }; assert_eq!( json!({ - "method": "newConversation", + "method": "getConversationSummary", "id": 42, "params": { - "model": "gpt-5.1-codex-max", - "modelProvider": null, - "profile": null, - "cwd": null, - "approvalPolicy": "on-request", - "sandbox": null, - "config": null, - "baseInstructions": null, - "includeApplyPatchTool": null + "conversationId": "67e55044-10b1-426f-9247-bb680e5fe0c8" } }), serde_json::to_value(&request)?, diff --git a/codex-rs/app-server-protocol/src/protocol/v1.rs b/codex-rs/app-server-protocol/src/protocol/v1.rs index ed1ca8622..d393f97f7 100644 --- a/codex-rs/app-server-protocol/src/protocol/v1.rs +++ b/codex-rs/app-server-protocol/src/protocol/v1.rs @@ -596,34 +596,3 @@ impl InputItem { } } } - -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] -#[serde(rename_all = "camelCase")] -/// Deprecated in favor of AccountLoginCompletedNotification. -pub struct LoginChatGptCompleteNotification { - #[schemars(with = "String")] - pub login_id: Uuid, - pub success: bool, - pub error: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema, TS)] -#[serde(rename_all = "camelCase")] -pub struct SessionConfiguredNotification { - pub session_id: ThreadId, - pub model: String, - pub service_tier: Option, - pub reasoning_effort: Option, - pub history_log_id: u64, - #[ts(type = "number")] - pub history_entry_count: usize, - pub initial_messages: Option>, - pub rollout_path: PathBuf, -} - -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] -#[serde(rename_all = "camelCase")] -/// Deprecated notification. Use AccountUpdatedNotification instead. -pub struct AuthStatusChangeNotification { - pub auth_method: Option, -} diff --git a/codex-rs/app-server-test-client/src/lib.rs b/codex-rs/app-server-test-client/src/lib.rs index d8f06be42..7baad9be6 100644 --- a/codex-rs/app-server-test-client/src/lib.rs +++ b/codex-rs/app-server-test-client/src/lib.rs @@ -23,8 +23,7 @@ use anyhow::bail; use clap::ArgAction; use clap::Parser; use clap::Subcommand; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; +use codex_app_server_protocol::AccountLoginCompletedNotification; use codex_app_server_protocol::AskForApproval; use codex_app_server_protocol::ClientInfo; use codex_app_server_protocol::ClientRequest; @@ -40,22 +39,16 @@ use codex_app_server_protocol::GetAccountRateLimitsResponse; use codex_app_server_protocol::InitializeCapabilities; use codex_app_server_protocol::InitializeParams; use codex_app_server_protocol::InitializeResponse; -use codex_app_server_protocol::InputItem; use codex_app_server_protocol::JSONRPCMessage; use codex_app_server_protocol::JSONRPCNotification; use codex_app_server_protocol::JSONRPCRequest; use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::LoginChatGptCompleteNotification; -use codex_app_server_protocol::LoginChatGptResponse; +use codex_app_server_protocol::LoginAccountResponse; use codex_app_server_protocol::ModelListParams; use codex_app_server_protocol::ModelListResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; use codex_app_server_protocol::ReadOnlyAccess; use codex_app_server_protocol::RequestId; use codex_app_server_protocol::SandboxPolicy; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; use codex_app_server_protocol::ServerNotification; use codex_app_server_protocol::ServerRequest; use codex_app_server_protocol::ThreadItem; @@ -69,9 +62,6 @@ use codex_app_server_protocol::TurnStartParams; use codex_app_server_protocol::TurnStartResponse; use codex_app_server_protocol::TurnStatus; use codex_app_server_protocol::UserInput as V2UserInput; -use codex_protocol::ThreadId; -use codex_protocol::protocol::Event; -use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::W3cTraceContext; use serde::Serialize; use serde::de::DeserializeOwned; @@ -502,26 +492,16 @@ fn send_message( config_overrides: &[String], user_message: String, ) -> Result<()> { - with_client(endpoint, config_overrides, |client| { - let initialize = client.initialize()?; - println!("< initialize response: {initialize:?}"); - - let conversation = client.start_thread()?; - println!("< newConversation response: {conversation:?}"); - - let subscription = client.add_conversation_listener(&conversation.conversation_id)?; - println!("< addConversationListener response: {subscription:?}"); - - let send_response = - client.send_user_message(&conversation.conversation_id, &user_message)?; - println!("< sendUserMessage response: {send_response:?}"); - - client.stream_conversation(&conversation.conversation_id)?; - - client.remove_thread_listener(subscription.subscription_id)?; - - Ok(()) - }) + let dynamic_tools = None; + send_message_v2_with_policies( + endpoint, + config_overrides, + user_message, + false, + None, + None, + &dynamic_tools, + ) } pub fn send_message_v2( @@ -877,15 +857,15 @@ fn test_login(endpoint: &Endpoint, config_overrides: &[String]) -> Result<()> { let initialize = client.initialize()?; println!("< initialize response: {initialize:?}"); - let login_response = client.login_chat_gpt()?; - println!("< loginChatGpt response: {login_response:?}"); - println!( - "Open the following URL in your browser to continue:\n{}", - login_response.auth_url - ); + let login_response = client.login_account_chatgpt()?; + println!("< account/login/start response: {login_response:?}"); + let LoginAccountResponse::Chatgpt { login_id, auth_url } = login_response else { + bail!("expected chatgpt login response"); + }; + println!("Open the following URL in your browser to continue:\n{auth_url}"); - let completion = client.wait_for_login_completion(&login_response.login_id)?; - println!("< loginChatGptComplete notification: {completion:?}"); + let completion = client.wait_for_account_login_completion(&login_id)?; + println!("< account/login/completed notification: {completion:?}"); if completion.success { println!("Login succeeded."); @@ -896,7 +876,7 @@ fn test_login(endpoint: &Endpoint, config_overrides: &[String]) -> Result<()> { completion .error .as_deref() - .unwrap_or("unknown error from loginChatGptComplete") + .unwrap_or("unknown error from account/login/completed") ); } }) @@ -1142,69 +1122,6 @@ impl CodexClient { Ok(response) } - fn start_thread(&mut self) -> Result { - let request_id = self.request_id(); - let request = ClientRequest::NewConversation { - request_id: request_id.clone(), - params: NewConversationParams::default(), - }; - - self.send_request(request, request_id, "newConversation") - } - - fn add_conversation_listener( - &mut self, - conversation_id: &ThreadId, - ) -> Result { - let request_id = self.request_id(); - let request = ClientRequest::AddConversationListener { - request_id: request_id.clone(), - params: AddConversationListenerParams { - conversation_id: *conversation_id, - experimental_raw_events: false, - }, - }; - - self.send_request(request, request_id, "addConversationListener") - } - - fn remove_thread_listener(&mut self, subscription_id: Uuid) -> Result<()> { - let request_id = self.request_id(); - let request = ClientRequest::RemoveConversationListener { - request_id: request_id.clone(), - params: codex_app_server_protocol::RemoveConversationListenerParams { subscription_id }, - }; - - self.send_request::( - request, - request_id, - "removeConversationListener", - )?; - - Ok(()) - } - - fn send_user_message( - &mut self, - conversation_id: &ThreadId, - message: &str, - ) -> Result { - let request_id = self.request_id(); - let request = ClientRequest::SendUserMessage { - request_id: request_id.clone(), - params: SendUserMessageParams { - conversation_id: *conversation_id, - items: vec![InputItem::Text { - text: message.to_string(), - // Test client sends plain text without UI element ranges. - text_elements: Vec::new(), - }], - }, - }; - - self.send_request(request, request_id, "sendUserMessage") - } - fn thread_start(&mut self, params: ThreadStartParams) -> Result { let request_id = self.request_id(); let request = ClientRequest::ThreadStart { @@ -1235,14 +1152,14 @@ impl CodexClient { self.send_request(request, request_id, "turn/start") } - fn login_chat_gpt(&mut self) -> Result { + fn login_account_chatgpt(&mut self) -> Result { let request_id = self.request_id(); - let request = ClientRequest::LoginChatGpt { + let request = ClientRequest::LoginAccount { request_id: request_id.clone(), - params: None, + params: codex_app_server_protocol::LoginAccountParams::Chatgpt, }; - self.send_request(request, request_id, "loginChatGpt") + self.send_request(request, request_id, "account/login/start") } fn get_account_rate_limits(&mut self) -> Result { @@ -1275,77 +1192,31 @@ impl CodexClient { self.send_request(request, request_id, "thread/list") } - fn stream_conversation(&mut self, conversation_id: &ThreadId) -> Result<()> { - loop { - let notification = self.next_notification()?; - - if !notification.method.starts_with("codex/event/") { - continue; - } - - if let Some(event) = self.extract_event(notification, conversation_id)? { - match &event.msg { - EventMsg::AgentMessage(event) => { - println!("{}", event.message); - } - EventMsg::AgentMessageDelta(event) => { - print!("{}", event.delta); - std::io::stdout().flush().ok(); - } - EventMsg::TurnComplete(event) => { - println!("\n[task complete: {event:?}]"); - break; - } - EventMsg::TurnAborted(event) => { - println!("\n[turn aborted: {:?}]", event.reason); - break; - } - EventMsg::Error(event) => { - println!("[error] {event:?}"); - } - _ => { - println!("[UNKNOWN EVENT] {:?}", event.msg); - } - } - } - } - - Ok(()) - } - - fn wait_for_login_completion( + fn wait_for_account_login_completion( &mut self, - expected_login_id: &Uuid, - ) -> Result { + expected_login_id: &str, + ) -> Result { loop { let notification = self.next_notification()?; if let Ok(server_notification) = ServerNotification::try_from(notification) { match server_notification { - ServerNotification::LoginChatGptComplete(completion) => { - if &completion.login_id == expected_login_id { + ServerNotification::AccountLoginCompleted(completion) => { + if completion.login_id.as_deref() == Some(expected_login_id) { return Ok(completion); } println!( - "[ignoring loginChatGptComplete for unexpected login_id: {}]", + "[ignoring account/login/completed for unexpected login_id: {:?}]", completion.login_id ); } - ServerNotification::AuthStatusChange(status) => { - println!("< authStatusChange notification: {status:?}"); - } ServerNotification::AccountRateLimitsUpdated(snapshot) => { println!("< accountRateLimitsUpdated notification: {snapshot:?}"); } - ServerNotification::SessionConfigured(_) => { - // SessionConfigured notifications are unrelated to login; skip. - } _ => {} } } - - // Not a server notification (likely a conversation event); keep waiting. } } @@ -1419,36 +1290,6 @@ impl CodexClient { } } - fn extract_event( - &self, - notification: JSONRPCNotification, - conversation_id: &ThreadId, - ) -> Result> { - let params = notification - .params - .context("event notification missing params")?; - - let mut map = match params { - Value::Object(map) => map, - other => bail!("unexpected params shape: {other:?}"), - }; - - let conversation_value = map - .remove("conversationId") - .context("event missing conversationId")?; - let notification_conversation: ThreadId = serde_json::from_value(conversation_value) - .context("conversationId was not a valid UUID")?; - - if ¬ification_conversation != conversation_id { - return Ok(None); - } - - let event_value = Value::Object(map); - let event: Event = - serde_json::from_value(event_value).context("failed to decode event payload")?; - Ok(Some(event)) - } - fn send_request( &mut self, request: ClientRequest, diff --git a/codex-rs/app-server/Cargo.toml b/codex-rs/app-server/Cargo.toml index 3efc7140a..ba2355f67 100644 --- a/codex-rs/app-server/Cargo.toml +++ b/codex-rs/app-server/Cargo.toml @@ -65,11 +65,9 @@ axum = { workspace = true, default-features = false, features = [ "tokio", ] } base64 = { workspace = true } -codex-execpolicy = { workspace = true } core_test_support = { workspace = true } codex-state = { workspace = true } codex-utils-cargo-bin = { workspace = true } -os_info = { workspace = true } pretty_assertions = { workspace = true } rmcp = { workspace = true, default-features = false, features = [ "server", diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rs index ca9eb374c..1c1834555 100644 --- a/codex-rs/app-server/src/codex_message_processor.rs +++ b/codex-rs/app-server/src/codex_message_processor.rs @@ -20,21 +20,15 @@ use chrono::Utc; use codex_app_server_protocol::Account; use codex_app_server_protocol::AccountLoginCompletedNotification; use codex_app_server_protocol::AccountUpdatedNotification; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; use codex_app_server_protocol::AppInfo; use codex_app_server_protocol::AppListUpdatedNotification; use codex_app_server_protocol::AppsListParams; use codex_app_server_protocol::AppsListResponse; -use codex_app_server_protocol::ArchiveConversationParams; -use codex_app_server_protocol::ArchiveConversationResponse; use codex_app_server_protocol::AskForApproval; use codex_app_server_protocol::AuthMode; -use codex_app_server_protocol::AuthStatusChangeNotification; use codex_app_server_protocol::CancelLoginAccountParams; use codex_app_server_protocol::CancelLoginAccountResponse; use codex_app_server_protocol::CancelLoginAccountStatus; -use codex_app_server_protocol::CancelLoginChatGptResponse; use codex_app_server_protocol::ClientRequest; use codex_app_server_protocol::CollaborationModeListParams; use codex_app_server_protocol::CollaborationModeListResponse; @@ -49,8 +43,6 @@ use codex_app_server_protocol::ExperimentalFeatureListResponse; use codex_app_server_protocol::ExperimentalFeatureStage as ApiExperimentalFeatureStage; use codex_app_server_protocol::FeedbackUploadParams; use codex_app_server_protocol::FeedbackUploadResponse; -use codex_app_server_protocol::ForkConversationParams; -use codex_app_server_protocol::ForkConversationResponse; use codex_app_server_protocol::FuzzyFileSearchParams; use codex_app_server_protocol::FuzzyFileSearchResponse; use codex_app_server_protocol::FuzzyFileSearchSessionStartParams; @@ -66,26 +58,16 @@ use codex_app_server_protocol::GetAuthStatusParams; use codex_app_server_protocol::GetAuthStatusResponse; use codex_app_server_protocol::GetConversationSummaryParams; use codex_app_server_protocol::GetConversationSummaryResponse; -use codex_app_server_protocol::GetUserAgentResponse; -use codex_app_server_protocol::GetUserSavedConfigResponse; use codex_app_server_protocol::GitDiffToRemoteResponse; use codex_app_server_protocol::GitInfo as ApiGitInfo; use codex_app_server_protocol::HazelnutScope as ApiHazelnutScope; -use codex_app_server_protocol::InputItem as WireInputItem; -use codex_app_server_protocol::InterruptConversationParams; use codex_app_server_protocol::JSONRPCErrorError; -use codex_app_server_protocol::ListConversationsParams; -use codex_app_server_protocol::ListConversationsResponse; use codex_app_server_protocol::ListMcpServerStatusParams; use codex_app_server_protocol::ListMcpServerStatusResponse; use codex_app_server_protocol::LoginAccountParams; use codex_app_server_protocol::LoginAccountResponse; use codex_app_server_protocol::LoginApiKeyParams; -use codex_app_server_protocol::LoginApiKeyResponse; -use codex_app_server_protocol::LoginChatGptCompleteNotification; -use codex_app_server_protocol::LoginChatGptResponse; use codex_app_server_protocol::LogoutAccountResponse; -use codex_app_server_protocol::LogoutChatGptResponse; use codex_app_server_protocol::McpServerOauthLoginCompletedNotification; use codex_app_server_protocol::McpServerOauthLoginParams; use codex_app_server_protocol::McpServerOauthLoginResponse; @@ -95,28 +77,15 @@ use codex_app_server_protocol::MockExperimentalMethodParams; use codex_app_server_protocol::MockExperimentalMethodResponse; use codex_app_server_protocol::ModelListParams; use codex_app_server_protocol::ModelListResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; use codex_app_server_protocol::ProductSurface as ApiProductSurface; -use codex_app_server_protocol::RemoveConversationListenerParams; -use codex_app_server_protocol::RemoveConversationSubscriptionResponse; use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::ResumeConversationParams; -use codex_app_server_protocol::ResumeConversationResponse; use codex_app_server_protocol::ReviewDelivery as ApiReviewDelivery; use codex_app_server_protocol::ReviewStartParams; use codex_app_server_protocol::ReviewStartResponse; use codex_app_server_protocol::ReviewTarget as ApiReviewTarget; use codex_app_server_protocol::SandboxMode; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use codex_app_server_protocol::SendUserTurnParams; -use codex_app_server_protocol::SendUserTurnResponse; use codex_app_server_protocol::ServerNotification; use codex_app_server_protocol::ServerRequestResolvedNotification; -use codex_app_server_protocol::SessionConfiguredNotification; -use codex_app_server_protocol::SetDefaultModelParams; -use codex_app_server_protocol::SetDefaultModelResponse; use codex_app_server_protocol::SkillsConfigWriteParams; use codex_app_server_protocol::SkillsConfigWriteResponse; use codex_app_server_protocol::SkillsListParams; @@ -176,9 +145,7 @@ use codex_app_server_protocol::TurnStartResponse; use codex_app_server_protocol::TurnStatus; use codex_app_server_protocol::TurnSteerParams; use codex_app_server_protocol::TurnSteerResponse; -use codex_app_server_protocol::UserInfoResponse; use codex_app_server_protocol::UserInput as V2UserInput; -use codex_app_server_protocol::UserSavedConfig; use codex_app_server_protocol::WindowsSandboxSetupCompletedNotification; use codex_app_server_protocol::WindowsSandboxSetupMode; use codex_app_server_protocol::WindowsSandboxSetupStartParams; @@ -205,13 +172,11 @@ use codex_core::auth::login_with_api_key; use codex_core::auth::login_with_chatgpt_auth_tokens; use codex_core::config::Config; use codex_core::config::ConfigOverrides; -use codex_core::config::ConfigService; use codex_core::config::NetworkProxyAuditMetadata; use codex_core::config::edit::ConfigEdit; use codex_core::config::edit::ConfigEditsBuilder; use codex_core::config::types::McpServerTransportConfig; use codex_core::config_loader::CloudRequirementsLoader; -use codex_core::default_client::get_codex_user_agent; use codex_core::default_client::set_default_client_residency_requirement; use codex_core::error::CodexErr; use codex_core::exec::ExecParams; @@ -330,7 +295,7 @@ struct ActiveLogin { #[derive(Clone, Copy, Debug)] enum CancelLoginError { - NotFound(Uuid), + NotFound, } enum AppListLoadResult { @@ -389,6 +354,7 @@ pub(crate) struct CodexMessageProcessor { #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub(crate) enum ApiVersion { + #[allow(dead_code)] V1, #[default] V2, @@ -718,21 +684,10 @@ impl CodexMessageProcessor { self.review_start(to_connection_request_id(request_id), params) .await; } - ClientRequest::NewConversation { request_id, params } => { - // Do not tokio::spawn() to process new_conversation() - // asynchronously because we need to ensure the conversation is - // created before processing any subsequent messages. - self.process_new_conversation(to_connection_request_id(request_id), params) - .await; - } ClientRequest::GetConversationSummary { request_id, params } => { self.get_thread_summary(to_connection_request_id(request_id), params) .await; } - ClientRequest::ListConversations { request_id, params } => { - self.handle_list_conversations(to_connection_request_id(request_id), params) - .await; - } ClientRequest::ModelList { request_id, params } => { let outgoing = self.outgoing.clone(); let thread_manager = self.thread_manager.clone(); @@ -794,100 +749,14 @@ impl CodexMessageProcessor { self.get_account(to_connection_request_id(request_id), params) .await; } - ClientRequest::ResumeConversation { request_id, params } => { - self.handle_resume_conversation(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::ForkConversation { request_id, params } => { - self.handle_fork_conversation(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::ArchiveConversation { request_id, params } => { - self.archive_conversation(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::SendUserMessage { request_id, params } => { - self.send_user_message( - to_connection_request_id(request_id), - params, - app_server_client_name.clone(), - ) - .await; - } - ClientRequest::SendUserTurn { request_id, params } => { - self.send_user_turn( - to_connection_request_id(request_id), - params, - app_server_client_name.clone(), - ) - .await; - } - ClientRequest::InterruptConversation { request_id, params } => { - self.interrupt_conversation(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::AddConversationListener { request_id, params } => { - self.add_conversation_listener(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::RemoveConversationListener { request_id, params } => { - self.remove_thread_listener(to_connection_request_id(request_id), params) - .await; - } ClientRequest::GitDiffToRemote { request_id, params } => { self.git_diff_to_origin(to_connection_request_id(request_id), params.cwd) .await; } - ClientRequest::LoginApiKey { request_id, params } => { - self.login_api_key_v1(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::LoginChatGpt { - request_id, - params: _, - } => { - self.login_chatgpt_v1(to_connection_request_id(request_id)) - .await; - } - ClientRequest::CancelLoginChatGpt { request_id, params } => { - self.cancel_login_chatgpt(to_connection_request_id(request_id), params.login_id) - .await; - } - ClientRequest::LogoutChatGpt { - request_id, - params: _, - } => { - self.logout_v1(to_connection_request_id(request_id)).await; - } ClientRequest::GetAuthStatus { request_id, params } => { self.get_auth_status(to_connection_request_id(request_id), params) .await; } - ClientRequest::GetUserSavedConfig { - request_id, - params: _, - } => { - self.get_user_saved_config(to_connection_request_id(request_id)) - .await; - } - ClientRequest::SetDefaultModel { request_id, params } => { - self.set_default_model(to_connection_request_id(request_id), params) - .await; - } - ClientRequest::GetUserAgent { - request_id, - params: _, - } => { - self.get_user_agent(to_connection_request_id(request_id)) - .await; - } - ClientRequest::UserInfo { - request_id, - params: _, - } => { - self.get_user_info(to_connection_request_id(request_id)) - .await; - } ClientRequest::FuzzyFileSearch { request_id, params } => { self.fuzzy_file_search(to_connection_request_id(request_id), params) .await; @@ -908,10 +777,6 @@ impl CodexMessageProcessor { self.exec_one_off_command(to_connection_request_id(request_id), params) .await; } - ClientRequest::ExecOneOffCommand { request_id, params } => { - self.exec_one_off_command(to_connection_request_id(request_id), params.into()) - .await; - } ClientRequest::ConfigRead { .. } | ClientRequest::ConfigValueWrite { .. } | ClientRequest::ConfigBatchWrite { .. } => { @@ -1016,34 +881,6 @@ impl CodexMessageProcessor { } } - async fn login_api_key_v1( - &mut self, - request_id: ConnectionRequestId, - params: LoginApiKeyParams, - ) { - match self.login_api_key_common(¶ms).await { - Ok(()) => { - self.outgoing - .send_response(request_id, LoginApiKeyResponse {}) - .await; - - let payload = AuthStatusChangeNotification { - auth_method: self - .auth_manager - .auth_cached() - .as_ref() - .map(CodexAuth::api_auth_mode), - }; - self.outgoing - .send_server_notification(ServerNotification::AuthStatusChange(payload)) - .await; - } - Err(error) => { - self.outgoing.send_error(request_id, error).await; - } - } - } - async fn login_api_key_v2( &mut self, request_id: ConnectionRequestId, @@ -1106,115 +943,6 @@ impl CodexMessageProcessor { }) } - // Deprecated in favor of login_chatgpt_v2. - async fn login_chatgpt_v1(&mut self, request_id: ConnectionRequestId) { - match self.login_chatgpt_common().await { - Ok(opts) => match run_login_server(opts) { - Ok(server) => { - let login_id = Uuid::new_v4(); - let shutdown_handle = server.cancel_handle(); - - // Replace active login if present. - { - let mut guard = self.active_login.lock().await; - if let Some(existing) = guard.take() { - drop(existing); - } - *guard = Some(ActiveLogin { - shutdown_handle: shutdown_handle.clone(), - login_id, - }); - } - - // Spawn background task to monitor completion. - let outgoing_clone = self.outgoing.clone(); - let active_login = self.active_login.clone(); - let auth_manager = self.auth_manager.clone(); - let cloud_requirements = self.cloud_requirements.clone(); - let chatgpt_base_url = self.config.chatgpt_base_url.clone(); - let codex_home = self.config.codex_home.clone(); - let cli_overrides = self.cli_overrides.clone(); - let auth_url = server.auth_url.clone(); - tokio::spawn(async move { - let (success, error_msg) = match tokio::time::timeout( - LOGIN_CHATGPT_TIMEOUT, - server.block_until_done(), - ) - .await - { - Ok(Ok(())) => (true, None), - Ok(Err(err)) => (false, Some(format!("Login server error: {err}"))), - Err(_elapsed) => { - shutdown_handle.shutdown(); - (false, Some("Login timed out".to_string())) - } - }; - - let payload = LoginChatGptCompleteNotification { - login_id, - success, - error: error_msg.clone(), - }; - outgoing_clone - .send_server_notification(ServerNotification::LoginChatGptComplete( - payload, - )) - .await; - - if success { - auth_manager.reload(); - replace_cloud_requirements_loader( - cloud_requirements.as_ref(), - auth_manager.clone(), - chatgpt_base_url, - codex_home, - ); - sync_default_client_residency_requirement( - &cli_overrides, - cloud_requirements.as_ref(), - ) - .await; - - // Notify clients with the actual current auth mode. - let current_auth_method = auth_manager - .auth_cached() - .as_ref() - .map(CodexAuth::api_auth_mode); - let payload = AuthStatusChangeNotification { - auth_method: current_auth_method, - }; - outgoing_clone - .send_server_notification(ServerNotification::AuthStatusChange( - payload, - )) - .await; - } - - // Clear the active login if it matches this attempt. It may have been replaced or cancelled. - let mut guard = active_login.lock().await; - if guard.as_ref().map(|l| l.login_id) == Some(login_id) { - *guard = None; - } - }); - - let response = LoginChatGptResponse { login_id, auth_url }; - self.outgoing.send_response(request_id, response).await; - } - Err(err) => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: format!("failed to start login server: {err}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } - }, - Err(err) => { - self.outgoing.send_error(request_id, err).await; - } - } - } - async fn login_chatgpt_v2(&mut self, request_id: ConnectionRequestId) { match self.login_chatgpt_common().await { Ok(opts) => match run_login_server(opts) { @@ -1335,25 +1063,7 @@ impl CodexMessageProcessor { } Ok(()) } else { - Err(CancelLoginError::NotFound(login_id)) - } - } - - async fn cancel_login_chatgpt(&mut self, request_id: ConnectionRequestId, login_id: Uuid) { - match self.cancel_login_chatgpt_common(login_id).await { - Ok(()) => { - self.outgoing - .send_response(request_id, CancelLoginChatGptResponse {}) - .await; - } - Err(CancelLoginError::NotFound(missing_login_id)) => { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("login id not found: {missing_login_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } + Err(CancelLoginError::NotFound) } } @@ -1367,7 +1077,7 @@ impl CodexMessageProcessor { Ok(uuid) => { let status = match self.cancel_login_chatgpt_common(uuid).await { Ok(()) => CancelLoginAccountStatus::Canceled, - Err(CancelLoginError::NotFound(_)) => CancelLoginAccountStatus::NotFound, + Err(CancelLoginError::NotFound) => CancelLoginAccountStatus::NotFound, }; let response = CancelLoginAccountResponse { status }; self.outgoing.send_response(request_id, response).await; @@ -1500,26 +1210,6 @@ impl CodexMessageProcessor { .map(CodexAuth::api_auth_mode)) } - async fn logout_v1(&mut self, request_id: ConnectionRequestId) { - match self.logout_common().await { - Ok(current_auth_method) => { - self.outgoing - .send_response(request_id, LogoutChatGptResponse {}) - .await; - - let payload = AuthStatusChangeNotification { - auth_method: current_auth_method, - }; - self.outgoing - .send_server_notification(ServerNotification::AuthStatusChange(payload)) - .await; - } - Err(error) => { - self.outgoing.send_error(request_id, error).await; - } - } - } - async fn logout_v2(&mut self, request_id: ConnectionRequestId) { match self.logout_common().await { Ok(current_auth_method) => { @@ -1651,12 +1341,6 @@ impl CodexMessageProcessor { self.outgoing.send_response(request_id, response).await; } - async fn get_user_agent(&self, request_id: ConnectionRequestId) { - let user_agent = get_codex_user_agent(); - let response = GetUserAgentResponse { user_agent }; - self.outgoing.send_response(request_id, response).await; - } - async fn get_account_rate_limits(&self, request_id: ConnectionRequestId) { match self.fetch_account_rate_limits().await { Ok((rate_limits, rate_limits_by_limit_id)) => { @@ -1746,69 +1430,6 @@ impl CodexMessageProcessor { Ok((primary, rate_limits_by_limit_id)) } - async fn get_user_saved_config(&self, request_id: ConnectionRequestId) { - let service = ConfigService::new_with_defaults(self.config.codex_home.clone()); - let user_saved_config: UserSavedConfig = match service.load_user_saved_config().await { - Ok(config) => config, - Err(err) => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: err.to_string(), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - - let response = GetUserSavedConfigResponse { - config: user_saved_config, - }; - self.outgoing.send_response(request_id, response).await; - } - - async fn get_user_info(&self, request_id: ConnectionRequestId) { - // Read alleged user email from cached auth (best-effort; not verified). - let alleged_user_email = self - .auth_manager - .auth_cached() - .and_then(|a| a.get_account_email()); - - let response = UserInfoResponse { alleged_user_email }; - self.outgoing.send_response(request_id, response).await; - } - - async fn set_default_model( - &self, - request_id: ConnectionRequestId, - params: SetDefaultModelParams, - ) { - let SetDefaultModelParams { - model, - reasoning_effort, - } = params; - - match ConfigEditsBuilder::new(&self.config.codex_home) - .with_profile(self.config.active_profile.as_deref()) - .set_model(model.as_deref(), reasoning_effort) - .apply() - .await - { - Ok(()) => { - let response = SetDefaultModelResponse {}; - self.outgoing.send_response(request_id, response).await; - } - Err(err) => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: format!("failed to persist model selection: {err}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } - } - } - async fn exec_one_off_command( &self, request_id: ConnectionRequestId, @@ -1930,119 +1551,6 @@ impl CodexMessageProcessor { }); } - async fn process_new_conversation( - &mut self, - request_id: ConnectionRequestId, - params: NewConversationParams, - ) { - let NewConversationParams { - model, - model_provider, - profile, - cwd, - approval_policy, - sandbox: sandbox_mode, - config: request_overrides, - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - } = params; - - let typesafe_overrides = ConfigOverrides { - model, - config_profile: profile, - cwd: cwd.clone().map(PathBuf::from), - approval_policy, - sandbox_mode, - model_provider, - codex_linux_sandbox_exe: self.arg0_paths.codex_linux_sandbox_exe.clone(), - main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - ..Default::default() - }; - - // Persist Windows sandbox mode. - // TODO: persist default config in general. - let mut request_overrides = request_overrides.unwrap_or_default(); - if cfg!(windows) { - match WindowsSandboxLevel::from_config(&self.config) { - WindowsSandboxLevel::Elevated => { - request_overrides - .insert("windows.sandbox".to_string(), serde_json::json!("elevated")); - } - WindowsSandboxLevel::RestrictedToken => { - request_overrides.insert( - "windows.sandbox".to_string(), - serde_json::json!("unelevated"), - ); - } - WindowsSandboxLevel::Disabled => {} - } - } - - let cloud_requirements = self.current_cloud_requirements(); - let config = match derive_config_from_params( - &self.cli_overrides, - Some(request_overrides), - typesafe_overrides, - &cloud_requirements, - ) - .await - { - Ok(config) => config, - Err(err) => { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("error deriving config: {err}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - - match self.thread_manager.start_thread(config).await { - Ok(new_thread) => { - let NewThread { - thread_id, - session_configured, - .. - } = new_thread; - let rollout_path = match session_configured.rollout_path { - Some(path) => path, - None => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: "rollout path missing for v1 conversation".to_string(), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - let response = NewConversationResponse { - conversation_id: thread_id, - model: session_configured.model, - reasoning_effort: session_configured.reasoning_effort, - rollout_path, - }; - self.outgoing.send_response(request_id, response).await; - } - Err(err) => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: format!("error creating conversation: {err}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } - } - } - async fn thread_start(&self, request_id: ConnectionRequestId, params: ThreadStartParams) { let ThreadStartParams { model, @@ -3814,45 +3322,6 @@ impl CodexMessageProcessor { } } - async fn handle_list_conversations( - &self, - request_id: ConnectionRequestId, - params: ListConversationsParams, - ) { - let ListConversationsParams { - page_size, - cursor, - model_providers, - } = params; - let requested_page_size = page_size - .unwrap_or(THREAD_LIST_DEFAULT_LIMIT) - .clamp(1, THREAD_LIST_MAX_LIMIT); - - match self - .list_threads_common( - requested_page_size, - cursor, - CoreThreadSortKey::UpdatedAt, - ThreadListFilters { - model_providers, - source_kinds: None, - archived: false, - cwd: None, - search_term: None, - }, - ) - .await - { - Ok((items, next_cursor)) => { - let response = ListConversationsResponse { items, next_cursor }; - self.outgoing.send_response(request_id, response).await; - } - Err(error) => { - self.outgoing.send_error(request_id, error).await; - } - }; - } - async fn list_threads_common( &self, requested_page_size: usize, @@ -4453,440 +3922,6 @@ impl CodexMessageProcessor { outgoing.send_response(request_id, response).await; } - async fn handle_resume_conversation( - &self, - request_id: ConnectionRequestId, - params: ResumeConversationParams, - ) { - let ResumeConversationParams { - path, - conversation_id, - history, - overrides, - } = params; - - let thread_history = if let Some(path) = path { - match RolloutRecorder::get_rollout_history(&path).await { - Ok(initial_history) => initial_history, - Err(err) => { - self.send_invalid_request_error( - request_id, - format!("failed to load rollout `{}`: {err}", path.display()), - ) - .await; - return; - } - } - } else if let Some(conversation_id) = conversation_id { - match find_thread_path_by_id_str(&self.config.codex_home, &conversation_id.to_string()) - .await - { - Ok(Some(found_path)) => { - match RolloutRecorder::get_rollout_history(&found_path).await { - Ok(initial_history) => initial_history, - Err(err) => { - self.send_invalid_request_error( - request_id, - format!( - "failed to load rollout `{}` for conversation {conversation_id}: {err}", - found_path.display() - ), - ).await; - return; - } - } - } - Ok(None) => { - self.send_invalid_request_error( - request_id, - format!("no rollout found for conversation id {conversation_id}"), - ) - .await; - return; - } - Err(err) => { - self.send_invalid_request_error( - request_id, - format!("failed to locate conversation id {conversation_id}: {err}"), - ) - .await; - return; - } - } - } else { - match history { - Some(history) if !history.is_empty() => InitialHistory::Forked( - history.into_iter().map(RolloutItem::ResponseItem).collect(), - ), - Some(_) | None => { - self.send_invalid_request_error( - request_id, - "either path, conversation id or non empty history must be provided" - .to_string(), - ) - .await; - return; - } - } - }; - - let history_cwd = thread_history.session_cwd(); - let (typesafe_overrides, request_overrides) = match overrides { - Some(overrides) => { - let NewConversationParams { - model, - model_provider, - profile, - cwd, - approval_policy, - sandbox: sandbox_mode, - config: request_overrides, - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - } = overrides; - - // Persist Windows sandbox mode. - let mut request_overrides = request_overrides.unwrap_or_default(); - if cfg!(windows) { - match WindowsSandboxLevel::from_config(&self.config) { - WindowsSandboxLevel::Elevated => { - request_overrides.insert( - "windows.sandbox".to_string(), - serde_json::json!("elevated"), - ); - } - WindowsSandboxLevel::RestrictedToken => { - request_overrides.insert( - "windows.sandbox".to_string(), - serde_json::json!("unelevated"), - ); - } - WindowsSandboxLevel::Disabled => {} - } - } - - let typesafe_overrides = ConfigOverrides { - model, - config_profile: profile, - cwd: cwd.map(PathBuf::from), - approval_policy, - sandbox_mode, - model_provider, - codex_linux_sandbox_exe: self.arg0_paths.codex_linux_sandbox_exe.clone(), - main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - ..Default::default() - }; - (typesafe_overrides, Some(request_overrides)) - } - None => ( - ConfigOverrides { - codex_linux_sandbox_exe: self.arg0_paths.codex_linux_sandbox_exe.clone(), - main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), - ..Default::default() - }, - None, - ), - }; - - let cloud_requirements = self.current_cloud_requirements(); - let config = match derive_config_for_cwd( - &self.cli_overrides, - request_overrides, - typesafe_overrides, - history_cwd, - &cloud_requirements, - ) - .await - { - Ok(cfg) => cfg, - Err(err) => { - self.send_invalid_request_error( - request_id, - format!("error deriving config: {err}"), - ) - .await; - return; - } - }; - - match self - .thread_manager - .resume_thread_with_history(config, thread_history, self.auth_manager.clone(), false) - .await - { - Ok(NewThread { - thread_id, - session_configured, - .. - }) => { - let rollout_path = match session_configured.rollout_path.clone() { - Some(path) => path, - None => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: "rollout path missing for resumed conversation".to_string(), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - self.outgoing - .send_server_notification(ServerNotification::SessionConfigured( - SessionConfiguredNotification { - session_id: session_configured.session_id, - model: session_configured.model.clone(), - service_tier: session_configured.service_tier, - reasoning_effort: session_configured.reasoning_effort, - history_log_id: session_configured.history_log_id, - history_entry_count: session_configured.history_entry_count, - initial_messages: session_configured.initial_messages.clone(), - rollout_path: rollout_path.clone(), - }, - )) - .await; - let initial_messages = session_configured - .initial_messages - .map(|msgs| msgs.into_iter().collect()); - - // Reply with thread id + model and initial messages (when present) - let response = ResumeConversationResponse { - conversation_id: thread_id, - model: session_configured.model.clone(), - initial_messages, - rollout_path, - }; - self.outgoing.send_response(request_id, response).await; - } - Err(err) => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: format!("error resuming conversation: {err}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } - } - } - - async fn handle_fork_conversation( - &self, - request_id: ConnectionRequestId, - params: ForkConversationParams, - ) { - let ForkConversationParams { - path, - conversation_id, - overrides, - } = params; - - // Derive a Config using the same logic as new conversation, honoring overrides if provided. - let (rollout_path, source_thread_id) = if let Some(path) = path { - (path, None) - } else if let Some(conversation_id) = conversation_id { - match find_thread_path_by_id_str(&self.config.codex_home, &conversation_id.to_string()) - .await - { - Ok(Some(found_path)) => (found_path, Some(conversation_id)), - Ok(None) => { - self.send_invalid_request_error( - request_id, - format!("no rollout found for conversation id {conversation_id}"), - ) - .await; - return; - } - Err(err) => { - self.send_invalid_request_error( - request_id, - format!("failed to locate conversation id {conversation_id}: {err}"), - ) - .await; - return; - } - } - } else { - self.send_invalid_request_error( - request_id, - "either path or conversation id must be provided".to_string(), - ) - .await; - return; - }; - - let history_cwd = - read_history_cwd_from_state_db(&self.config, source_thread_id, rollout_path.as_path()) - .await; - - let (typesafe_overrides, request_overrides) = match overrides { - Some(overrides) => { - let NewConversationParams { - model, - model_provider, - profile, - cwd, - approval_policy, - sandbox: sandbox_mode, - config: cli_overrides, - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - } = overrides; - - // Persist Windows sandbox mode. - let mut cli_overrides = cli_overrides.unwrap_or_default(); - if cfg!(windows) { - match WindowsSandboxLevel::from_config(&self.config) { - WindowsSandboxLevel::Elevated => { - cli_overrides.insert( - "windows.sandbox".to_string(), - serde_json::json!("elevated"), - ); - } - WindowsSandboxLevel::RestrictedToken => { - cli_overrides.insert( - "windows.sandbox".to_string(), - serde_json::json!("unelevated"), - ); - } - WindowsSandboxLevel::Disabled => {} - } - } - let request_overrides = if cli_overrides.is_empty() { - None - } else { - Some(cli_overrides) - }; - - let overrides = ConfigOverrides { - model, - config_profile: profile, - cwd: cwd.map(PathBuf::from), - approval_policy, - sandbox_mode, - model_provider, - codex_linux_sandbox_exe: self.arg0_paths.codex_linux_sandbox_exe.clone(), - main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), - base_instructions, - developer_instructions, - compact_prompt, - include_apply_patch_tool, - ..Default::default() - }; - - (overrides, request_overrides) - } - None => ( - ConfigOverrides { - codex_linux_sandbox_exe: self.arg0_paths.codex_linux_sandbox_exe.clone(), - main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), - ..Default::default() - }, - None, - ), - }; - - let cloud_requirements = self.current_cloud_requirements(); - let config = match derive_config_for_cwd( - &self.cli_overrides, - request_overrides, - typesafe_overrides, - history_cwd, - &cloud_requirements, - ) - .await - { - Ok(cfg) => cfg, - Err(err) => { - self.send_invalid_request_error( - request_id, - format!("error deriving config: {err}"), - ) - .await; - return; - } - }; - - let NewThread { - thread_id, - session_configured, - .. - } = match self - .thread_manager - .fork_thread(usize::MAX, config, rollout_path.clone(), false) - .await - { - Ok(thread) => thread, - Err(err) => { - let (code, message) = match err { - CodexErr::Io(_) | CodexErr::Json(_) => ( - INVALID_REQUEST_ERROR_CODE, - format!("failed to load rollout `{}`: {err}", rollout_path.display()), - ), - CodexErr::InvalidRequest(message) => (INVALID_REQUEST_ERROR_CODE, message), - _ => ( - INTERNAL_ERROR_CODE, - format!("error forking conversation: {err}"), - ), - }; - let error = JSONRPCErrorError { - code, - message, - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - - let rollout_path = match session_configured.rollout_path.clone() { - Some(path) => path, - None => { - let error = JSONRPCErrorError { - code: INTERNAL_ERROR_CODE, - message: "rollout path missing for forked conversation".to_string(), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - - self.outgoing - .send_server_notification(ServerNotification::SessionConfigured( - SessionConfiguredNotification { - session_id: session_configured.session_id, - model: session_configured.model.clone(), - service_tier: session_configured.service_tier, - reasoning_effort: session_configured.reasoning_effort, - history_log_id: session_configured.history_log_id, - history_entry_count: session_configured.history_entry_count, - initial_messages: session_configured.initial_messages.clone(), - rollout_path: rollout_path.clone(), - }, - )) - .await; - let initial_messages = session_configured - .initial_messages - .map(|msgs| msgs.into_iter().collect()); - - // Reply with conversation id + model and initial messages (when present) - let response = ForkConversationResponse { - conversation_id: thread_id, - model: session_configured.model.clone(), - initial_messages, - rollout_path, - }; - self.outgoing.send_response(request_id, response).await; - } - async fn send_invalid_request_error(&self, request_id: ConnectionRequestId, message: String) { let error = JSONRPCErrorError { code: INVALID_REQUEST_ERROR_CODE, @@ -4910,14 +3945,6 @@ impl CodexMessageProcessor { } } - fn validate_v1_input_limit(items: &[WireInputItem]) -> Result<(), JSONRPCErrorError> { - let actual_chars: usize = items.iter().map(WireInputItem::text_char_count).sum(); - if actual_chars > MAX_USER_INPUT_TEXT_CHARS { - return Err(Self::input_too_large_error(actual_chars)); - } - Ok(()) - } - fn validate_v2_input_limit(items: &[V2UserInput]) -> Result<(), JSONRPCErrorError> { let actual_chars: usize = items.iter().map(V2UserInput::text_char_count).sum(); if actual_chars > MAX_USER_INPUT_TEXT_CHARS { @@ -4935,29 +3962,6 @@ impl CodexMessageProcessor { self.outgoing.send_error(request_id, error).await; } - async fn archive_conversation( - &mut self, - request_id: ConnectionRequestId, - params: ArchiveConversationParams, - ) { - let ArchiveConversationParams { - conversation_id: thread_id, - rollout_path, - } = params; - - match self.archive_thread_common(thread_id, &rollout_path).await { - Ok(()) => { - tracing::info!("thread/archive succeeded for {thread_id}"); - let response = ArchiveConversationResponse {}; - self.outgoing.send_response(request_id, response).await; - } - Err(err) => { - tracing::warn!("thread/archive failed for {thread_id}: {}", err.message); - self.outgoing.send_error(request_id, err).await; - } - } - } - async fn wait_for_thread_shutdown(thread: &Arc) -> ThreadShutdownResult { match thread.submit(Op::Shutdown).await { Ok(_) => { @@ -5220,140 +4224,6 @@ impl CodexMessageProcessor { }) } - async fn send_user_message( - &self, - request_id: ConnectionRequestId, - params: SendUserMessageParams, - app_server_client_name: Option, - ) { - let SendUserMessageParams { - conversation_id, - items, - } = params; - if let Err(error) = Self::validate_v1_input_limit(&items) { - self.outgoing.send_error(request_id, error).await; - return; - } - let Ok(conversation) = self.thread_manager.get_thread(conversation_id).await else { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("conversation not found: {conversation_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - }; - if let Err(error) = - Self::set_app_server_client_name(conversation.as_ref(), app_server_client_name).await - { - self.outgoing.send_error(request_id, error).await; - return; - } - - let mapped_items: Vec = items - .into_iter() - .map(|item| match item { - WireInputItem::Text { - text, - text_elements, - } => CoreInputItem::Text { - text, - text_elements: text_elements.into_iter().map(Into::into).collect(), - }, - WireInputItem::Image { image_url } => CoreInputItem::Image { image_url }, - WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path }, - }) - .collect(); - - // Submit user input to the conversation. - let _ = conversation - .submit(Op::UserInput { - items: mapped_items, - final_output_json_schema: None, - }) - .await; - - // Acknowledge with an empty result. - self.outgoing - .send_response(request_id, SendUserMessageResponse {}) - .await; - } - - async fn send_user_turn( - &self, - request_id: ConnectionRequestId, - params: SendUserTurnParams, - app_server_client_name: Option, - ) { - let SendUserTurnParams { - conversation_id, - items, - cwd, - approval_policy, - sandbox_policy, - model, - service_tier, - effort, - summary, - output_schema, - } = params; - if let Err(error) = Self::validate_v1_input_limit(&items) { - self.outgoing.send_error(request_id, error).await; - return; - } - - let Ok(conversation) = self.thread_manager.get_thread(conversation_id).await else { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("conversation not found: {conversation_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - }; - if let Err(error) = - Self::set_app_server_client_name(conversation.as_ref(), app_server_client_name).await - { - self.outgoing.send_error(request_id, error).await; - return; - } - - let mapped_items: Vec = items - .into_iter() - .map(|item| match item { - WireInputItem::Text { - text, - text_elements, - } => CoreInputItem::Text { - text, - text_elements: text_elements.into_iter().map(Into::into).collect(), - }, - WireInputItem::Image { image_url } => CoreInputItem::Image { image_url }, - WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path }, - }) - .collect(); - - let _ = conversation - .submit(Op::UserTurn { - items: mapped_items, - cwd, - approval_policy, - sandbox_policy, - model, - effort, - summary: Some(summary), - service_tier, - final_output_json_schema: output_schema, - collaboration_mode: None, - personality: None, - }) - .await; - - self.outgoing - .send_response(request_id, SendUserTurnResponse {}) - .await; - } - async fn apps_list(&self, request_id: ConnectionRequestId, params: AppsListParams) { let mut config = match self.load_latest_config().await { Ok(config) => config, @@ -5808,40 +4678,6 @@ impl CodexMessageProcessor { } } - async fn interrupt_conversation( - &mut self, - request_id: ConnectionRequestId, - params: InterruptConversationParams, - ) { - let InterruptConversationParams { conversation_id } = params; - let Ok(conversation) = self.thread_manager.get_thread(conversation_id).await else { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("conversation not found: {conversation_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - }; - - let request = request_id.clone(); - - // Record the pending interrupt so we can reply when TurnAborted arrives. - { - let pending_interrupts = self - .thread_state_manager - .thread_state(conversation_id) - .await; - let mut thread_state = pending_interrupts.lock().await; - thread_state - .pending_interrupts - .push((request, ApiVersion::V1)); - } - - // Submit the interrupt; we'll respond upon TurnAborted. - let _ = conversation.submit(Op::Interrupt).await; - } - async fn turn_start( &self, request_id: ConnectionRequestId, @@ -6447,76 +5283,6 @@ impl CodexMessageProcessor { let _ = thread.submit(Op::Interrupt).await; } - async fn add_conversation_listener( - &mut self, - request_id: ConnectionRequestId, - params: AddConversationListenerParams, - ) { - let AddConversationListenerParams { - conversation_id, - experimental_raw_events, - } = params; - let conversation = match self.thread_manager.get_thread(conversation_id).await { - Ok(conv) => conv, - Err(_) => { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("thread not found: {conversation_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - return; - } - }; - let subscription_id = Uuid::new_v4(); - let thread_state = self - .thread_state_manager - .set_listener( - subscription_id, - conversation_id, - request_id.connection_id, - experimental_raw_events, - ) - .await; - self.ensure_listener_task_running( - conversation_id, - conversation, - thread_state, - ApiVersion::V1, - ) - .await; - - let response = AddConversationSubscriptionResponse { subscription_id }; - self.outgoing.send_response(request_id, response).await; - } - - async fn remove_thread_listener( - &mut self, - request_id: ConnectionRequestId, - params: RemoveConversationListenerParams, - ) { - let RemoveConversationListenerParams { subscription_id } = params; - match self - .thread_state_manager - .remove_listener(subscription_id) - .await - { - Some(thread_id) => { - info!("removed listener for thread {thread_id}"); - let response = RemoveConversationSubscriptionResponse {}; - self.outgoing.send_response(request_id, response).await; - } - None => { - let error = JSONRPCErrorError { - code: INVALID_REQUEST_ERROR_CODE, - message: format!("subscription not found: {subscription_id}"), - data: None, - }; - self.outgoing.send_error(request_id, error).await; - } - } - } - async fn ensure_conversation_listener( &self, conversation_id: ThreadId, @@ -8290,143 +7056,6 @@ mod tests { Ok(()) } - #[tokio::test] - async fn removing_listeners_retains_thread_listener_when_last_subscriber_leaves() -> Result<()> - { - let manager = ThreadStateManager::new(); - let thread_id = ThreadId::from_string("ad7f0408-99b8-4f6e-a46f-bd0eec433370")?; - let listener_a = Uuid::new_v4(); - let listener_b = Uuid::new_v4(); - let connection_a = ConnectionId(1); - let connection_b = ConnectionId(2); - let (cancel_tx, mut cancel_rx) = oneshot::channel(); - - manager - .set_listener(listener_a, thread_id, connection_a, false) - .await; - manager - .set_listener(listener_b, thread_id, connection_b, false) - .await; - { - let state = manager.thread_state(thread_id).await; - state.lock().await.cancel_tx = Some(cancel_tx); - } - - assert_eq!(manager.remove_listener(listener_a).await, Some(thread_id)); - assert!( - tokio::time::timeout(Duration::from_millis(20), &mut cancel_rx) - .await - .is_err() - ); - assert_eq!(manager.remove_listener(listener_b).await, Some(thread_id)); - assert!( - tokio::time::timeout(Duration::from_millis(20), &mut cancel_rx) - .await - .is_err() - ); - assert!( - manager - .subscribed_connection_ids(thread_id) - .await - .is_empty() - ); - Ok(()) - } - - #[tokio::test] - async fn removing_listener_unsubscribes_its_connection() -> Result<()> { - let manager = ThreadStateManager::new(); - let thread_id = ThreadId::from_string("ad7f0408-99b8-4f6e-a46f-bd0eec433370")?; - let listener_a = Uuid::new_v4(); - let listener_b = Uuid::new_v4(); - let connection_a = ConnectionId(1); - let connection_b = ConnectionId(2); - - manager - .set_listener(listener_a, thread_id, connection_a, false) - .await; - manager - .set_listener(listener_b, thread_id, connection_b, false) - .await; - - assert_eq!(manager.remove_listener(listener_a).await, Some(thread_id)); - let subscribed_connection_ids = manager.subscribed_connection_ids(thread_id).await; - assert_eq!(subscribed_connection_ids, vec![connection_b]); - Ok(()) - } - - #[tokio::test] - async fn set_listener_uses_last_write_for_raw_events() -> Result<()> { - let manager = ThreadStateManager::new(); - let thread_id = ThreadId::from_string("ad7f0408-99b8-4f6e-a46f-bd0eec433370")?; - let listener_a = Uuid::new_v4(); - let listener_b = Uuid::new_v4(); - let connection_a = ConnectionId(1); - let connection_b = ConnectionId(2); - - manager - .set_listener(listener_a, thread_id, connection_a, true) - .await; - { - let state = manager.thread_state(thread_id).await; - assert!(state.lock().await.experimental_raw_events); - } - manager - .set_listener(listener_b, thread_id, connection_b, false) - .await; - let state = manager.thread_state(thread_id).await; - assert!(!state.lock().await.experimental_raw_events); - Ok(()) - } - - #[tokio::test] - async fn removing_connection_retains_listener_and_active_turn_when_last_subscriber_disconnects() - -> Result<()> { - let manager = ThreadStateManager::new(); - let thread_id = ThreadId::from_string("ad7f0408-99b8-4f6e-a46f-bd0eec433370")?; - let listener = Uuid::new_v4(); - let connection = ConnectionId(1); - let (cancel_tx, mut cancel_rx) = oneshot::channel(); - - manager - .set_listener(listener, thread_id, connection, false) - .await; - { - let state = manager.thread_state(thread_id).await; - let mut state = state.lock().await; - state.cancel_tx = Some(cancel_tx); - state.track_current_turn_event(&EventMsg::TurnStarted( - codex_protocol::protocol::TurnStartedEvent { - turn_id: "turn-1".to_string(), - model_context_window: None, - collaboration_mode_kind: Default::default(), - }, - )); - } - - manager.remove_connection(connection).await; - assert!( - tokio::time::timeout(Duration::from_millis(20), &mut cancel_rx) - .await - .is_err() - ); - assert_eq!(manager.remove_listener(listener).await, None); - - let state = manager.thread_state(thread_id).await; - let state = state.lock().await; - assert!( - manager - .subscribed_connection_ids(thread_id) - .await - .is_empty() - ); - assert!(state.cancel_tx.is_some()); - let active_turn = state.active_turn_snapshot().expect("active turn snapshot"); - assert_eq!(active_turn.id, "turn-1"); - assert_eq!(active_turn.status, TurnStatus::InProgress); - Ok(()) - } - #[tokio::test] async fn removing_thread_state_clears_listener_and_active_turn_history() -> Result<()> { let manager = ThreadStateManager::new(); diff --git a/codex-rs/app-server/src/outgoing_message.rs b/codex-rs/app-server/src/outgoing_message.rs index 5f56c81c5..368d5d21a 100644 --- a/codex-rs/app-server/src/outgoing_message.rs +++ b/codex-rs/app-server/src/outgoing_message.rs @@ -500,7 +500,6 @@ mod tests { use codex_app_server_protocol::ConfigWarningNotification; use codex_app_server_protocol::DynamicToolCallParams; use codex_app_server_protocol::FileChangeRequestApprovalParams; - use codex_app_server_protocol::LoginChatGptCompleteNotification; use codex_app_server_protocol::ModelRerouteReason; use codex_app_server_protocol::ModelReroutedNotification; use codex_app_server_protocol::RateLimitSnapshot; @@ -518,8 +517,8 @@ mod tests { #[test] fn verify_server_notification_serialization() { let notification = - ServerNotification::LoginChatGptComplete(LoginChatGptCompleteNotification { - login_id: Uuid::nil(), + ServerNotification::AccountLoginCompleted(AccountLoginCompletedNotification { + login_id: Some(Uuid::nil().to_string()), success: true, error: None, }); @@ -527,9 +526,9 @@ mod tests { let jsonrpc_notification = OutgoingMessage::AppServerNotification(notification); assert_eq!( json!({ - "method": "loginChatGptComplete", + "method": "account/login/completed", "params": { - "loginId": Uuid::nil(), + "loginId": Uuid::nil().to_string(), "success": true, "error": null, }, diff --git a/codex-rs/app-server/src/thread_state.rs b/codex-rs/app-server/src/thread_state.rs index a60dc07b5..915cc0fd7 100644 --- a/codex-rs/app-server/src/thread_state.rs +++ b/codex-rs/app-server/src/thread_state.rs @@ -16,7 +16,6 @@ use std::sync::Weak; use tokio::sync::Mutex; use tokio::sync::mpsc; use tokio::sync::oneshot; -use uuid::Uuid; type PendingInterruptQueue = Vec<( ConnectionRequestId, @@ -116,12 +115,6 @@ impl ThreadState { } } -#[derive(Clone, Copy)] -struct SubscriptionState { - thread_id: ThreadId, - connection_id: ConnectionId, -} - struct ThreadEntry { state: Arc>, connection_ids: HashSet, @@ -140,7 +133,6 @@ impl Default for ThreadEntry { struct ThreadStateManagerInner { live_connections: HashSet, threads: HashMap, - subscription_state_by_id: HashMap, thread_ids_by_connection: HashMap>, } @@ -176,70 +168,6 @@ impl ThreadStateManager { state.threads.entry(thread_id).or_default().state.clone() } - pub(crate) async fn remove_listener(&self, subscription_id: Uuid) -> Option { - let (subscription_state, connection_still_subscribed_to_thread, thread_state) = { - let mut state = self.state.lock().await; - let subscription_state = state.subscription_state_by_id.remove(&subscription_id)?; - let thread_id = subscription_state.thread_id; - - let connection_still_subscribed_to_thread = state - .subscription_state_by_id - .values() - .any(|subscription_state_entry| { - subscription_state_entry.thread_id == thread_id - && subscription_state_entry.connection_id - == subscription_state.connection_id - }); - if !connection_still_subscribed_to_thread { - let mut remove_connection_entry = false; - if let Some(thread_ids) = state - .thread_ids_by_connection - .get_mut(&subscription_state.connection_id) - { - thread_ids.remove(&thread_id); - remove_connection_entry = thread_ids.is_empty(); - } - if remove_connection_entry { - state - .thread_ids_by_connection - .remove(&subscription_state.connection_id); - } - if let Some(thread_entry) = state.threads.get_mut(&thread_id) { - thread_entry - .connection_ids - .remove(&subscription_state.connection_id); - } - } - - let thread_state = state.threads.get(&thread_id).map(|thread_entry| { - ( - thread_entry.connection_ids.is_empty(), - thread_entry.state.clone(), - ) - }); - ( - subscription_state, - connection_still_subscribed_to_thread, - thread_state, - ) - }; - let thread_id = subscription_state.thread_id; - - if let Some((no_subscribers, thread_state)) = thread_state { - let thread_state = thread_state.lock().await; - if !connection_still_subscribed_to_thread && no_subscribers { - tracing::debug!( - thread_id = %thread_id, - subscription_id = %subscription_id, - connection_id = ?subscription_state.connection_id, - listener_generation = thread_state.listener_generation, - "retaining thread listener after last subscription removed" - ); - } - } - Some(thread_id) - } - pub(crate) async fn remove_thread_state(&self, thread_id: ThreadId) { let thread_state = { let mut state = self.state.lock().await; @@ -247,9 +175,6 @@ impl ThreadStateManager { .threads .remove(&thread_id) .map(|thread_entry| thread_entry.state); - state - .subscription_state_by_id - .retain(|_, state| state.thread_id != thread_id); state.thread_ids_by_connection.retain(|_, thread_ids| { thread_ids.remove(&thread_id); !thread_ids.is_empty() @@ -298,13 +223,6 @@ impl ThreadStateManager { if let Some(thread_entry) = state.threads.get_mut(&thread_id) { thread_entry.connection_ids.remove(&connection_id); } - - state - .subscription_state_by_id - .retain(|_, subscription_state| { - !(subscription_state.thread_id == thread_id - && subscription_state.connection_id == connection_id) - }); }; true @@ -319,38 +237,6 @@ impl ThreadStateManager { .is_some_and(|thread_entry| !thread_entry.connection_ids.is_empty()) } - pub(crate) async fn set_listener( - &self, - subscription_id: Uuid, - thread_id: ThreadId, - connection_id: ConnectionId, - experimental_raw_events: bool, - ) -> Arc> { - let thread_state = { - let mut state = self.state.lock().await; - state.subscription_state_by_id.insert( - subscription_id, - SubscriptionState { - thread_id, - connection_id, - }, - ); - state - .thread_ids_by_connection - .entry(connection_id) - .or_default() - .insert(thread_id); - let thread_entry = state.threads.entry(thread_id).or_default(); - thread_entry.connection_ids.insert(connection_id); - thread_entry.state.clone() - }; - { - let mut thread_state_guard = thread_state.lock().await; - thread_state_guard.set_experimental_raw_events(experimental_raw_events); - } - thread_state - } - pub(crate) async fn try_ensure_connection_subscribed( &self, thread_id: ThreadId, @@ -411,9 +297,6 @@ impl ThreadStateManager { .thread_ids_by_connection .remove(&connection_id) .unwrap_or_default(); - state - .subscription_state_by_id - .retain(|_, state| state.connection_id != connection_id); for thread_id in &thread_ids { if let Some(thread_entry) = state.threads.get_mut(thread_id) { thread_entry.connection_ids.remove(&connection_id); diff --git a/codex-rs/app-server/tests/common/mcp_process.rs b/codex-rs/app-server/tests/common/mcp_process.rs index 9f0fb31cb..4b525878b 100644 --- a/codex-rs/app-server/tests/common/mcp_process.rs +++ b/codex-rs/app-server/tests/common/mcp_process.rs @@ -11,11 +11,8 @@ use tokio::process::ChildStdin; use tokio::process::ChildStdout; use anyhow::Context; -use codex_app_server_protocol::AddConversationListenerParams; use codex_app_server_protocol::AppsListParams; -use codex_app_server_protocol::ArchiveConversationParams; use codex_app_server_protocol::CancelLoginAccountParams; -use codex_app_server_protocol::CancelLoginChatGptParams; use codex_app_server_protocol::ClientInfo; use codex_app_server_protocol::ClientNotification; use codex_app_server_protocol::CollaborationModeListParams; @@ -24,32 +21,23 @@ use codex_app_server_protocol::ConfigReadParams; use codex_app_server_protocol::ConfigValueWriteParams; use codex_app_server_protocol::ExperimentalFeatureListParams; use codex_app_server_protocol::FeedbackUploadParams; -use codex_app_server_protocol::ForkConversationParams; use codex_app_server_protocol::GetAccountParams; use codex_app_server_protocol::GetAuthStatusParams; +use codex_app_server_protocol::GetConversationSummaryParams; use codex_app_server_protocol::InitializeCapabilities; use codex_app_server_protocol::InitializeParams; -use codex_app_server_protocol::InterruptConversationParams; use codex_app_server_protocol::JSONRPCError; use codex_app_server_protocol::JSONRPCErrorError; use codex_app_server_protocol::JSONRPCMessage; use codex_app_server_protocol::JSONRPCNotification; use codex_app_server_protocol::JSONRPCRequest; use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::ListConversationsParams; use codex_app_server_protocol::LoginAccountParams; -use codex_app_server_protocol::LoginApiKeyParams; use codex_app_server_protocol::MockExperimentalMethodParams; use codex_app_server_protocol::ModelListParams; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::RemoveConversationListenerParams; use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::ResumeConversationParams; use codex_app_server_protocol::ReviewStartParams; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserTurnParams; use codex_app_server_protocol::ServerRequest; -use codex_app_server_protocol::SetDefaultModelParams; use codex_app_server_protocol::SkillsListParams; use codex_app_server_protocol::ThreadArchiveParams; use codex_app_server_protocol::ThreadCompactStartParams; @@ -243,71 +231,6 @@ impl McpProcess { } } - /// Send a `newConversation` JSON-RPC request. - pub async fn send_new_conversation_request( - &mut self, - params: NewConversationParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("newConversation", params).await - } - - /// Send an `archiveConversation` JSON-RPC request. - pub async fn send_archive_conversation_request( - &mut self, - params: ArchiveConversationParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("archiveConversation", params).await - } - - /// Send an `addConversationListener` JSON-RPC request. - pub async fn send_add_conversation_listener_request( - &mut self, - params: AddConversationListenerParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("addConversationListener", params).await - } - - /// Send a `sendUserMessage` JSON-RPC request with a single text item. - pub async fn send_send_user_message_request( - &mut self, - params: SendUserMessageParams, - ) -> anyhow::Result { - // Wire format expects variants in camelCase; text item uses external tagging. - let params = Some(serde_json::to_value(params)?); - self.send_request("sendUserMessage", params).await - } - - /// Send a `removeConversationListener` JSON-RPC request. - pub async fn send_remove_thread_listener_request( - &mut self, - params: RemoveConversationListenerParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("removeConversationListener", params) - .await - } - - /// Send a `sendUserTurn` JSON-RPC request. - pub async fn send_send_user_turn_request( - &mut self, - params: SendUserTurnParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("sendUserTurn", params).await - } - - /// Send a `interruptConversation` JSON-RPC request. - pub async fn send_interrupt_conversation_request( - &mut self, - params: InterruptConversationParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("interruptConversation", params).await - } - /// Send a `getAuthStatus` JSON-RPC request. pub async fn send_get_auth_status_request( &mut self, @@ -317,14 +240,13 @@ impl McpProcess { self.send_request("getAuthStatus", params).await } - /// Send a `getUserSavedConfig` JSON-RPC request. - pub async fn send_get_user_saved_config_request(&mut self) -> anyhow::Result { - self.send_request("getUserSavedConfig", None).await - } - - /// Send a `getUserAgent` JSON-RPC request. - pub async fn send_get_user_agent_request(&mut self) -> anyhow::Result { - self.send_request("getUserAgent", None).await + /// Send a `getConversationSummary` JSON-RPC request. + pub async fn send_get_conversation_summary_request( + &mut self, + params: GetConversationSummaryParams, + ) -> anyhow::Result { + let params = Some(serde_json::to_value(params)?); + self.send_request("getConversationSummary", params).await } /// Send an `account/rateLimits/read` JSON-RPC request. @@ -366,29 +288,6 @@ impl McpProcess { self.send_request("feedback/upload", params).await } - /// Send a `userInfo` JSON-RPC request. - pub async fn send_user_info_request(&mut self) -> anyhow::Result { - self.send_request("userInfo", None).await - } - - /// Send a `setDefaultModel` JSON-RPC request. - pub async fn send_set_default_model_request( - &mut self, - params: SetDefaultModelParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("setDefaultModel", params).await - } - - /// Send a `listConversations` JSON-RPC request. - pub async fn send_list_conversations_request( - &mut self, - params: ListConversationsParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("listConversations", params).await - } - /// Send a `thread/start` JSON-RPC request. pub async fn send_thread_start_request( &mut self, @@ -548,38 +447,6 @@ impl McpProcess { self.send_request("mock/experimentalMethod", params).await } - /// Send a `resumeConversation` JSON-RPC request. - pub async fn send_resume_conversation_request( - &mut self, - params: ResumeConversationParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("resumeConversation", params).await - } - - /// Send a `forkConversation` JSON-RPC request. - pub async fn send_fork_conversation_request( - &mut self, - params: ForkConversationParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("forkConversation", params).await - } - - /// Send a `loginApiKey` JSON-RPC request. - pub async fn send_login_api_key_request( - &mut self, - params: LoginApiKeyParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("loginApiKey", params).await - } - - /// Send a `loginChatGpt` JSON-RPC request. - pub async fn send_login_chat_gpt_request(&mut self) -> anyhow::Result { - self.send_request("loginChatGpt", None).await - } - /// Send a `turn/start` JSON-RPC request (v2). pub async fn send_turn_start_request( &mut self, @@ -719,20 +586,6 @@ impl McpProcess { self.send_request("windowsSandbox/setupStart", params).await } - /// Send a `cancelLoginChatGpt` JSON-RPC request. - pub async fn send_cancel_login_chat_gpt_request( - &mut self, - params: CancelLoginChatGptParams, - ) -> anyhow::Result { - let params = Some(serde_json::to_value(params)?); - self.send_request("cancelLoginChatGpt", params).await - } - - /// Send a `logoutChatGpt` JSON-RPC request. - pub async fn send_logout_chat_gpt_request(&mut self) -> anyhow::Result { - self.send_request("logoutChatGpt", None).await - } - pub async fn send_config_read_request( &mut self, params: ConfigReadParams, diff --git a/codex-rs/app-server/tests/suite/archive_thread.rs b/codex-rs/app-server/tests/suite/archive_thread.rs deleted file mode 100644 index a47b247bf..000000000 --- a/codex-rs/app-server/tests/suite/archive_thread.rs +++ /dev/null @@ -1,154 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_mock_responses_server_repeating_assistant; -use app_test_support::to_response; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; -use codex_app_server_protocol::ArchiveConversationParams; -use codex_app_server_protocol::ArchiveConversationResponse; -use codex_app_server_protocol::InputItem; -use codex_app_server_protocol::JSONRPCNotification; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use codex_core::ARCHIVED_SESSIONS_SUBDIR; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(20); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn archive_conversation_moves_rollout_into_archived_directory() -> Result<()> { - let server = create_mock_responses_server_repeating_assistant("Done").await; - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_request_id = mcp - .send_new_conversation_request(NewConversationParams { - model: Some("mock-model".to_string()), - ..Default::default() - }) - .await?; - let new_response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_request_id)), - ) - .await??; - - let NewConversationResponse { - conversation_id, - rollout_path, - .. - } = to_response::(new_response)?; - - assert!( - !rollout_path.exists(), - "expected rollout path {} to be deferred until first user message", - rollout_path.display() - ); - - let add_listener_request_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let add_listener_response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_request_id)), - ) - .await??; - let AddConversationSubscriptionResponse { subscription_id: _ } = - to_response::(add_listener_response)?; - - let send_request_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![InputItem::Text { - text: "materialize".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - let send_response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_request_id)), - ) - .await??; - let _: SendUserMessageResponse = to_response::(send_response)?; - let _: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - assert!( - rollout_path.exists(), - "expected rollout path {} to exist after first user message", - rollout_path.display() - ); - - let archive_request_id = mcp - .send_archive_conversation_request(ArchiveConversationParams { - conversation_id, - rollout_path: rollout_path.clone(), - }) - .await?; - let archive_response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(archive_request_id)), - ) - .await??; - - let _: ArchiveConversationResponse = - to_response::(archive_response)?; - - let archived_directory = codex_home.path().join(ARCHIVED_SESSIONS_SUBDIR); - let archived_rollout_path = - archived_directory.join(rollout_path.file_name().unwrap_or_else(|| { - panic!("rollout path {} missing file name", rollout_path.display()) - })); - - assert!( - !rollout_path.exists(), - "expected rollout path {} to be moved", - rollout_path.display() - ); - assert!( - archived_rollout_path.exists(), - "expected archived rollout path {} to exist", - archived_rollout_path.display() - ); - - Ok(()) -} - -fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write(config_toml, config_contents(server_uri)) -} - -fn config_contents(server_uri: &str) -> String { - format!( - r#"model = "mock-model" -approval_policy = "never" -sandbox_mode = "read-only" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ) -} diff --git a/codex-rs/app-server/tests/suite/auth.rs b/codex-rs/app-server/tests/suite/auth.rs index 469315861..2bbdeff40 100644 --- a/codex-rs/app-server/tests/suite/auth.rs +++ b/codex-rs/app-server/tests/suite/auth.rs @@ -6,8 +6,7 @@ use codex_app_server_protocol::GetAuthStatusParams; use codex_app_server_protocol::GetAuthStatusResponse; use codex_app_server_protocol::JSONRPCError; use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::LoginApiKeyParams; -use codex_app_server_protocol::LoginApiKeyResponse; +use codex_app_server_protocol::LoginAccountResponse; use codex_app_server_protocol::RequestId; use pretty_assertions::assert_eq; use std::path::Path; @@ -72,18 +71,15 @@ forced_login_method = "{forced_method}" } async fn login_with_api_key_via_request(mcp: &mut McpProcess, api_key: &str) -> Result<()> { - let request_id = mcp - .send_login_api_key_request(LoginApiKeyParams { - api_key: api_key.to_string(), - }) - .await?; + let request_id = mcp.send_login_account_api_key_request(api_key).await?; let resp: JSONRPCResponse = timeout( DEFAULT_READ_TIMEOUT, mcp.read_stream_until_response_message(RequestId::Integer(request_id)), ) .await??; - let _: LoginApiKeyResponse = to_response(resp)?; + let response: LoginAccountResponse = to_response(resp)?; + assert_eq!(response, LoginAccountResponse::ApiKey {}); Ok(()) } @@ -211,9 +207,7 @@ async fn login_api_key_rejected_when_forced_chatgpt() -> Result<()> { timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; let request_id = mcp - .send_login_api_key_request(LoginApiKeyParams { - api_key: "sk-test-key".to_string(), - }) + .send_login_account_api_key_request("sk-test-key") .await?; let err: JSONRPCError = timeout( diff --git a/codex-rs/app-server/tests/suite/codex_message_processor_flow.rs b/codex-rs/app-server/tests/suite/codex_message_processor_flow.rs deleted file mode 100644 index b5176886b..000000000 --- a/codex-rs/app-server/tests/suite/codex_message_processor_flow.rs +++ /dev/null @@ -1,550 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_final_assistant_message_sse_response; -use app_test_support::create_mock_responses_server_sequence; -use app_test_support::create_shell_command_sse_response; -use app_test_support::format_with_current_shell; -use app_test_support::to_response; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; -use codex_app_server_protocol::ExecCommandApprovalParams; -use codex_app_server_protocol::InputItem; -use codex_app_server_protocol::JSONRPCNotification; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RemoveConversationListenerParams; -use codex_app_server_protocol::RemoveConversationSubscriptionResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use codex_app_server_protocol::SendUserTurnParams; -use codex_app_server_protocol::SendUserTurnResponse; -use codex_app_server_protocol::ServerRequest; -use codex_core::spawn::CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR; -use codex_protocol::config_types::ReasoningSummary; -use codex_protocol::config_types::SandboxMode; -use codex_protocol::openai_models::ReasoningEffort; -use codex_protocol::parse_command::ParsedCommand; -use codex_protocol::protocol::AskForApproval; -use codex_protocol::protocol::Event; -use codex_protocol::protocol::EventMsg; -use codex_protocol::protocol::SandboxPolicy; -use pretty_assertions::assert_eq; -use std::env; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(45); - -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] -async fn test_codex_jsonrpc_conversation_flow() -> Result<()> { - if env::var(CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR).is_ok() { - println!( - "Skipping test because it cannot execute when network is disabled in a Codex sandbox." - ); - return Ok(()); - } - - let tmp = TempDir::new()?; - // Temporary Codex home with config pointing at the mock server. - let codex_home = tmp.path().join("codex_home"); - std::fs::create_dir(&codex_home)?; - let working_directory = tmp.path().join("workdir"); - std::fs::create_dir(&working_directory)?; - - // Create a mock model server that immediately ends each turn. - // Two turns are expected: initial session configure + one user message. - let responses = vec![ - create_shell_command_sse_response( - vec!["ls".to_string()], - Some(&working_directory), - Some(5000), - "call1234", - )?, - create_final_assistant_message_sse_response("Enjoy your new git repo!")?, - ]; - let server = create_mock_responses_server_sequence(responses).await; - create_config_toml(&codex_home, &server.uri())?; - - // Start MCP server and initialize. - let mut mcp = McpProcess::new(&codex_home).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // 1) newConversation - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - cwd: Some(working_directory.to_string_lossy().into_owned()), - sandbox: Some(SandboxMode::DangerFullAccess), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let new_conv_resp = to_response::(new_conv_resp)?; - let NewConversationResponse { - conversation_id, - model, - reasoning_effort: _, - rollout_path: _, - } = new_conv_resp; - assert_eq!(model, "mock-model"); - - // 2) addConversationListener - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let add_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - let AddConversationSubscriptionResponse { subscription_id } = - to_response::(add_listener_resp)?; - - // Drop any buffered events from conversation setup to avoid - // matching an earlier task_complete. - mcp.clear_message_buffer(); - - // 3) sendUserMessage (should trigger notifications; we only validate an OK response) - let send_user_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![codex_app_server_protocol::InputItem::Text { - text: "text".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - let send_user_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_user_id)), - ) - .await??; - let SendUserMessageResponse {} = to_response::(send_user_resp)?; - - let task_started_notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_started"), - ) - .await??; - let task_started_event: Event = serde_json::from_value( - task_started_notification - .params - .clone() - .expect("task_started should have params"), - ) - .expect("task_started should deserialize to Event"); - - // Verify the task_finished notification for this turn is received. - // Note this also ensures that the final request to the server was made. - let task_finished_notification: JSONRPCNotification = loop { - let notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - let event: Event = serde_json::from_value( - notification - .params - .clone() - .expect("task_complete should have params"), - ) - .expect("task_complete should deserialize to Event"); - if event.id == task_started_event.id { - break notification; - } - }; - let serde_json::Value::Object(map) = task_finished_notification - .params - .expect("notification should have params") - else { - panic!("task_finished_notification should have params"); - }; - assert_eq!( - map.get("conversationId") - .expect("should have conversationId"), - &serde_json::Value::String(conversation_id.to_string()) - ); - - // 4) removeConversationListener - let remove_listener_id = mcp - .send_remove_thread_listener_request(RemoveConversationListenerParams { subscription_id }) - .await?; - let remove_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(remove_listener_id)), - ) - .await??; - let RemoveConversationSubscriptionResponse {} = to_response(remove_listener_resp)?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] -async fn test_send_user_turn_changes_approval_policy_behavior() -> Result<()> { - if env::var(CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR).is_ok() { - println!( - "Skipping test because it cannot execute when network is disabled in a Codex sandbox." - ); - return Ok(()); - } - - let tmp = TempDir::new()?; - let codex_home = tmp.path().join("codex_home"); - std::fs::create_dir(&codex_home)?; - let working_directory = tmp.path().join("workdir"); - std::fs::create_dir(&working_directory)?; - - // Mock server will request a python shell call for the first and second turn, then finish. - let responses = vec![ - create_shell_command_sse_response( - vec![ - "python3".to_string(), - "-c".to_string(), - "print(42)".to_string(), - ], - Some(&working_directory), - Some(5000), - "call1", - )?, - create_final_assistant_message_sse_response("done 1")?, - create_shell_command_sse_response( - vec![ - "python3".to_string(), - "-c".to_string(), - "print(42)".to_string(), - ], - Some(&working_directory), - Some(5000), - "call2", - )?, - create_final_assistant_message_sse_response("done 2")?, - ]; - let server = create_mock_responses_server_sequence(responses).await; - create_config_toml(&codex_home, &server.uri())?; - - // Start MCP server and initialize. - let mut mcp = McpProcess::new(&codex_home).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // 1) Start conversation with approval_policy=untrusted - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - cwd: Some(working_directory.to_string_lossy().into_owned()), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::(new_conv_resp)?; - - // 2) addConversationListener - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let _: AddConversationSubscriptionResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??, - )?; - - // 3) sendUserMessage triggers a shell call; approval policy is Untrusted so we should get an elicitation - let send_user_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![codex_app_server_protocol::InputItem::Text { - text: "run python".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - let _send_user_resp: SendUserMessageResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_user_id)), - ) - .await??, - )?; - - // Expect an ExecCommandApproval request (elicitation) - let request = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_request_message(), - ) - .await??; - let ServerRequest::ExecCommandApproval { request_id, params } = request else { - panic!("expected ExecCommandApproval request, got: {request:?}"); - }; - - assert_eq!( - ExecCommandApprovalParams { - conversation_id, - call_id: "call1".to_string(), - approval_id: None, - command: format_with_current_shell("python3 -c 'print(42)'"), - cwd: working_directory.clone(), - reason: None, - parsed_cmd: vec![ParsedCommand::Unknown { - cmd: "python3 -c 'print(42)'".to_string() - }], - }, - params - ); - - // Approve so the first turn can complete - mcp.send_response( - request_id, - serde_json::json!({ "decision": codex_protocol::protocol::ReviewDecision::Approved }), - ) - .await?; - - // Wait for first TurnComplete - let _ = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - // 4) sendUserTurn with approval_policy=never should run without elicitation - let send_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![codex_app_server_protocol::InputItem::Text { - text: "run python again".to_string(), - text_elements: Vec::new(), - }], - cwd: working_directory.clone(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::new_read_only_policy(), - model: "mock-model".to_string(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: None, - }) - .await?; - // Acknowledge sendUserTurn - let _send_turn_resp: SendUserTurnResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_turn_id)), - ) - .await??, - )?; - - // Ensure we do NOT receive an ExecCommandApproval request before the task completes. - // If any Request is seen while waiting for task_complete, the helper will error and the test fails. - let _ = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - Ok(()) -} - -// Helper: minimal config.toml pointing at mock provider. - -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] -async fn test_send_user_turn_updates_sandbox_and_cwd_between_turns() -> Result<()> { - if env::var(CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR).is_ok() { - println!( - "Skipping test because it cannot execute when network is disabled in a Codex sandbox." - ); - return Ok(()); - } - - let tmp = TempDir::new()?; - let codex_home = tmp.path().join("codex_home"); - std::fs::create_dir(&codex_home)?; - let workspace_root = tmp.path().join("workspace"); - std::fs::create_dir(&workspace_root)?; - let first_cwd = workspace_root.join("turn1"); - let second_cwd = workspace_root.join("turn2"); - std::fs::create_dir(&first_cwd)?; - std::fs::create_dir(&second_cwd)?; - - let responses = vec![ - create_shell_command_sse_response( - vec!["echo".to_string(), "first".to_string(), "turn".to_string()], - None, - Some(5000), - "call-first", - )?, - create_final_assistant_message_sse_response("done first")?, - create_shell_command_sse_response( - vec!["echo".to_string(), "second".to_string(), "turn".to_string()], - None, - Some(5000), - "call-second", - )?, - create_final_assistant_message_sse_response("done second")?, - ]; - let server = create_mock_responses_server_sequence(responses).await; - create_config_toml(&codex_home, &server.uri())?; - - let mut mcp = McpProcess::new(&codex_home).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - cwd: Some(first_cwd.to_string_lossy().into_owned()), - approval_policy: Some(AskForApproval::Never), - sandbox: Some(SandboxMode::WorkspaceWrite), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, - model, - .. - } = to_response::(new_conv_resp)?; - - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - - let first_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: "first turn".to_string(), - text_elements: Vec::new(), - }], - cwd: first_cwd.clone(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::WorkspaceWrite { - writable_roots: vec![first_cwd.try_into()?], - read_only_access: Default::default(), - network_access: false, - exclude_tmpdir_env_var: false, - exclude_slash_tmp: false, - }, - model: model.clone(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: None, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(first_turn_id)), - ) - .await??; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - mcp.clear_message_buffer(); - - let second_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: "second turn".to_string(), - text_elements: Vec::new(), - }], - cwd: second_cwd.clone(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::DangerFullAccess, - model: model.clone(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: None, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(second_turn_id)), - ) - .await??; - - let exec_begin_notification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/exec_command_begin"), - ) - .await??; - let params = exec_begin_notification - .params - .clone() - .expect("exec_command_begin params"); - let event: Event = serde_json::from_value(params).expect("deserialize exec begin event"); - let exec_begin = match event.msg { - EventMsg::ExecCommandBegin(exec_begin) => exec_begin, - other => panic!("expected ExecCommandBegin event, got {other:?}"), - }; - assert_eq!( - exec_begin.cwd, second_cwd, - "exec turn should run from updated cwd" - ); - let expected_command = format_with_current_shell("echo second turn"); - assert_eq!( - exec_begin.command, expected_command, - "exec turn should run expected command" - ); - - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - Ok(()) -} - -fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "mock-model" -approval_policy = "untrusted" -sandbox_mode = "danger-full-access" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ), - ) -} diff --git a/codex-rs/app-server/tests/suite/config.rs b/codex-rs/app-server/tests/suite/config.rs deleted file mode 100644 index 27a44ef55..000000000 --- a/codex-rs/app-server/tests/suite/config.rs +++ /dev/null @@ -1,158 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::test_tmp_path; -use app_test_support::to_response; -use codex_app_server_protocol::GetUserSavedConfigResponse; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::Profile; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SandboxSettings; -use codex_app_server_protocol::Tools; -use codex_app_server_protocol::UserSavedConfig; -use codex_protocol::config_types::ForcedLoginMethod; -use codex_protocol::config_types::ReasoningSummary; -use codex_protocol::config_types::SandboxMode; -use codex_protocol::config_types::Verbosity; -use codex_protocol::openai_models::ReasoningEffort; -use codex_protocol::protocol::AskForApproval; -use pretty_assertions::assert_eq; -use std::collections::HashMap; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -fn create_config_toml(codex_home: &Path) -> std::io::Result<()> { - let writable_root = test_tmp_path(); - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "gpt-5.1-codex-max" -approval_policy = "on-request" -sandbox_mode = "workspace-write" -model_reasoning_summary = "detailed" -model_reasoning_effort = "high" -model_verbosity = "medium" -profile = "test" -forced_chatgpt_workspace_id = "12345678-0000-0000-0000-000000000000" -forced_login_method = "chatgpt" - -[sandbox_workspace_write] -writable_roots = [{}] -network_access = true -exclude_tmpdir_env_var = true -exclude_slash_tmp = true - -[tools] -web_search = false -view_image = true - -[profiles.test] -model = "gpt-4o" -approval_policy = "on-request" -model_reasoning_effort = "high" -model_reasoning_summary = "detailed" -model_verbosity = "medium" -model_provider = "openai" -chatgpt_base_url = "https://api.chatgpt.com" -"#, - serde_json::json!(writable_root) - ), - ) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] -async fn get_config_toml_parses_all_fields() -> Result<()> { - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_get_user_saved_config_request().await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let config: GetUserSavedConfigResponse = to_response(resp)?; - let writable_root = test_tmp_path(); - let expected = GetUserSavedConfigResponse { - config: UserSavedConfig { - approval_policy: Some(AskForApproval::OnRequest), - sandbox_mode: Some(SandboxMode::WorkspaceWrite), - sandbox_settings: Some(SandboxSettings { - writable_roots: vec![writable_root], - network_access: Some(true), - exclude_tmpdir_env_var: Some(true), - exclude_slash_tmp: Some(true), - }), - forced_chatgpt_workspace_id: Some("12345678-0000-0000-0000-000000000000".into()), - forced_login_method: Some(ForcedLoginMethod::Chatgpt), - model: Some("gpt-5.1-codex-max".into()), - model_reasoning_effort: Some(ReasoningEffort::High), - model_reasoning_summary: Some(ReasoningSummary::Detailed), - model_verbosity: Some(Verbosity::Medium), - tools: Some(Tools { - web_search: Some(false), - view_image: Some(true), - }), - profile: Some("test".to_string()), - profiles: HashMap::from([( - "test".into(), - Profile { - model: Some("gpt-4o".into()), - approval_policy: Some(AskForApproval::OnRequest), - model_reasoning_effort: Some(ReasoningEffort::High), - model_reasoning_summary: Some(ReasoningSummary::Detailed), - model_verbosity: Some(Verbosity::Medium), - model_provider: Some("openai".into()), - chatgpt_base_url: Some("https://api.chatgpt.com".into()), - }, - )]), - }, - }; - - assert_eq!(config, expected); - Ok(()) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn get_config_toml_empty() -> Result<()> { - let codex_home = TempDir::new()?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_get_user_saved_config_request().await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let config: GetUserSavedConfigResponse = to_response(resp)?; - let expected = GetUserSavedConfigResponse { - config: UserSavedConfig { - approval_policy: None, - sandbox_mode: None, - sandbox_settings: None, - forced_chatgpt_workspace_id: None, - forced_login_method: None, - model: None, - model_reasoning_effort: None, - model_reasoning_summary: None, - model_verbosity: None, - tools: None, - profile: None, - profiles: HashMap::new(), - }, - }; - - assert_eq!(config, expected); - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/conversation_summary.rs b/codex-rs/app-server/tests/suite/conversation_summary.rs new file mode 100644 index 000000000..31108a845 --- /dev/null +++ b/codex-rs/app-server/tests/suite/conversation_summary.rs @@ -0,0 +1,113 @@ +use anyhow::Result; +use app_test_support::McpProcess; +use app_test_support::create_fake_rollout; +use app_test_support::rollout_path; +use app_test_support::to_response; +use codex_app_server_protocol::ConversationSummary; +use codex_app_server_protocol::GetConversationSummaryParams; +use codex_app_server_protocol::GetConversationSummaryResponse; +use codex_app_server_protocol::JSONRPCResponse; +use codex_app_server_protocol::RequestId; +use codex_protocol::ThreadId; +use codex_protocol::protocol::SessionSource; +use pretty_assertions::assert_eq; +use std::path::PathBuf; +use tempfile::TempDir; +use tokio::time::timeout; + +const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); +const FILENAME_TS: &str = "2025-01-02T12-00-00"; +const META_RFC3339: &str = "2025-01-02T12:00:00Z"; +const PREVIEW: &str = "Summarize this conversation"; +const MODEL_PROVIDER: &str = "openai"; + +fn expected_summary(conversation_id: ThreadId, path: PathBuf) -> ConversationSummary { + ConversationSummary { + conversation_id, + path, + preview: PREVIEW.to_string(), + timestamp: Some(META_RFC3339.to_string()), + updated_at: Some(META_RFC3339.to_string()), + model_provider: MODEL_PROVIDER.to_string(), + cwd: PathBuf::from("/"), + cli_version: "0.0.0".to_string(), + source: SessionSource::Cli, + git_info: None, + } +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn get_conversation_summary_by_thread_id_reads_rollout() -> Result<()> { + let codex_home = TempDir::new()?; + let conversation_id = create_fake_rollout( + codex_home.path(), + FILENAME_TS, + META_RFC3339, + PREVIEW, + Some(MODEL_PROVIDER), + None, + )?; + let thread_id = ThreadId::from_string(&conversation_id)?; + let expected = expected_summary( + thread_id, + std::fs::canonicalize(rollout_path( + codex_home.path(), + FILENAME_TS, + &conversation_id, + ))?, + ); + + let mut mcp = McpProcess::new(codex_home.path()).await?; + timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; + + let request_id = mcp + .send_get_conversation_summary_request(GetConversationSummaryParams::ThreadId { + conversation_id: thread_id, + }) + .await?; + let response: JSONRPCResponse = timeout( + DEFAULT_READ_TIMEOUT, + mcp.read_stream_until_response_message(RequestId::Integer(request_id)), + ) + .await??; + let received: GetConversationSummaryResponse = to_response(response)?; + + assert_eq!(received.summary, expected); + Ok(()) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn get_conversation_summary_by_relative_rollout_path_resolves_from_codex_home() -> Result<()> +{ + let codex_home = TempDir::new()?; + let conversation_id = create_fake_rollout( + codex_home.path(), + FILENAME_TS, + META_RFC3339, + PREVIEW, + Some(MODEL_PROVIDER), + None, + )?; + let thread_id = ThreadId::from_string(&conversation_id)?; + let rollout_path = rollout_path(codex_home.path(), FILENAME_TS, &conversation_id); + let relative_path = rollout_path.strip_prefix(codex_home.path())?.to_path_buf(); + let expected = expected_summary(thread_id, std::fs::canonicalize(rollout_path)?); + + let mut mcp = McpProcess::new(codex_home.path()).await?; + timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; + + let request_id = mcp + .send_get_conversation_summary_request(GetConversationSummaryParams::RolloutPath { + rollout_path: relative_path, + }) + .await?; + let response: JSONRPCResponse = timeout( + DEFAULT_READ_TIMEOUT, + mcp.read_stream_until_response_message(RequestId::Integer(request_id)), + ) + .await??; + let received: GetConversationSummaryResponse = to_response(response)?; + + assert_eq!(received.summary, expected); + Ok(()) +} diff --git a/codex-rs/app-server/tests/suite/create_thread.rs b/codex-rs/app-server/tests/suite/create_thread.rs deleted file mode 100644 index 8ad334253..000000000 --- a/codex-rs/app-server/tests/suite/create_thread.rs +++ /dev/null @@ -1,142 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_final_assistant_message_sse_response; -use app_test_support::to_response; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; -use codex_app_server_protocol::InputItem; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use core_test_support::responses; -use pretty_assertions::assert_eq; -use serde_json::json; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_conversation_create_and_send_message_ok() -> Result<()> { - // Mock server – we won't strictly rely on it, but provide one to satisfy any model wiring. - let response_body = create_final_assistant_message_sse_response("Done")?; - let server = responses::start_mock_server().await; - let response_mock = responses::mount_sse_sequence(&server, vec![response_body]).await; - - // Temporary Codex home with config pointing at the mock server. - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - // Start MCP server process and initialize. - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // Create a conversation via the new JSON-RPC API. - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - model: Some("o3".to_string()), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, - model, - reasoning_effort: _, - rollout_path: _, - } = to_response::(new_conv_resp)?; - assert_eq!(model, "o3"); - - // Add a listener so we receive notifications for this conversation (not strictly required for this test). - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let _sub: AddConversationSubscriptionResponse = - to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??, - )?; - - // Now send a user message via the wire API and expect an OK (empty object) result. - let send_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![InputItem::Text { - text: "Hello".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - let send_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_id)), - ) - .await??; - let _ok: SendUserMessageResponse = to_response::(send_resp)?; - - // Avoid race condition by waiting for the mock server to receive the responses request. - let deadline = std::time::Instant::now() + DEFAULT_READ_TIMEOUT; - let requests = loop { - let requests = response_mock.requests(); - if !requests.is_empty() { - break requests; - } - if std::time::Instant::now() >= deadline { - panic!("mock server did not receive the responses request in time"); - } - tokio::time::sleep(std::time::Duration::from_millis(10)).await; - }; - - // Verify the outbound request body matches expectations for Responses. - let request = requests - .first() - .expect("mock server should have received at least one request"); - let body = request.body_json(); - assert_eq!(body["model"], json!("o3")); - let user_texts = request.message_input_texts("user"); - assert!( - user_texts.iter().any(|text| text == "Hello"), - "expected user input to include Hello, got {user_texts:?}" - ); - - drop(server); - Ok(()) -} - -// Helper to create a config.toml pointing at the mock model server. -fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ), - ) -} diff --git a/codex-rs/app-server/tests/suite/fork_thread.rs b/codex-rs/app-server/tests/suite/fork_thread.rs deleted file mode 100644 index ec282be4a..000000000 --- a/codex-rs/app-server/tests/suite/fork_thread.rs +++ /dev/null @@ -1,140 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_fake_rollout; -use app_test_support::to_response; -use codex_app_server_protocol::ForkConversationParams; -use codex_app_server_protocol::ForkConversationResponse; -use codex_app_server_protocol::JSONRPCNotification; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; // reused for overrides shape -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::ServerNotification; -use codex_app_server_protocol::SessionConfiguredNotification; -use codex_protocol::protocol::EventMsg; -use pretty_assertions::assert_eq; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn fork_conversation_creates_new_rollout() -> Result<()> { - let codex_home = TempDir::new()?; - - let preview = "Hello A"; - let conversation_id = create_fake_rollout( - codex_home.path(), - "2025-01-02T12-00-00", - "2025-01-02T12:00:00Z", - preview, - Some("openai"), - None, - )?; - - let original_path = codex_home - .path() - .join("sessions") - .join("2025") - .join("01") - .join("02") - .join(format!( - "rollout-2025-01-02T12-00-00-{conversation_id}.jsonl" - )); - assert!( - original_path.exists(), - "expected original rollout to exist at {}", - original_path.display() - ); - let original_contents = std::fs::read_to_string(&original_path)?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let fork_req_id = mcp - .send_fork_conversation_request(ForkConversationParams { - path: Some(original_path.clone()), - conversation_id: None, - overrides: Some(NewConversationParams { - model: Some("o3".to_string()), - ..Default::default() - }), - }) - .await?; - - // Expect a sessionConfigured notification for the forked session. - let notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("sessionConfigured"), - ) - .await??; - let session_configured: ServerNotification = notification.try_into()?; - let ServerNotification::SessionConfigured(SessionConfiguredNotification { - model, - session_id, - rollout_path, - initial_messages: session_initial_messages, - .. - }) = session_configured - else { - unreachable!("expected sessionConfigured notification"); - }; - - assert_eq!(model, "o3"); - assert_ne!( - session_id.to_string(), - conversation_id, - "expected a new conversation id when forking" - ); - assert_ne!( - rollout_path, original_path, - "expected a new rollout path when forking" - ); - assert!( - rollout_path.exists(), - "expected forked rollout to exist at {}", - rollout_path.display() - ); - - let session_initial_messages = - session_initial_messages.expect("expected initial messages when forking from rollout"); - match session_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, preview); - } - other => panic!("unexpected initial messages from rollout fork: {other:#?}"), - } - - // Then the response for forkConversation. - let fork_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(fork_req_id)), - ) - .await??; - let ForkConversationResponse { - conversation_id: forked_id, - model: forked_model, - initial_messages: response_initial_messages, - rollout_path: response_rollout_path, - } = to_response::(fork_resp)?; - - assert_eq!(forked_model, "o3"); - assert_eq!(response_rollout_path, rollout_path); - assert_ne!(forked_id.to_string(), conversation_id); - - let response_initial_messages = - response_initial_messages.expect("expected initial messages in fork response"); - match response_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, preview); - } - other => panic!("unexpected initial messages in fork response: {other:#?}"), - } - - let after_contents = std::fs::read_to_string(&original_path)?; - assert_eq!( - after_contents, original_contents, - "fork should not mutate the original rollout file" - ); - - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/interrupt.rs b/codex-rs/app-server/tests/suite/interrupt.rs deleted file mode 100644 index dd09b832f..000000000 --- a/codex-rs/app-server/tests/suite/interrupt.rs +++ /dev/null @@ -1,163 +0,0 @@ -#![cfg(unix)] -// Support code lives in the `app_test_support` crate under tests/common. - -use std::path::Path; - -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::InterruptConversationParams; -use codex_app_server_protocol::InterruptConversationResponse; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use codex_protocol::protocol::TurnAbortReason; -use core_test_support::skip_if_no_network; -use tempfile::TempDir; -use tokio::time::timeout; - -use app_test_support::McpProcess; -use app_test_support::create_mock_responses_server_sequence; -use app_test_support::create_shell_command_sse_response; -use app_test_support::to_response; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_shell_command_interruption() { - skip_if_no_network!(); - - if let Err(err) = shell_command_interruption().await { - panic!("failure: {err}"); - } -} - -async fn shell_command_interruption() -> anyhow::Result<()> { - // Use a cross-platform blocking command. On Windows plain `sleep` is not guaranteed to exist - // (MSYS/GNU coreutils may be absent) and the failure causes the tool call to finish immediately, - // which triggers a second model request before the test sends the explicit follow-up. That - // prematurely consumes the second mocked SSE response and leads to a third POST (panic: no response for 2). - // Powershell Start-Sleep is always available on Windows runners. On Unix we keep using `sleep`. - #[cfg(target_os = "windows")] - let shell_command = vec![ - "powershell".to_string(), - "-Command".to_string(), - "Start-Sleep -Seconds 10".to_string(), - ]; - #[cfg(not(target_os = "windows"))] - let shell_command = vec!["sleep".to_string(), "10".to_string()]; - - let tmp = TempDir::new()?; - // Temporary Codex home with config pointing at the mock server. - let codex_home = tmp.path().join("codex_home"); - std::fs::create_dir(&codex_home)?; - let working_directory = tmp.path().join("workdir"); - std::fs::create_dir(&working_directory)?; - - // Create mock server with a single SSE response: the long sleep command - let server = create_mock_responses_server_sequence(vec![create_shell_command_sse_response( - shell_command.clone(), - Some(&working_directory), - Some(10_000), // 10 seconds timeout in ms - "call_sleep", - )?]) - .await; - create_config_toml(&codex_home, server.uri())?; - - // Start MCP server and initialize. - let mut mcp = McpProcess::new(&codex_home).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // 1) newConversation - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - cwd: Some(working_directory.to_string_lossy().into_owned()), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let new_conv_resp = to_response::(new_conv_resp)?; - let NewConversationResponse { - conversation_id, .. - } = new_conv_resp; - - // 2) addConversationListener - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let _add_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - - // 3) sendUserMessage (should trigger notifications; we only validate an OK response) - let send_user_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![codex_app_server_protocol::InputItem::Text { - text: "run first sleep command".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - let send_user_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_user_id)), - ) - .await??; - let SendUserMessageResponse {} = to_response::(send_user_resp)?; - - // Give the command a moment to start - tokio::time::sleep(std::time::Duration::from_secs(1)).await; - - // 4) send interrupt request - let interrupt_id = mcp - .send_interrupt_conversation_request(InterruptConversationParams { conversation_id }) - .await?; - let interrupt_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(interrupt_id)), - ) - .await??; - let InterruptConversationResponse { abort_reason } = - to_response::(interrupt_resp)?; - assert_eq!(TurnAbortReason::Interrupted, abort_reason); - - Ok(()) -} - -// --------------------------------------------------------------------------- -// Helpers -// --------------------------------------------------------------------------- - -fn create_config_toml(codex_home: &Path, server_uri: String) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ), - ) -} diff --git a/codex-rs/app-server/tests/suite/list_resume.rs b/codex-rs/app-server/tests/suite/list_resume.rs deleted file mode 100644 index 97c8f41d1..000000000 --- a/codex-rs/app-server/tests/suite/list_resume.rs +++ /dev/null @@ -1,440 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_fake_rollout; -use app_test_support::to_response; -use codex_app_server_protocol::JSONRPCNotification; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::ListConversationsParams; -use codex_app_server_protocol::ListConversationsResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::ResumeConversationParams; -use codex_app_server_protocol::ResumeConversationResponse; -use codex_app_server_protocol::ServerNotification; -use codex_app_server_protocol::SessionConfiguredNotification; -use codex_protocol::models::ContentItem; -use codex_protocol::models::ResponseItem; -use codex_protocol::protocol::EventMsg; -use pretty_assertions::assert_eq; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_list_and_resume_conversations() -> Result<()> { - // Prepare a temporary CODEX_HOME with a few fake rollout files. - let codex_home = TempDir::new()?; - create_fake_rollout( - codex_home.path(), - "2025-01-02T12-00-00", - "2025-01-02T12:00:00Z", - "Hello A", - Some("openai"), - None, - )?; - create_fake_rollout( - codex_home.path(), - "2025-01-01T13-00-00", - "2025-01-01T13:00:00Z", - "Hello B", - Some("openai"), - None, - )?; - create_fake_rollout( - codex_home.path(), - "2025-01-01T12-00-00", - "2025-01-01T12:00:00Z", - "Hello C", - None, - None, - )?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // Request first page with size 2 - let req_id = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(2), - cursor: None, - model_providers: None, - }) - .await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(req_id)), - ) - .await??; - let ListConversationsResponse { items, next_cursor } = - to_response::(resp)?; - - assert_eq!(items.len(), 2); - // Newest first; preview text should match - assert_eq!(items[0].preview, "Hello A"); - assert_eq!(items[1].preview, "Hello B"); - assert_eq!(items[0].model_provider, "openai"); - assert_eq!(items[1].model_provider, "openai"); - assert!(items[0].path.is_absolute()); - assert!(next_cursor.is_some()); - - // Request the next page using the cursor - let req_id2 = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(2), - cursor: next_cursor, - model_providers: None, - }) - .await?; - let resp2: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(req_id2)), - ) - .await??; - let ListConversationsResponse { - items: items2, - next_cursor: next2, - .. - } = to_response::(resp2)?; - assert_eq!(items2.len(), 1); - assert_eq!(items2[0].preview, "Hello C"); - assert_eq!(items2[0].model_provider, "openai"); - assert_eq!(next2, None); - - // Add a conversation with an explicit non-OpenAI provider for filter tests. - create_fake_rollout( - codex_home.path(), - "2025-01-01T11-30-00", - "2025-01-01T11:30:00Z", - "Hello TP", - Some("test-provider"), - None, - )?; - - // Filtering by model provider should return only matching sessions. - let filter_req_id = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(10), - cursor: None, - model_providers: Some(vec!["test-provider".to_string()]), - }) - .await?; - let filter_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(filter_req_id)), - ) - .await??; - let ListConversationsResponse { - items: filtered_items, - next_cursor: filtered_next, - } = to_response::(filter_resp)?; - assert_eq!(filtered_items.len(), 1); - assert_eq!(filtered_next, None); - assert_eq!(filtered_items[0].preview, "Hello TP"); - assert_eq!(filtered_items[0].model_provider, "test-provider"); - - // Empty filter should include every session regardless of provider metadata. - let unfiltered_req_id = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(10), - cursor: None, - model_providers: Some(Vec::new()), - }) - .await?; - let unfiltered_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(unfiltered_req_id)), - ) - .await??; - let ListConversationsResponse { - items: unfiltered_items, - next_cursor: unfiltered_next, - } = to_response::(unfiltered_resp)?; - assert_eq!(unfiltered_items.len(), 4); - assert!(unfiltered_next.is_none()); - - let empty_req_id = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(10), - cursor: None, - model_providers: Some(vec!["other".to_string()]), - }) - .await?; - let empty_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(empty_req_id)), - ) - .await??; - let ListConversationsResponse { - items: empty_items, - next_cursor: empty_next, - } = to_response::(empty_resp)?; - assert!(empty_items.is_empty()); - assert!(empty_next.is_none()); - - let first_item = &items[0]; - - // Now resume one of the sessions from an explicit rollout path. - let resume_req_id = mcp - .send_resume_conversation_request(ResumeConversationParams { - path: Some(first_item.path.clone()), - conversation_id: None, - history: None, - overrides: Some(NewConversationParams { - model: Some("o3".to_string()), - ..Default::default() - }), - }) - .await?; - - // Expect a codex/event notification with msg.type == sessionConfigured - let notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("sessionConfigured"), - ) - .await??; - let session_configured: ServerNotification = notification.try_into()?; - let ServerNotification::SessionConfigured(SessionConfiguredNotification { - model, - rollout_path, - initial_messages: session_initial_messages, - .. - }) = session_configured - else { - unreachable!("expected sessionConfigured notification"); - }; - assert_eq!(model, "o3"); - assert_eq!(rollout_path, first_item.path.clone()); - let session_initial_messages = session_initial_messages - .expect("expected initial messages when resuming from rollout path"); - match session_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, first_item.preview.clone()); - } - other => panic!("unexpected initial messages from rollout resume: {other:#?}"), - } - - // Then the response for resumeConversation - let resume_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(resume_req_id)), - ) - .await??; - let ResumeConversationResponse { - conversation_id, - model: resume_model, - initial_messages: response_initial_messages, - .. - } = to_response::(resume_resp)?; - // conversation id should be a valid UUID - assert!(!conversation_id.to_string().is_empty()); - assert_eq!(resume_model, "o3"); - let response_initial_messages = - response_initial_messages.expect("expected initial messages in resume response"); - match response_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, first_item.preview.clone()); - } - other => panic!("unexpected initial messages in resume response: {other:#?}"), - } - - // Resuming with only a conversation id should locate the rollout automatically. - let resume_by_id_req_id = mcp - .send_resume_conversation_request(ResumeConversationParams { - path: None, - conversation_id: Some(first_item.conversation_id), - history: None, - overrides: Some(NewConversationParams { - model: Some("o3".to_string()), - ..Default::default() - }), - }) - .await?; - let notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("sessionConfigured"), - ) - .await??; - let session_configured: ServerNotification = notification.try_into()?; - let ServerNotification::SessionConfigured(SessionConfiguredNotification { - model, - rollout_path, - initial_messages: session_initial_messages, - .. - }) = session_configured - else { - unreachable!("expected sessionConfigured notification"); - }; - assert_eq!(model, "o3"); - assert_eq!(rollout_path, first_item.path.clone()); - let session_initial_messages = session_initial_messages - .expect("expected initial messages when resuming from conversation id"); - match session_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, first_item.preview.clone()); - } - other => panic!("unexpected initial messages from conversation id resume: {other:#?}"), - } - let resume_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(resume_by_id_req_id)), - ) - .await??; - let ResumeConversationResponse { - conversation_id: by_id_conversation_id, - model: by_id_model, - initial_messages: by_id_initial_messages, - .. - } = to_response::(resume_resp)?; - assert!(!by_id_conversation_id.to_string().is_empty()); - assert_eq!(by_id_model, "o3"); - let by_id_initial_messages = by_id_initial_messages - .expect("expected initial messages when resuming from conversation id response"); - match by_id_initial_messages.as_slice() { - [EventMsg::UserMessage(message)] => { - assert_eq!(message.message, first_item.preview.clone()); - } - other => { - panic!("unexpected initial messages in conversation id resume response: {other:#?}") - } - } - - // Resuming with explicit history should succeed even without a stored rollout. - let fork_history_text = "Hello from history"; - let history = vec![ResponseItem::Message { - id: None, - role: "user".to_string(), - content: vec![ContentItem::InputText { - text: fork_history_text.to_string(), - }], - end_turn: None, - phase: None, - }]; - let resume_with_history_req_id = mcp - .send_resume_conversation_request(ResumeConversationParams { - path: None, - conversation_id: None, - history: Some(history), - overrides: Some(NewConversationParams { - model: Some("o3".to_string()), - ..Default::default() - }), - }) - .await?; - let notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("sessionConfigured"), - ) - .await??; - let session_configured: ServerNotification = notification.try_into()?; - let ServerNotification::SessionConfigured(SessionConfiguredNotification { - model, - initial_messages: session_initial_messages, - .. - }) = session_configured - else { - unreachable!("expected sessionConfigured notification"); - }; - assert_eq!(model, "o3"); - assert!( - session_initial_messages.as_ref().is_none_or(Vec::is_empty), - "expected no initial messages when resuming from explicit history but got {session_initial_messages:#?}" - ); - let resume_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(resume_with_history_req_id)), - ) - .await??; - let ResumeConversationResponse { - conversation_id: history_conversation_id, - model: history_model, - initial_messages: history_initial_messages, - .. - } = to_response::(resume_resp)?; - assert!(!history_conversation_id.to_string().is_empty()); - assert_eq!(history_model, "o3"); - assert!( - history_initial_messages.as_ref().is_none_or(Vec::is_empty), - "expected no initial messages in resume response when history is provided but got {history_initial_messages:#?}" - ); - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn list_conversations_fetches_through_filtered_pages() -> Result<()> { - let codex_home = TempDir::new()?; - - // Only the last 3 conversations match the provider filter; request 3 and - // ensure pagination keeps fetching past non-matching pages. - let cases = [ - ( - "2025-03-04T12-00-00", - "2025-03-04T12:00:00Z", - "skip_provider", - ), - ( - "2025-03-03T12-00-00", - "2025-03-03T12:00:00Z", - "skip_provider", - ), - ( - "2025-03-02T12-00-00", - "2025-03-02T12:00:00Z", - "target_provider", - ), - ( - "2025-03-01T12-00-00", - "2025-03-01T12:00:00Z", - "target_provider", - ), - ( - "2025-02-28T12-00-00", - "2025-02-28T12:00:00Z", - "target_provider", - ), - ]; - - for (ts_file, ts_rfc, provider) in cases { - create_fake_rollout( - codex_home.path(), - ts_file, - ts_rfc, - "Hello", - Some(provider), - None, - )?; - } - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let req_id = mcp - .send_list_conversations_request(ListConversationsParams { - page_size: Some(3), - cursor: None, - model_providers: Some(vec!["target_provider".to_string()]), - }) - .await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(req_id)), - ) - .await??; - let ListConversationsResponse { items, next_cursor } = - to_response::(resp)?; - - assert_eq!( - items.len(), - 3, - "should fetch across pages to satisfy the limit" - ); - assert!( - items - .iter() - .all(|item| item.model_provider == "target_provider") - ); - assert_eq!(next_cursor, None); - - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/login.rs b/codex-rs/app-server/tests/suite/login.rs deleted file mode 100644 index afc69787e..000000000 --- a/codex-rs/app-server/tests/suite/login.rs +++ /dev/null @@ -1,161 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::to_response; -use codex_app_server_protocol::GetAuthStatusParams; -use codex_app_server_protocol::GetAuthStatusResponse; -use codex_app_server_protocol::JSONRPCError; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::LoginChatGptResponse; -use codex_app_server_protocol::LogoutChatGptResponse; -use codex_app_server_protocol::RequestId; -use codex_core::auth::AuthCredentialsStoreMode; -use codex_login::login_with_api_key; -use serial_test::serial; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -// Helper to create a config.toml; mirrors create_conversation.rs -fn create_config_toml(codex_home: &Path) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "http://127.0.0.1:0/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"#, - ) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn logout_chatgpt_removes_auth() -> Result<()> { - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path())?; - login_with_api_key( - codex_home.path(), - "sk-test-key", - AuthCredentialsStoreMode::File, - )?; - assert!(codex_home.path().join("auth.json").exists()); - - let mut mcp = McpProcess::new_with_env(codex_home.path(), &[("OPENAI_API_KEY", None)]).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let id = mcp.send_logout_chat_gpt_request().await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(id)), - ) - .await??; - let _ok: LogoutChatGptResponse = to_response(resp)?; - - assert!( - !codex_home.path().join("auth.json").exists(), - "auth.json should be deleted" - ); - - // Verify status reflects signed-out state. - let status_id = mcp - .send_get_auth_status_request(GetAuthStatusParams { - include_token: Some(true), - refresh_token: Some(false), - }) - .await?; - let status_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(status_id)), - ) - .await??; - let status: GetAuthStatusResponse = to_response(status_resp)?; - assert_eq!(status.auth_method, None); - assert_eq!(status.auth_token, None); - Ok(()) -} - -fn create_config_toml_forced_login(codex_home: &Path, forced_method: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - let contents = format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" -forced_login_method = "{forced_method}" -"# - ); - std::fs::write(config_toml, contents) -} - -fn create_config_toml_forced_workspace( - codex_home: &Path, - workspace_id: &str, -) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - let contents = format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" -forced_chatgpt_workspace_id = "{workspace_id}" -"# - ); - std::fs::write(config_toml, contents) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn login_chatgpt_rejected_when_forced_api() -> Result<()> { - let codex_home = TempDir::new()?; - create_config_toml_forced_login(codex_home.path(), "api")?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_login_chat_gpt_request().await?; - let err: JSONRPCError = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_error_message(RequestId::Integer(request_id)), - ) - .await??; - - assert_eq!( - err.error.message, - "ChatGPT login is disabled. Use API key login instead." - ); - Ok(()) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -// Serialize tests that launch the login server since it binds to a fixed port. -#[serial(login_port)] -async fn login_chatgpt_includes_forced_workspace_query_param() -> Result<()> { - let codex_home = TempDir::new()?; - create_config_toml_forced_workspace(codex_home.path(), "ws-forced")?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_login_chat_gpt_request().await?; - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let login: LoginChatGptResponse = to_response(resp)?; - assert!( - login.auth_url.contains("allowed_workspace_id=ws-forced"), - "auth URL should include forced workspace" - ); - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/mod.rs b/codex-rs/app-server/tests/suite/mod.rs index ae7e0cb43..c60f4a32a 100644 --- a/codex-rs/app-server/tests/suite/mod.rs +++ b/codex-rs/app-server/tests/suite/mod.rs @@ -1,16 +1,4 @@ -mod archive_thread; mod auth; -mod codex_message_processor_flow; -mod config; -mod create_thread; -mod fork_thread; +mod conversation_summary; mod fuzzy_file_search; -mod interrupt; -mod list_resume; -mod login; -mod output_schema; -mod send_message; -mod set_default_model; -mod user_agent; -mod user_info; mod v2; diff --git a/codex-rs/app-server/tests/suite/output_schema.rs b/codex-rs/app-server/tests/suite/output_schema.rs deleted file mode 100644 index b182e4262..000000000 --- a/codex-rs/app-server/tests/suite/output_schema.rs +++ /dev/null @@ -1,372 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::to_response; -use codex_app_server::INPUT_TOO_LARGE_ERROR_CODE; -use codex_app_server::INVALID_PARAMS_ERROR_CODE; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::InputItem; -use codex_app_server_protocol::JSONRPCError; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SendUserTurnParams; -use codex_app_server_protocol::SendUserTurnResponse; -use codex_protocol::config_types::ReasoningSummary; -use codex_protocol::openai_models::ReasoningEffort; -use codex_protocol::protocol::AskForApproval; -use codex_protocol::protocol::SandboxPolicy; -use codex_protocol::user_input::MAX_USER_INPUT_TEXT_CHARS; -use core_test_support::responses; -use core_test_support::skip_if_no_network; -use pretty_assertions::assert_eq; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test] -async fn send_user_turn_accepts_output_schema_v1() -> Result<()> { - skip_if_no_network!(Ok(())); - - let server = responses::start_mock_server().await; - let body = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let response_mock = responses::mount_sse_once(&server, body).await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::(new_conv_resp)?; - - let listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(listener_id)), - ) - .await??; - - let output_schema = serde_json::json!({ - "type": "object", - "properties": { - "answer": { "type": "string" } - }, - "required": ["answer"], - "additionalProperties": false - }); - - let send_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: "Hello".to_string(), - text_elements: Vec::new(), - }], - cwd: codex_home.path().to_path_buf(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::new_read_only_policy(), - model: "mock-model".to_string(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: Some(output_schema.clone()), - }) - .await?; - let _send_turn_resp: SendUserTurnResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_turn_id)), - ) - .await??, - )?; - - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - let request = response_mock.single_request(); - let payload = request.body_json(); - let text = payload.get("text").expect("request missing text field"); - let format = text - .get("format") - .expect("request missing text.format field"); - assert_eq!( - format, - &serde_json::json!({ - "name": "codex_output_schema", - "type": "json_schema", - "strict": true, - "schema": output_schema, - }) - ); - - Ok(()) -} - -#[tokio::test] -async fn send_user_turn_rejects_oversized_input_v1() -> Result<()> { - let server = responses::start_mock_server().await; - let body = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let _response_mock = responses::mount_sse_once(&server, body).await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::(new_conv_resp)?; - - let listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(listener_id)), - ) - .await??; - - let oversized_input = "x".repeat(MAX_USER_INPUT_TEXT_CHARS + 1); - let send_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: oversized_input.clone(), - text_elements: Vec::new(), - }], - cwd: codex_home.path().to_path_buf(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::DangerFullAccess, - model: "mock-model".to_string(), - effort: Some(ReasoningEffort::Low), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: None, - }) - .await?; - - let err: JSONRPCError = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_error_message(RequestId::Integer(send_turn_id)), - ) - .await??; - - assert_eq!(err.error.code, INVALID_PARAMS_ERROR_CODE); - assert_eq!( - err.error.message, - format!("Input exceeds the maximum length of {MAX_USER_INPUT_TEXT_CHARS} characters.") - ); - let data = err.error.data.expect("expected structured error data"); - assert_eq!(data["input_error_code"], INPUT_TOO_LARGE_ERROR_CODE); - assert_eq!(data["max_chars"], MAX_USER_INPUT_TEXT_CHARS); - assert_eq!(data["actual_chars"], oversized_input.chars().count()); - - Ok(()) -} - -#[tokio::test] -async fn send_user_turn_output_schema_is_per_turn_v1() -> Result<()> { - skip_if_no_network!(Ok(())); - - let server = responses::start_mock_server().await; - let body1 = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let response_mock1 = responses::mount_sse_once(&server, body1).await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::(new_conv_resp)?; - - let listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(listener_id)), - ) - .await??; - - let output_schema = serde_json::json!({ - "type": "object", - "properties": { - "answer": { "type": "string" } - }, - "required": ["answer"], - "additionalProperties": false - }); - - let send_turn_id = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: "Hello".to_string(), - text_elements: Vec::new(), - }], - cwd: codex_home.path().to_path_buf(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::new_read_only_policy(), - model: "mock-model".to_string(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: Some(output_schema.clone()), - }) - .await?; - let _send_turn_resp: SendUserTurnResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_turn_id)), - ) - .await??, - )?; - - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - let payload1 = response_mock1.single_request().body_json(); - assert_eq!( - payload1.pointer("/text/format"), - Some(&serde_json::json!({ - "name": "codex_output_schema", - "type": "json_schema", - "strict": true, - "schema": output_schema, - })) - ); - - let body2 = responses::sse(vec![ - responses::ev_response_created("resp-2"), - responses::ev_assistant_message("msg-2", "Done"), - responses::ev_completed("resp-2"), - ]); - let response_mock2 = responses::mount_sse_once(&server, body2).await; - - let send_turn_id_2 = mcp - .send_send_user_turn_request(SendUserTurnParams { - conversation_id, - items: vec![InputItem::Text { - text: "Hello again".to_string(), - text_elements: Vec::new(), - }], - cwd: codex_home.path().to_path_buf(), - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::new_read_only_policy(), - model: "mock-model".to_string(), - effort: Some(ReasoningEffort::Medium), - summary: ReasoningSummary::Auto, - service_tier: None, - output_schema: None, - }) - .await?; - let _send_turn_resp_2: SendUserTurnResponse = to_response::( - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_turn_id_2)), - ) - .await??, - )?; - - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - - let payload2 = response_mock2.single_request().body_json(); - assert_eq!(payload2.pointer("/text/format"), None); - - Ok(()) -} - -fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "read-only" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ), - ) -} diff --git a/codex-rs/app-server/tests/suite/send_message.rs b/codex-rs/app-server/tests/suite/send_message.rs deleted file mode 100644 index 725f327b4..000000000 --- a/codex-rs/app-server/tests/suite/send_message.rs +++ /dev/null @@ -1,645 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::create_fake_rollout; -use app_test_support::rollout_path; -use app_test_support::to_response; -use codex_app_server::INPUT_TOO_LARGE_ERROR_CODE; -use codex_app_server::INVALID_PARAMS_ERROR_CODE; -use codex_app_server_protocol::AddConversationListenerParams; -use codex_app_server_protocol::AddConversationSubscriptionResponse; -use codex_app_server_protocol::InputItem; -use codex_app_server_protocol::JSONRPCError; -use codex_app_server_protocol::JSONRPCNotification; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::NewConversationParams; -use codex_app_server_protocol::NewConversationResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::ResumeConversationParams; -use codex_app_server_protocol::ResumeConversationResponse; -use codex_app_server_protocol::SendUserMessageParams; -use codex_app_server_protocol::SendUserMessageResponse; -use codex_execpolicy::Policy; -use codex_protocol::ThreadId; -use codex_protocol::config_types::ReasoningSummary; -use codex_protocol::models::ContentItem; -use codex_protocol::models::DeveloperInstructions; -use codex_protocol::models::ResponseItem; -use codex_protocol::protocol::AskForApproval; -use codex_protocol::protocol::RawResponseItemEvent; -use codex_protocol::protocol::RolloutItem; -use codex_protocol::protocol::RolloutLine; -use codex_protocol::protocol::SandboxPolicy; -use codex_protocol::protocol::TurnContextItem; -use codex_protocol::user_input::MAX_USER_INPUT_TEXT_CHARS; -use core_test_support::responses; -use pretty_assertions::assert_eq; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test] -async fn test_send_message_success() -> Result<()> { - // Spin up a mock responses server that immediately ends the Codex turn. - // Two Codex turns hit the mock model (session start + send-user-message). Provide two SSE responses. - let server = responses::start_mock_server().await; - let body1 = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let body2 = responses::sse(vec![ - responses::ev_response_created("resp-2"), - responses::ev_assistant_message("msg-2", "Done"), - responses::ev_completed("resp-2"), - ]); - let _response_mock1 = responses::mount_sse_once(&server, body1).await; - let _response_mock2 = responses::mount_sse_once(&server, body2).await; - - // Create a temporary Codex home with config pointing at the mock server. - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - // Start MCP server process and initialize. - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - // Start a conversation using the new wire API. - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::<_>(new_conv_resp)?; - - // 2) addConversationListener - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let add_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - let AddConversationSubscriptionResponse { subscription_id: _ } = - to_response::<_>(add_listener_resp)?; - - // Now exercise sendUserMessage twice. - send_message("Hello", conversation_id, &mut mcp).await?; - send_message("Hello again", conversation_id, &mut mcp).await?; - Ok(()) -} - -#[expect(clippy::expect_used)] -async fn send_message( - message: &str, - conversation_id: ThreadId, - mcp: &mut McpProcess, -) -> Result<()> { - // Now exercise sendUserMessage. - let send_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![InputItem::Text { - text: message.to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - - let response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_id)), - ) - .await??; - - let _ok: SendUserMessageResponse = to_response::(response)?; - - // Verify the task_finished notification is received. - // Note this also ensures that the final request to the server was made. - let task_finished_notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await??; - let serde_json::Value::Object(map) = task_finished_notification - .params - .expect("notification should have params") - else { - panic!("task_finished_notification should have params"); - }; - assert_eq!( - map.get("conversationId") - .expect("should have conversationId"), - &serde_json::Value::String(conversation_id.to_string()) - ); - - let raw_attempt = tokio::time::timeout( - std::time::Duration::from_millis(200), - mcp.read_stream_until_notification_message("codex/event/raw_response_item"), - ) - .await; - assert!( - raw_attempt.is_err(), - "unexpected raw item notification when not opted in" - ); - Ok(()) -} - -#[tokio::test] -async fn test_send_message_raw_notifications_opt_in() -> Result<()> { - let server = responses::start_mock_server().await; - let body = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let _response_mock = responses::mount_sse_once(&server, body).await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - developer_instructions: Some("Use the test harness tools.".to_string()), - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::<_>(new_conv_resp)?; - - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: true, - }) - .await?; - let add_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - let AddConversationSubscriptionResponse { subscription_id: _ } = - to_response::<_>(add_listener_resp)?; - - let send_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![InputItem::Text { - text: "Hello".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - - let developer = read_raw_response_item(&mut mcp, conversation_id).await; - assert_permissions_message(&developer); - assert_developer_message(&developer, "Use the test harness tools."); - - let contextual_user = read_raw_response_item(&mut mcp, conversation_id).await; - assert_instructions_message(&contextual_user); - assert_environment_message(&contextual_user); - - let response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(send_id)), - ) - .await??; - let _ok: SendUserMessageResponse = to_response::(response)?; - - let user_message = read_raw_response_item(&mut mcp, conversation_id).await; - assert_user_message(&user_message, "Hello"); - - let assistant_message = read_raw_response_item(&mut mcp, conversation_id).await; - assert_assistant_message(&assistant_message, "Done"); - - let _ = tokio::time::timeout( - std::time::Duration::from_millis(250), - mcp.read_stream_until_notification_message("codex/event/task_complete"), - ) - .await; - - Ok(()) -} - -#[tokio::test] -async fn test_send_message_session_not_found() -> Result<()> { - // Start MCP without creating a Codex session - let codex_home = TempDir::new()?; - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let unknown = ThreadId::new(); - let req_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id: unknown, - items: vec![InputItem::Text { - text: "ping".to_string(), - text_elements: Vec::new(), - }], - }) - .await?; - - // Expect an error response for unknown conversation. - let err = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_error_message(RequestId::Integer(req_id)), - ) - .await??; - assert_eq!(err.id, RequestId::Integer(req_id)); - Ok(()) -} - -#[tokio::test] -async fn test_send_message_rejects_oversized_input() -> Result<()> { - let server = responses::start_mock_server().await; - let body = responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]); - let _response_mock = responses::mount_sse_once(&server, body).await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let new_conv_id = mcp - .send_new_conversation_request(NewConversationParams { - ..Default::default() - }) - .await?; - let new_conv_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(new_conv_id)), - ) - .await??; - let NewConversationResponse { - conversation_id, .. - } = to_response::<_>(new_conv_resp)?; - - let oversized_input = "x".repeat(MAX_USER_INPUT_TEXT_CHARS + 1); - let req_id = mcp - .send_send_user_message_request(SendUserMessageParams { - conversation_id, - items: vec![InputItem::Text { - text: oversized_input.clone(), - text_elements: Vec::new(), - }], - }) - .await?; - - let err: JSONRPCError = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_error_message(RequestId::Integer(req_id)), - ) - .await??; - - assert_eq!(err.error.code, INVALID_PARAMS_ERROR_CODE); - assert_eq!( - err.error.message, - format!("Input exceeds the maximum length of {MAX_USER_INPUT_TEXT_CHARS} characters.") - ); - let data = err.error.data.expect("expected structured error data"); - assert_eq!(data["input_error_code"], INPUT_TOO_LARGE_ERROR_CODE); - assert_eq!(data["max_chars"], MAX_USER_INPUT_TEXT_CHARS); - assert_eq!(data["actual_chars"], oversized_input.chars().count()); - - Ok(()) -} - -#[tokio::test] -async fn resume_with_model_mismatch_appends_model_switch_once() -> Result<()> { - let server = responses::start_mock_server().await; - let response_mock = responses::mount_sse_sequence( - &server, - vec![ - responses::sse(vec![ - responses::ev_response_created("resp-1"), - responses::ev_assistant_message("msg-1", "Done"), - responses::ev_completed("resp-1"), - ]), - responses::sse(vec![ - responses::ev_response_created("resp-2"), - responses::ev_assistant_message("msg-2", "Done again"), - responses::ev_completed("resp-2"), - ]), - ], - ) - .await; - - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path(), &server.uri())?; - - let filename_ts = "2025-01-02T12-00-00"; - let meta_rfc3339 = "2025-01-02T12:00:00Z"; - let preview = "Resume me"; - let conversation_id = create_fake_rollout( - codex_home.path(), - filename_ts, - meta_rfc3339, - preview, - Some("mock_provider"), - None, - )?; - let rollout_path = rollout_path(codex_home.path(), filename_ts, &conversation_id); - append_rollout_turn_context(&rollout_path, meta_rfc3339, "previous-model")?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let resume_id = mcp - .send_resume_conversation_request(ResumeConversationParams { - path: Some(rollout_path.clone()), - conversation_id: None, - history: None, - overrides: Some(NewConversationParams { - model: Some("gpt-5.2-codex".to_string()), - ..Default::default() - }), - }) - .await?; - timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("sessionConfigured"), - ) - .await??; - let resume_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(resume_id)), - ) - .await??; - let ResumeConversationResponse { - conversation_id, .. - } = to_response::(resume_resp)?; - - let add_listener_id = mcp - .send_add_conversation_listener_request(AddConversationListenerParams { - conversation_id, - experimental_raw_events: false, - }) - .await?; - let add_listener_resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(add_listener_id)), - ) - .await??; - let AddConversationSubscriptionResponse { subscription_id: _ } = - to_response::<_>(add_listener_resp)?; - - send_message("hello after resume", conversation_id, &mut mcp).await?; - send_message("second turn", conversation_id, &mut mcp).await?; - - let requests = response_mock.requests(); - assert_eq!(requests.len(), 2, "expected two model requests"); - - let first_developer_texts = requests[0].message_input_texts("developer"); - let first_model_switch_count = first_developer_texts - .iter() - .filter(|text| text.contains("")) - .count(); - assert!( - first_model_switch_count >= 1, - "expected model switch message on first post-resume turn, got {first_developer_texts:?}" - ); - - let second_developer_texts = requests[1].message_input_texts("developer"); - let second_model_switch_count = second_developer_texts - .iter() - .filter(|text| text.contains("")) - .count(); - assert_eq!( - second_model_switch_count, 1, - "did not expect duplicate model switch message on second post-resume turn, got {second_developer_texts:?}" - ); - - Ok(()) -} - -// --------------------------------------------------------------------------- -// Helpers -// --------------------------------------------------------------------------- - -fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - format!( - r#" -model = "mock-model" -approval_policy = "never" -sandbox_mode = "danger-full-access" - -model_provider = "mock_provider" - -[model_providers.mock_provider] -name = "Mock provider for test" -base_url = "{server_uri}/v1" -wire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 -"# - ), - ) -} - -#[expect(clippy::expect_used)] -async fn read_raw_response_item(mcp: &mut McpProcess, conversation_id: ThreadId) -> ResponseItem { - // TODO: Switch to rawResponseItem/completed once we migrate to app server v2 in codex web. - loop { - let raw_notification: JSONRPCNotification = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("codex/event/raw_response_item"), - ) - .await - .expect("codex/event/raw_response_item notification timeout") - .expect("codex/event/raw_response_item notification resp"); - - let serde_json::Value::Object(params) = raw_notification - .params - .expect("codex/event/raw_response_item should have params") - else { - panic!("codex/event/raw_response_item should have params"); - }; - - let conversation_id_value = params - .get("conversationId") - .and_then(|value| value.as_str()) - .expect("raw response item should include conversationId"); - - assert_eq!( - conversation_id_value, - conversation_id.to_string(), - "raw response item conversation mismatch" - ); - - let msg_value = params - .get("msg") - .cloned() - .expect("raw response item should include msg payload"); - - // Ghost snapshots are produced concurrently and may arrive before the model reply. - let event: RawResponseItemEvent = - serde_json::from_value(msg_value).expect("deserialize raw response item"); - if !matches!(event.item, ResponseItem::GhostSnapshot { .. }) { - return event.item; - } - } -} - -fn assert_instructions_message(item: &ResponseItem) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "user"); - let texts = content_texts(content); - let is_instructions = texts - .iter() - .any(|text| text.starts_with("# AGENTS.md instructions for ")); - assert!( - is_instructions, - "expected instructions message, got {texts:?}" - ); - } - other => panic!("expected instructions message, got {other:?}"), - } -} - -fn assert_permissions_message(item: &ResponseItem) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "developer"); - let texts = content_texts(content); - let expected = DeveloperInstructions::from_policy( - &SandboxPolicy::DangerFullAccess, - AskForApproval::Never, - &Policy::empty(), - &PathBuf::from("/tmp"), - false, - ) - .into_text(); - assert!( - texts.iter().any(|text| *text == expected), - "expected permissions developer message, got {texts:?}" - ); - } - other => panic!("expected permissions message, got {other:?}"), - } -} - -fn assert_developer_message(item: &ResponseItem, expected_text: &str) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "developer"); - let texts = content_texts(content); - assert!( - texts.contains(&expected_text), - "expected developer instructions message, got {texts:?}" - ); - } - other => panic!("expected developer instructions message, got {other:?}"), - } -} - -fn assert_environment_message(item: &ResponseItem) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "user"); - let texts = content_texts(content); - assert!( - texts - .iter() - .any(|text| text.contains("")), - "expected environment context message, got {texts:?}" - ); - } - other => panic!("expected environment message, got {other:?}"), - } -} - -fn assert_user_message(item: &ResponseItem, expected_text: &str) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "user"); - let texts = content_texts(content); - assert_eq!(texts, vec![expected_text]); - } - other => panic!("expected user message, got {other:?}"), - } -} - -fn assert_assistant_message(item: &ResponseItem, expected_text: &str) { - match item { - ResponseItem::Message { role, content, .. } => { - assert_eq!(role, "assistant"); - let texts = content_texts(content); - assert_eq!(texts, vec![expected_text]); - } - other => panic!("expected assistant message, got {other:?}"), - } -} - -fn content_texts(content: &[ContentItem]) -> Vec<&str> { - content - .iter() - .filter_map(|item| match item { - ContentItem::InputText { text, .. } | ContentItem::OutputText { text } => { - Some(text.as_str()) - } - _ => None, - }) - .collect() -} - -fn append_rollout_turn_context(path: &Path, timestamp: &str, model: &str) -> std::io::Result<()> { - let line = RolloutLine { - timestamp: timestamp.to_string(), - item: RolloutItem::TurnContext(TurnContextItem { - turn_id: None, - cwd: PathBuf::from("/"), - current_date: None, - timezone: None, - approval_policy: AskForApproval::Never, - sandbox_policy: SandboxPolicy::DangerFullAccess, - network: None, - model: model.to_string(), - personality: None, - collaboration_mode: None, - realtime_active: Some(false), - effort: None, - summary: ReasoningSummary::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, - }), - }; - let serialized = serde_json::to_string(&line).map_err(std::io::Error::other)?; - std::fs::OpenOptions::new() - .append(true) - .open(path)? - .write_all(format!("{serialized}\n").as_bytes()) -} diff --git a/codex-rs/app-server/tests/suite/set_default_model.rs b/codex-rs/app-server/tests/suite/set_default_model.rs deleted file mode 100644 index b56c54dbd..000000000 --- a/codex-rs/app-server/tests/suite/set_default_model.rs +++ /dev/null @@ -1,64 +0,0 @@ -use anyhow::Result; -use app_test_support::McpProcess; -use app_test_support::to_response; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::SetDefaultModelParams; -use codex_app_server_protocol::SetDefaultModelResponse; -use codex_core::config::ConfigToml; -use pretty_assertions::assert_eq; -use std::path::Path; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn set_default_model_persists_overrides() -> Result<()> { - let codex_home = TempDir::new()?; - create_config_toml(codex_home.path())?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let params = SetDefaultModelParams { - model: Some("gpt-4.1".to_string()), - reasoning_effort: None, - }; - - let request_id = mcp.send_set_default_model_request(params).await?; - - let resp: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let _: SetDefaultModelResponse = to_response(resp)?; - - let config_path = codex_home.path().join("config.toml"); - let config_contents = tokio::fs::read_to_string(&config_path).await?; - let config_toml: ConfigToml = toml::from_str(&config_contents)?; - - assert_eq!( - ConfigToml { - model: Some("gpt-4.1".to_string()), - model_reasoning_effort: None, - ..Default::default() - }, - config_toml, - ); - Ok(()) -} - -// Helper to create a config.toml; mirrors create_conversation.rs -fn create_config_toml(codex_home: &Path) -> std::io::Result<()> { - let config_toml = codex_home.join("config.toml"); - std::fs::write( - config_toml, - r#" -model = "gpt-5.1-codex-max" -model_reasoning_effort = "medium" -"#, - ) -} diff --git a/codex-rs/app-server/tests/suite/user_agent.rs b/codex-rs/app-server/tests/suite/user_agent.rs deleted file mode 100644 index 9178a3ef5..000000000 --- a/codex-rs/app-server/tests/suite/user_agent.rs +++ /dev/null @@ -1,43 +0,0 @@ -use anyhow::Result; -use app_test_support::DEFAULT_CLIENT_NAME; -use app_test_support::McpProcess; -use app_test_support::to_response; -use codex_app_server_protocol::GetUserAgentResponse; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::RequestId; -use pretty_assertions::assert_eq; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn get_user_agent_returns_current_codex_user_agent() -> Result<()> { - let codex_home = TempDir::new()?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_get_user_agent_request().await?; - let response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let os_info = os_info::get(); - let originator = DEFAULT_CLIENT_NAME; - let os_type = os_info.os_type(); - let os_version = os_info.version(); - let architecture = os_info.architecture().unwrap_or("unknown"); - let terminal_ua = codex_core::terminal::user_agent(); - let user_agent = format!( - "{originator}/0.0.0 ({os_type} {os_version}; {architecture}) {terminal_ua} ({DEFAULT_CLIENT_NAME}; 0.1.0)" - ); - - let received: GetUserAgentResponse = to_response(response)?; - let expected = GetUserAgentResponse { user_agent }; - - assert_eq!(received, expected); - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/user_info.rs b/codex-rs/app-server/tests/suite/user_info.rs deleted file mode 100644 index 6a44f1a3a..000000000 --- a/codex-rs/app-server/tests/suite/user_info.rs +++ /dev/null @@ -1,46 +0,0 @@ -use anyhow::Result; -use app_test_support::ChatGptAuthFixture; -use app_test_support::McpProcess; -use app_test_support::to_response; -use app_test_support::write_chatgpt_auth; -use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::RequestId; -use codex_app_server_protocol::UserInfoResponse; -use codex_core::auth::AuthCredentialsStoreMode; -use pretty_assertions::assert_eq; -use std::time::Duration; -use tempfile::TempDir; -use tokio::time::timeout; - -const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(10); - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn user_info_returns_email_from_auth_json() -> Result<()> { - let codex_home = TempDir::new()?; - - write_chatgpt_auth( - codex_home.path(), - ChatGptAuthFixture::new("access") - .refresh_token("refresh") - .email("user@example.com"), - AuthCredentialsStoreMode::File, - )?; - - let mut mcp = McpProcess::new(codex_home.path()).await?; - timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??; - - let request_id = mcp.send_user_info_request().await?; - let response: JSONRPCResponse = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_response_message(RequestId::Integer(request_id)), - ) - .await??; - - let received: UserInfoResponse = to_response(response)?; - let expected = UserInfoResponse { - alleged_user_email: Some("user@example.com".to_string()), - }; - - assert_eq!(received, expected); - Ok(()) -} diff --git a/codex-rs/app-server/tests/suite/v2/rate_limits.rs b/codex-rs/app-server/tests/suite/v2/rate_limits.rs index 6f66d7bff..51048202f 100644 --- a/codex-rs/app-server/tests/suite/v2/rate_limits.rs +++ b/codex-rs/app-server/tests/suite/v2/rate_limits.rs @@ -6,7 +6,7 @@ use app_test_support::write_chatgpt_auth; use codex_app_server_protocol::GetAccountRateLimitsResponse; use codex_app_server_protocol::JSONRPCError; use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::LoginApiKeyParams; +use codex_app_server_protocol::LoginAccountResponse; use codex_app_server_protocol::RateLimitSnapshot; use codex_app_server_protocol::RateLimitWindow; use codex_app_server_protocol::RequestId; @@ -221,17 +221,14 @@ async fn get_account_rate_limits_returns_snapshot() -> Result<()> { } async fn login_with_api_key(mcp: &mut McpProcess, api_key: &str) -> Result<()> { - let request_id = mcp - .send_login_api_key_request(LoginApiKeyParams { - api_key: api_key.to_string(), - }) - .await?; - - timeout( + let request_id = mcp.send_login_account_api_key_request(api_key).await?; + let response: JSONRPCResponse = timeout( DEFAULT_READ_TIMEOUT, mcp.read_stream_until_response_message(RequestId::Integer(request_id)), ) .await??; + let login: LoginAccountResponse = to_response(response)?; + assert_eq!(login, LoginAccountResponse::ApiKey {}); Ok(()) } diff --git a/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs b/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs index 139e8b378..71150d712 100644 --- a/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs +++ b/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs @@ -5,7 +5,7 @@ use app_test_support::create_mock_responses_server_sequence_unchecked; use app_test_support::to_response; use codex_app_server_protocol::JSONRPCError; use codex_app_server_protocol::JSONRPCResponse; -use codex_app_server_protocol::LoginApiKeyParams; +use codex_app_server_protocol::LoginAccountResponse; use codex_app_server_protocol::RequestId; use codex_app_server_protocol::ThreadRealtimeAppendAudioParams; use codex_app_server_protocol::ThreadRealtimeAppendAudioResponse; @@ -350,17 +350,14 @@ async fn read_notification(mcp: &mut McpProcess, method: &s } async fn login_with_api_key(mcp: &mut McpProcess, api_key: &str) -> Result<()> { - let request_id = mcp - .send_login_api_key_request(LoginApiKeyParams { - api_key: api_key.to_string(), - }) - .await?; - - timeout( + let request_id = mcp.send_login_account_api_key_request(api_key).await?; + let response: JSONRPCResponse = timeout( DEFAULT_TIMEOUT, mcp.read_stream_until_response_message(RequestId::Integer(request_id)), ) .await??; + let login: LoginAccountResponse = to_response(response)?; + assert_eq!(login, LoginAccountResponse::ApiKey {}); Ok(()) } diff --git a/codex-rs/docs/codex_mcp_interface.md b/codex-rs/docs/codex_mcp_interface.md index 763f2602a..b4e3adfe5 100644 --- a/codex-rs/docs/codex_mcp_interface.md +++ b/codex-rs/docs/codex_mcp_interface.md @@ -1,38 +1,36 @@ # Codex MCP Server Interface [experimental] -This document describes Codex’s experimental MCP server interface: a JSON‑RPC API that runs over the Model Context Protocol (MCP) transport to control a local Codex engine. +This document describes Codex's experimental MCP server interface: a JSON-RPC API that runs over the Model Context Protocol (MCP) transport to control a local Codex engine. - Status: experimental and subject to change without notice - Server binary: `codex mcp-server` (or `codex-mcp-server`) -- Transport: standard MCP over stdio (JSON‑RPC 2.0, line‑delimited) +- Transport: standard MCP over stdio (JSON-RPC 2.0, line-delimited) ## Overview -Codex exposes a small set of MCP‑compatible methods to create and manage conversations, send user input, receive live events, and handle approval prompts. The types are defined in `protocol/src/mcp_protocol.rs` and re‑used by the MCP server implementation in `mcp-server/`. +Codex exposes MCP-compatible methods to manage threads, turns, accounts, config, and approvals. The types live in `app-server-protocol/src/protocol/{common,v1,v2}.rs` and are consumed by the app server implementation in `app-server/`. At a glance: -- Conversations - - `newConversation` → start a Codex session - - `sendUserMessage` / `sendUserTurn` → send user input into a conversation - - `interruptConversation` → stop the current turn - - `listConversations`, `resumeConversation`, `archiveConversation` -- Configuration and info - - `getUserSavedConfig`, `setDefaultModel`, `getUserAgent`, `userInfo` - - `model/list` → enumerate available models and reasoning options - - `collaborationMode/list` → enumerate collaboration mode presets (experimental) -- Auth +- Primary v2 RPCs + - `thread/start`, `thread/resume`, `thread/fork`, `thread/read`, `thread/list` + - `turn/start`, `turn/steer`, `turn/interrupt` - `account/read`, `account/login/start`, `account/login/cancel`, `account/logout`, `account/rateLimits/read` - - notifications: `account/login/completed`, `account/updated`, `account/rateLimits/updated` -- Utilities - - `gitDiffToRemote`, `execOneOffCommand` -- Approvals (server → client requests) + - `config/read`, `config/value/write`, `config/batchWrite` + - `model/list`, `app/list`, `collaborationMode/list` +- Remaining v1 compatibility RPCs + - `getConversationSummary` + - `getAuthStatus` + - `gitDiffToRemote` + - `fuzzyFileSearch`, `fuzzyFileSearch/sessionStart`, `fuzzyFileSearch/sessionUpdate`, `fuzzyFileSearch/sessionStop` +- Notifications + - v2 typed notifications such as `thread/started`, `turn/completed`, `account/login/completed` + - `codex/event/*` stream notifications for live agent events + - `fuzzyFileSearch/sessionUpdated`, `fuzzyFileSearch/sessionCompleted` +- Approvals (server -> client requests) - `applyPatchApproval`, `execCommandApproval` -- Notifications (server → client) - - `loginChatGptComplete`, `authStatusChange` - - `codex/event` stream with agent events -See code for full type definitions and exact shapes: `protocol/src/mcp_protocol.rs`. +See code for full type definitions and exact shapes: `app-server-protocol/src/protocol/{common,v1,v2}.rs`. ## Starting the server @@ -50,73 +48,45 @@ npx @modelcontextprotocol/inspector codex mcp-server Use the separate `codex mcp` subcommand to manage configured MCP server launchers in `config.toml`. -## Conversations +## Threads and turns -Start a new session with optional overrides: +Use the v2 thread and turn APIs for all new integrations. `thread/start` creates a thread, `turn/start` submits user input, `turn/interrupt` stops an in-flight turn, and `thread/list` / `thread/read` expose persisted history. -Request `newConversation` params (subset): +`getConversationSummary` remains as a compatibility helper for clients that still need a summary lookup by `conversationId` or `rolloutPath`. -- `model`: string model id (e.g. "o3", "gpt-5.1", "gpt-5.1-codex") -- `profile`: optional named profile -- `cwd`: optional working directory -- `approvalPolicy`: `untrusted` | `on-request` | `on-failure` (deprecated) | `never` -- `sandbox`: `read-only` | `workspace-write` | `external-sandbox` (honors `networkAccess` restricted/enabled) | `danger-full-access` -- `config`: map of additional config overrides -- `baseInstructions`: optional instruction override -- `compactPrompt`: optional replacement for the default compaction prompt -- `includePlanTool` / `includeApplyPatchTool`: booleans - -Response: `{ conversationId, model, reasoningEffort?, rolloutPath }` - -Send input to the active turn: - -- `sendUserMessage` → enqueue items to the conversation -- `sendUserTurn` → structured turn with explicit `cwd`, `approvalPolicy`, `sandboxPolicy`, `model`, optional `effort`, `summary`, optional `personality`, and optional `outputSchema` (JSON Schema for the final assistant message) - -Valid `personality` values are `friendly`, `pragmatic`, and `none`. When `none` is selected, the personality placeholder is replaced with an empty string. - -For v2 threads, `turn/start` also accepts `outputSchema` to constrain the final assistant message for that turn. - -Interrupt a running turn: `interruptConversation`. - -List/resume/archive: `listConversations`, `resumeConversation`, `archiveConversation`. - -For v2 threads, use `thread/list` with filters such as `archived: true`, `cwd: "/path"`, or -`searchTerm: "needle"` to -narrow results, and `thread/unarchive` to restore archived rollouts to the active sessions -directory (it returns the restored thread summary). +For complete request and response shapes, see the app-server README and the protocol definitions in `app-server-protocol/src/protocol/v2.rs`. ## Models Fetch the catalog of models available in the current Codex build with `model/list`. The request accepts optional pagination inputs: -- `limit` – number of models to return (defaults to a server-selected value) -- `cursor` – opaque string from the previous response’s `nextCursor` +- `limit` - number of models to return (defaults to a server-selected value) +- `cursor` - opaque string from the previous response's `nextCursor` Each response yields: -- `data` – ordered list of models. A model includes: +- `data` - ordered list of models. A model includes: - `id`, `model`, `displayName`, `description` - - `supportedReasoningEfforts` – array of objects with: - - `reasoningEffort` – one of `none|minimal|low|medium|high|xhigh` - - `description` – human-friendly label for the effort - - `defaultReasoningEffort` – suggested effort for the UI - - `inputModalities` – accepted input types for the model - - `supportsPersonality` – whether the model supports personality-specific instructions - - `isDefault` – whether the model is recommended for most users - - `upgrade` – optional recommended upgrade model id - - `upgradeInfo` – optional upgrade metadata object with: - - `model` – recommended upgrade model id - - `upgradeCopy` – optional display copy for the upgrade recommendation - - `modelLink` – optional link for the upgrade recommendation - - `migrationMarkdown` – optional markdown shown when presenting the upgrade -- `nextCursor` – pass into the next request to continue paging (optional) + - `supportedReasoningEfforts` - array of objects with: + - `reasoningEffort` - one of `none|minimal|low|medium|high|xhigh` + - `description` - human-friendly label for the effort + - `defaultReasoningEffort` - suggested effort for the UI + - `inputModalities` - accepted input types for the model + - `supportsPersonality` - whether the model supports personality-specific instructions + - `isDefault` - whether the model is recommended for most users + - `upgrade` - optional recommended upgrade model id + - `upgradeInfo` - optional upgrade metadata object with: + - `model` - recommended upgrade model id + - `upgradeCopy` - optional display copy for the upgrade recommendation + - `modelLink` - optional link for the upgrade recommendation + - `migrationMarkdown` - optional markdown shown when presenting the upgrade +- `nextCursor` - pass into the next request to continue paging (optional) ## Collaboration modes (experimental) Fetch the built-in collaboration mode presets with `collaborationMode/list`. This endpoint does not accept pagination and returns the full list in one response: -- `data` – ordered list of collaboration mode masks (partial settings to apply on top of the base mode) +- `data` - ordered list of collaboration mode masks (partial settings to apply on top of the base mode) - For tri-state fields like `reasoning_effort` and `developer_instructions`, omit the field to keep the current value, set it to `null` to clear it, or set a concrete value to update it. When sending `turn/start` with `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode". @@ -125,16 +95,14 @@ When sending `turn/start` with `collaborationMode`, `settings.developer_instruct While a conversation runs, the server sends notifications: -- `codex/event` with the serialized Codex event payload. The shape matches `core/src/protocol.rs`’s `Event` and `EventMsg` types. Some notifications include a `_meta.requestId` to correlate with the originating request. -- Auth notifications via method names `loginChatGptComplete` and `authStatusChange`. +- `codex/event` with the serialized Codex event payload. The shape matches `core/src/protocol.rs`'s `Event` and `EventMsg` types. Some notifications include a `_meta.requestId` to correlate with the originating request. +- `fuzzyFileSearch/sessionUpdated` and `fuzzyFileSearch/sessionCompleted` for the legacy fuzzy search flow. Clients should render events and, when present, surface approval requests (see next section). ## Tool responses -The `codex` and `codex-reply` tools return standard MCP `CallToolResult` payloads. For -compatibility with MCP clients that prefer `structuredContent`, Codex mirrors the -content blocks inside `structuredContent` alongside the `threadId`. +The `codex` and `codex-reply` tools return standard MCP `CallToolResult` payloads. For compatibility with MCP clients that prefer `structuredContent`, Codex mirrors the content blocks inside `structuredContent` alongside the `threadId`. Example: @@ -148,9 +116,9 @@ Example: } ``` -## Approvals (server → client) +## Approvals (server -> client) -When Codex needs approval to apply changes or run commands, the server issues JSON‑RPC requests to the client: +When Codex needs approval to apply changes or run commands, the server issues JSON-RPC requests to the client: - `applyPatchApproval { conversationId, callId, fileChanges, reason?, grantRoot? }` - `execCommandApproval { conversationId, callId, approvalId?, command, cwd, reason? }` @@ -159,28 +127,17 @@ The client must reply with `{ decision: "allow" | "deny" }` for each request. ## Auth helpers -For the complete request/response shapes and flow examples, see the [“Auth endpoints (v2)” section in the app‑server README](../app-server/README.md#auth-endpoints-v2). +For the complete request/response shapes and flow examples, see the [Auth endpoints (v2) section in the app-server README](../app-server/README.md#auth-endpoints-v2). -## Example: start and send a message +## Legacy compatibility methods -```json -{ "jsonrpc": "2.0", "id": 1, "method": "newConversation", "params": { "model": "gpt-5.1", "approvalPolicy": "on-request" } } -``` +The server still accepts a narrow v1 compatibility surface for existing app clients: -Server responds: - -```json -{ "jsonrpc": "2.0", "id": 1, "result": { "conversationId": "c7b0…", "model": "gpt-5.1", "rolloutPath": "/path/to/rollout.jsonl" } } -``` - -Then send input: - -```json -{ "jsonrpc": "2.0", "id": 2, "method": "sendUserMessage", "params": { "conversationId": "c7b0…", "items": [{ "type": "text", "text": "Hello Codex" }] } } -``` - -While processing, the server emits `codex/event` notifications containing agent output, approvals, and status updates. +- `getConversationSummary` +- `getAuthStatus` +- `gitDiffToRemote` +- `fuzzyFileSearch`, `fuzzyFileSearch/sessionStart`, `fuzzyFileSearch/sessionUpdate`, `fuzzyFileSearch/sessionStop` ## Compatibility and stability -This interface is experimental. Method names, fields, and event shapes may evolve. For the authoritative schema, consult `protocol/src/mcp_protocol.rs` and the corresponding server wiring in `mcp-server/`. +This interface is experimental. Method names, fields, and event shapes may evolve. For the authoritative schema, consult `app-server-protocol/src/protocol/{common,v1,v2}.rs` and the corresponding server wiring in `app-server/`.