diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index dc5dd6ad60..f0e2ff4a8c 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -5,6 +5,48 @@ "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", "type": "string" }, + "AccountSessionsAddParams": { + "properties": { + "switchToAddedAccount": { + "type": "boolean" + } + }, + "type": "object" + }, + "AccountSessionsListParams": { + "properties": { + "refreshWorkspaceMetadata": { + "type": "boolean" + } + }, + "type": "object" + }, + "AccountSessionsLogoutParams": { + "properties": { + "sessionId": { + "type": "string" + } + }, + "required": [ + "sessionId" + ], + "type": "object" + }, + "AccountSessionsSwitchParams": { + "properties": { + "accountId": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + }, + "required": [ + "accountId", + "sessionId" + ], + "type": "object" + }, "AddCreditsNudgeCreditType": { "enum": [ "credits", @@ -5875,6 +5917,102 @@ "title": "Account/login/cancelRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/add" + ], + "title": "AccountSession/addRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsAddParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/addRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/list" + ], + "title": "AccountSession/listRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsListParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/listRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/logout" + ], + "title": "AccountSession/logoutRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsLogoutParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/logoutRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/switch" + ], + "title": "AccountSession/switchRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsSwitchParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/switchRequest", + "type": "object" + }, { "properties": { "id": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 0c2ebf121e..774ca0497e 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -1787,6 +1787,102 @@ "title": "Account/login/cancelRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "accountSession/add" + ], + "title": "AccountSession/addRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/AccountSessionsAddParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/addRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "accountSession/list" + ], + "title": "AccountSession/listRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/AccountSessionsListParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/listRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "accountSession/logout" + ], + "title": "AccountSession/logoutRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/AccountSessionsLogoutParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/logoutRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "accountSession/switch" + ], + "title": "AccountSession/switchRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/AccountSessionsSwitchParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/switchRequest", + "type": "object" + }, { "properties": { "id": { @@ -5731,6 +5827,193 @@ "title": "AccountRateLimitsUpdatedNotification", "type": "object" }, + "AccountSession": { + "properties": { + "displayName": { + "type": [ + "string", + "null" + ] + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "isActive": { + "type": "boolean" + }, + "lastUsedAt": { + "format": "int64", + "type": "integer" + }, + "plan": { + "type": [ + "string", + "null" + ] + }, + "selectedWorkspaceAccountId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": "string" + }, + "userId": { + "type": [ + "string", + "null" + ] + }, + "workspaces": { + "items": { + "$ref": "#/definitions/v2/AccountSessionWorkspace" + }, + "type": "array" + } + }, + "required": [ + "isActive", + "lastUsedAt", + "sessionId", + "workspaces" + ], + "type": "object" + }, + "AccountSessionWorkspace": { + "properties": { + "accountId": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "kind": { + "anyOf": [ + { + "$ref": "#/definitions/v2/AccountSessionWorkspaceKind" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/definitions/v2/AccountSessionWorkspaceStatus" + } + }, + "required": [ + "accountId", + "status" + ], + "type": "object" + }, + "AccountSessionWorkspaceKind": { + "enum": [ + "personal", + "workspace" + ], + "type": "string" + }, + "AccountSessionWorkspaceStatus": { + "enum": [ + "active", + "disabled", + "deactivated" + ], + "type": "string" + }, + "AccountSessionsAddParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "switchToAddedAccount": { + "type": "boolean" + } + }, + "title": "AccountSessionsAddParams", + "type": "object" + }, + "AccountSessionsListParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "refreshWorkspaceMetadata": { + "type": "boolean" + } + }, + "title": "AccountSessionsListParams", + "type": "object" + }, + "AccountSessionsLogoutParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "sessionId": { + "type": "string" + } + }, + "required": [ + "sessionId" + ], + "title": "AccountSessionsLogoutParams", + "type": "object" + }, + "AccountSessionsResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "activeSessionId": { + "type": [ + "string", + "null" + ] + }, + "sessions": { + "items": { + "$ref": "#/definitions/v2/AccountSession" + }, + "type": "array" + } + }, + "required": [ + "sessions" + ], + "title": "AccountSessionsResponse", + "type": "object" + }, + "AccountSessionsSwitchParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "accountId": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + }, + "required": [ + "accountId", + "sessionId" + ], + "title": "AccountSessionsSwitchParams", + "type": "object" + }, "AccountUpdatedNotification": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index c6ea51680d..591f0545ee 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -103,6 +103,193 @@ "title": "AccountRateLimitsUpdatedNotification", "type": "object" }, + "AccountSession": { + "properties": { + "displayName": { + "type": [ + "string", + "null" + ] + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "isActive": { + "type": "boolean" + }, + "lastUsedAt": { + "format": "int64", + "type": "integer" + }, + "plan": { + "type": [ + "string", + "null" + ] + }, + "selectedWorkspaceAccountId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": "string" + }, + "userId": { + "type": [ + "string", + "null" + ] + }, + "workspaces": { + "items": { + "$ref": "#/definitions/AccountSessionWorkspace" + }, + "type": "array" + } + }, + "required": [ + "isActive", + "lastUsedAt", + "sessionId", + "workspaces" + ], + "type": "object" + }, + "AccountSessionWorkspace": { + "properties": { + "accountId": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "kind": { + "anyOf": [ + { + "$ref": "#/definitions/AccountSessionWorkspaceKind" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/definitions/AccountSessionWorkspaceStatus" + } + }, + "required": [ + "accountId", + "status" + ], + "type": "object" + }, + "AccountSessionWorkspaceKind": { + "enum": [ + "personal", + "workspace" + ], + "type": "string" + }, + "AccountSessionWorkspaceStatus": { + "enum": [ + "active", + "disabled", + "deactivated" + ], + "type": "string" + }, + "AccountSessionsAddParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "switchToAddedAccount": { + "type": "boolean" + } + }, + "title": "AccountSessionsAddParams", + "type": "object" + }, + "AccountSessionsListParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "refreshWorkspaceMetadata": { + "type": "boolean" + } + }, + "title": "AccountSessionsListParams", + "type": "object" + }, + "AccountSessionsLogoutParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "sessionId": { + "type": "string" + } + }, + "required": [ + "sessionId" + ], + "title": "AccountSessionsLogoutParams", + "type": "object" + }, + "AccountSessionsResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "activeSessionId": { + "type": [ + "string", + "null" + ] + }, + "sessions": { + "items": { + "$ref": "#/definitions/AccountSession" + }, + "type": "array" + } + }, + "required": [ + "sessions" + ], + "title": "AccountSessionsResponse", + "type": "object" + }, + "AccountSessionsSwitchParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "accountId": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + }, + "required": [ + "accountId", + "sessionId" + ], + "title": "AccountSessionsSwitchParams", + "type": "object" + }, "AccountUpdatedNotification": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { @@ -2535,6 +2722,102 @@ "title": "Account/login/cancelRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/add" + ], + "title": "AccountSession/addRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsAddParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/addRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/list" + ], + "title": "AccountSession/listRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsListParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/listRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/logout" + ], + "title": "AccountSession/logoutRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsLogoutParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/logoutRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "accountSession/switch" + ], + "title": "AccountSession/switchRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/AccountSessionsSwitchParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "AccountSession/switchRequest", + "type": "object" + }, { "properties": { "id": { diff --git a/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsAddParams.json b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsAddParams.json new file mode 100644 index 0000000000..a2f4af7018 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsAddParams.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "switchToAddedAccount": { + "type": "boolean" + } + }, + "title": "AccountSessionsAddParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsListParams.json b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsListParams.json new file mode 100644 index 0000000000..b92cd0ab00 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsListParams.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "refreshWorkspaceMetadata": { + "type": "boolean" + } + }, + "title": "AccountSessionsListParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsLogoutParams.json b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsLogoutParams.json new file mode 100644 index 0000000000..be3c2719da --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsLogoutParams.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "sessionId": { + "type": "string" + } + }, + "required": [ + "sessionId" + ], + "title": "AccountSessionsLogoutParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsResponse.json b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsResponse.json new file mode 100644 index 0000000000..3cf11fca62 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsResponse.json @@ -0,0 +1,139 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AccountSession": { + "properties": { + "displayName": { + "type": [ + "string", + "null" + ] + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "isActive": { + "type": "boolean" + }, + "lastUsedAt": { + "format": "int64", + "type": "integer" + }, + "plan": { + "type": [ + "string", + "null" + ] + }, + "selectedWorkspaceAccountId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": "string" + }, + "userId": { + "type": [ + "string", + "null" + ] + }, + "workspaces": { + "items": { + "$ref": "#/definitions/AccountSessionWorkspace" + }, + "type": "array" + } + }, + "required": [ + "isActive", + "lastUsedAt", + "sessionId", + "workspaces" + ], + "type": "object" + }, + "AccountSessionWorkspace": { + "properties": { + "accountId": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "kind": { + "anyOf": [ + { + "$ref": "#/definitions/AccountSessionWorkspaceKind" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/definitions/AccountSessionWorkspaceStatus" + } + }, + "required": [ + "accountId", + "status" + ], + "type": "object" + }, + "AccountSessionWorkspaceKind": { + "enum": [ + "personal", + "workspace" + ], + "type": "string" + }, + "AccountSessionWorkspaceStatus": { + "enum": [ + "active", + "disabled", + "deactivated" + ], + "type": "string" + } + }, + "properties": { + "activeSessionId": { + "type": [ + "string", + "null" + ] + }, + "sessions": { + "items": { + "$ref": "#/definitions/AccountSession" + }, + "type": "array" + } + }, + "required": [ + "sessions" + ], + "title": "AccountSessionsResponse", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsSwitchParams.json b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsSwitchParams.json new file mode 100644 index 0000000000..0a34ef0842 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/AccountSessionsSwitchParams.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "accountId": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + }, + "required": [ + "accountId", + "sessionId" + ], + "title": "AccountSessionsSwitchParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts index e19ac2dfde..2aec503709 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts @@ -7,6 +7,10 @@ import type { GetConversationSummaryParams } from "./GetConversationSummaryParam import type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams"; import type { InitializeParams } from "./InitializeParams"; import type { RequestId } from "./RequestId"; +import type { AccountSessionsAddParams } from "./v2/AccountSessionsAddParams"; +import type { AccountSessionsListParams } from "./v2/AccountSessionsListParams"; +import type { AccountSessionsLogoutParams } from "./v2/AccountSessionsLogoutParams"; +import type { AccountSessionsSwitchParams } from "./v2/AccountSessionsSwitchParams"; import type { AppsListParams } from "./v2/AppsListParams"; import type { CancelLoginAccountParams } from "./v2/CancelLoginAccountParams"; import type { CommandExecParams } from "./v2/CommandExecParams"; @@ -86,4 +90,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/goal/set", id: RequestId, params: ThreadGoalSetParams, } | { "method": "thread/goal/get", id: RequestId, params: ThreadGoalGetParams, } | { "method": "thread/goal/clear", id: RequestId, params: ThreadGoalClearParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/approveGuardianDeniedAction", id: RequestId, params: ThreadApproveGuardianDeniedActionParams, } | { "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": "thread/inject_items", id: RequestId, params: ThreadInjectItemsParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/extraRoots/set", id: RequestId, params: SkillsExtraRootsSetParams, } | { "method": "hooks/list", id: RequestId, params: HooksListParams, } | { "method": "marketplace/add", id: RequestId, params: MarketplaceAddParams, } | { "method": "marketplace/remove", id: RequestId, params: MarketplaceRemoveParams, } | { "method": "marketplace/upgrade", id: RequestId, params: MarketplaceUpgradeParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/installed", id: RequestId, params: PluginInstalledParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "plugin/skill/read", id: RequestId, params: PluginSkillReadParams, } | { "method": "plugin/share/save", id: RequestId, params: PluginShareSaveParams, } | { "method": "plugin/share/updateTargets", id: RequestId, params: PluginShareUpdateTargetsParams, } | { "method": "plugin/share/list", id: RequestId, params: PluginShareListParams, } | { "method": "plugin/share/checkout", id: RequestId, params: PluginShareCheckoutParams, } | { "method": "plugin/share/delete", id: RequestId, params: PluginShareDeleteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "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": "modelProvider/capabilities/read", id: RequestId, params: ModelProviderCapabilitiesReadParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "permissionProfile/list", id: RequestId, params: PermissionProfileListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "mcpServer/resource/read", id: RequestId, params: McpResourceReadParams, } | { "method": "mcpServer/tool/call", id: RequestId, params: McpServerToolCallParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "windowsSandbox/readiness", id: RequestId, params: undefined, } | { "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": "account/sendAddCreditsNudgeEmail", id: RequestId, params: SendAddCreditsNudgeEmailParams, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "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, }; +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/goal/set", id: RequestId, params: ThreadGoalSetParams, } | { "method": "thread/goal/get", id: RequestId, params: ThreadGoalGetParams, } | { "method": "thread/goal/clear", id: RequestId, params: ThreadGoalClearParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/approveGuardianDeniedAction", id: RequestId, params: ThreadApproveGuardianDeniedActionParams, } | { "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": "thread/inject_items", id: RequestId, params: ThreadInjectItemsParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/extraRoots/set", id: RequestId, params: SkillsExtraRootsSetParams, } | { "method": "hooks/list", id: RequestId, params: HooksListParams, } | { "method": "marketplace/add", id: RequestId, params: MarketplaceAddParams, } | { "method": "marketplace/remove", id: RequestId, params: MarketplaceRemoveParams, } | { "method": "marketplace/upgrade", id: RequestId, params: MarketplaceUpgradeParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/installed", id: RequestId, params: PluginInstalledParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "plugin/skill/read", id: RequestId, params: PluginSkillReadParams, } | { "method": "plugin/share/save", id: RequestId, params: PluginShareSaveParams, } | { "method": "plugin/share/updateTargets", id: RequestId, params: PluginShareUpdateTargetsParams, } | { "method": "plugin/share/list", id: RequestId, params: PluginShareListParams, } | { "method": "plugin/share/checkout", id: RequestId, params: PluginShareCheckoutParams, } | { "method": "plugin/share/delete", id: RequestId, params: PluginShareDeleteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "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": "modelProvider/capabilities/read", id: RequestId, params: ModelProviderCapabilitiesReadParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "permissionProfile/list", id: RequestId, params: PermissionProfileListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "mcpServer/resource/read", id: RequestId, params: McpResourceReadParams, } | { "method": "mcpServer/tool/call", id: RequestId, params: McpServerToolCallParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "windowsSandbox/readiness", id: RequestId, params: undefined, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "accountSession/add", id: RequestId, params: AccountSessionsAddParams, } | { "method": "accountSession/list", id: RequestId, params: AccountSessionsListParams, } | { "method": "accountSession/logout", id: RequestId, params: AccountSessionsLogoutParams, } | { "method": "accountSession/switch", id: RequestId, params: AccountSessionsSwitchParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "account/sendAddCreditsNudgeEmail", id: RequestId, params: SendAddCreditsNudgeEmailParams, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "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/v2/AccountSession.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSession.ts new file mode 100644 index 0000000000..93f2be5d56 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSession.ts @@ -0,0 +1,6 @@ +// 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 { AccountSessionWorkspace } from "./AccountSessionWorkspace"; + +export type AccountSession = { sessionId: string, email: string | null, userId: string | null, displayName: string | null, imageUrl: string | null, plan: string | null, lastUsedAt: bigint, isActive: boolean, selectedWorkspaceAccountId: string | null, workspaces: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspace.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspace.ts new file mode 100644 index 0000000000..e67c9aa473 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspace.ts @@ -0,0 +1,7 @@ +// 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 { AccountSessionWorkspaceKind } from "./AccountSessionWorkspaceKind"; +import type { AccountSessionWorkspaceStatus } from "./AccountSessionWorkspaceStatus"; + +export type AccountSessionWorkspace = { accountId: string, name: string | null, imageUrl: string | null, kind: AccountSessionWorkspaceKind | null, status: AccountSessionWorkspaceStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceKind.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceKind.ts new file mode 100644 index 0000000000..1ece70db35 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceKind.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionWorkspaceKind = "personal" | "workspace"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceStatus.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceStatus.ts new file mode 100644 index 0000000000..c2f3e8e0e3 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionWorkspaceStatus.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionWorkspaceStatus = "active" | "disabled" | "deactivated"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsAddParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsAddParams.ts new file mode 100644 index 0000000000..8095a42ef1 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsAddParams.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionsAddParams = { switchToAddedAccount?: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsListParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsListParams.ts new file mode 100644 index 0000000000..c0e9762416 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsListParams.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionsListParams = { refreshWorkspaceMetadata?: boolean, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsLogoutParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsLogoutParams.ts new file mode 100644 index 0000000000..928eb3c72d --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsLogoutParams.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionsLogoutParams = { sessionId: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsResponse.ts new file mode 100644 index 0000000000..ceb55ece7f --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsResponse.ts @@ -0,0 +1,6 @@ +// 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 { AccountSession } from "./AccountSession"; + +export type AccountSessionsResponse = { activeSessionId: string | null, sessions: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsSwitchParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsSwitchParams.ts new file mode 100644 index 0000000000..532e50ad9c --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/AccountSessionsSwitchParams.ts @@ -0,0 +1,5 @@ +// 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 AccountSessionsSwitchParams = { sessionId: string, accountId: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index 66b67fb1b4..1c1c463a20 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -3,6 +3,15 @@ export type { Account } from "./Account"; export type { AccountLoginCompletedNotification } from "./AccountLoginCompletedNotification"; export type { AccountRateLimitsUpdatedNotification } from "./AccountRateLimitsUpdatedNotification"; +export type { AccountSession } from "./AccountSession"; +export type { AccountSessionWorkspace } from "./AccountSessionWorkspace"; +export type { AccountSessionWorkspaceKind } from "./AccountSessionWorkspaceKind"; +export type { AccountSessionWorkspaceStatus } from "./AccountSessionWorkspaceStatus"; +export type { AccountSessionsAddParams } from "./AccountSessionsAddParams"; +export type { AccountSessionsListParams } from "./AccountSessionsListParams"; +export type { AccountSessionsLogoutParams } from "./AccountSessionsLogoutParams"; +export type { AccountSessionsResponse } from "./AccountSessionsResponse"; +export type { AccountSessionsSwitchParams } from "./AccountSessionsSwitchParams"; export type { AccountUpdatedNotification } from "./AccountUpdatedNotification"; export type { ActivePermissionProfile } from "./ActivePermissionProfile"; export type { AddCreditsNudgeCreditType } from "./AddCreditsNudgeCreditType"; diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index 71c89a185c..0b9ffdb5cc 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -919,6 +919,33 @@ client_request_definitions! { response: v2::CancelLoginAccountResponse, }, + AccountSessionsAdd => "accountSession/add" { + params: v2::AccountSessionsAddParams, + serialization: global("account-auth"), + response: v2::AccountSessionsResponse, + }, + + AccountSessionsList => "accountSession/list" { + params: v2::AccountSessionsListParams, + serialization: global("account-auth"), + manual_payload_conversion: manual, + response: v2::AccountSessionsResponse, + }, + + AccountSessionsLogout => "accountSession/logout" { + params: v2::AccountSessionsLogoutParams, + serialization: global("account-auth"), + manual_payload_conversion: manual, + response: v2::AccountSessionsResponse, + }, + + AccountSessionsSwitch => "accountSession/switch" { + params: v2::AccountSessionsSwitchParams, + serialization: global("account-auth"), + manual_payload_conversion: manual, + response: v2::AccountSessionsResponse, + }, + LogoutAccount => "account/logout" { params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, serialization: global("account-auth"), diff --git a/codex-rs/app-server-protocol/src/protocol/v2/account.rs b/codex-rs/app-server-protocol/src/protocol/v2/account.rs index 796c93d555..73e385a3b5 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/account.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/account.rs @@ -137,6 +137,89 @@ pub struct CancelLoginAccountResponse { pub status: CancelLoginAccountStatus, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionsAddParams { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub switch_to_added_account: bool, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionsListParams { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub refresh_workspace_metadata: bool, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionsLogoutParams { + pub session_id: String, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionsSwitchParams { + pub session_id: String, + pub account_id: String, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionsResponse { + pub active_session_id: Option, + pub sessions: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSession { + pub session_id: String, + pub email: Option, + pub user_id: Option, + pub display_name: Option, + pub image_url: Option, + pub plan: Option, + pub last_used_at: i64, + pub is_active: bool, + pub selected_workspace_account_id: Option, + pub workspaces: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct AccountSessionWorkspace { + pub account_id: String, + pub name: Option, + pub image_url: Option, + pub kind: Option, + pub status: AccountSessionWorkspaceStatus, +} + +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub enum AccountSessionWorkspaceKind { + Personal, + Workspace, +} + +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub enum AccountSessionWorkspaceStatus { + Active, + Disabled, + Deactivated, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/codex-rs/backend-client/src/client.rs b/codex-rs/backend-client/src/client.rs index 6365d527ed..2bf78cb272 100644 --- a/codex-rs/backend-client/src/client.rs +++ b/codex-rs/backend-client/src/client.rs @@ -1,3 +1,4 @@ +use crate::types::AccountsCheckResponse; use crate::types::CodeTaskDetailsResponse; use crate::types::ConfigFileResponse; use crate::types::PaginatedListTaskListItem; @@ -301,6 +302,16 @@ impl Client { Ok(Self::rate_limit_snapshots_from_payload(payload)) } + pub async fn get_accounts_check(&self) -> Result { + let url = match self.path_style { + PathStyle::CodexApi => format!("{}/api/codex/accounts/check", self.base_url), + PathStyle::ChatGptApi => format!("{}/wham/accounts/check", self.base_url), + }; + let req = self.http.get(&url).headers(self.headers()); + let (body, ct) = self.exec_request(req, "GET", &url).await?; + self.decode_json(&url, &ct, &body) + } + pub async fn send_add_credits_nudge_email( &self, credit_type: AddCreditsNudgeCreditType, diff --git a/codex-rs/backend-client/src/lib.rs b/codex-rs/backend-client/src/lib.rs index 300da81568..92525d7519 100644 --- a/codex-rs/backend-client/src/lib.rs +++ b/codex-rs/backend-client/src/lib.rs @@ -4,6 +4,8 @@ pub(crate) mod types; pub use client::AddCreditsNudgeCreditType; pub use client::Client; pub use client::RequestError; +pub use types::AccountEntry; +pub use types::AccountsCheckResponse; pub use types::CodeTaskDetailsResponse; pub use types::CodeTaskDetailsResponseExt; pub use types::ConfigFileResponse; diff --git a/codex-rs/backend-client/src/types.rs b/codex-rs/backend-client/src/types.rs index d8d24ab9fc..e1845a4f16 100644 --- a/codex-rs/backend-client/src/types.rs +++ b/codex-rs/backend-client/src/types.rs @@ -13,6 +13,27 @@ use serde::de::Deserializer; use serde_json::Value; use std::collections::HashMap; +#[derive(Clone, Debug, Deserialize)] +pub struct AccountsCheckResponse { + #[serde(default)] + pub accounts: Vec, + #[serde(default)] + pub account_ordering: Vec, + #[serde(default)] + pub default_account_id: Option, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct AccountEntry { + pub id: String, + #[serde(default)] + pub name: Option, + #[serde(default)] + pub profile_picture_url: Option, + #[serde(default)] + pub structure: String, +} + /// Hand-rolled models for the Cloud Tasks task-details response. /// The generated OpenAPI models are pretty bad. This is a half-step /// towards hand-rolling them.