mirror of
https://github.com/openai/codex.git
synced 2026-05-04 05:11:37 +03:00
fix(app-server): fix TS annotations for optional fields on requests (#10412)
This updates our generated TypeScript types to be more correct with how the server actually behaves, **specifically for JSON-RPC requests**. Before this PR, we'd generate `field: T | null`. After this PR, we will have `field?: T | null`. The latter matches how the server actually works, in that if an optional field is omitted, the server will treat it as null. This also makes it less annoying in theory for clients to upgrade to newer versions of Codex, since adding a new optional field to a JSON-RPC request should not require a client change. NOTE: This only applies to JSON-RPC requests. All other payloads (i.e. responses, notifications) will return `field: T | null` as usual.
This commit is contained in:
@@ -6,8 +6,8 @@ export type AppsListParams = {
|
||||
/**
|
||||
* Opaque pagination cursor returned by a previous call.
|
||||
*/
|
||||
cursor: string | null,
|
||||
cursor?: string | null,
|
||||
/**
|
||||
* Optional page size; defaults to a reasonable server-side value.
|
||||
*/
|
||||
limit: number | null, };
|
||||
limit?: number | null, };
|
||||
|
||||
@@ -13,4 +13,4 @@ export type ChatgptAuthTokensRefreshParams = { reason: ChatgptAuthTokensRefreshR
|
||||
* This may be `null` when the prior ID token did not include a workspace
|
||||
* identifier (`chatgpt_account_id`) or when the token could not be parsed.
|
||||
*/
|
||||
previousAccountId: string | null, };
|
||||
previousAccountId?: string | null, };
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
// 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 CommandExecParams = { command: Array<string>, timeoutMs: number | null, cwd: string | null, sandboxPolicy: SandboxPolicy | null, };
|
||||
export type CommandExecParams = { command: Array<string>, timeoutMs?: number | null, cwd?: string | null, sandboxPolicy?: SandboxPolicy | null, };
|
||||
|
||||
@@ -8,20 +8,20 @@ export type CommandExecutionRequestApprovalParams = { threadId: string, turnId:
|
||||
/**
|
||||
* Optional explanatory reason (e.g. request for network access).
|
||||
*/
|
||||
reason: string | null,
|
||||
reason?: string | null,
|
||||
/**
|
||||
* The command to be executed.
|
||||
*/
|
||||
command?: string,
|
||||
command?: string | null,
|
||||
/**
|
||||
* The command's working directory.
|
||||
*/
|
||||
cwd?: string,
|
||||
cwd?: string | null,
|
||||
/**
|
||||
* Best-effort parsed command actions for friendly display.
|
||||
*/
|
||||
commandActions?: Array<CommandAction>,
|
||||
commandActions?: Array<CommandAction> | null,
|
||||
/**
|
||||
* Optional proposed execpolicy amendment to allow similar commands without prompting.
|
||||
*/
|
||||
proposedExecpolicyAmendment: ExecPolicyAmendment | null, };
|
||||
proposedExecpolicyAmendment?: ExecPolicyAmendment | null, };
|
||||
|
||||
@@ -7,4 +7,4 @@ export type ConfigBatchWriteParams = { edits: Array<ConfigEdit>,
|
||||
/**
|
||||
* Path to the config file to write; defaults to the user's `config.toml` when omitted.
|
||||
*/
|
||||
filePath: string | null, expectedVersion: string | null, };
|
||||
filePath?: string | null, expectedVersion?: string | null, };
|
||||
|
||||
@@ -8,4 +8,4 @@ export type ConfigReadParams = { includeLayers: boolean,
|
||||
* return the effective config as seen from that directory (i.e., including any
|
||||
* project layers between `cwd` and the project/repo root).
|
||||
*/
|
||||
cwd: string | null, };
|
||||
cwd?: string | null, };
|
||||
|
||||
@@ -8,4 +8,4 @@ export type ConfigValueWriteParams = { keyPath: string, value: JsonValue, mergeS
|
||||
/**
|
||||
* Path to the config file to write; defaults to the user's `config.toml` when omitted.
|
||||
*/
|
||||
filePath: string | null, expectedVersion: string | null, };
|
||||
filePath?: string | null, expectedVersion?: string | null, };
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FeedbackUploadParams = { classification: string, reason: string | null, threadId: string | null, includeLogs: boolean, };
|
||||
export type FeedbackUploadParams = { classification: string, reason?: string | null, threadId?: string | null, includeLogs: boolean, };
|
||||
|
||||
@@ -6,9 +6,9 @@ export type FileChangeRequestApprovalParams = { threadId: string, turnId: string
|
||||
/**
|
||||
* Optional explanatory reason (e.g. request for extra write access).
|
||||
*/
|
||||
reason: string | null,
|
||||
reason?: string | null,
|
||||
/**
|
||||
* [UNSTABLE] When set, the agent is asking the user to allow writes under this root
|
||||
* for the remainder of the session (unclear if this is honored today).
|
||||
*/
|
||||
grantRoot: string | null, };
|
||||
grantRoot?: string | null, };
|
||||
|
||||
@@ -6,8 +6,8 @@ export type ListMcpServerStatusParams = {
|
||||
/**
|
||||
* Opaque pagination cursor returned by a previous call.
|
||||
*/
|
||||
cursor: string | null,
|
||||
cursor?: string | null,
|
||||
/**
|
||||
* Optional page size; defaults to a server-defined value.
|
||||
*/
|
||||
limit: number | null, };
|
||||
limit?: number | null, };
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type McpServerOauthLoginParams = { name: string, scopes?: Array<string>, timeoutSecs?: bigint, };
|
||||
export type McpServerOauthLoginParams = { name: string, scopes?: Array<string> | null, timeoutSecs?: bigint | null, };
|
||||
|
||||
@@ -6,8 +6,8 @@ export type ModelListParams = {
|
||||
/**
|
||||
* Opaque pagination cursor returned by a previous call.
|
||||
*/
|
||||
cursor: string | null,
|
||||
cursor?: string | null,
|
||||
/**
|
||||
* Optional page size; defaults to a reasonable server-side value.
|
||||
*/
|
||||
limit: number | null, };
|
||||
limit?: number | null, };
|
||||
|
||||
@@ -9,4 +9,4 @@ export type ReviewStartParams = { threadId: string, target: ReviewTarget,
|
||||
* Where to run the review: inline (default) on the current thread or
|
||||
* detached on a new thread (returned in `reviewThreadId`).
|
||||
*/
|
||||
delivery: ReviewDelivery | null, };
|
||||
delivery?: ReviewDelivery | null, };
|
||||
|
||||
@@ -19,8 +19,8 @@ export type ThreadForkParams = { threadId: string,
|
||||
* [UNSTABLE] Specify the rollout path to fork from.
|
||||
* If specified, the thread_id param will be ignored.
|
||||
*/
|
||||
path: string | null,
|
||||
path?: string | null,
|
||||
/**
|
||||
* Configuration overrides for the forked thread, if any.
|
||||
*/
|
||||
model: string | null, modelProvider: string | null, cwd: string | null, approvalPolicy: AskForApproval | null, sandbox: SandboxMode | null, config: { [key in string]?: JsonValue } | null, baseInstructions: string | null, developerInstructions: string | null, };
|
||||
model?: string | null, modelProvider?: string | null, cwd?: string | null, approvalPolicy?: AskForApproval | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, };
|
||||
|
||||
@@ -8,27 +8,27 @@ export type ThreadListParams = {
|
||||
/**
|
||||
* Opaque pagination cursor returned by a previous call.
|
||||
*/
|
||||
cursor: string | null,
|
||||
cursor?: string | null,
|
||||
/**
|
||||
* Optional page size; defaults to a reasonable server-side value.
|
||||
*/
|
||||
limit: number | null,
|
||||
limit?: number | null,
|
||||
/**
|
||||
* Optional sort key; defaults to created_at.
|
||||
*/
|
||||
sortKey: ThreadSortKey | null,
|
||||
sortKey?: ThreadSortKey | null,
|
||||
/**
|
||||
* Optional provider filter; when set, only sessions recorded under these
|
||||
* providers are returned. When present but empty, includes all providers.
|
||||
*/
|
||||
modelProviders: Array<string> | null,
|
||||
modelProviders?: Array<string> | null,
|
||||
/**
|
||||
* Optional source filter; when set, only sessions from these source kinds
|
||||
* are returned. When omitted or empty, defaults to interactive sources.
|
||||
*/
|
||||
sourceKinds: Array<ThreadSourceKind> | null,
|
||||
sourceKinds?: Array<ThreadSourceKind> | null,
|
||||
/**
|
||||
* Optional archived filter; when set to true, only archived threads are returned.
|
||||
* If false or null, only non-archived threads are returned.
|
||||
*/
|
||||
archived: boolean | null, };
|
||||
archived?: boolean | null, };
|
||||
|
||||
@@ -6,8 +6,8 @@ export type ThreadLoadedListParams = {
|
||||
/**
|
||||
* Opaque pagination cursor returned by a previous call.
|
||||
*/
|
||||
cursor: string | null,
|
||||
cursor?: string | null,
|
||||
/**
|
||||
* Optional page size; defaults to no limit.
|
||||
*/
|
||||
limit: number | null, };
|
||||
limit?: number | null, };
|
||||
|
||||
@@ -24,13 +24,13 @@ export type ThreadResumeParams = { threadId: string,
|
||||
* If specified, the thread will be resumed with the provided history
|
||||
* instead of loaded from disk.
|
||||
*/
|
||||
history: Array<ResponseItem> | null,
|
||||
history?: Array<ResponseItem> | null,
|
||||
/**
|
||||
* [UNSTABLE] Specify the rollout path to resume from.
|
||||
* If specified, the thread_id param will be ignored.
|
||||
*/
|
||||
path: string | null,
|
||||
path?: string | null,
|
||||
/**
|
||||
* Configuration overrides for the resumed thread, if any.
|
||||
*/
|
||||
model: string | null, modelProvider: string | null, cwd: string | null, approvalPolicy: AskForApproval | null, sandbox: SandboxMode | null, config: { [key in string]?: JsonValue } | null, baseInstructions: string | null, developerInstructions: string | null, personality: Personality | null, };
|
||||
model?: string | null, modelProvider?: string | null, cwd?: string | null, approvalPolicy?: AskForApproval | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, personality?: Personality | null, };
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { JsonValue } from "../serde_json/JsonValue";
|
||||
import type { AskForApproval } from "./AskForApproval";
|
||||
import type { SandboxMode } from "./SandboxMode";
|
||||
|
||||
export type ThreadStartParams = {model: string | null, modelProvider: string | null, cwd: string | null, approvalPolicy: AskForApproval | null, sandbox: SandboxMode | null, config: { [key in string]?: JsonValue } | null, baseInstructions: string | null, developerInstructions: string | null, personality: Personality | null, ephemeral: boolean | null, /**
|
||||
export type ThreadStartParams = {model?: string | null, modelProvider?: string | null, cwd?: string | null, approvalPolicy?: AskForApproval | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, personality?: Personality | null, ephemeral?: boolean | null, /**
|
||||
* If true, opt into emitting raw response items on the event stream.
|
||||
*
|
||||
* This is for internal use only (e.g. Codex Cloud).
|
||||
|
||||
@@ -14,37 +14,37 @@ export type TurnStartParams = { threadId: string, input: Array<UserInput>,
|
||||
/**
|
||||
* Override the working directory for this turn and subsequent turns.
|
||||
*/
|
||||
cwd: string | null,
|
||||
cwd?: string | null,
|
||||
/**
|
||||
* Override the approval policy for this turn and subsequent turns.
|
||||
*/
|
||||
approvalPolicy: AskForApproval | null,
|
||||
approvalPolicy?: AskForApproval | null,
|
||||
/**
|
||||
* Override the sandbox policy for this turn and subsequent turns.
|
||||
*/
|
||||
sandboxPolicy: SandboxPolicy | null,
|
||||
sandboxPolicy?: SandboxPolicy | null,
|
||||
/**
|
||||
* Override the model for this turn and subsequent turns.
|
||||
*/
|
||||
model: string | null,
|
||||
model?: string | null,
|
||||
/**
|
||||
* Override the reasoning effort for this turn and subsequent turns.
|
||||
*/
|
||||
effort: ReasoningEffort | null,
|
||||
effort?: ReasoningEffort | null,
|
||||
/**
|
||||
* Override the reasoning summary for this turn and subsequent turns.
|
||||
*/
|
||||
summary: ReasoningSummary | null,
|
||||
summary?: ReasoningSummary | null,
|
||||
/**
|
||||
* Override the personality for this turn and subsequent turns.
|
||||
*/
|
||||
personality: Personality | null,
|
||||
personality?: Personality | null,
|
||||
/**
|
||||
* Optional JSON Schema used to constrain the final assistant message for this turn.
|
||||
*/
|
||||
outputSchema: JsonValue | null,
|
||||
outputSchema?: JsonValue | null,
|
||||
/**
|
||||
* EXPERIMENTAL - set a pre-set collaboration mode.
|
||||
* Takes precedence over model, reasoning_effort, and developer instructions if set.
|
||||
*/
|
||||
collaborationMode: CollaborationMode | null, };
|
||||
collaborationMode?: CollaborationMode | null, };
|
||||
|
||||
Reference in New Issue
Block a user