diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index ced7f23245..d51a4cad15 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -2847,6 +2847,7 @@ dependencies = [ "codex-shell-command", "codex-test-binary-support", "codex-utils-absolute-path", + "codex-utils-home-dir", "codex-utils-path-uri", "codex-utils-pty", "codex-utils-rustls-provider", diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index 14b8eeed1c..7206542c80 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -2982,27 +2982,6 @@ ], "type": "object" }, - "RuntimeInstallParams": { - "properties": { - "environmentId": { - "type": [ - "string", - "null" - ] - }, - "manifest": { - "$ref": "#/definitions/RuntimeInstallManifestParams" - }, - "release": { - "type": "string" - } - }, - "required": [ - "manifest", - "release" - ], - "type": "object" - }, "SandboxMode": { "enum": [ "read-only", @@ -5684,53 +5663,6 @@ "title": "Plugin/installRequest", "type": "object" }, - { - "properties": { - "id": { - "$ref": "#/definitions/RequestId" - }, - "method": { - "enum": [ - "runtime/install" - ], - "title": "Runtime/installRequestMethod", - "type": "string" - }, - "params": { - "$ref": "#/definitions/RuntimeInstallParams" - } - }, - "required": [ - "id", - "method", - "params" - ], - "title": "Runtime/installRequest", - "type": "object" - }, - { - "properties": { - "id": { - "$ref": "#/definitions/RequestId" - }, - "method": { - "enum": [ - "runtime/install/cancel" - ], - "title": "Runtime/install/cancelRequestMethod", - "type": "string" - }, - "params": { - "type": "null" - } - }, - "required": [ - "id", - "method" - ], - "title": "Runtime/install/cancelRequest", - "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 4fca0138dd..b8b9231e44 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 @@ -1357,53 +1357,6 @@ "title": "Plugin/installRequest", "type": "object" }, - { - "properties": { - "id": { - "$ref": "#/definitions/v2/RequestId" - }, - "method": { - "enum": [ - "runtime/install" - ], - "title": "Runtime/installRequestMethod", - "type": "string" - }, - "params": { - "$ref": "#/definitions/v2/RuntimeInstallParams" - } - }, - "required": [ - "id", - "method", - "params" - ], - "title": "Runtime/installRequest", - "type": "object" - }, - { - "properties": { - "id": { - "$ref": "#/definitions/v2/RequestId" - }, - "method": { - "enum": [ - "runtime/install/cancel" - ], - "title": "Runtime/install/cancelRequestMethod", - "type": "string" - }, - "params": { - "type": "null" - } - }, - "required": [ - "id", - "method" - ], - "title": "Runtime/install/cancelRequest", - "type": "object" - }, { "properties": { "id": { @@ -15167,19 +15120,6 @@ } ] }, - "RuntimeInstallCancelResponse": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "status": { - "$ref": "#/definitions/v2/RuntimeInstallCancelStatus" - } - }, - "required": [ - "status" - ], - "title": "RuntimeInstallCancelResponse", - "type": "object" - }, "RuntimeInstallCancelStatus": { "enum": [ "canceled", @@ -15242,29 +15182,6 @@ ], "type": "object" }, - "RuntimeInstallParams": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "environmentId": { - "type": [ - "string", - "null" - ] - }, - "manifest": { - "$ref": "#/definitions/v2/RuntimeInstallManifestParams" - }, - "release": { - "type": "string" - } - }, - "required": [ - "manifest", - "release" - ], - "title": "RuntimeInstallParams", - "type": "object" - }, "RuntimeInstallPaths": { "properties": { "bundledPluginMarketplacePaths": { @@ -15352,29 +15269,6 @@ ], "type": "string" }, - "RuntimeInstallResponse": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "bundleVersion": { - "type": [ - "string", - "null" - ] - }, - "paths": { - "$ref": "#/definitions/v2/RuntimeInstallPaths" - }, - "status": { - "$ref": "#/definitions/v2/RuntimeInstallStatus" - } - }, - "required": [ - "paths", - "status" - ], - "title": "RuntimeInstallResponse", - "type": "object" - }, "RuntimeInstallStatus": { "enum": [ "already-current", 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 c44ca59059..0810c9adb0 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 @@ -2341,53 +2341,6 @@ "title": "Plugin/installRequest", "type": "object" }, - { - "properties": { - "id": { - "$ref": "#/definitions/RequestId" - }, - "method": { - "enum": [ - "runtime/install" - ], - "title": "Runtime/installRequestMethod", - "type": "string" - }, - "params": { - "$ref": "#/definitions/RuntimeInstallParams" - } - }, - "required": [ - "id", - "method", - "params" - ], - "title": "Runtime/installRequest", - "type": "object" - }, - { - "properties": { - "id": { - "$ref": "#/definitions/RequestId" - }, - "method": { - "enum": [ - "runtime/install/cancel" - ], - "title": "Runtime/install/cancelRequestMethod", - "type": "string" - }, - "params": { - "type": "null" - } - }, - "required": [ - "id", - "method" - ], - "title": "Runtime/install/cancelRequest", - "type": "object" - }, { "properties": { "id": { @@ -11620,19 +11573,6 @@ } ] }, - "RuntimeInstallCancelResponse": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "status": { - "$ref": "#/definitions/RuntimeInstallCancelStatus" - } - }, - "required": [ - "status" - ], - "title": "RuntimeInstallCancelResponse", - "type": "object" - }, "RuntimeInstallCancelStatus": { "enum": [ "canceled", @@ -11695,29 +11635,6 @@ ], "type": "object" }, - "RuntimeInstallParams": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "environmentId": { - "type": [ - "string", - "null" - ] - }, - "manifest": { - "$ref": "#/definitions/RuntimeInstallManifestParams" - }, - "release": { - "type": "string" - } - }, - "required": [ - "manifest", - "release" - ], - "title": "RuntimeInstallParams", - "type": "object" - }, "RuntimeInstallPaths": { "properties": { "bundledPluginMarketplacePaths": { @@ -11805,29 +11722,6 @@ ], "type": "string" }, - "RuntimeInstallResponse": { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "bundleVersion": { - "type": [ - "string", - "null" - ] - }, - "paths": { - "$ref": "#/definitions/RuntimeInstallPaths" - }, - "status": { - "$ref": "#/definitions/RuntimeInstallStatus" - } - }, - "required": [ - "paths", - "status" - ], - "title": "RuntimeInstallResponse", - "type": "object" - }, "RuntimeInstallStatus": { "enum": [ "already-current", diff --git a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallCancelResponse.json b/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallCancelResponse.json deleted file mode 100644 index c7ba89ef08..0000000000 --- a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallCancelResponse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "RuntimeInstallCancelStatus": { - "enum": [ - "canceled", - "not-found" - ], - "type": "string" - } - }, - "properties": { - "status": { - "$ref": "#/definitions/RuntimeInstallCancelStatus" - } - }, - "required": [ - "status" - ], - "title": "RuntimeInstallCancelResponse", - "type": "object" -} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallParams.json b/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallParams.json deleted file mode 100644 index 6fa843ec9e..0000000000 --- a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallParams.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "RuntimeInstallManifestParams": { - "properties": { - "archiveName": { - "type": [ - "string", - "null" - ] - }, - "archiveSha256": { - "type": "string" - }, - "archiveSizeBytes": { - "format": "uint64", - "minimum": 0.0, - "type": [ - "integer", - "null" - ] - }, - "archiveUrl": { - "type": "string" - }, - "bundleFormatVersion": { - "format": "uint32", - "minimum": 0.0, - "type": [ - "integer", - "null" - ] - }, - "bundleVersion": { - "type": [ - "string", - "null" - ] - }, - "format": { - "type": [ - "string", - "null" - ] - }, - "runtimeRootDirectoryName": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "archiveSha256", - "archiveUrl" - ], - "type": "object" - } - }, - "properties": { - "environmentId": { - "type": [ - "string", - "null" - ] - }, - "manifest": { - "$ref": "#/definitions/RuntimeInstallManifestParams" - }, - "release": { - "type": "string" - } - }, - "required": [ - "manifest", - "release" - ], - "title": "RuntimeInstallParams", - "type": "object" -} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallResponse.json b/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallResponse.json deleted file mode 100644 index 26649bbc33..0000000000 --- a/codex-rs/app-server-protocol/schema/json/v2/RuntimeInstallResponse.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AbsolutePathBuf": { - "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" - }, - "RuntimeInstallPaths": { - "properties": { - "bundledPluginMarketplacePaths": { - "items": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": "array" - }, - "bundledSkillPaths": { - "items": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": "array" - }, - "nodeModulesPath": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "nodePath": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "pythonPath": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "skillsToRemove": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "bundledPluginMarketplacePaths", - "bundledSkillPaths", - "nodeModulesPath", - "nodePath", - "pythonPath", - "skillsToRemove" - ], - "type": "object" - }, - "RuntimeInstallStatus": { - "enum": [ - "already-current", - "installed" - ], - "type": "string" - } - }, - "properties": { - "bundleVersion": { - "type": [ - "string", - "null" - ] - }, - "paths": { - "$ref": "#/definitions/RuntimeInstallPaths" - }, - "status": { - "$ref": "#/definitions/RuntimeInstallStatus" - } - }, - "required": [ - "paths", - "status" - ], - "title": "RuntimeInstallResponse", - "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 bc1c92cfb6..b6a13fe307 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts @@ -55,7 +55,6 @@ import type { PluginShareUpdateTargetsParams } from "./v2/PluginShareUpdateTarge import type { PluginSkillReadParams } from "./v2/PluginSkillReadParams"; import type { PluginUninstallParams } from "./v2/PluginUninstallParams"; import type { ReviewStartParams } from "./v2/ReviewStartParams"; -import type { RuntimeInstallParams } from "./v2/RuntimeInstallParams"; import type { SendAddCreditsNudgeEmailParams } from "./v2/SendAddCreditsNudgeEmailParams"; import type { SkillsConfigWriteParams } from "./v2/SkillsConfigWriteParams"; import type { SkillsExtraRootsSetParams } from "./v2/SkillsExtraRootsSetParams"; @@ -88,4 +87,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/delete", id: RequestId, params: ThreadDeleteParams, } | { "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": "runtime/install", id: RequestId, params: RuntimeInstallParams, } | { "method": "runtime/install/cancel", id: RequestId, params: undefined, } | { "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/usage/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/delete", id: RequestId, params: ThreadDeleteParams, } | { "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/usage/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/RuntimeInstallCancelResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallCancelResponse.ts deleted file mode 100644 index 47dd42e9e4..0000000000 --- a/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallCancelResponse.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 { RuntimeInstallCancelStatus } from "./RuntimeInstallCancelStatus"; - -export type RuntimeInstallCancelResponse = { status: RuntimeInstallCancelStatus, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallParams.ts deleted file mode 100644 index f0cb81cb74..0000000000 --- a/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallParams.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 { RuntimeInstallManifestParams } from "./RuntimeInstallManifestParams"; - -export type RuntimeInstallParams = { environmentId?: string | null, manifest: RuntimeInstallManifestParams, release: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallResponse.ts deleted file mode 100644 index 4d263665b6..0000000000 --- a/codex-rs/app-server-protocol/schema/typescript/v2/RuntimeInstallResponse.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 { RuntimeInstallPaths } from "./RuntimeInstallPaths"; -import type { RuntimeInstallStatus } from "./RuntimeInstallStatus"; - -export type RuntimeInstallResponse = { bundleVersion: string | null, paths: RuntimeInstallPaths, status: RuntimeInstallStatus, }; 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 b5aa6b0ecb..f8f1168061 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -334,14 +334,11 @@ export type { ReviewDelivery } from "./ReviewDelivery"; export type { ReviewStartParams } from "./ReviewStartParams"; export type { ReviewStartResponse } from "./ReviewStartResponse"; export type { ReviewTarget } from "./ReviewTarget"; -export type { RuntimeInstallCancelResponse } from "./RuntimeInstallCancelResponse"; export type { RuntimeInstallCancelStatus } from "./RuntimeInstallCancelStatus"; export type { RuntimeInstallManifestParams } from "./RuntimeInstallManifestParams"; -export type { RuntimeInstallParams } from "./RuntimeInstallParams"; export type { RuntimeInstallPaths } from "./RuntimeInstallPaths"; export type { RuntimeInstallProgressNotification } from "./RuntimeInstallProgressNotification"; export type { RuntimeInstallProgressPhase } from "./RuntimeInstallProgressPhase"; -export type { RuntimeInstallResponse } from "./RuntimeInstallResponse"; export type { RuntimeInstallStatus } from "./RuntimeInstallStatus"; export type { SandboxMode } from "./SandboxMode"; export type { SandboxPolicy } from "./SandboxPolicy"; diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index 1e71e12814..9b4349438c 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -791,11 +791,13 @@ client_request_definitions! { serialization: global("config"), response: v2::PluginInstallResponse, }, + #[experimental("runtime/install")] RuntimeInstall => "runtime/install" { params: v2::RuntimeInstallParams, serialization: global("runtime-install"), response: v2::RuntimeInstallResponse, }, + #[experimental("runtime/install/cancel")] RuntimeInstallCancel => "runtime/install/cancel" { params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, serialization: None, diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.md index 08f5073c55..0c03c8fe58 100644 --- a/codex-rs/app-server/README.md +++ b/codex-rs/app-server/README.md @@ -220,9 +220,9 @@ Example with notification opt-out: - `remoteControl/status/changed` — notification emitted when the remote-control status or client-visible environment id changes. `status` is one of `disabled`, `connecting`, `connected`, or `errored`; `serverName` is the local machine name used by this app-server process; `environmentId` is a string when the app-server has a current enrollment and `null` when that enrollment is cleared, invalidated, or remote control is disabled. Newly initialized app-server clients always receive the current status snapshot. - `skills/config/write` — write user-level skill config by name or absolute path. - `plugin/install` — install a plugin from a discovered marketplace entry, rejecting marketplace entries marked unavailable for install, install MCPs if any, and return the effective plugin auth policy plus any apps that still need auth (**under development; do not call from production clients yet**). -- `runtime/install` — install the selected primary runtime bundle and return its executable, dependency, bundled-skill, and bundled-marketplace paths after app-server config synchronization. App-server coordinates the install through the selected environment's generic process and filesystem operations; runtime installs are process-wide and serialized. +- `runtime/install` — experimental; install the selected primary runtime bundle and return its executable, dependency, bundled-skill, and bundled-marketplace paths after app-server config synchronization. App-server coordinates the install through the selected environment's generic process and filesystem operations; runtime installs are process-wide and serialized. - `runtime/install/progress` — notification sent to the connection that requested `runtime/install` as the active install moves through checking, downloading, verifying, extracting, validating, installed, and configuring phases. Download notifications include byte counts when available. -- `runtime/install/cancel` — cancel the one active `runtime/install` request for this app-server process and report whether an install was found. +- `runtime/install/cancel` — experimental; cancel the one active `runtime/install` request for this app-server process and report whether an install was found. - `plugin/uninstall` — uninstall a local plugin by `pluginId` in `@` form by removing its cached files and clearing its user-level config entry, or uninstall a remote ChatGPT plugin by backend `pluginId` by forwarding the uninstall to the ChatGPT plugin backend and removing any downloaded remote-plugin cache (**under development; do not call from production clients yet**). - `mcpServer/oauth/login` — start an OAuth login for a configured MCP server; returns an `authorization_url` and later emits `mcpServer/oauthLogin/completed` once the browser flow finishes. - `tool/requestUserInput` — prompt the user with 1–3 short questions for a tool call and return their answers (experimental). diff --git a/codex-rs/app-server/src/runtime_install.rs b/codex-rs/app-server/src/runtime_install.rs index 4c7b44d27b..03d7146efd 100644 --- a/codex-rs/app-server/src/runtime_install.rs +++ b/codex-rs/app-server/src/runtime_install.rs @@ -11,6 +11,7 @@ use codex_app_server_protocol::RuntimeInstallResponse; use codex_exec_server::CopyOptions; use codex_exec_server::CreateDirectoryOptions; use codex_exec_server::Environment; +use codex_exec_server::ExecServerError; use codex_exec_server::ExecutorFileSystem; use codex_exec_server::RemoveOptions; use codex_utils_absolute_path::AbsolutePathBuf; @@ -33,12 +34,26 @@ pub(crate) async fn finalize_runtime_install( return Ok(response); } - let codex_home = environment.codex_home().await?; + let codex_home = environment + .codex_home() + .await + .map_err(exec_server_error_to_jsonrpc)?; response.paths = finalize_runtime_paths(environment.get_filesystem(), &codex_home, response.paths).await?; Ok(response) } +fn exec_server_error_to_jsonrpc(err: ExecServerError) -> JSONRPCErrorError { + match err { + ExecServerError::Server { code, message } => JSONRPCErrorError { + code, + message, + data: None, + }, + _ => internal_error(err.to_string()), + } +} + async fn finalize_runtime_paths( fs: Arc, codex_home: &AbsolutePathBuf, diff --git a/codex-rs/exec-server/Cargo.toml b/codex-rs/exec-server/Cargo.toml index 56b875f7a5..cd82e5dc70 100644 --- a/codex-rs/exec-server/Cargo.toml +++ b/codex-rs/exec-server/Cargo.toml @@ -23,6 +23,7 @@ codex-protocol = { workspace = true } codex-sandboxing = { workspace = true } codex-shell-command = { workspace = true } codex-utils-absolute-path = { workspace = true } +codex-utils-home-dir = { workspace = true } codex-utils-path-uri = { workspace = true } codex-utils-pty = { workspace = true } codex-utils-rustls-provider = { workspace = true } diff --git a/codex-rs/exec-server/src/codex_home.rs b/codex-rs/exec-server/src/codex_home.rs deleted file mode 100644 index c64f909757..0000000000 --- a/codex-rs/exec-server/src/codex_home.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::path::PathBuf; - -use codex_app_server_protocol::JSONRPCErrorError; -use codex_utils_absolute_path::AbsolutePathBuf; - -use crate::rpc::internal_error; - -pub(crate) fn default_codex_home() -> Result { - default_codex_home_path() - .and_then(|path| { - AbsolutePathBuf::from_absolute_path_checked(path) - .map_err(|err| format!("runtime codex home is not absolute: {err}")) - }) - .map_err(internal_error) -} - -pub(crate) fn default_codex_home_path() -> Result { - if let Some(codex_home) = std::env::var_os("CODEX_HOME") { - return Ok(PathBuf::from(codex_home)); - } - let home = std::env::var_os("HOME") - .or_else(|| std::env::var_os("USERPROFILE")) - .map(PathBuf::from) - .ok_or_else(|| "failed to locate home directory".to_string())?; - Ok(home.join(".codex")) -} diff --git a/codex-rs/exec-server/src/environment.rs b/codex-rs/exec-server/src/environment.rs index 7b93b96ae7..fe108f2eee 100644 --- a/codex-rs/exec-server/src/environment.rs +++ b/codex-rs/exec-server/src/environment.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; use std::sync::Arc; use std::sync::RwLock; -use codex_app_server_protocol::JSONRPCErrorError; use codex_utils_absolute_path::AbsolutePathBuf; +use codex_utils_home_dir::find_codex_home; use futures::FutureExt; use futures::future::BoxFuture; @@ -14,7 +14,6 @@ use crate::HttpClient; use crate::client::LazyRemoteExecServerClient; use crate::client::http_client::ReqwestHttpClient; use crate::client_api::ExecServerTransportParams; -use crate::codex_home::default_codex_home_path; use crate::environment_provider::DefaultEnvironmentProvider; use crate::environment_provider::EnvironmentDefault; use crate::environment_provider::EnvironmentProvider; @@ -28,7 +27,6 @@ use crate::protocol::EnvironmentInfo; use crate::protocol::ShellInfo; use crate::remote_file_system::RemoteFileSystem; use crate::remote_process::RemoteProcess; -use crate::rpc::internal_error; use codex_shell_command::shell_detect::DetectedShell; pub const CODEX_EXEC_SERVER_URL_ENV_VAR: &str = "CODEX_EXEC_SERVER_URL"; @@ -354,16 +352,6 @@ impl EnvironmentInfoProvider for RemoteEnvironmentInfoProvider { async move { self.client.environment_info().await }.boxed() } } -fn exec_server_error_to_jsonrpc(err: ExecServerError) -> JSONRPCErrorError { - match err { - ExecServerError::Server { code, message } => JSONRPCErrorError { - code, - data: None, - message, - }, - _ => internal_error(err.to_string()), - } -} impl Environment { /// Builds a test-only local environment without configured sandbox helper paths. @@ -519,24 +507,24 @@ impl Environment { Arc::clone(&self.filesystem) } - pub async fn codex_home(&self) -> Result { + pub async fn codex_home(&self) -> Result { if let Some(codex_home) = self.codex_home.clone() { return Ok(codex_home); } let client = self.remote_client.as_ref().ok_or_else(|| { - internal_error("failed to locate local codex home for runtime install") + ExecServerError::Protocol( + "failed to locate local codex home for runtime install".to_string(), + ) })?; - let client = client.get().await.map_err(exec_server_error_to_jsonrpc)?; - client - .codex_home() - .ok_or_else(|| internal_error("remote exec-server did not report a codex home")) + let client = client.get().await?; + client.codex_home().ok_or_else(|| { + ExecServerError::Protocol("remote exec-server did not report a codex home".to_string()) + }) } } fn default_local_codex_home() -> Option { - default_codex_home_path() - .ok() - .and_then(|path| AbsolutePathBuf::from_absolute_path_checked(path).ok()) + find_codex_home().ok() } impl EnvironmentInfo { diff --git a/codex-rs/exec-server/src/lib.rs b/codex-rs/exec-server/src/lib.rs index ed46bab5c2..d6a9aacb51 100644 --- a/codex-rs/exec-server/src/lib.rs +++ b/codex-rs/exec-server/src/lib.rs @@ -1,7 +1,6 @@ mod client; mod client_api; mod client_transport; -mod codex_home; mod connection; mod environment; mod environment_provider; diff --git a/codex-rs/exec-server/src/server/handler.rs b/codex-rs/exec-server/src/server/handler.rs index 0eda299459..cbf607e245 100644 --- a/codex-rs/exec-server/src/server/handler.rs +++ b/codex-rs/exec-server/src/server/handler.rs @@ -4,6 +4,7 @@ use std::sync::atomic::Ordering; use codex_app_server_protocol::JSONRPCErrorError; use codex_app_server_protocol::RequestId; +use codex_utils_home_dir::find_codex_home; use serde_json::to_value; use std::collections::HashSet; use tokio::sync::Mutex; @@ -129,7 +130,8 @@ impl ExecServerHandler { .unwrap_or_else(std::sync::PoisonError::into_inner) = Some(session); Ok(InitializeResponse { session_id, - codex_home: crate::codex_home::default_codex_home()?, + codex_home: find_codex_home() + .map_err(|err| internal_error(format!("failed to locate Codex home: {err}")))?, }) } diff --git a/codex-rs/runtime-install/src/errors.rs b/codex-rs/runtime-install/src/errors.rs index d88e81eea9..c90bb20e3d 100644 --- a/codex-rs/runtime-install/src/errors.rs +++ b/codex-rs/runtime-install/src/errors.rs @@ -1,4 +1,5 @@ use codex_app_server_protocol::JSONRPCErrorError; +use codex_exec_server::ExecServerError; const INVALID_PARAMS_ERROR_CODE: i64 = -32602; const INTERNAL_ERROR_CODE: i64 = -32603; @@ -11,6 +12,17 @@ pub(crate) fn internal_error(message: impl Into) -> JSONRPCErrorError { error(INTERNAL_ERROR_CODE, message) } +pub(crate) fn exec_server_error_to_jsonrpc(err: ExecServerError) -> JSONRPCErrorError { + match err { + ExecServerError::Server { code, message } => JSONRPCErrorError { + code, + message, + data: None, + }, + _ => internal_error(err.to_string()), + } +} + fn error(code: i64, message: impl Into) -> JSONRPCErrorError { JSONRPCErrorError { code, diff --git a/codex-rs/runtime-install/src/executor.rs b/codex-rs/runtime-install/src/executor.rs index 64608860fd..ce12f257fd 100644 --- a/codex-rs/runtime-install/src/executor.rs +++ b/codex-rs/runtime-install/src/executor.rs @@ -17,6 +17,7 @@ use codex_utils_path_uri::PathUri; use tokio_util::sync::CancellationToken; use uuid::Uuid; +use crate::errors::exec_server_error_to_jsonrpc; use crate::errors::internal_error; #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -55,7 +56,10 @@ pub(crate) struct RuntimeExecutor { impl RuntimeExecutor { pub(crate) async fn new(environment: &Environment) -> Result { - let codex_home = environment.codex_home().await?; + let codex_home = environment + .codex_home() + .await + .map_err(exec_server_error_to_jsonrpc)?; Ok(Self { backend: environment.get_exec_backend(), filesystem: environment.get_filesystem(),