Integrate Codex app-server support
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
038560e580
commit
90d0f40790
68 files changed
+17389
-19730
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// This file is generated by the effect-codex-app-server package. Do not edit manually.
|
||||
// Upstream protocol ref: 678157acaa819d5510adfe359abb5d0392cfe461
|
||||
// Upstream protocol ref: dbfe855f4fd0f5dcdf079882652a8efe622b0595
|
||||
|
||||
import * as CodexSchema from "./schema.gen.ts";
|
||||
|
||||
@@ -9,40 +9,20 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"thread/resume": "thread/resume",
|
||||
"thread/fork": "thread/fork",
|
||||
"thread/archive": "thread/archive",
|
||||
"thread/delete": "thread/delete",
|
||||
"thread/unsubscribe": "thread/unsubscribe",
|
||||
"thread/name/set": "thread/name/set",
|
||||
"thread/goal/set": "thread/goal/set",
|
||||
"thread/goal/get": "thread/goal/get",
|
||||
"thread/goal/clear": "thread/goal/clear",
|
||||
"thread/metadata/update": "thread/metadata/update",
|
||||
"thread/unarchive": "thread/unarchive",
|
||||
"thread/compact/start": "thread/compact/start",
|
||||
"thread/shellCommand": "thread/shellCommand",
|
||||
"thread/approveGuardianDeniedAction": "thread/approveGuardianDeniedAction",
|
||||
"thread/rollback": "thread/rollback",
|
||||
"thread/list": "thread/list",
|
||||
"thread/loaded/list": "thread/loaded/list",
|
||||
"thread/read": "thread/read",
|
||||
"thread/inject_items": "thread/inject_items",
|
||||
"skills/list": "skills/list",
|
||||
"skills/extraRoots/set": "skills/extraRoots/set",
|
||||
"hooks/list": "hooks/list",
|
||||
"marketplace/add": "marketplace/add",
|
||||
"marketplace/remove": "marketplace/remove",
|
||||
"marketplace/upgrade": "marketplace/upgrade",
|
||||
"plugin/list": "plugin/list",
|
||||
"plugin/installed": "plugin/installed",
|
||||
"plugin/read": "plugin/read",
|
||||
"plugin/skill/read": "plugin/skill/read",
|
||||
"plugin/share/save": "plugin/share/save",
|
||||
"plugin/share/updateTargets": "plugin/share/updateTargets",
|
||||
"plugin/share/list": "plugin/share/list",
|
||||
"plugin/share/checkout": "plugin/share/checkout",
|
||||
"plugin/share/delete": "plugin/share/delete",
|
||||
"app/read": "app/read",
|
||||
"app/list": "app/list",
|
||||
"app/installed": "app/installed",
|
||||
"fs/readFile": "fs/readFile",
|
||||
"fs/writeFile": "fs/writeFile",
|
||||
"fs/createDirectory": "fs/createDirectory",
|
||||
@@ -60,9 +40,7 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"turn/interrupt": "turn/interrupt",
|
||||
"review/start": "review/start",
|
||||
"model/list": "model/list",
|
||||
"modelProvider/capabilities/read": "modelProvider/capabilities/read",
|
||||
"experimentalFeature/list": "experimentalFeature/list",
|
||||
"permissionProfile/list": "permissionProfile/list",
|
||||
"experimentalFeature/enablement/set": "experimentalFeature/enablement/set",
|
||||
"mcpServer/oauth/login": "mcpServer/oauth/login",
|
||||
"config/mcpServer/reload": "config/mcpServer/reload",
|
||||
@@ -70,15 +48,10 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"mcpServer/resource/read": "mcpServer/resource/read",
|
||||
"mcpServer/tool/call": "mcpServer/tool/call",
|
||||
"windowsSandbox/setupStart": "windowsSandbox/setupStart",
|
||||
"windowsSandbox/readiness": "windowsSandbox/readiness",
|
||||
"account/login/start": "account/login/start",
|
||||
"account/login/cancel": "account/login/cancel",
|
||||
"account/logout": "account/logout",
|
||||
"account/rateLimits/read": "account/rateLimits/read",
|
||||
"account/rateLimitResetCredit/consume": "account/rateLimitResetCredit/consume",
|
||||
"account/usage/read": "account/usage/read",
|
||||
"account/workspaceMessages/read": "account/workspaceMessages/read",
|
||||
"account/sendAddCreditsNudgeEmail": "account/sendAddCreditsNudgeEmail",
|
||||
"feedback/upload": "feedback/upload",
|
||||
"command/exec": "command/exec",
|
||||
"command/exec/write": "command/exec/write",
|
||||
@@ -87,7 +60,6 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"config/read": "config/read",
|
||||
"externalAgentConfig/detect": "externalAgentConfig/detect",
|
||||
"externalAgentConfig/import": "externalAgentConfig/import",
|
||||
"externalAgentConfig/import/readHistories": "externalAgentConfig/import/readHistories",
|
||||
"config/value/write": "config/value/write",
|
||||
"config/batchWrite": "config/batchWrite",
|
||||
"configRequirements/read": "configRequirements/read",
|
||||
@@ -110,7 +82,6 @@ export const SERVER_REQUEST_METHODS = {
|
||||
"item/permissions/requestApproval": "item/permissions/requestApproval",
|
||||
"item/tool/call": "item/tool/call",
|
||||
"account/chatgptAuthTokens/refresh": "account/chatgptAuthTokens/refresh",
|
||||
"attestation/generate": "attestation/generate",
|
||||
applyPatchApproval: "applyPatchApproval",
|
||||
execCommandApproval: "execCommandApproval",
|
||||
} as const;
|
||||
@@ -120,16 +91,10 @@ export const SERVER_NOTIFICATION_METHODS = {
|
||||
"thread/started": "thread/started",
|
||||
"thread/status/changed": "thread/status/changed",
|
||||
"thread/archived": "thread/archived",
|
||||
"thread/deleted": "thread/deleted",
|
||||
"thread/unarchived": "thread/unarchived",
|
||||
"thread/closed": "thread/closed",
|
||||
"skills/changed": "skills/changed",
|
||||
"thread/name/updated": "thread/name/updated",
|
||||
"thread/goal/updated": "thread/goal/updated",
|
||||
"thread/goal/cleared": "thread/goal/cleared",
|
||||
"thread/environment/connected": "thread/environment/connected",
|
||||
"thread/environment/disconnected": "thread/environment/disconnected",
|
||||
"thread/settings/updated": "thread/settings/updated",
|
||||
"thread/tokenUsage/updated": "thread/tokenUsage/updated",
|
||||
"turn/started": "turn/started",
|
||||
"hook/started": "hook/started",
|
||||
@@ -142,16 +107,12 @@ export const SERVER_NOTIFICATION_METHODS = {
|
||||
"item/autoApprovalReview/completed": "item/autoApprovalReview/completed",
|
||||
"item/completed": "item/completed",
|
||||
"rawResponseItem/completed": "rawResponseItem/completed",
|
||||
"rawResponse/completed": "rawResponse/completed",
|
||||
"item/agentMessage/delta": "item/agentMessage/delta",
|
||||
"item/plan/delta": "item/plan/delta",
|
||||
"command/exec/outputDelta": "command/exec/outputDelta",
|
||||
"process/outputDelta": "process/outputDelta",
|
||||
"process/exited": "process/exited",
|
||||
"item/commandExecution/outputDelta": "item/commandExecution/outputDelta",
|
||||
"item/commandExecution/terminalInteraction": "item/commandExecution/terminalInteraction",
|
||||
"item/fileChange/outputDelta": "item/fileChange/outputDelta",
|
||||
"item/fileChange/patchUpdated": "item/fileChange/patchUpdated",
|
||||
"serverRequest/resolved": "serverRequest/resolved",
|
||||
"item/mcpToolCall/progress": "item/mcpToolCall/progress",
|
||||
"mcpServer/oauthLogin/completed": "mcpServer/oauthLogin/completed",
|
||||
@@ -159,28 +120,19 @@ export const SERVER_NOTIFICATION_METHODS = {
|
||||
"account/updated": "account/updated",
|
||||
"account/rateLimits/updated": "account/rateLimits/updated",
|
||||
"app/list/updated": "app/list/updated",
|
||||
"remoteControl/status/changed": "remoteControl/status/changed",
|
||||
"externalAgentConfig/import/progress": "externalAgentConfig/import/progress",
|
||||
"externalAgentConfig/import/completed": "externalAgentConfig/import/completed",
|
||||
"fs/changed": "fs/changed",
|
||||
"item/reasoning/summaryTextDelta": "item/reasoning/summaryTextDelta",
|
||||
"item/reasoning/summaryPartAdded": "item/reasoning/summaryPartAdded",
|
||||
"item/reasoning/textDelta": "item/reasoning/textDelta",
|
||||
"thread/compacted": "thread/compacted",
|
||||
"model/rerouted": "model/rerouted",
|
||||
"model/verification": "model/verification",
|
||||
"turn/moderationMetadata": "turn/moderationMetadata",
|
||||
"model/safetyBuffering/updated": "model/safetyBuffering/updated",
|
||||
warning: "warning",
|
||||
guardianWarning: "guardianWarning",
|
||||
deprecationNotice: "deprecationNotice",
|
||||
configWarning: "configWarning",
|
||||
"fuzzyFileSearch/sessionUpdated": "fuzzyFileSearch/sessionUpdated",
|
||||
"fuzzyFileSearch/sessionCompleted": "fuzzyFileSearch/sessionCompleted",
|
||||
"thread/realtime/started": "thread/realtime/started",
|
||||
"thread/realtime/itemAdded": "thread/realtime/itemAdded",
|
||||
"thread/realtime/transcript/delta": "thread/realtime/transcript/delta",
|
||||
"thread/realtime/transcript/done": "thread/realtime/transcript/done",
|
||||
"thread/realtime/transcriptUpdated": "thread/realtime/transcriptUpdated",
|
||||
"thread/realtime/outputAudio/delta": "thread/realtime/outputAudio/delta",
|
||||
"thread/realtime/sdp": "thread/realtime/sdp",
|
||||
"thread/realtime/error": "thread/realtime/error",
|
||||
@@ -196,193 +148,137 @@ export type ServerRequestMethod = keyof typeof SERVER_REQUEST_METHODS;
|
||||
export type ServerNotificationMethod = keyof typeof SERVER_NOTIFICATION_METHODS;
|
||||
|
||||
export interface ClientRequestParamsByMethod {
|
||||
readonly initialize: CodexSchema.V1InitializeParams;
|
||||
readonly "thread/start": CodexSchema.V2ThreadStartParams;
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeParams;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkParams;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveParams;
|
||||
readonly "thread/delete": CodexSchema.V2ThreadDeleteParams;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeParams;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameParams;
|
||||
readonly "thread/goal/set": CodexSchema.V2ThreadGoalSetParams;
|
||||
readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetParams;
|
||||
readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearParams;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveParams;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartParams;
|
||||
readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandParams;
|
||||
readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionParams;
|
||||
readonly "thread/rollback": CodexSchema.V2ThreadRollbackParams;
|
||||
readonly "thread/list": CodexSchema.V2ThreadListParams;
|
||||
readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListParams;
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadParams;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsParams;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListParams;
|
||||
readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListParams;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddParams;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveParams;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListParams;
|
||||
readonly "plugin/installed": CodexSchema.V2PluginInstalledParams;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadParams;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadParams;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveParams;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsParams;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListParams;
|
||||
readonly "plugin/share/checkout": CodexSchema.V2PluginShareCheckoutParams;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteParams;
|
||||
readonly "app/read": CodexSchema.V2AppsReadParams;
|
||||
readonly "app/list": CodexSchema.V2AppsListParams;
|
||||
readonly "app/installed": CodexSchema.V2AppsInstalledParams;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileParams;
|
||||
readonly "fs/writeFile": CodexSchema.V2FsWriteFileParams;
|
||||
readonly "fs/createDirectory": CodexSchema.V2FsCreateDirectoryParams;
|
||||
readonly "fs/getMetadata": CodexSchema.V2FsGetMetadataParams;
|
||||
readonly "fs/readDirectory": CodexSchema.V2FsReadDirectoryParams;
|
||||
readonly "fs/remove": CodexSchema.V2FsRemoveParams;
|
||||
readonly "fs/copy": CodexSchema.V2FsCopyParams;
|
||||
readonly "fs/watch": CodexSchema.V2FsWatchParams;
|
||||
readonly "fs/unwatch": CodexSchema.V2FsUnwatchParams;
|
||||
readonly "skills/config/write": CodexSchema.V2SkillsConfigWriteParams;
|
||||
readonly "plugin/install": CodexSchema.V2PluginInstallParams;
|
||||
readonly "plugin/uninstall": CodexSchema.V2PluginUninstallParams;
|
||||
readonly "turn/start": CodexSchema.V2TurnStartParams;
|
||||
readonly "turn/steer": CodexSchema.V2TurnSteerParams;
|
||||
readonly "turn/interrupt": CodexSchema.V2TurnInterruptParams;
|
||||
readonly "review/start": CodexSchema.V2ReviewStartParams;
|
||||
readonly "model/list": CodexSchema.V2ModelListParams;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadParams;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListParams;
|
||||
readonly "permissionProfile/list": CodexSchema.V2PermissionProfileListParams;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetParams;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginParams;
|
||||
readonly initialize: typeof CodexSchema.V1InitializeParams.Type;
|
||||
readonly "thread/start": typeof CodexSchema.V2ThreadStartParams.Type;
|
||||
readonly "thread/resume": typeof CodexSchema.V2ThreadResumeParams.Type;
|
||||
readonly "thread/fork": typeof CodexSchema.V2ThreadForkParams.Type;
|
||||
readonly "thread/archive": typeof CodexSchema.V2ThreadArchiveParams.Type;
|
||||
readonly "thread/unsubscribe": typeof CodexSchema.V2ThreadUnsubscribeParams.Type;
|
||||
readonly "thread/name/set": typeof CodexSchema.V2ThreadSetNameParams.Type;
|
||||
readonly "thread/metadata/update": typeof CodexSchema.V2ThreadMetadataUpdateParams.Type;
|
||||
readonly "thread/unarchive": typeof CodexSchema.V2ThreadUnarchiveParams.Type;
|
||||
readonly "thread/compact/start": typeof CodexSchema.V2ThreadCompactStartParams.Type;
|
||||
readonly "thread/shellCommand": typeof CodexSchema.V2ThreadShellCommandParams.Type;
|
||||
readonly "thread/rollback": typeof CodexSchema.V2ThreadRollbackParams.Type;
|
||||
readonly "thread/list": typeof CodexSchema.V2ThreadListParams.Type;
|
||||
readonly "thread/loaded/list": typeof CodexSchema.V2ThreadLoadedListParams.Type;
|
||||
readonly "thread/read": typeof CodexSchema.V2ThreadReadParams.Type;
|
||||
readonly "skills/list": typeof CodexSchema.V2SkillsListParams.Type;
|
||||
readonly "plugin/list": typeof CodexSchema.V2PluginListParams.Type;
|
||||
readonly "plugin/read": typeof CodexSchema.V2PluginReadParams.Type;
|
||||
readonly "app/list": typeof CodexSchema.V2AppsListParams.Type;
|
||||
readonly "fs/readFile": typeof CodexSchema.V2FsReadFileParams.Type;
|
||||
readonly "fs/writeFile": typeof CodexSchema.V2FsWriteFileParams.Type;
|
||||
readonly "fs/createDirectory": typeof CodexSchema.V2FsCreateDirectoryParams.Type;
|
||||
readonly "fs/getMetadata": typeof CodexSchema.V2FsGetMetadataParams.Type;
|
||||
readonly "fs/readDirectory": typeof CodexSchema.V2FsReadDirectoryParams.Type;
|
||||
readonly "fs/remove": typeof CodexSchema.V2FsRemoveParams.Type;
|
||||
readonly "fs/copy": typeof CodexSchema.V2FsCopyParams.Type;
|
||||
readonly "fs/watch": typeof CodexSchema.V2FsWatchParams.Type;
|
||||
readonly "fs/unwatch": typeof CodexSchema.V2FsUnwatchParams.Type;
|
||||
readonly "skills/config/write": typeof CodexSchema.V2SkillsConfigWriteParams.Type;
|
||||
readonly "plugin/install": typeof CodexSchema.V2PluginInstallParams.Type;
|
||||
readonly "plugin/uninstall": typeof CodexSchema.V2PluginUninstallParams.Type;
|
||||
readonly "turn/start": typeof CodexSchema.V2TurnStartParams.Type;
|
||||
readonly "turn/steer": typeof CodexSchema.V2TurnSteerParams.Type;
|
||||
readonly "turn/interrupt": typeof CodexSchema.V2TurnInterruptParams.Type;
|
||||
readonly "review/start": typeof CodexSchema.V2ReviewStartParams.Type;
|
||||
readonly "model/list": typeof CodexSchema.V2ModelListParams.Type;
|
||||
readonly "experimentalFeature/list": typeof CodexSchema.V2ExperimentalFeatureListParams.Type;
|
||||
readonly "experimentalFeature/enablement/set": typeof CodexSchema.V2ExperimentalFeatureEnablementSetParams.Type;
|
||||
readonly "mcpServer/oauth/login": typeof CodexSchema.V2McpServerOauthLoginParams.Type;
|
||||
readonly "config/mcpServer/reload": undefined;
|
||||
readonly "mcpServerStatus/list": CodexSchema.V2ListMcpServerStatusParams;
|
||||
readonly "mcpServer/resource/read": CodexSchema.V2McpResourceReadParams;
|
||||
readonly "mcpServer/tool/call": CodexSchema.V2McpServerToolCallParams;
|
||||
readonly "windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartParams;
|
||||
readonly "windowsSandbox/readiness": undefined;
|
||||
readonly "account/login/start": CodexSchema.V2LoginAccountParams;
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountParams;
|
||||
readonly "mcpServerStatus/list": typeof CodexSchema.V2ListMcpServerStatusParams.Type;
|
||||
readonly "mcpServer/resource/read": typeof CodexSchema.V2McpResourceReadParams.Type;
|
||||
readonly "mcpServer/tool/call": typeof CodexSchema.V2McpServerToolCallParams.Type;
|
||||
readonly "windowsSandbox/setupStart": typeof CodexSchema.V2WindowsSandboxSetupStartParams.Type;
|
||||
readonly "account/login/start": typeof CodexSchema.V2LoginAccountParams.Type;
|
||||
readonly "account/login/cancel": typeof CodexSchema.V2CancelLoginAccountParams.Type;
|
||||
readonly "account/logout": undefined;
|
||||
readonly "account/rateLimits/read": undefined;
|
||||
readonly "account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditParams;
|
||||
readonly "account/usage/read": undefined;
|
||||
readonly "account/workspaceMessages/read": undefined;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadParams;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecParams;
|
||||
readonly "command/exec/write": CodexSchema.V2CommandExecWriteParams;
|
||||
readonly "command/exec/terminate": CodexSchema.V2CommandExecTerminateParams;
|
||||
readonly "command/exec/resize": CodexSchema.V2CommandExecResizeParams;
|
||||
readonly "config/read": CodexSchema.V2ConfigReadParams;
|
||||
readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectParams;
|
||||
readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportParams;
|
||||
readonly "externalAgentConfig/import/readHistories": undefined;
|
||||
readonly "config/value/write": CodexSchema.V2ConfigValueWriteParams;
|
||||
readonly "config/batchWrite": CodexSchema.V2ConfigBatchWriteParams;
|
||||
readonly "feedback/upload": typeof CodexSchema.V2FeedbackUploadParams.Type;
|
||||
readonly "command/exec": typeof CodexSchema.V2CommandExecParams.Type;
|
||||
readonly "command/exec/write": typeof CodexSchema.V2CommandExecWriteParams.Type;
|
||||
readonly "command/exec/terminate": typeof CodexSchema.V2CommandExecTerminateParams.Type;
|
||||
readonly "command/exec/resize": typeof CodexSchema.V2CommandExecResizeParams.Type;
|
||||
readonly "config/read": typeof CodexSchema.V2ConfigReadParams.Type;
|
||||
readonly "externalAgentConfig/detect": typeof CodexSchema.V2ExternalAgentConfigDetectParams.Type;
|
||||
readonly "externalAgentConfig/import": typeof CodexSchema.V2ExternalAgentConfigImportParams.Type;
|
||||
readonly "config/value/write": typeof CodexSchema.V2ConfigValueWriteParams.Type;
|
||||
readonly "config/batchWrite": typeof CodexSchema.V2ConfigBatchWriteParams.Type;
|
||||
readonly "configRequirements/read": undefined;
|
||||
readonly "account/read": CodexSchema.V2GetAccountParams;
|
||||
readonly getConversationSummary: CodexSchema.GetConversationSummaryParams;
|
||||
readonly gitDiffToRemote: CodexSchema.GitDiffToRemoteParams;
|
||||
readonly getAuthStatus: CodexSchema.GetAuthStatusParams;
|
||||
readonly fuzzyFileSearch: CodexSchema.FuzzyFileSearchParams;
|
||||
readonly "account/read": typeof CodexSchema.V2GetAccountParams.Type;
|
||||
readonly getConversationSummary: typeof CodexSchema.GetConversationSummaryParams.Type;
|
||||
readonly gitDiffToRemote: typeof CodexSchema.GitDiffToRemoteParams.Type;
|
||||
readonly getAuthStatus: typeof CodexSchema.GetAuthStatusParams.Type;
|
||||
readonly fuzzyFileSearch: typeof CodexSchema.FuzzyFileSearchParams.Type;
|
||||
}
|
||||
|
||||
export interface ClientRequestResponsesByMethod {
|
||||
readonly initialize: CodexSchema.V1InitializeResponse;
|
||||
readonly "thread/start": CodexSchema.V2ThreadStartResponse;
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeResponse;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkResponse;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveResponse;
|
||||
readonly "thread/delete": CodexSchema.V2ThreadDeleteResponse;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeResponse;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameResponse;
|
||||
readonly "thread/goal/set": CodexSchema.V2ThreadGoalSetResponse;
|
||||
readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetResponse;
|
||||
readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartResponse;
|
||||
readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandResponse;
|
||||
readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionResponse;
|
||||
readonly "thread/rollback": CodexSchema.V2ThreadRollbackResponse;
|
||||
readonly "thread/list": CodexSchema.V2ThreadListResponse;
|
||||
readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListResponse;
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadResponse;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListResponse;
|
||||
readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListResponse;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddResponse;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveResponse;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListResponse;
|
||||
readonly "plugin/installed": CodexSchema.V2PluginInstalledResponse;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadResponse;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadResponse;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveResponse;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsResponse;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListResponse;
|
||||
readonly "plugin/share/checkout": CodexSchema.V2PluginShareCheckoutResponse;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteResponse;
|
||||
readonly "app/read": CodexSchema.V2AppsReadResponse;
|
||||
readonly "app/list": CodexSchema.V2AppsListResponse;
|
||||
readonly "app/installed": CodexSchema.V2AppsInstalledResponse;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileResponse;
|
||||
readonly "fs/writeFile": CodexSchema.V2FsWriteFileResponse;
|
||||
readonly "fs/createDirectory": CodexSchema.V2FsCreateDirectoryResponse;
|
||||
readonly "fs/getMetadata": CodexSchema.V2FsGetMetadataResponse;
|
||||
readonly "fs/readDirectory": CodexSchema.V2FsReadDirectoryResponse;
|
||||
readonly "fs/remove": CodexSchema.V2FsRemoveResponse;
|
||||
readonly "fs/copy": CodexSchema.V2FsCopyResponse;
|
||||
readonly "fs/watch": CodexSchema.V2FsWatchResponse;
|
||||
readonly "fs/unwatch": CodexSchema.V2FsUnwatchResponse;
|
||||
readonly "skills/config/write": CodexSchema.V2SkillsConfigWriteResponse;
|
||||
readonly "plugin/install": CodexSchema.V2PluginInstallResponse;
|
||||
readonly "plugin/uninstall": CodexSchema.V2PluginUninstallResponse;
|
||||
readonly "turn/start": CodexSchema.V2TurnStartResponse;
|
||||
readonly "turn/steer": CodexSchema.V2TurnSteerResponse;
|
||||
readonly "turn/interrupt": CodexSchema.V2TurnInterruptResponse;
|
||||
readonly "review/start": CodexSchema.V2ReviewStartResponse;
|
||||
readonly "model/list": CodexSchema.V2ModelListResponse;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadResponse;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListResponse;
|
||||
readonly "permissionProfile/list": CodexSchema.V2PermissionProfileListResponse;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetResponse;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginResponse;
|
||||
readonly "config/mcpServer/reload": CodexSchema.V2McpServerRefreshResponse;
|
||||
readonly "mcpServerStatus/list": CodexSchema.V2ListMcpServerStatusResponse;
|
||||
readonly "mcpServer/resource/read": CodexSchema.V2McpResourceReadResponse;
|
||||
readonly "mcpServer/tool/call": CodexSchema.V2McpServerToolCallResponse;
|
||||
readonly "windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartResponse;
|
||||
readonly "windowsSandbox/readiness": CodexSchema.V2WindowsSandboxReadinessResponse;
|
||||
readonly "account/login/start": CodexSchema.V2LoginAccountResponse;
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountResponse;
|
||||
readonly "account/logout": CodexSchema.V2LogoutAccountResponse;
|
||||
readonly "account/rateLimits/read": CodexSchema.V2GetAccountRateLimitsResponse;
|
||||
readonly "account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditResponse;
|
||||
readonly "account/usage/read": CodexSchema.V2GetAccountTokenUsageResponse;
|
||||
readonly "account/workspaceMessages/read": CodexSchema.V2GetWorkspaceMessagesResponse;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailResponse;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadResponse;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecResponse;
|
||||
readonly "command/exec/write": CodexSchema.V2CommandExecWriteResponse;
|
||||
readonly "command/exec/terminate": CodexSchema.V2CommandExecTerminateResponse;
|
||||
readonly "command/exec/resize": CodexSchema.V2CommandExecResizeResponse;
|
||||
readonly "config/read": CodexSchema.V2ConfigReadResponse;
|
||||
readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectResponse;
|
||||
readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportResponse;
|
||||
readonly "externalAgentConfig/import/readHistories": CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse;
|
||||
readonly "config/value/write": CodexSchema.V2ConfigWriteResponse;
|
||||
readonly "config/batchWrite": CodexSchema.V2ConfigWriteResponse;
|
||||
readonly "configRequirements/read": CodexSchema.V2ConfigRequirementsReadResponse;
|
||||
readonly "account/read": CodexSchema.V2GetAccountResponse;
|
||||
readonly getConversationSummary: CodexSchema.GetConversationSummaryResponse;
|
||||
readonly gitDiffToRemote: CodexSchema.GitDiffToRemoteResponse;
|
||||
readonly getAuthStatus: CodexSchema.GetAuthStatusResponse;
|
||||
readonly fuzzyFileSearch: CodexSchema.FuzzyFileSearchResponse;
|
||||
readonly initialize: typeof CodexSchema.V1InitializeResponse.Type;
|
||||
readonly "thread/start": typeof CodexSchema.V2ThreadStartResponse.Type;
|
||||
readonly "thread/resume": typeof CodexSchema.V2ThreadResumeResponse.Type;
|
||||
readonly "thread/fork": typeof CodexSchema.V2ThreadForkResponse.Type;
|
||||
readonly "thread/archive": typeof CodexSchema.V2ThreadArchiveResponse.Type;
|
||||
readonly "thread/unsubscribe": typeof CodexSchema.V2ThreadUnsubscribeResponse.Type;
|
||||
readonly "thread/name/set": typeof CodexSchema.V2ThreadSetNameResponse.Type;
|
||||
readonly "thread/metadata/update": typeof CodexSchema.V2ThreadMetadataUpdateResponse.Type;
|
||||
readonly "thread/unarchive": typeof CodexSchema.V2ThreadUnarchiveResponse.Type;
|
||||
readonly "thread/compact/start": typeof CodexSchema.V2ThreadCompactStartResponse.Type;
|
||||
readonly "thread/shellCommand": typeof CodexSchema.V2ThreadShellCommandResponse.Type;
|
||||
readonly "thread/rollback": typeof CodexSchema.V2ThreadRollbackResponse.Type;
|
||||
readonly "thread/list": typeof CodexSchema.V2ThreadListResponse.Type;
|
||||
readonly "thread/loaded/list": typeof CodexSchema.V2ThreadLoadedListResponse.Type;
|
||||
readonly "thread/read": typeof CodexSchema.V2ThreadReadResponse.Type;
|
||||
readonly "skills/list": typeof CodexSchema.V2SkillsListResponse.Type;
|
||||
readonly "plugin/list": typeof CodexSchema.V2PluginListResponse.Type;
|
||||
readonly "plugin/read": typeof CodexSchema.V2PluginReadResponse.Type;
|
||||
readonly "app/list": typeof CodexSchema.V2AppsListResponse.Type;
|
||||
readonly "fs/readFile": typeof CodexSchema.V2FsReadFileResponse.Type;
|
||||
readonly "fs/writeFile": typeof CodexSchema.V2FsWriteFileResponse.Type;
|
||||
readonly "fs/createDirectory": typeof CodexSchema.V2FsCreateDirectoryResponse.Type;
|
||||
readonly "fs/getMetadata": typeof CodexSchema.V2FsGetMetadataResponse.Type;
|
||||
readonly "fs/readDirectory": typeof CodexSchema.V2FsReadDirectoryResponse.Type;
|
||||
readonly "fs/remove": typeof CodexSchema.V2FsRemoveResponse.Type;
|
||||
readonly "fs/copy": typeof CodexSchema.V2FsCopyResponse.Type;
|
||||
readonly "fs/watch": typeof CodexSchema.V2FsWatchResponse.Type;
|
||||
readonly "fs/unwatch": typeof CodexSchema.V2FsUnwatchResponse.Type;
|
||||
readonly "skills/config/write": typeof CodexSchema.V2SkillsConfigWriteResponse.Type;
|
||||
readonly "plugin/install": typeof CodexSchema.V2PluginInstallResponse.Type;
|
||||
readonly "plugin/uninstall": typeof CodexSchema.V2PluginUninstallResponse.Type;
|
||||
readonly "turn/start": typeof CodexSchema.V2TurnStartResponse.Type;
|
||||
readonly "turn/steer": typeof CodexSchema.V2TurnSteerResponse.Type;
|
||||
readonly "turn/interrupt": typeof CodexSchema.V2TurnInterruptResponse.Type;
|
||||
readonly "review/start": typeof CodexSchema.V2ReviewStartResponse.Type;
|
||||
readonly "model/list": typeof CodexSchema.V2ModelListResponse.Type;
|
||||
readonly "experimentalFeature/list": typeof CodexSchema.V2ExperimentalFeatureListResponse.Type;
|
||||
readonly "experimentalFeature/enablement/set": typeof CodexSchema.V2ExperimentalFeatureEnablementSetResponse.Type;
|
||||
readonly "mcpServer/oauth/login": typeof CodexSchema.V2McpServerOauthLoginResponse.Type;
|
||||
readonly "config/mcpServer/reload": typeof CodexSchema.V2McpServerRefreshResponse.Type;
|
||||
readonly "mcpServerStatus/list": typeof CodexSchema.V2ListMcpServerStatusResponse.Type;
|
||||
readonly "mcpServer/resource/read": typeof CodexSchema.V2McpResourceReadResponse.Type;
|
||||
readonly "mcpServer/tool/call": typeof CodexSchema.V2McpServerToolCallResponse.Type;
|
||||
readonly "windowsSandbox/setupStart": typeof CodexSchema.V2WindowsSandboxSetupStartResponse.Type;
|
||||
readonly "account/login/start": typeof CodexSchema.V2LoginAccountResponse.Type;
|
||||
readonly "account/login/cancel": typeof CodexSchema.V2CancelLoginAccountResponse.Type;
|
||||
readonly "account/logout": typeof CodexSchema.V2LogoutAccountResponse.Type;
|
||||
readonly "account/rateLimits/read": typeof CodexSchema.V2GetAccountRateLimitsResponse.Type;
|
||||
readonly "feedback/upload": typeof CodexSchema.V2FeedbackUploadResponse.Type;
|
||||
readonly "command/exec": typeof CodexSchema.V2CommandExecResponse.Type;
|
||||
readonly "command/exec/write": typeof CodexSchema.V2CommandExecWriteResponse.Type;
|
||||
readonly "command/exec/terminate": typeof CodexSchema.V2CommandExecTerminateResponse.Type;
|
||||
readonly "command/exec/resize": typeof CodexSchema.V2CommandExecResizeResponse.Type;
|
||||
readonly "config/read": typeof CodexSchema.V2ConfigReadResponse.Type;
|
||||
readonly "externalAgentConfig/detect": typeof CodexSchema.V2ExternalAgentConfigDetectResponse.Type;
|
||||
readonly "externalAgentConfig/import": typeof CodexSchema.V2ExternalAgentConfigImportResponse.Type;
|
||||
readonly "config/value/write": typeof CodexSchema.V2ConfigWriteResponse.Type;
|
||||
readonly "config/batchWrite": typeof CodexSchema.V2ConfigWriteResponse.Type;
|
||||
readonly "configRequirements/read": typeof CodexSchema.V2ConfigRequirementsReadResponse.Type;
|
||||
readonly "account/read": typeof CodexSchema.V2GetAccountResponse.Type;
|
||||
readonly getConversationSummary: typeof CodexSchema.GetConversationSummaryResponse.Type;
|
||||
readonly gitDiffToRemote: typeof CodexSchema.GitDiffToRemoteResponse.Type;
|
||||
readonly getAuthStatus: typeof CodexSchema.GetAuthStatusResponse.Type;
|
||||
readonly fuzzyFileSearch: typeof CodexSchema.FuzzyFileSearchResponse.Type;
|
||||
}
|
||||
|
||||
export interface ClientNotificationParamsByMethod {
|
||||
@@ -390,104 +286,83 @@ export interface ClientNotificationParamsByMethod {
|
||||
}
|
||||
|
||||
export interface ServerRequestParamsByMethod {
|
||||
readonly "item/commandExecution/requestApproval": CodexSchema.CommandExecutionRequestApprovalParams;
|
||||
readonly "item/fileChange/requestApproval": CodexSchema.FileChangeRequestApprovalParams;
|
||||
readonly "item/tool/requestUserInput": CodexSchema.ToolRequestUserInputParams;
|
||||
readonly "mcpServer/elicitation/request": CodexSchema.McpServerElicitationRequestParams;
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalParams;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallParams;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshParams;
|
||||
readonly "attestation/generate": CodexSchema.AttestationGenerateParams;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalParams;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalParams;
|
||||
readonly "item/commandExecution/requestApproval": typeof CodexSchema.CommandExecutionRequestApprovalParams.Type;
|
||||
readonly "item/fileChange/requestApproval": typeof CodexSchema.FileChangeRequestApprovalParams.Type;
|
||||
readonly "item/tool/requestUserInput": typeof CodexSchema.ToolRequestUserInputParams.Type;
|
||||
readonly "mcpServer/elicitation/request": typeof CodexSchema.McpServerElicitationRequestParams.Type;
|
||||
readonly "item/permissions/requestApproval": typeof CodexSchema.PermissionsRequestApprovalParams.Type;
|
||||
readonly "item/tool/call": typeof CodexSchema.DynamicToolCallParams.Type;
|
||||
readonly "account/chatgptAuthTokens/refresh": typeof CodexSchema.ChatgptAuthTokensRefreshParams.Type;
|
||||
readonly applyPatchApproval: typeof CodexSchema.ApplyPatchApprovalParams.Type;
|
||||
readonly execCommandApproval: typeof CodexSchema.ExecCommandApprovalParams.Type;
|
||||
}
|
||||
|
||||
export interface ServerRequestResponsesByMethod {
|
||||
readonly "item/commandExecution/requestApproval": CodexSchema.CommandExecutionRequestApprovalResponse;
|
||||
readonly "item/fileChange/requestApproval": CodexSchema.FileChangeRequestApprovalResponse;
|
||||
readonly "item/tool/requestUserInput": CodexSchema.ToolRequestUserInputResponse;
|
||||
readonly "mcpServer/elicitation/request": CodexSchema.McpServerElicitationRequestResponse;
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalResponse;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallResponse;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshResponse;
|
||||
readonly "attestation/generate": CodexSchema.AttestationGenerateResponse;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalResponse;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalResponse;
|
||||
readonly "item/commandExecution/requestApproval": typeof CodexSchema.CommandExecutionRequestApprovalResponse.Type;
|
||||
readonly "item/fileChange/requestApproval": typeof CodexSchema.FileChangeRequestApprovalResponse.Type;
|
||||
readonly "item/tool/requestUserInput": typeof CodexSchema.ToolRequestUserInputResponse.Type;
|
||||
readonly "mcpServer/elicitation/request": typeof CodexSchema.McpServerElicitationRequestResponse.Type;
|
||||
readonly "item/permissions/requestApproval": typeof CodexSchema.PermissionsRequestApprovalResponse.Type;
|
||||
readonly "item/tool/call": typeof CodexSchema.DynamicToolCallResponse.Type;
|
||||
readonly "account/chatgptAuthTokens/refresh": typeof CodexSchema.ChatgptAuthTokensRefreshResponse.Type;
|
||||
readonly applyPatchApproval: typeof CodexSchema.ApplyPatchApprovalResponse.Type;
|
||||
readonly execCommandApproval: typeof CodexSchema.ExecCommandApprovalResponse.Type;
|
||||
}
|
||||
|
||||
export interface ServerNotificationParamsByMethod {
|
||||
readonly error: CodexSchema.V2ErrorNotification;
|
||||
readonly "thread/started": CodexSchema.V2ThreadStartedNotification;
|
||||
readonly "thread/status/changed": CodexSchema.V2ThreadStatusChangedNotification;
|
||||
readonly "thread/archived": CodexSchema.V2ThreadArchivedNotification;
|
||||
readonly "thread/deleted": CodexSchema.V2ThreadDeletedNotification;
|
||||
readonly "thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification;
|
||||
readonly "thread/closed": CodexSchema.V2ThreadClosedNotification;
|
||||
readonly "skills/changed": CodexSchema.V2SkillsChangedNotification;
|
||||
readonly "thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification;
|
||||
readonly "thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification;
|
||||
readonly "thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification;
|
||||
readonly "thread/environment/connected": CodexSchema.V2EnvironmentConnectionNotification;
|
||||
readonly "thread/environment/disconnected": CodexSchema.V2EnvironmentConnectionNotification;
|
||||
readonly "thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification;
|
||||
readonly "thread/tokenUsage/updated": CodexSchema.V2ThreadTokenUsageUpdatedNotification;
|
||||
readonly "turn/started": CodexSchema.V2TurnStartedNotification;
|
||||
readonly "hook/started": CodexSchema.V2HookStartedNotification;
|
||||
readonly "turn/completed": CodexSchema.V2TurnCompletedNotification;
|
||||
readonly "hook/completed": CodexSchema.V2HookCompletedNotification;
|
||||
readonly "turn/diff/updated": CodexSchema.V2TurnDiffUpdatedNotification;
|
||||
readonly "turn/plan/updated": CodexSchema.V2TurnPlanUpdatedNotification;
|
||||
readonly "item/started": CodexSchema.V2ItemStartedNotification;
|
||||
readonly "item/autoApprovalReview/started": CodexSchema.V2ItemGuardianApprovalReviewStartedNotification;
|
||||
readonly "item/autoApprovalReview/completed": CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification;
|
||||
readonly "item/completed": CodexSchema.V2ItemCompletedNotification;
|
||||
readonly "rawResponseItem/completed": CodexSchema.V2RawResponseItemCompletedNotification;
|
||||
readonly "rawResponse/completed": CodexSchema.V2RawResponseCompletedNotification;
|
||||
readonly "item/agentMessage/delta": CodexSchema.V2AgentMessageDeltaNotification;
|
||||
readonly "item/plan/delta": CodexSchema.V2PlanDeltaNotification;
|
||||
readonly "command/exec/outputDelta": CodexSchema.V2CommandExecOutputDeltaNotification;
|
||||
readonly "process/outputDelta": CodexSchema.V2ProcessOutputDeltaNotification;
|
||||
readonly "process/exited": CodexSchema.V2ProcessExitedNotification;
|
||||
readonly "item/commandExecution/outputDelta": CodexSchema.V2CommandExecutionOutputDeltaNotification;
|
||||
readonly "item/commandExecution/terminalInteraction": CodexSchema.V2TerminalInteractionNotification;
|
||||
readonly "item/fileChange/outputDelta": CodexSchema.V2FileChangeOutputDeltaNotification;
|
||||
readonly "item/fileChange/patchUpdated": CodexSchema.V2FileChangePatchUpdatedNotification;
|
||||
readonly "serverRequest/resolved": CodexSchema.V2ServerRequestResolvedNotification;
|
||||
readonly "item/mcpToolCall/progress": CodexSchema.V2McpToolCallProgressNotification;
|
||||
readonly "mcpServer/oauthLogin/completed": CodexSchema.V2McpServerOauthLoginCompletedNotification;
|
||||
readonly "mcpServer/startupStatus/updated": CodexSchema.V2McpServerStatusUpdatedNotification;
|
||||
readonly "account/updated": CodexSchema.V2AccountUpdatedNotification;
|
||||
readonly "account/rateLimits/updated": CodexSchema.V2AccountRateLimitsUpdatedNotification;
|
||||
readonly "app/list/updated": CodexSchema.V2AppListUpdatedNotification;
|
||||
readonly "remoteControl/status/changed": CodexSchema.V2RemoteControlStatusChangedNotification;
|
||||
readonly "externalAgentConfig/import/progress": CodexSchema.V2ExternalAgentConfigImportProgressNotification;
|
||||
readonly "externalAgentConfig/import/completed": CodexSchema.V2ExternalAgentConfigImportCompletedNotification;
|
||||
readonly "fs/changed": CodexSchema.V2FsChangedNotification;
|
||||
readonly "item/reasoning/summaryTextDelta": CodexSchema.V2ReasoningSummaryTextDeltaNotification;
|
||||
readonly "item/reasoning/summaryPartAdded": CodexSchema.V2ReasoningSummaryPartAddedNotification;
|
||||
readonly "item/reasoning/textDelta": CodexSchema.V2ReasoningTextDeltaNotification;
|
||||
readonly "thread/compacted": CodexSchema.V2ContextCompactedNotification;
|
||||
readonly "model/rerouted": CodexSchema.V2ModelReroutedNotification;
|
||||
readonly "model/verification": CodexSchema.V2ModelVerificationNotification;
|
||||
readonly "turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification;
|
||||
readonly "model/safetyBuffering/updated": CodexSchema.V2ModelSafetyBufferingUpdatedNotification;
|
||||
readonly warning: CodexSchema.V2WarningNotification;
|
||||
readonly guardianWarning: CodexSchema.V2GuardianWarningNotification;
|
||||
readonly deprecationNotice: CodexSchema.V2DeprecationNoticeNotification;
|
||||
readonly configWarning: CodexSchema.V2ConfigWarningNotification;
|
||||
readonly "fuzzyFileSearch/sessionUpdated": CodexSchema.FuzzyFileSearchSessionUpdatedNotification;
|
||||
readonly "fuzzyFileSearch/sessionCompleted": CodexSchema.FuzzyFileSearchSessionCompletedNotification;
|
||||
readonly "thread/realtime/started": CodexSchema.V2ThreadRealtimeStartedNotification;
|
||||
readonly "thread/realtime/itemAdded": CodexSchema.V2ThreadRealtimeItemAddedNotification;
|
||||
readonly "thread/realtime/transcript/delta": CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification;
|
||||
readonly "thread/realtime/transcript/done": CodexSchema.V2ThreadRealtimeTranscriptDoneNotification;
|
||||
readonly "thread/realtime/outputAudio/delta": CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification;
|
||||
readonly "thread/realtime/sdp": CodexSchema.V2ThreadRealtimeSdpNotification;
|
||||
readonly "thread/realtime/error": CodexSchema.V2ThreadRealtimeErrorNotification;
|
||||
readonly "thread/realtime/closed": CodexSchema.V2ThreadRealtimeClosedNotification;
|
||||
readonly "windows/worldWritableWarning": CodexSchema.V2WindowsWorldWritableWarningNotification;
|
||||
readonly "windowsSandbox/setupCompleted": CodexSchema.V2WindowsSandboxSetupCompletedNotification;
|
||||
readonly "account/login/completed": CodexSchema.V2AccountLoginCompletedNotification;
|
||||
readonly error: typeof CodexSchema.V2ErrorNotification.Type;
|
||||
readonly "thread/started": typeof CodexSchema.V2ThreadStartedNotification.Type;
|
||||
readonly "thread/status/changed": typeof CodexSchema.V2ThreadStatusChangedNotification.Type;
|
||||
readonly "thread/archived": typeof CodexSchema.V2ThreadArchivedNotification.Type;
|
||||
readonly "thread/unarchived": typeof CodexSchema.V2ThreadUnarchivedNotification.Type;
|
||||
readonly "thread/closed": typeof CodexSchema.V2ThreadClosedNotification.Type;
|
||||
readonly "skills/changed": typeof CodexSchema.V2SkillsChangedNotification.Type;
|
||||
readonly "thread/name/updated": typeof CodexSchema.V2ThreadNameUpdatedNotification.Type;
|
||||
readonly "thread/tokenUsage/updated": typeof CodexSchema.V2ThreadTokenUsageUpdatedNotification.Type;
|
||||
readonly "turn/started": typeof CodexSchema.V2TurnStartedNotification.Type;
|
||||
readonly "hook/started": typeof CodexSchema.V2HookStartedNotification.Type;
|
||||
readonly "turn/completed": typeof CodexSchema.V2TurnCompletedNotification.Type;
|
||||
readonly "hook/completed": typeof CodexSchema.V2HookCompletedNotification.Type;
|
||||
readonly "turn/diff/updated": typeof CodexSchema.V2TurnDiffUpdatedNotification.Type;
|
||||
readonly "turn/plan/updated": typeof CodexSchema.V2TurnPlanUpdatedNotification.Type;
|
||||
readonly "item/started": typeof CodexSchema.V2ItemStartedNotification.Type;
|
||||
readonly "item/autoApprovalReview/started": typeof CodexSchema.V2ItemGuardianApprovalReviewStartedNotification.Type;
|
||||
readonly "item/autoApprovalReview/completed": typeof CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification.Type;
|
||||
readonly "item/completed": typeof CodexSchema.V2ItemCompletedNotification.Type;
|
||||
readonly "rawResponseItem/completed": typeof CodexSchema.V2RawResponseItemCompletedNotification.Type;
|
||||
readonly "item/agentMessage/delta": typeof CodexSchema.V2AgentMessageDeltaNotification.Type;
|
||||
readonly "item/plan/delta": typeof CodexSchema.V2PlanDeltaNotification.Type;
|
||||
readonly "command/exec/outputDelta": typeof CodexSchema.V2CommandExecOutputDeltaNotification.Type;
|
||||
readonly "item/commandExecution/outputDelta": typeof CodexSchema.V2CommandExecutionOutputDeltaNotification.Type;
|
||||
readonly "item/commandExecution/terminalInteraction": typeof CodexSchema.V2TerminalInteractionNotification.Type;
|
||||
readonly "item/fileChange/outputDelta": typeof CodexSchema.V2FileChangeOutputDeltaNotification.Type;
|
||||
readonly "serverRequest/resolved": typeof CodexSchema.V2ServerRequestResolvedNotification.Type;
|
||||
readonly "item/mcpToolCall/progress": typeof CodexSchema.V2McpToolCallProgressNotification.Type;
|
||||
readonly "mcpServer/oauthLogin/completed": typeof CodexSchema.V2McpServerOauthLoginCompletedNotification.Type;
|
||||
readonly "mcpServer/startupStatus/updated": typeof CodexSchema.V2McpServerStatusUpdatedNotification.Type;
|
||||
readonly "account/updated": typeof CodexSchema.V2AccountUpdatedNotification.Type;
|
||||
readonly "account/rateLimits/updated": typeof CodexSchema.V2AccountRateLimitsUpdatedNotification.Type;
|
||||
readonly "app/list/updated": typeof CodexSchema.V2AppListUpdatedNotification.Type;
|
||||
readonly "fs/changed": typeof CodexSchema.V2FsChangedNotification.Type;
|
||||
readonly "item/reasoning/summaryTextDelta": typeof CodexSchema.V2ReasoningSummaryTextDeltaNotification.Type;
|
||||
readonly "item/reasoning/summaryPartAdded": typeof CodexSchema.V2ReasoningSummaryPartAddedNotification.Type;
|
||||
readonly "item/reasoning/textDelta": typeof CodexSchema.V2ReasoningTextDeltaNotification.Type;
|
||||
readonly "thread/compacted": typeof CodexSchema.V2ContextCompactedNotification.Type;
|
||||
readonly "model/rerouted": typeof CodexSchema.V2ModelReroutedNotification.Type;
|
||||
readonly deprecationNotice: typeof CodexSchema.V2DeprecationNoticeNotification.Type;
|
||||
readonly configWarning: typeof CodexSchema.V2ConfigWarningNotification.Type;
|
||||
readonly "fuzzyFileSearch/sessionUpdated": typeof CodexSchema.FuzzyFileSearchSessionUpdatedNotification.Type;
|
||||
readonly "fuzzyFileSearch/sessionCompleted": typeof CodexSchema.FuzzyFileSearchSessionCompletedNotification.Type;
|
||||
readonly "thread/realtime/started": typeof CodexSchema.V2ThreadRealtimeStartedNotification.Type;
|
||||
readonly "thread/realtime/itemAdded": typeof CodexSchema.V2ThreadRealtimeItemAddedNotification.Type;
|
||||
readonly "thread/realtime/transcriptUpdated": typeof CodexSchema.V2ThreadRealtimeTranscriptUpdatedNotification.Type;
|
||||
readonly "thread/realtime/outputAudio/delta": typeof CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification.Type;
|
||||
readonly "thread/realtime/sdp": typeof CodexSchema.V2ThreadRealtimeSdpNotification.Type;
|
||||
readonly "thread/realtime/error": typeof CodexSchema.V2ThreadRealtimeErrorNotification.Type;
|
||||
readonly "thread/realtime/closed": typeof CodexSchema.V2ThreadRealtimeClosedNotification.Type;
|
||||
readonly "windows/worldWritableWarning": typeof CodexSchema.V2WindowsWorldWritableWarningNotification.Type;
|
||||
readonly "windowsSandbox/setupCompleted": typeof CodexSchema.V2WindowsSandboxSetupCompletedNotification.Type;
|
||||
readonly "account/login/completed": typeof CodexSchema.V2AccountLoginCompletedNotification.Type;
|
||||
}
|
||||
|
||||
export const CLIENT_REQUEST_PARAMS = {
|
||||
@@ -496,40 +371,20 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"thread/resume": CodexSchema.V2ThreadResumeParams,
|
||||
"thread/fork": CodexSchema.V2ThreadForkParams,
|
||||
"thread/archive": CodexSchema.V2ThreadArchiveParams,
|
||||
"thread/delete": CodexSchema.V2ThreadDeleteParams,
|
||||
"thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeParams,
|
||||
"thread/name/set": CodexSchema.V2ThreadSetNameParams,
|
||||
"thread/goal/set": CodexSchema.V2ThreadGoalSetParams,
|
||||
"thread/goal/get": CodexSchema.V2ThreadGoalGetParams,
|
||||
"thread/goal/clear": CodexSchema.V2ThreadGoalClearParams,
|
||||
"thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams,
|
||||
"thread/unarchive": CodexSchema.V2ThreadUnarchiveParams,
|
||||
"thread/compact/start": CodexSchema.V2ThreadCompactStartParams,
|
||||
"thread/shellCommand": CodexSchema.V2ThreadShellCommandParams,
|
||||
"thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionParams,
|
||||
"thread/rollback": CodexSchema.V2ThreadRollbackParams,
|
||||
"thread/list": CodexSchema.V2ThreadListParams,
|
||||
"thread/loaded/list": CodexSchema.V2ThreadLoadedListParams,
|
||||
"thread/read": CodexSchema.V2ThreadReadParams,
|
||||
"thread/inject_items": CodexSchema.V2ThreadInjectItemsParams,
|
||||
"skills/list": CodexSchema.V2SkillsListParams,
|
||||
"skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams,
|
||||
"hooks/list": CodexSchema.V2HooksListParams,
|
||||
"marketplace/add": CodexSchema.V2MarketplaceAddParams,
|
||||
"marketplace/remove": CodexSchema.V2MarketplaceRemoveParams,
|
||||
"marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams,
|
||||
"plugin/list": CodexSchema.V2PluginListParams,
|
||||
"plugin/installed": CodexSchema.V2PluginInstalledParams,
|
||||
"plugin/read": CodexSchema.V2PluginReadParams,
|
||||
"plugin/skill/read": CodexSchema.V2PluginSkillReadParams,
|
||||
"plugin/share/save": CodexSchema.V2PluginShareSaveParams,
|
||||
"plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsParams,
|
||||
"plugin/share/list": CodexSchema.V2PluginShareListParams,
|
||||
"plugin/share/checkout": CodexSchema.V2PluginShareCheckoutParams,
|
||||
"plugin/share/delete": CodexSchema.V2PluginShareDeleteParams,
|
||||
"app/read": CodexSchema.V2AppsReadParams,
|
||||
"app/list": CodexSchema.V2AppsListParams,
|
||||
"app/installed": CodexSchema.V2AppsInstalledParams,
|
||||
"fs/readFile": CodexSchema.V2FsReadFileParams,
|
||||
"fs/writeFile": CodexSchema.V2FsWriteFileParams,
|
||||
"fs/createDirectory": CodexSchema.V2FsCreateDirectoryParams,
|
||||
@@ -547,9 +402,7 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"turn/interrupt": CodexSchema.V2TurnInterruptParams,
|
||||
"review/start": CodexSchema.V2ReviewStartParams,
|
||||
"model/list": CodexSchema.V2ModelListParams,
|
||||
"modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadParams,
|
||||
"experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListParams,
|
||||
"permissionProfile/list": CodexSchema.V2PermissionProfileListParams,
|
||||
"experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetParams,
|
||||
"mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginParams,
|
||||
"config/mcpServer/reload": undefined,
|
||||
@@ -557,15 +410,10 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"mcpServer/resource/read": CodexSchema.V2McpResourceReadParams,
|
||||
"mcpServer/tool/call": CodexSchema.V2McpServerToolCallParams,
|
||||
"windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartParams,
|
||||
"windowsSandbox/readiness": undefined,
|
||||
"account/login/start": CodexSchema.V2LoginAccountParams,
|
||||
"account/login/cancel": CodexSchema.V2CancelLoginAccountParams,
|
||||
"account/logout": undefined,
|
||||
"account/rateLimits/read": undefined,
|
||||
"account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditParams,
|
||||
"account/usage/read": undefined,
|
||||
"account/workspaceMessages/read": undefined,
|
||||
"account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams,
|
||||
"feedback/upload": CodexSchema.V2FeedbackUploadParams,
|
||||
"command/exec": CodexSchema.V2CommandExecParams,
|
||||
"command/exec/write": CodexSchema.V2CommandExecWriteParams,
|
||||
@@ -574,7 +422,6 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"config/read": CodexSchema.V2ConfigReadParams,
|
||||
"externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectParams,
|
||||
"externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportParams,
|
||||
"externalAgentConfig/import/readHistories": undefined,
|
||||
"config/value/write": CodexSchema.V2ConfigValueWriteParams,
|
||||
"config/batchWrite": CodexSchema.V2ConfigBatchWriteParams,
|
||||
"configRequirements/read": undefined,
|
||||
@@ -591,40 +438,20 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"thread/resume": CodexSchema.V2ThreadResumeResponse,
|
||||
"thread/fork": CodexSchema.V2ThreadForkResponse,
|
||||
"thread/archive": CodexSchema.V2ThreadArchiveResponse,
|
||||
"thread/delete": CodexSchema.V2ThreadDeleteResponse,
|
||||
"thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeResponse,
|
||||
"thread/name/set": CodexSchema.V2ThreadSetNameResponse,
|
||||
"thread/goal/set": CodexSchema.V2ThreadGoalSetResponse,
|
||||
"thread/goal/get": CodexSchema.V2ThreadGoalGetResponse,
|
||||
"thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse,
|
||||
"thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse,
|
||||
"thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse,
|
||||
"thread/compact/start": CodexSchema.V2ThreadCompactStartResponse,
|
||||
"thread/shellCommand": CodexSchema.V2ThreadShellCommandResponse,
|
||||
"thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionResponse,
|
||||
"thread/rollback": CodexSchema.V2ThreadRollbackResponse,
|
||||
"thread/list": CodexSchema.V2ThreadListResponse,
|
||||
"thread/loaded/list": CodexSchema.V2ThreadLoadedListResponse,
|
||||
"thread/read": CodexSchema.V2ThreadReadResponse,
|
||||
"thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse,
|
||||
"skills/list": CodexSchema.V2SkillsListResponse,
|
||||
"skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse,
|
||||
"hooks/list": CodexSchema.V2HooksListResponse,
|
||||
"marketplace/add": CodexSchema.V2MarketplaceAddResponse,
|
||||
"marketplace/remove": CodexSchema.V2MarketplaceRemoveResponse,
|
||||
"marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse,
|
||||
"plugin/list": CodexSchema.V2PluginListResponse,
|
||||
"plugin/installed": CodexSchema.V2PluginInstalledResponse,
|
||||
"plugin/read": CodexSchema.V2PluginReadResponse,
|
||||
"plugin/skill/read": CodexSchema.V2PluginSkillReadResponse,
|
||||
"plugin/share/save": CodexSchema.V2PluginShareSaveResponse,
|
||||
"plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsResponse,
|
||||
"plugin/share/list": CodexSchema.V2PluginShareListResponse,
|
||||
"plugin/share/checkout": CodexSchema.V2PluginShareCheckoutResponse,
|
||||
"plugin/share/delete": CodexSchema.V2PluginShareDeleteResponse,
|
||||
"app/read": CodexSchema.V2AppsReadResponse,
|
||||
"app/list": CodexSchema.V2AppsListResponse,
|
||||
"app/installed": CodexSchema.V2AppsInstalledResponse,
|
||||
"fs/readFile": CodexSchema.V2FsReadFileResponse,
|
||||
"fs/writeFile": CodexSchema.V2FsWriteFileResponse,
|
||||
"fs/createDirectory": CodexSchema.V2FsCreateDirectoryResponse,
|
||||
@@ -642,9 +469,7 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"turn/interrupt": CodexSchema.V2TurnInterruptResponse,
|
||||
"review/start": CodexSchema.V2ReviewStartResponse,
|
||||
"model/list": CodexSchema.V2ModelListResponse,
|
||||
"modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadResponse,
|
||||
"experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListResponse,
|
||||
"permissionProfile/list": CodexSchema.V2PermissionProfileListResponse,
|
||||
"experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetResponse,
|
||||
"mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginResponse,
|
||||
"config/mcpServer/reload": CodexSchema.V2McpServerRefreshResponse,
|
||||
@@ -652,15 +477,10 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"mcpServer/resource/read": CodexSchema.V2McpResourceReadResponse,
|
||||
"mcpServer/tool/call": CodexSchema.V2McpServerToolCallResponse,
|
||||
"windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartResponse,
|
||||
"windowsSandbox/readiness": CodexSchema.V2WindowsSandboxReadinessResponse,
|
||||
"account/login/start": CodexSchema.V2LoginAccountResponse,
|
||||
"account/login/cancel": CodexSchema.V2CancelLoginAccountResponse,
|
||||
"account/logout": CodexSchema.V2LogoutAccountResponse,
|
||||
"account/rateLimits/read": CodexSchema.V2GetAccountRateLimitsResponse,
|
||||
"account/rateLimitResetCredit/consume": CodexSchema.V2ConsumeAccountRateLimitResetCreditResponse,
|
||||
"account/usage/read": CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
"account/workspaceMessages/read": CodexSchema.V2GetWorkspaceMessagesResponse,
|
||||
"account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailResponse,
|
||||
"feedback/upload": CodexSchema.V2FeedbackUploadResponse,
|
||||
"command/exec": CodexSchema.V2CommandExecResponse,
|
||||
"command/exec/write": CodexSchema.V2CommandExecWriteResponse,
|
||||
@@ -669,8 +489,6 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"config/read": CodexSchema.V2ConfigReadResponse,
|
||||
"externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectResponse,
|
||||
"externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportResponse,
|
||||
"externalAgentConfig/import/readHistories":
|
||||
CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse,
|
||||
"config/value/write": CodexSchema.V2ConfigWriteResponse,
|
||||
"config/batchWrite": CodexSchema.V2ConfigWriteResponse,
|
||||
"configRequirements/read": CodexSchema.V2ConfigRequirementsReadResponse,
|
||||
@@ -693,7 +511,6 @@ export const SERVER_REQUEST_PARAMS = {
|
||||
"item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalParams,
|
||||
"item/tool/call": CodexSchema.DynamicToolCallParams,
|
||||
"account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshParams,
|
||||
"attestation/generate": CodexSchema.AttestationGenerateParams,
|
||||
applyPatchApproval: CodexSchema.ApplyPatchApprovalParams,
|
||||
execCommandApproval: CodexSchema.ExecCommandApprovalParams,
|
||||
} as const;
|
||||
@@ -706,7 +523,6 @@ export const SERVER_REQUEST_RESPONSES = {
|
||||
"item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalResponse,
|
||||
"item/tool/call": CodexSchema.DynamicToolCallResponse,
|
||||
"account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshResponse,
|
||||
"attestation/generate": CodexSchema.AttestationGenerateResponse,
|
||||
applyPatchApproval: CodexSchema.ApplyPatchApprovalResponse,
|
||||
execCommandApproval: CodexSchema.ExecCommandApprovalResponse,
|
||||
} as const;
|
||||
@@ -716,16 +532,10 @@ export const SERVER_NOTIFICATION_PARAMS = {
|
||||
"thread/started": CodexSchema.V2ThreadStartedNotification,
|
||||
"thread/status/changed": CodexSchema.V2ThreadStatusChangedNotification,
|
||||
"thread/archived": CodexSchema.V2ThreadArchivedNotification,
|
||||
"thread/deleted": CodexSchema.V2ThreadDeletedNotification,
|
||||
"thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification,
|
||||
"thread/closed": CodexSchema.V2ThreadClosedNotification,
|
||||
"skills/changed": CodexSchema.V2SkillsChangedNotification,
|
||||
"thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification,
|
||||
"thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification,
|
||||
"thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification,
|
||||
"thread/environment/connected": CodexSchema.V2EnvironmentConnectionNotification,
|
||||
"thread/environment/disconnected": CodexSchema.V2EnvironmentConnectionNotification,
|
||||
"thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification,
|
||||
"thread/tokenUsage/updated": CodexSchema.V2ThreadTokenUsageUpdatedNotification,
|
||||
"turn/started": CodexSchema.V2TurnStartedNotification,
|
||||
"hook/started": CodexSchema.V2HookStartedNotification,
|
||||
@@ -739,16 +549,12 @@ export const SERVER_NOTIFICATION_PARAMS = {
|
||||
CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification,
|
||||
"item/completed": CodexSchema.V2ItemCompletedNotification,
|
||||
"rawResponseItem/completed": CodexSchema.V2RawResponseItemCompletedNotification,
|
||||
"rawResponse/completed": CodexSchema.V2RawResponseCompletedNotification,
|
||||
"item/agentMessage/delta": CodexSchema.V2AgentMessageDeltaNotification,
|
||||
"item/plan/delta": CodexSchema.V2PlanDeltaNotification,
|
||||
"command/exec/outputDelta": CodexSchema.V2CommandExecOutputDeltaNotification,
|
||||
"process/outputDelta": CodexSchema.V2ProcessOutputDeltaNotification,
|
||||
"process/exited": CodexSchema.V2ProcessExitedNotification,
|
||||
"item/commandExecution/outputDelta": CodexSchema.V2CommandExecutionOutputDeltaNotification,
|
||||
"item/commandExecution/terminalInteraction": CodexSchema.V2TerminalInteractionNotification,
|
||||
"item/fileChange/outputDelta": CodexSchema.V2FileChangeOutputDeltaNotification,
|
||||
"item/fileChange/patchUpdated": CodexSchema.V2FileChangePatchUpdatedNotification,
|
||||
"serverRequest/resolved": CodexSchema.V2ServerRequestResolvedNotification,
|
||||
"item/mcpToolCall/progress": CodexSchema.V2McpToolCallProgressNotification,
|
||||
"mcpServer/oauthLogin/completed": CodexSchema.V2McpServerOauthLoginCompletedNotification,
|
||||
@@ -756,30 +562,19 @@ export const SERVER_NOTIFICATION_PARAMS = {
|
||||
"account/updated": CodexSchema.V2AccountUpdatedNotification,
|
||||
"account/rateLimits/updated": CodexSchema.V2AccountRateLimitsUpdatedNotification,
|
||||
"app/list/updated": CodexSchema.V2AppListUpdatedNotification,
|
||||
"remoteControl/status/changed": CodexSchema.V2RemoteControlStatusChangedNotification,
|
||||
"externalAgentConfig/import/progress":
|
||||
CodexSchema.V2ExternalAgentConfigImportProgressNotification,
|
||||
"externalAgentConfig/import/completed":
|
||||
CodexSchema.V2ExternalAgentConfigImportCompletedNotification,
|
||||
"fs/changed": CodexSchema.V2FsChangedNotification,
|
||||
"item/reasoning/summaryTextDelta": CodexSchema.V2ReasoningSummaryTextDeltaNotification,
|
||||
"item/reasoning/summaryPartAdded": CodexSchema.V2ReasoningSummaryPartAddedNotification,
|
||||
"item/reasoning/textDelta": CodexSchema.V2ReasoningTextDeltaNotification,
|
||||
"thread/compacted": CodexSchema.V2ContextCompactedNotification,
|
||||
"model/rerouted": CodexSchema.V2ModelReroutedNotification,
|
||||
"model/verification": CodexSchema.V2ModelVerificationNotification,
|
||||
"turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification,
|
||||
"model/safetyBuffering/updated": CodexSchema.V2ModelSafetyBufferingUpdatedNotification,
|
||||
warning: CodexSchema.V2WarningNotification,
|
||||
guardianWarning: CodexSchema.V2GuardianWarningNotification,
|
||||
deprecationNotice: CodexSchema.V2DeprecationNoticeNotification,
|
||||
configWarning: CodexSchema.V2ConfigWarningNotification,
|
||||
"fuzzyFileSearch/sessionUpdated": CodexSchema.FuzzyFileSearchSessionUpdatedNotification,
|
||||
"fuzzyFileSearch/sessionCompleted": CodexSchema.FuzzyFileSearchSessionCompletedNotification,
|
||||
"thread/realtime/started": CodexSchema.V2ThreadRealtimeStartedNotification,
|
||||
"thread/realtime/itemAdded": CodexSchema.V2ThreadRealtimeItemAddedNotification,
|
||||
"thread/realtime/transcript/delta": CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification,
|
||||
"thread/realtime/transcript/done": CodexSchema.V2ThreadRealtimeTranscriptDoneNotification,
|
||||
"thread/realtime/transcriptUpdated": CodexSchema.V2ThreadRealtimeTranscriptUpdatedNotification,
|
||||
"thread/realtime/outputAudio/delta": CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification,
|
||||
"thread/realtime/sdp": CodexSchema.V2ThreadRealtimeSdpNotification,
|
||||
"thread/realtime/error": CodexSchema.V2ThreadRealtimeErrorNotification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This file is generated by the effect-codex-app-server package. Do not edit manually.
|
||||
// Upstream protocol ref: 678157acaa819d5510adfe359abb5d0392cfe461
|
||||
// Upstream protocol ref: dbfe855f4fd0f5dcdf079882652a8efe622b0595
|
||||
|
||||
import * as CodexSchema from "./schema.gen.ts";
|
||||
|
||||
@@ -14,12 +14,8 @@ export const v2 = {
|
||||
AccountUpdatedNotification: CodexSchema.V2AccountUpdatedNotification,
|
||||
AgentMessageDeltaNotification: CodexSchema.V2AgentMessageDeltaNotification,
|
||||
AppListUpdatedNotification: CodexSchema.V2AppListUpdatedNotification,
|
||||
AppsInstalledParams: CodexSchema.V2AppsInstalledParams,
|
||||
AppsInstalledResponse: CodexSchema.V2AppsInstalledResponse,
|
||||
AppsListParams: CodexSchema.V2AppsListParams,
|
||||
AppsListResponse: CodexSchema.V2AppsListResponse,
|
||||
AppsReadParams: CodexSchema.V2AppsReadParams,
|
||||
AppsReadResponse: CodexSchema.V2AppsReadResponse,
|
||||
CancelLoginAccountParams: CodexSchema.V2CancelLoginAccountParams,
|
||||
CancelLoginAccountResponse: CodexSchema.V2CancelLoginAccountResponse,
|
||||
CommandExecOutputDeltaNotification: CodexSchema.V2CommandExecOutputDeltaNotification,
|
||||
@@ -39,12 +35,8 @@ export const v2 = {
|
||||
ConfigValueWriteParams: CodexSchema.V2ConfigValueWriteParams,
|
||||
ConfigWarningNotification: CodexSchema.V2ConfigWarningNotification,
|
||||
ConfigWriteResponse: CodexSchema.V2ConfigWriteResponse,
|
||||
ConsumeAccountRateLimitResetCreditParams: CodexSchema.V2ConsumeAccountRateLimitResetCreditParams,
|
||||
ConsumeAccountRateLimitResetCreditResponse:
|
||||
CodexSchema.V2ConsumeAccountRateLimitResetCreditResponse,
|
||||
ContextCompactedNotification: CodexSchema.V2ContextCompactedNotification,
|
||||
DeprecationNoticeNotification: CodexSchema.V2DeprecationNoticeNotification,
|
||||
EnvironmentConnectionNotification: CodexSchema.V2EnvironmentConnectionNotification,
|
||||
ErrorNotification: CodexSchema.V2ErrorNotification,
|
||||
ExperimentalFeatureEnablementSetParams: CodexSchema.V2ExperimentalFeatureEnablementSetParams,
|
||||
ExperimentalFeatureEnablementSetResponse: CodexSchema.V2ExperimentalFeatureEnablementSetResponse,
|
||||
@@ -52,18 +44,11 @@ export const v2 = {
|
||||
ExperimentalFeatureListResponse: CodexSchema.V2ExperimentalFeatureListResponse,
|
||||
ExternalAgentConfigDetectParams: CodexSchema.V2ExternalAgentConfigDetectParams,
|
||||
ExternalAgentConfigDetectResponse: CodexSchema.V2ExternalAgentConfigDetectResponse,
|
||||
ExternalAgentConfigImportCompletedNotification:
|
||||
CodexSchema.V2ExternalAgentConfigImportCompletedNotification,
|
||||
ExternalAgentConfigImportHistoriesReadResponse:
|
||||
CodexSchema.V2ExternalAgentConfigImportHistoriesReadResponse,
|
||||
ExternalAgentConfigImportParams: CodexSchema.V2ExternalAgentConfigImportParams,
|
||||
ExternalAgentConfigImportProgressNotification:
|
||||
CodexSchema.V2ExternalAgentConfigImportProgressNotification,
|
||||
ExternalAgentConfigImportResponse: CodexSchema.V2ExternalAgentConfigImportResponse,
|
||||
FeedbackUploadParams: CodexSchema.V2FeedbackUploadParams,
|
||||
FeedbackUploadResponse: CodexSchema.V2FeedbackUploadResponse,
|
||||
FileChangeOutputDeltaNotification: CodexSchema.V2FileChangeOutputDeltaNotification,
|
||||
FileChangePatchUpdatedNotification: CodexSchema.V2FileChangePatchUpdatedNotification,
|
||||
FsChangedNotification: CodexSchema.V2FsChangedNotification,
|
||||
FsCopyParams: CodexSchema.V2FsCopyParams,
|
||||
FsCopyResponse: CodexSchema.V2FsCopyResponse,
|
||||
@@ -86,12 +71,7 @@ export const v2 = {
|
||||
GetAccountParams: CodexSchema.V2GetAccountParams,
|
||||
GetAccountRateLimitsResponse: CodexSchema.V2GetAccountRateLimitsResponse,
|
||||
GetAccountResponse: CodexSchema.V2GetAccountResponse,
|
||||
GetAccountTokenUsageResponse: CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
GetWorkspaceMessagesResponse: CodexSchema.V2GetWorkspaceMessagesResponse,
|
||||
GuardianWarningNotification: CodexSchema.V2GuardianWarningNotification,
|
||||
HookCompletedNotification: CodexSchema.V2HookCompletedNotification,
|
||||
HooksListParams: CodexSchema.V2HooksListParams,
|
||||
HooksListResponse: CodexSchema.V2HooksListResponse,
|
||||
HookStartedNotification: CodexSchema.V2HookStartedNotification,
|
||||
ItemCompletedNotification: CodexSchema.V2ItemCompletedNotification,
|
||||
ItemGuardianApprovalReviewCompletedNotification:
|
||||
@@ -104,12 +84,6 @@ export const v2 = {
|
||||
LoginAccountParams: CodexSchema.V2LoginAccountParams,
|
||||
LoginAccountResponse: CodexSchema.V2LoginAccountResponse,
|
||||
LogoutAccountResponse: CodexSchema.V2LogoutAccountResponse,
|
||||
MarketplaceAddParams: CodexSchema.V2MarketplaceAddParams,
|
||||
MarketplaceAddResponse: CodexSchema.V2MarketplaceAddResponse,
|
||||
MarketplaceRemoveParams: CodexSchema.V2MarketplaceRemoveParams,
|
||||
MarketplaceRemoveResponse: CodexSchema.V2MarketplaceRemoveResponse,
|
||||
MarketplaceUpgradeParams: CodexSchema.V2MarketplaceUpgradeParams,
|
||||
MarketplaceUpgradeResponse: CodexSchema.V2MarketplaceUpgradeResponse,
|
||||
McpResourceReadParams: CodexSchema.V2McpResourceReadParams,
|
||||
McpResourceReadResponse: CodexSchema.V2McpResourceReadResponse,
|
||||
McpServerOauthLoginCompletedNotification: CodexSchema.V2McpServerOauthLoginCompletedNotification,
|
||||
@@ -122,81 +96,37 @@ export const v2 = {
|
||||
McpToolCallProgressNotification: CodexSchema.V2McpToolCallProgressNotification,
|
||||
ModelListParams: CodexSchema.V2ModelListParams,
|
||||
ModelListResponse: CodexSchema.V2ModelListResponse,
|
||||
ModelProviderCapabilitiesReadParams: CodexSchema.V2ModelProviderCapabilitiesReadParams,
|
||||
ModelProviderCapabilitiesReadResponse: CodexSchema.V2ModelProviderCapabilitiesReadResponse,
|
||||
ModelReroutedNotification: CodexSchema.V2ModelReroutedNotification,
|
||||
ModelSafetyBufferingUpdatedNotification: CodexSchema.V2ModelSafetyBufferingUpdatedNotification,
|
||||
ModelVerificationNotification: CodexSchema.V2ModelVerificationNotification,
|
||||
PermissionProfileListParams: CodexSchema.V2PermissionProfileListParams,
|
||||
PermissionProfileListResponse: CodexSchema.V2PermissionProfileListResponse,
|
||||
PlanDeltaNotification: CodexSchema.V2PlanDeltaNotification,
|
||||
PluginInstalledParams: CodexSchema.V2PluginInstalledParams,
|
||||
PluginInstalledResponse: CodexSchema.V2PluginInstalledResponse,
|
||||
PluginInstallParams: CodexSchema.V2PluginInstallParams,
|
||||
PluginInstallResponse: CodexSchema.V2PluginInstallResponse,
|
||||
PluginListParams: CodexSchema.V2PluginListParams,
|
||||
PluginListResponse: CodexSchema.V2PluginListResponse,
|
||||
PluginReadParams: CodexSchema.V2PluginReadParams,
|
||||
PluginReadResponse: CodexSchema.V2PluginReadResponse,
|
||||
PluginShareCheckoutParams: CodexSchema.V2PluginShareCheckoutParams,
|
||||
PluginShareCheckoutResponse: CodexSchema.V2PluginShareCheckoutResponse,
|
||||
PluginShareDeleteParams: CodexSchema.V2PluginShareDeleteParams,
|
||||
PluginShareDeleteResponse: CodexSchema.V2PluginShareDeleteResponse,
|
||||
PluginShareListParams: CodexSchema.V2PluginShareListParams,
|
||||
PluginShareListResponse: CodexSchema.V2PluginShareListResponse,
|
||||
PluginShareSaveParams: CodexSchema.V2PluginShareSaveParams,
|
||||
PluginShareSaveResponse: CodexSchema.V2PluginShareSaveResponse,
|
||||
PluginShareUpdateTargetsParams: CodexSchema.V2PluginShareUpdateTargetsParams,
|
||||
PluginShareUpdateTargetsResponse: CodexSchema.V2PluginShareUpdateTargetsResponse,
|
||||
PluginSkillReadParams: CodexSchema.V2PluginSkillReadParams,
|
||||
PluginSkillReadResponse: CodexSchema.V2PluginSkillReadResponse,
|
||||
PluginUninstallParams: CodexSchema.V2PluginUninstallParams,
|
||||
PluginUninstallResponse: CodexSchema.V2PluginUninstallResponse,
|
||||
ProcessExitedNotification: CodexSchema.V2ProcessExitedNotification,
|
||||
ProcessOutputDeltaNotification: CodexSchema.V2ProcessOutputDeltaNotification,
|
||||
RawResponseCompletedNotification: CodexSchema.V2RawResponseCompletedNotification,
|
||||
RawResponseItemCompletedNotification: CodexSchema.V2RawResponseItemCompletedNotification,
|
||||
ReasoningSummaryPartAddedNotification: CodexSchema.V2ReasoningSummaryPartAddedNotification,
|
||||
ReasoningSummaryTextDeltaNotification: CodexSchema.V2ReasoningSummaryTextDeltaNotification,
|
||||
ReasoningTextDeltaNotification: CodexSchema.V2ReasoningTextDeltaNotification,
|
||||
RemoteControlStatusChangedNotification: CodexSchema.V2RemoteControlStatusChangedNotification,
|
||||
ReviewStartParams: CodexSchema.V2ReviewStartParams,
|
||||
ReviewStartResponse: CodexSchema.V2ReviewStartResponse,
|
||||
SendAddCreditsNudgeEmailParams: CodexSchema.V2SendAddCreditsNudgeEmailParams,
|
||||
SendAddCreditsNudgeEmailResponse: CodexSchema.V2SendAddCreditsNudgeEmailResponse,
|
||||
ServerRequestResolvedNotification: CodexSchema.V2ServerRequestResolvedNotification,
|
||||
SkillsChangedNotification: CodexSchema.V2SkillsChangedNotification,
|
||||
SkillsConfigWriteParams: CodexSchema.V2SkillsConfigWriteParams,
|
||||
SkillsConfigWriteResponse: CodexSchema.V2SkillsConfigWriteResponse,
|
||||
SkillsExtraRootsSetParams: CodexSchema.V2SkillsExtraRootsSetParams,
|
||||
SkillsExtraRootsSetResponse: CodexSchema.V2SkillsExtraRootsSetResponse,
|
||||
SkillsListParams: CodexSchema.V2SkillsListParams,
|
||||
SkillsListResponse: CodexSchema.V2SkillsListResponse,
|
||||
TerminalInteractionNotification: CodexSchema.V2TerminalInteractionNotification,
|
||||
ThreadApproveGuardianDeniedActionParams: CodexSchema.V2ThreadApproveGuardianDeniedActionParams,
|
||||
ThreadApproveGuardianDeniedActionResponse:
|
||||
CodexSchema.V2ThreadApproveGuardianDeniedActionResponse,
|
||||
ThreadArchivedNotification: CodexSchema.V2ThreadArchivedNotification,
|
||||
ThreadArchiveParams: CodexSchema.V2ThreadArchiveParams,
|
||||
ThreadArchiveResponse: CodexSchema.V2ThreadArchiveResponse,
|
||||
ThreadClosedNotification: CodexSchema.V2ThreadClosedNotification,
|
||||
ThreadCompactStartParams: CodexSchema.V2ThreadCompactStartParams,
|
||||
ThreadCompactStartResponse: CodexSchema.V2ThreadCompactStartResponse,
|
||||
ThreadDeletedNotification: CodexSchema.V2ThreadDeletedNotification,
|
||||
ThreadDeleteParams: CodexSchema.V2ThreadDeleteParams,
|
||||
ThreadDeleteResponse: CodexSchema.V2ThreadDeleteResponse,
|
||||
ThreadForkParams: CodexSchema.V2ThreadForkParams,
|
||||
ThreadForkResponse: CodexSchema.V2ThreadForkResponse,
|
||||
ThreadGoalClearedNotification: CodexSchema.V2ThreadGoalClearedNotification,
|
||||
ThreadGoalClearParams: CodexSchema.V2ThreadGoalClearParams,
|
||||
ThreadGoalClearResponse: CodexSchema.V2ThreadGoalClearResponse,
|
||||
ThreadGoalGetParams: CodexSchema.V2ThreadGoalGetParams,
|
||||
ThreadGoalGetResponse: CodexSchema.V2ThreadGoalGetResponse,
|
||||
ThreadGoalSetParams: CodexSchema.V2ThreadGoalSetParams,
|
||||
ThreadGoalSetResponse: CodexSchema.V2ThreadGoalSetResponse,
|
||||
ThreadGoalUpdatedNotification: CodexSchema.V2ThreadGoalUpdatedNotification,
|
||||
ThreadInjectItemsParams: CodexSchema.V2ThreadInjectItemsParams,
|
||||
ThreadInjectItemsResponse: CodexSchema.V2ThreadInjectItemsResponse,
|
||||
ThreadListParams: CodexSchema.V2ThreadListParams,
|
||||
ThreadListResponse: CodexSchema.V2ThreadListResponse,
|
||||
ThreadLoadedListParams: CodexSchema.V2ThreadLoadedListParams,
|
||||
@@ -213,16 +143,14 @@ export const v2 = {
|
||||
CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification,
|
||||
ThreadRealtimeSdpNotification: CodexSchema.V2ThreadRealtimeSdpNotification,
|
||||
ThreadRealtimeStartedNotification: CodexSchema.V2ThreadRealtimeStartedNotification,
|
||||
ThreadRealtimeTranscriptDeltaNotification:
|
||||
CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification,
|
||||
ThreadRealtimeTranscriptDoneNotification: CodexSchema.V2ThreadRealtimeTranscriptDoneNotification,
|
||||
ThreadRealtimeTranscriptUpdatedNotification:
|
||||
CodexSchema.V2ThreadRealtimeTranscriptUpdatedNotification,
|
||||
ThreadResumeParams: CodexSchema.V2ThreadResumeParams,
|
||||
ThreadResumeResponse: CodexSchema.V2ThreadResumeResponse,
|
||||
ThreadRollbackParams: CodexSchema.V2ThreadRollbackParams,
|
||||
ThreadRollbackResponse: CodexSchema.V2ThreadRollbackResponse,
|
||||
ThreadSetNameParams: CodexSchema.V2ThreadSetNameParams,
|
||||
ThreadSetNameResponse: CodexSchema.V2ThreadSetNameResponse,
|
||||
ThreadSettingsUpdatedNotification: CodexSchema.V2ThreadSettingsUpdatedNotification,
|
||||
ThreadShellCommandParams: CodexSchema.V2ThreadShellCommandParams,
|
||||
ThreadShellCommandResponse: CodexSchema.V2ThreadShellCommandResponse,
|
||||
ThreadStartedNotification: CodexSchema.V2ThreadStartedNotification,
|
||||
@@ -239,15 +167,12 @@ export const v2 = {
|
||||
TurnDiffUpdatedNotification: CodexSchema.V2TurnDiffUpdatedNotification,
|
||||
TurnInterruptParams: CodexSchema.V2TurnInterruptParams,
|
||||
TurnInterruptResponse: CodexSchema.V2TurnInterruptResponse,
|
||||
TurnModerationMetadataNotification: CodexSchema.V2TurnModerationMetadataNotification,
|
||||
TurnPlanUpdatedNotification: CodexSchema.V2TurnPlanUpdatedNotification,
|
||||
TurnStartedNotification: CodexSchema.V2TurnStartedNotification,
|
||||
TurnStartParams: CodexSchema.V2TurnStartParams,
|
||||
TurnStartResponse: CodexSchema.V2TurnStartResponse,
|
||||
TurnSteerParams: CodexSchema.V2TurnSteerParams,
|
||||
TurnSteerResponse: CodexSchema.V2TurnSteerResponse,
|
||||
WarningNotification: CodexSchema.V2WarningNotification,
|
||||
WindowsSandboxReadinessResponse: CodexSchema.V2WindowsSandboxReadinessResponse,
|
||||
WindowsSandboxSetupCompletedNotification: CodexSchema.V2WindowsSandboxSetupCompletedNotification,
|
||||
WindowsSandboxSetupStartParams: CodexSchema.V2WindowsSandboxSetupStartParams,
|
||||
WindowsSandboxSetupStartResponse: CodexSchema.V2WindowsSandboxSetupStartResponse,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,8 +1,11 @@
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Schema from "effect/Schema";
|
||||
import * as SchemaIssue from "effect/SchemaIssue";
|
||||
|
||||
import * as CodexError from "../errors.ts";
|
||||
|
||||
const formatSchemaIssue = SchemaIssue.makeFormatterDefault();
|
||||
|
||||
export const JsonRpcId = Schema.Union([Schema.Number, Schema.String]);
|
||||
|
||||
export const JsonRpcError = Schema.Struct({
|
||||
@@ -27,13 +30,16 @@ export const decodeOptionalPayload = <A, I>(
|
||||
return Effect.sync(() => undefined as A);
|
||||
}
|
||||
return Effect.fail(
|
||||
CodexError.CodexAppServerRequestError.unexpectedPayload(method, "decode-payload", raw),
|
||||
CodexError.CodexAppServerRequestError.invalidParams(`${method} does not accept params`, raw),
|
||||
);
|
||||
}
|
||||
|
||||
return Schema.decodeUnknownEffect(schema)(raw).pipe(
|
||||
Effect.mapError((error) =>
|
||||
CodexError.CodexAppServerRequestError.invalidPayload(method, "decode-payload", error),
|
||||
CodexError.CodexAppServerRequestError.invalidParams(
|
||||
`Invalid ${method} payload: ${formatSchemaIssue(error.issue)}`,
|
||||
{ issue: error.issue },
|
||||
),
|
||||
),
|
||||
);
|
||||
};
|
||||
@@ -48,13 +54,19 @@ export const encodeOptionalPayload = <A, I>(
|
||||
return Effect.sync(() => undefined);
|
||||
}
|
||||
return Effect.fail(
|
||||
CodexError.CodexAppServerRequestError.unexpectedPayload(method, "encode-payload", payload),
|
||||
CodexError.CodexAppServerRequestError.invalidParams(
|
||||
`${method} does not accept params`,
|
||||
payload,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Schema.encodeEffect(schema)(payload).pipe(
|
||||
Effect.mapError((error) =>
|
||||
CodexError.CodexAppServerRequestError.invalidPayload(method, "encode-payload", error),
|
||||
CodexError.CodexAppServerRequestError.invalidParams(
|
||||
`Invalid ${method} payload: ${formatSchemaIssue(error.issue)}`,
|
||||
{ issue: error.issue },
|
||||
),
|
||||
),
|
||||
);
|
||||
};
|
||||
@@ -65,12 +77,12 @@ export const decodeNotificationPayload = <A, I>(
|
||||
raw: unknown,
|
||||
): Effect.Effect<A, CodexError.CodexAppServerProtocolParseError> =>
|
||||
decodeOptionalPayload(method, schema, raw).pipe(
|
||||
Effect.mapError((error) =>
|
||||
CodexError.CodexAppServerProtocolParseError.fromRequestError(
|
||||
"decode-notification-payload",
|
||||
method,
|
||||
error,
|
||||
),
|
||||
Effect.mapError(
|
||||
(error) =>
|
||||
new CodexError.CodexAppServerProtocolParseError({
|
||||
detail: error.message,
|
||||
cause: error,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -84,8 +96,6 @@ export const runHandler = Effect.fnUntraced(function* <A, B>(
|
||||
}
|
||||
|
||||
return yield* handler(payload).pipe(
|
||||
Effect.mapError((error) =>
|
||||
CodexError.CodexAppServerRequestError.fromAppServerError(error, method),
|
||||
),
|
||||
Effect.mapError((error) => CodexError.normalizeToRequestError(error)),
|
||||
);
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
import * as CodexError from "../errors.ts";
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
export const makeChildStdio = (handle: ChildProcessSpawner.ChildProcessHandle) =>
|
||||
Stdio.make({
|
||||
@@ -24,7 +25,6 @@ export const makeChildStdio = (handle: ChildProcessSpawner.ChildProcessHandle) =
|
||||
export const makeInMemoryStdio = Effect.fn("makeInMemoryStdio")(function* () {
|
||||
const input = yield* Queue.unbounded<Uint8Array, Cause.Done<void>>();
|
||||
const output = yield* Queue.unbounded<string>();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
return {
|
||||
stdio: Stdio.make({
|
||||
@@ -32,10 +32,7 @@ export const makeInMemoryStdio = Effect.fn("makeInMemoryStdio")(function* () {
|
||||
stdin: Stream.fromQueue(input),
|
||||
stdout: () =>
|
||||
Sink.forEach((chunk: string | Uint8Array) =>
|
||||
Queue.offer(
|
||||
output,
|
||||
typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }),
|
||||
),
|
||||
Queue.offer(output, typeof chunk === "string" ? chunk : decoder.decode(chunk)),
|
||||
),
|
||||
stderr: () => Sink.drain,
|
||||
}),
|
||||
@@ -44,20 +41,14 @@ export const makeInMemoryStdio = Effect.fn("makeInMemoryStdio")(function* () {
|
||||
};
|
||||
});
|
||||
|
||||
type ChildProcessTerminationHandle = Pick<
|
||||
ChildProcessSpawner.ChildProcessHandle,
|
||||
"exitCode" | "pid"
|
||||
>;
|
||||
|
||||
export const makeTerminationError = (
|
||||
handle: ChildProcessTerminationHandle,
|
||||
handle: ChildProcessSpawner.ChildProcessHandle,
|
||||
): Effect.Effect<CodexError.CodexAppServerError> =>
|
||||
Effect.match(handle.exitCode, {
|
||||
onFailure: (cause) =>
|
||||
new CodexError.CodexAppServerTransportError({
|
||||
operation: "read-process-exit-status",
|
||||
pid: handle.pid,
|
||||
detail: "Failed to determine Codex App Server process exit status",
|
||||
cause,
|
||||
}),
|
||||
onSuccess: (code) => new CodexError.CodexAppServerProcessExitedError({ code, pid: handle.pid }),
|
||||
onSuccess: (code) => new CodexError.CodexAppServerProcessExitedError({ code }),
|
||||
});
|
||||
@@ -14,17 +14,15 @@ import * as CodexClient from "./client.ts";
|
||||
const mockPeerPath = Effect.map(Effect.service(Path.Path), (path) =>
|
||||
path.join(import.meta.dirname, "../test/fixtures/codex-app-server-mock-peer.ts"),
|
||||
);
|
||||
const mockPeerArgs = (path: string) => [path];
|
||||
|
||||
it.layer(NodeServices.layer)("effect-codex-app-server client", (it) => {
|
||||
const makeHandle = (env?: Record<string, string>) =>
|
||||
const makeHandle = () =>
|
||||
Effect.gen(function* () {
|
||||
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
||||
const path = yield* Path.Path;
|
||||
const peerCwd = path.join(import.meta.dirname, "..");
|
||||
const command = ChildProcess.make(process.execPath, mockPeerArgs(yield* mockPeerPath), {
|
||||
cwd: peerCwd,
|
||||
...(env ? { env: { ...process.env, ...env } } : {}),
|
||||
const command = ChildProcess.make("bun", ["run", yield* mockPeerPath], {
|
||||
cwd: path.join(import.meta.dirname, ".."),
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
return yield* spawner.spawn(command);
|
||||
});
|
||||
@@ -80,11 +78,11 @@ it.layer(NodeServices.layer)("effect-codex-app-server client", (it) => {
|
||||
planType: "plus",
|
||||
});
|
||||
|
||||
const path = yield* Path.Path;
|
||||
const peerCwd = path.join(import.meta.dirname, "..");
|
||||
const skills = yield* client.request("skills/list", { cwds: [peerCwd] });
|
||||
const skills = yield* client.request("skills/list", {
|
||||
cwds: [process.cwd()],
|
||||
});
|
||||
assert.equal(skills.data.length, 1);
|
||||
assert.equal(skills.data[0]?.cwd, peerCwd);
|
||||
assert.equal(skills.data[0]?.cwd, process.cwd());
|
||||
|
||||
return {
|
||||
account,
|
||||
@@ -123,35 +121,4 @@ it.layer(NodeServices.layer)("effect-codex-app-server client", (it) => {
|
||||
]);
|
||||
}),
|
||||
);
|
||||
it.effect("drains child stderr so large diagnostics cannot block protocol responses", () =>
|
||||
Effect.gen(function* () {
|
||||
const handle = yield* makeHandle({
|
||||
CODEX_APP_SERVER_TEST_STDERR_BYTES: String(512 * 1024),
|
||||
});
|
||||
const scope = yield* Scope.make();
|
||||
const clientLayer = CodexClient.layerChildProcess(handle);
|
||||
const context = yield* Layer.buildWithScope(clientLayer, scope);
|
||||
|
||||
const initialized = yield* Effect.gen(function* () {
|
||||
const client = yield* CodexClient.CodexAppServerClient;
|
||||
return yield* client.request("initialize", {
|
||||
clientInfo: {
|
||||
name: "effect-codex-app-server-test",
|
||||
title: "Effect Codex App Server Test",
|
||||
version: "0.0.0",
|
||||
},
|
||||
capabilities: {
|
||||
experimentalApi: true,
|
||||
optOutNotificationMethods: null,
|
||||
},
|
||||
});
|
||||
}).pipe(
|
||||
Effect.timeout("5 seconds"),
|
||||
Effect.provide(context),
|
||||
Effect.ensuring(Scope.close(scope, Exit.void)),
|
||||
);
|
||||
|
||||
assert.equal(initialized.userAgent, "mock-codex-app-server");
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -4,8 +4,7 @@ import * as Layer from "effect/Layer";
|
||||
import * as Schema from "effect/Schema";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stdio from "effect/Stdio";
|
||||
import * as Stream from "effect/Stream";
|
||||
import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import * as CodexRpc from "./_generated/meta.gen.ts";
|
||||
import * as CodexError from "./errors.ts";
|
||||
@@ -35,47 +34,46 @@ interface CodexAppServerClientRaw {
|
||||
readonly respondError: CodexProtocol.CodexAppServerPatchedProtocol["respondError"];
|
||||
}
|
||||
|
||||
export interface CodexAppServerClientShape {
|
||||
readonly raw: CodexAppServerClientRaw;
|
||||
readonly request: <M extends CodexRpc.ClientRequestMethod>(
|
||||
method: M,
|
||||
payload: CodexRpc.ClientRequestParamsByMethod[M],
|
||||
) => Effect.Effect<CodexRpc.ClientRequestResponsesByMethod[M], CodexError.CodexAppServerError>;
|
||||
readonly notify: <M extends CodexRpc.ClientNotificationMethod>(
|
||||
method: M,
|
||||
payload: CodexRpc.ClientNotificationParamsByMethod[M],
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>;
|
||||
readonly handleServerRequest: <M extends CodexRpc.ServerRequestMethod>(
|
||||
method: M,
|
||||
handler: (
|
||||
payload: CodexRpc.ServerRequestParamsByMethod[M],
|
||||
) => Effect.Effect<CodexRpc.ServerRequestResponsesByMethod[M], CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleServerNotification: <M extends CodexRpc.ServerNotificationMethod>(
|
||||
method: M,
|
||||
handler: (
|
||||
payload: CodexRpc.ServerNotificationParamsByMethod[M],
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleUnknownServerRequest: (
|
||||
handler: (
|
||||
method: string,
|
||||
params: unknown,
|
||||
) => Effect.Effect<unknown, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleUnknownServerNotification: (
|
||||
handler: (
|
||||
method: string,
|
||||
params: unknown,
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
}
|
||||
|
||||
export class CodexAppServerClient extends Context.Service<
|
||||
CodexAppServerClient,
|
||||
{
|
||||
readonly raw: CodexAppServerClientRaw;
|
||||
readonly request: <M extends CodexRpc.ClientRequestMethod>(
|
||||
method: M,
|
||||
payload: CodexRpc.ClientRequestParamsByMethod[M],
|
||||
) => Effect.Effect<CodexRpc.ClientRequestResponsesByMethod[M], CodexError.CodexAppServerError>;
|
||||
readonly notify: <M extends CodexRpc.ClientNotificationMethod>(
|
||||
method: M,
|
||||
payload: CodexRpc.ClientNotificationParamsByMethod[M],
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>;
|
||||
readonly handleServerRequest: <M extends CodexRpc.ServerRequestMethod>(
|
||||
method: M,
|
||||
handler: (
|
||||
payload: CodexRpc.ServerRequestParamsByMethod[M],
|
||||
) => Effect.Effect<
|
||||
CodexRpc.ServerRequestResponsesByMethod[M],
|
||||
CodexError.CodexAppServerError
|
||||
>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleServerNotification: <M extends CodexRpc.ServerNotificationMethod>(
|
||||
method: M,
|
||||
handler: (
|
||||
payload: CodexRpc.ServerNotificationParamsByMethod[M],
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleUnknownServerRequest: (
|
||||
handler: (
|
||||
method: string,
|
||||
params: unknown,
|
||||
) => Effect.Effect<unknown, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
readonly handleUnknownServerNotification: (
|
||||
handler: (
|
||||
method: string,
|
||||
params: unknown,
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>;
|
||||
}
|
||||
>()("effect-codex-app-server/client/CodexAppServerClient") {}
|
||||
CodexAppServerClientShape
|
||||
>()("effect-codex-app-server/CodexAppServerClient") {}
|
||||
|
||||
type ServerRequestHandler = (
|
||||
payload: unknown,
|
||||
@@ -88,7 +86,7 @@ export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make
|
||||
stdio: Stdio.Stdio,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
terminationError?: Effect.Effect<CodexError.CodexAppServerError>,
|
||||
): Effect.fn.Return<CodexAppServerClient["Service"], never, Scope.Scope> {
|
||||
): Effect.fn.Return<CodexAppServerClientShape, never, Scope.Scope> {
|
||||
const requestHandlers = new Map<string, ServerRequestHandler>();
|
||||
const notificationHandlers = new Map<string, Array<ServerNotificationHandler>>();
|
||||
let unknownRequestHandler:
|
||||
@@ -250,20 +248,51 @@ export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make
|
||||
});
|
||||
});
|
||||
|
||||
export const layer = (
|
||||
stdio: Stdio.Stdio,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
): Layer.Layer<CodexAppServerClient> => Layer.effect(CodexAppServerClient, make(stdio, options));
|
||||
|
||||
export const layerChildProcess = (
|
||||
handle: ChildProcessSpawner.ChildProcessHandle,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
): Layer.Layer<CodexAppServerClient> =>
|
||||
Layer.effect(CodexAppServerClient, makeChildProcessClient(handle, options));
|
||||
): Layer.Layer<CodexAppServerClient> => {
|
||||
const stdio = makeChildStdio(handle);
|
||||
const terminationError = makeTerminationError(handle);
|
||||
return Layer.effect(CodexAppServerClient, make(stdio, options, terminationError));
|
||||
};
|
||||
|
||||
const makeChildProcessClient = Effect.fn(
|
||||
"effect-codex-app-server/CodexAppServerClient.makeChildProcessClient",
|
||||
)(function* (handle: ChildProcessSpawner.ChildProcessHandle, options: CodexAppServerClientOptions) {
|
||||
yield* Stream.runDrain(handle.stderr).pipe(Effect.ignore, Effect.forkScoped);
|
||||
return yield* make(makeChildStdio(handle), options, makeTerminationError(handle));
|
||||
});
|
||||
export interface CodexAppServerCommandLayerOptions extends CodexAppServerClientOptions {
|
||||
readonly command: string;
|
||||
readonly args?: ReadonlyArray<string>;
|
||||
readonly cwd?: string;
|
||||
readonly env?: Record<string, string>;
|
||||
}
|
||||
|
||||
export const layerCommand = (
|
||||
options: CodexAppServerCommandLayerOptions,
|
||||
): Layer.Layer<
|
||||
CodexAppServerClient,
|
||||
CodexError.CodexAppServerSpawnError,
|
||||
ChildProcessSpawner.ChildProcessSpawner
|
||||
> =>
|
||||
Layer.effect(
|
||||
CodexAppServerClient,
|
||||
Effect.acquireRelease(
|
||||
Effect.gen(function* () {
|
||||
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
||||
const command = ChildProcess.make(options.command, [...(options.args ?? [])], {
|
||||
...(options.cwd ? { cwd: options.cwd } : {}),
|
||||
...(options.env ? { env: { ...process.env, ...options.env } } : {}),
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
const handle = yield* spawner.spawn(command).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new CodexError.CodexAppServerSpawnError({
|
||||
command: [options.command, ...(options.args ?? [])].join(" "),
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
const client = yield* make(makeChildStdio(handle), options, makeTerminationError(handle));
|
||||
return { client, handle };
|
||||
}),
|
||||
({ handle }) => handle.kill().pipe(Effect.orDie),
|
||||
).pipe(Effect.map(({ client }) => client)),
|
||||
);
|
||||
@@ -1,126 +1,4 @@
|
||||
import * as Schema from "effect/Schema";
|
||||
import type * as SchemaIssue from "effect/SchemaIssue";
|
||||
|
||||
export const CodexAppServerRequestOperation = Schema.Literals([
|
||||
"decode-payload",
|
||||
"encode-payload",
|
||||
"handle-request",
|
||||
"receive-response",
|
||||
]);
|
||||
export type CodexAppServerRequestOperation = typeof CodexAppServerRequestOperation.Type;
|
||||
|
||||
export const CodexAppServerSchemaIssueKind = Schema.Literals([
|
||||
"Filter",
|
||||
"Encoding",
|
||||
"Pointer",
|
||||
"Composite",
|
||||
"AnyOf",
|
||||
"InvalidType",
|
||||
"InvalidValue",
|
||||
"MissingKey",
|
||||
"UnexpectedKey",
|
||||
"Forbidden",
|
||||
"OneOf",
|
||||
]);
|
||||
export type CodexAppServerSchemaIssueKind = typeof CodexAppServerSchemaIssueKind.Type;
|
||||
|
||||
export interface CodexAppServerSchemaIssueDiagnostics {
|
||||
readonly issueCount: number;
|
||||
readonly issueKinds: ReadonlyArray<CodexAppServerSchemaIssueKind>;
|
||||
readonly maximumPathDepth: number;
|
||||
}
|
||||
|
||||
const schemaIssueDiagnostics = (root: SchemaIssue.Issue): CodexAppServerSchemaIssueDiagnostics => {
|
||||
let issueCount = 0;
|
||||
let maximumPathDepth = 0;
|
||||
const issueKinds = new Set<CodexAppServerSchemaIssueKind>();
|
||||
|
||||
const visit = (issue: SchemaIssue.Issue, pathDepth: number): void => {
|
||||
issueCount += 1;
|
||||
issueKinds.add(issue._tag);
|
||||
maximumPathDepth = Math.max(maximumPathDepth, pathDepth);
|
||||
switch (issue._tag) {
|
||||
case "Filter":
|
||||
case "Encoding":
|
||||
visit(issue.issue, pathDepth);
|
||||
break;
|
||||
case "Pointer":
|
||||
visit(issue.issue, pathDepth + issue.path.length);
|
||||
break;
|
||||
case "Composite":
|
||||
case "AnyOf":
|
||||
for (const child of issue.issues) visit(child, pathDepth);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
visit(root, 0);
|
||||
return {
|
||||
issueCount,
|
||||
issueKinds: [...issueKinds],
|
||||
maximumPathDepth,
|
||||
};
|
||||
};
|
||||
|
||||
export const CodexAppServerPayloadKind = Schema.Literals([
|
||||
"null",
|
||||
"array",
|
||||
"string",
|
||||
"number",
|
||||
"boolean",
|
||||
"bigint",
|
||||
"object",
|
||||
"symbol",
|
||||
"function",
|
||||
"undefined",
|
||||
]);
|
||||
export type CodexAppServerPayloadKind = typeof CodexAppServerPayloadKind.Type;
|
||||
|
||||
const payloadKind = (payload: unknown): CodexAppServerPayloadKind => {
|
||||
if (payload === null) return "null";
|
||||
if (Array.isArray(payload)) return "array";
|
||||
return typeof payload;
|
||||
};
|
||||
|
||||
const protocolMessageFields = ["id", "method", "params", "result", "error"] as const;
|
||||
|
||||
export const CodexAppServerProtocolMessageField = Schema.Literals(protocolMessageFields);
|
||||
export type CodexAppServerProtocolMessageField = typeof CodexAppServerProtocolMessageField.Type;
|
||||
|
||||
export interface CodexAppServerRequestDiagnostics {
|
||||
readonly method?: string;
|
||||
readonly requestId?: string;
|
||||
readonly operation?: CodexAppServerRequestOperation;
|
||||
readonly cause?: unknown;
|
||||
readonly issueCount?: number;
|
||||
readonly issueKinds?: ReadonlyArray<CodexAppServerSchemaIssueKind>;
|
||||
readonly maximumPathDepth?: number;
|
||||
readonly payloadKind?: CodexAppServerPayloadKind;
|
||||
}
|
||||
|
||||
export const CodexAppServerProtocolParseOperation = Schema.Literals([
|
||||
"encode-wire-message",
|
||||
"decode-wire-message",
|
||||
"route-wire-message",
|
||||
"decode-notification-payload",
|
||||
"decode-request-payload",
|
||||
"decode-response-payload",
|
||||
]);
|
||||
export type CodexAppServerProtocolParseOperation = typeof CodexAppServerProtocolParseOperation.Type;
|
||||
|
||||
export const CodexAppServerTransportOperation = Schema.Literals([
|
||||
"read-input-stream",
|
||||
"read-process-exit-status",
|
||||
]);
|
||||
export type CodexAppServerTransportOperation = typeof CodexAppServerTransportOperation.Type;
|
||||
|
||||
export const CodexAppServerIdentifierPurpose = Schema.Literals([
|
||||
"provider-event",
|
||||
"command-approval-request",
|
||||
"file-change-approval-request",
|
||||
"user-input-request",
|
||||
]);
|
||||
export type CodexAppServerIdentifierPurpose = typeof CodexAppServerIdentifierPurpose.Type;
|
||||
|
||||
export interface CodexAppServerProtocolErrorShape {
|
||||
readonly code: number;
|
||||
@@ -132,7 +10,7 @@ export class CodexAppServerSpawnError extends Schema.TaggedErrorClass<CodexAppSe
|
||||
"CodexAppServerSpawnError",
|
||||
{
|
||||
command: Schema.optional(Schema.String),
|
||||
cause: Schema.Defect(),
|
||||
cause: Schema.Defect,
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
@@ -146,8 +24,7 @@ export class CodexAppServerProcessExitedError extends Schema.TaggedErrorClass<Co
|
||||
"CodexAppServerProcessExitedError",
|
||||
{
|
||||
code: Schema.optional(Schema.Number),
|
||||
pid: Schema.optionalKey(Schema.Int),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
@@ -160,107 +37,24 @@ export class CodexAppServerProcessExitedError extends Schema.TaggedErrorClass<Co
|
||||
export class CodexAppServerProtocolParseError extends Schema.TaggedErrorClass<CodexAppServerProtocolParseError>()(
|
||||
"CodexAppServerProtocolParseError",
|
||||
{
|
||||
operation: CodexAppServerProtocolParseOperation,
|
||||
method: Schema.optionalKey(Schema.String),
|
||||
requestId: Schema.optionalKey(Schema.String),
|
||||
payloadKind: Schema.optionalKey(CodexAppServerPayloadKind),
|
||||
presentFields: Schema.optionalKey(Schema.Array(CodexAppServerProtocolMessageField)),
|
||||
issueCount: Schema.optionalKey(Schema.Number),
|
||||
issueKinds: Schema.optionalKey(Schema.Array(CodexAppServerSchemaIssueKind)),
|
||||
maximumPathDepth: Schema.optionalKey(Schema.Number),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
detail: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
const method = this.method === undefined ? "" : ` for method '${this.method}'`;
|
||||
return `Codex App Server protocol operation '${this.operation}' failed${method}.`;
|
||||
}
|
||||
|
||||
static fromSchemaError(
|
||||
operation: CodexAppServerProtocolParseOperation,
|
||||
cause: Schema.SchemaError,
|
||||
context: { readonly method?: string; readonly requestId?: string } = {},
|
||||
) {
|
||||
return new CodexAppServerProtocolParseError({
|
||||
operation,
|
||||
...context,
|
||||
...schemaIssueDiagnostics(cause.issue),
|
||||
cause,
|
||||
});
|
||||
}
|
||||
|
||||
static fromRequestError(
|
||||
operation: CodexAppServerProtocolParseOperation,
|
||||
method: string,
|
||||
cause: CodexAppServerRequestError,
|
||||
) {
|
||||
return new CodexAppServerProtocolParseError({
|
||||
operation,
|
||||
method,
|
||||
...(cause.issueCount === undefined ? {} : { issueCount: cause.issueCount }),
|
||||
...(cause.issueKinds === undefined ? {} : { issueKinds: cause.issueKinds }),
|
||||
...(cause.maximumPathDepth === undefined ? {} : { maximumPathDepth: cause.maximumPathDepth }),
|
||||
cause,
|
||||
});
|
||||
}
|
||||
|
||||
static fromUnroutableMessage(message: unknown) {
|
||||
const diagnostics = { payloadKind: payloadKind(message) };
|
||||
if (typeof message !== "object" || message === null || Array.isArray(message)) {
|
||||
return new CodexAppServerProtocolParseError({
|
||||
operation: "route-wire-message",
|
||||
...diagnostics,
|
||||
});
|
||||
}
|
||||
|
||||
const presentFields = protocolMessageFields.filter((field) => field in message);
|
||||
const method =
|
||||
"method" in message && typeof message.method === "string" ? message.method : undefined;
|
||||
const requestId =
|
||||
"id" in message && (typeof message.id === "string" || typeof message.id === "number")
|
||||
? String(message.id)
|
||||
: undefined;
|
||||
return new CodexAppServerProtocolParseError({
|
||||
operation: "route-wire-message",
|
||||
...diagnostics,
|
||||
presentFields,
|
||||
...(method === undefined ? {} : { method }),
|
||||
...(requestId === undefined ? {} : { requestId }),
|
||||
});
|
||||
return `Failed to parse Codex App Server protocol message: ${this.detail}`;
|
||||
}
|
||||
}
|
||||
|
||||
export class CodexAppServerTransportError extends Schema.TaggedErrorClass<CodexAppServerTransportError>()(
|
||||
"CodexAppServerTransportError",
|
||||
{
|
||||
operation: CodexAppServerTransportOperation,
|
||||
pid: Schema.optionalKey(Schema.Int),
|
||||
cause: Schema.Defect(),
|
||||
detail: Schema.String,
|
||||
cause: Schema.Defect,
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
return `Codex App Server transport operation '${this.operation}' failed.`;
|
||||
}
|
||||
}
|
||||
|
||||
export class CodexAppServerIdentifierGenerationError extends Schema.TaggedErrorClass<CodexAppServerIdentifierGenerationError>()(
|
||||
"CodexAppServerIdentifierGenerationError",
|
||||
{
|
||||
purpose: CodexAppServerIdentifierPurpose,
|
||||
cause: Schema.Defect(),
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
return `Failed to generate Codex App Server identifier for ${this.purpose}.`;
|
||||
}
|
||||
}
|
||||
|
||||
export class CodexAppServerInputStreamEndedError extends Schema.TaggedErrorClass<CodexAppServerInputStreamEndedError>()(
|
||||
"CodexAppServerInputStreamEndedError",
|
||||
{},
|
||||
) {
|
||||
override get message() {
|
||||
return "Codex App Server input stream ended.";
|
||||
return this.detail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,51 +64,20 @@ export class CodexAppServerRequestError extends Schema.TaggedErrorClass<CodexApp
|
||||
code: Schema.Number,
|
||||
errorMessage: Schema.String,
|
||||
data: Schema.optional(Schema.Unknown),
|
||||
method: Schema.optionalKey(Schema.String),
|
||||
requestId: Schema.optionalKey(Schema.String),
|
||||
operation: Schema.optionalKey(CodexAppServerRequestOperation),
|
||||
issueCount: Schema.optionalKey(Schema.Number),
|
||||
issueKinds: Schema.optionalKey(Schema.Array(CodexAppServerSchemaIssueKind)),
|
||||
maximumPathDepth: Schema.optionalKey(Schema.Number),
|
||||
payloadKind: Schema.optionalKey(CodexAppServerPayloadKind),
|
||||
cause: Schema.optionalKey(Schema.Defect()),
|
||||
},
|
||||
) {
|
||||
override get message() {
|
||||
return this.errorMessage;
|
||||
}
|
||||
|
||||
static fromProtocolError(
|
||||
error: CodexAppServerProtocolErrorShape,
|
||||
method: string,
|
||||
requestId: string,
|
||||
) {
|
||||
static fromProtocolError(error: CodexAppServerProtocolErrorShape) {
|
||||
return new CodexAppServerRequestError({
|
||||
code: error.code,
|
||||
errorMessage: error.message,
|
||||
...(error.data !== undefined ? { data: error.data } : {}),
|
||||
method,
|
||||
requestId,
|
||||
operation: "receive-response",
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
|
||||
static fromAppServerError(error: CodexAppServerError, method: string) {
|
||||
if (error._tag === "CodexAppServerRequestError") {
|
||||
return error;
|
||||
}
|
||||
return CodexAppServerRequestError.internalError(
|
||||
`Codex App Server request handler failed for method '${method}'`,
|
||||
undefined,
|
||||
{
|
||||
method,
|
||||
operation: "handle-request",
|
||||
cause: error,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static parseError(message = "Parse error", data?: unknown) {
|
||||
return new CodexAppServerRequestError({
|
||||
code: -32700,
|
||||
@@ -338,62 +101,19 @@ export class CodexAppServerRequestError extends Schema.TaggedErrorClass<CodexApp
|
||||
});
|
||||
}
|
||||
|
||||
static invalidParams(
|
||||
message = "Invalid params",
|
||||
data?: unknown,
|
||||
diagnostics: CodexAppServerRequestDiagnostics = {},
|
||||
) {
|
||||
static invalidParams(message = "Invalid params", data?: unknown) {
|
||||
return new CodexAppServerRequestError({
|
||||
code: -32602,
|
||||
errorMessage: message,
|
||||
...(data !== undefined ? { data } : {}),
|
||||
...diagnostics,
|
||||
});
|
||||
}
|
||||
|
||||
static invalidPayload(
|
||||
method: string,
|
||||
operation: "decode-payload" | "encode-payload",
|
||||
cause: Schema.SchemaError,
|
||||
) {
|
||||
const diagnostics = schemaIssueDiagnostics(cause.issue);
|
||||
return new CodexAppServerRequestError({
|
||||
code: -32602,
|
||||
errorMessage: `Invalid payload for method '${method}' during '${operation}'`,
|
||||
data: diagnostics,
|
||||
method,
|
||||
operation,
|
||||
...diagnostics,
|
||||
cause,
|
||||
});
|
||||
}
|
||||
|
||||
static unexpectedPayload(
|
||||
method: string,
|
||||
operation: "decode-payload" | "encode-payload",
|
||||
payload: unknown,
|
||||
) {
|
||||
const diagnostics = { payloadKind: payloadKind(payload) };
|
||||
return new CodexAppServerRequestError({
|
||||
code: -32602,
|
||||
errorMessage: `Method '${method}' does not accept a payload during '${operation}'`,
|
||||
data: diagnostics,
|
||||
method,
|
||||
operation,
|
||||
...diagnostics,
|
||||
});
|
||||
}
|
||||
|
||||
static internalError(
|
||||
message = "Internal error",
|
||||
data?: unknown,
|
||||
diagnostics: CodexAppServerRequestDiagnostics = {},
|
||||
) {
|
||||
static internalError(message = "Internal error", data?: unknown) {
|
||||
return new CodexAppServerRequestError({
|
||||
code: -32603,
|
||||
errorMessage: message,
|
||||
...(data !== undefined ? { data } : {}),
|
||||
...diagnostics,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -420,8 +140,12 @@ export const CodexAppServerError = Schema.Union([
|
||||
CodexAppServerProcessExitedError,
|
||||
CodexAppServerProtocolParseError,
|
||||
CodexAppServerTransportError,
|
||||
CodexAppServerIdentifierGenerationError,
|
||||
CodexAppServerInputStreamEndedError,
|
||||
]);
|
||||
|
||||
export type CodexAppServerError = typeof CodexAppServerError.Type;
|
||||
|
||||
export function normalizeToRequestError(error: CodexAppServerError): CodexAppServerRequestError {
|
||||
return Schema.is(CodexAppServerRequestError)(error)
|
||||
? error
|
||||
: CodexAppServerRequestError.internalError(error.message);
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import * as Deferred from "effect/Deferred";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
import * as Queue from "effect/Queue";
|
||||
import * as Schema from "effect/Schema";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
@@ -10,124 +9,13 @@ import { assert, it } from "@effect/vitest";
|
||||
|
||||
import * as CodexError from "./errors.ts";
|
||||
import * as CodexProtocol from "./protocol.ts";
|
||||
import * as CodexRpc from "./rpc.ts";
|
||||
import * as CodexSchema from "./schema.ts";
|
||||
import { makeInMemoryStdio } from "./_internal/stdio.ts";
|
||||
const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
const encodeJsonl = (value: unknown) => encoder.encode(`${encodeUnknownJsonString(value)}\n`);
|
||||
|
||||
const decodeJson = Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown));
|
||||
const decodeAccountTokenUsageResponse = Schema.decodeUnknownEffect(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/usage/read"],
|
||||
);
|
||||
const decodeAccountRateLimitsResponse = Schema.decodeUnknownEffect(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/rateLimits/read"],
|
||||
);
|
||||
const decodeConsumeRateLimitResetCreditParams = Schema.decodeUnknownEffect(
|
||||
CodexRpc.CLIENT_REQUEST_PARAMS["account/rateLimitResetCredit/consume"],
|
||||
);
|
||||
const decodeConsumeRateLimitResetCreditResponse = Schema.decodeUnknownEffect(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/rateLimitResetCredit/consume"],
|
||||
);
|
||||
const encodeJsonl = (value: unknown) => encoder.encode(`${JSON.stringify(value)}\n`);
|
||||
|
||||
it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
it.effect("maps account usage responses to the upstream token usage schema", () =>
|
||||
Effect.gen(function* () {
|
||||
assert.strictEqual(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/usage/read"],
|
||||
CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
);
|
||||
const decoded = yield* decodeAccountTokenUsageResponse({
|
||||
dailyUsageBuckets: [{ startDate: "2026-06-10", tokens: 42 }],
|
||||
summary: { lifetimeTokens: 42 },
|
||||
});
|
||||
assert.deepEqual(decoded, {
|
||||
dailyUsageBuckets: [{ startDate: "2026-06-10", tokens: 42 }],
|
||||
summary: { lifetimeTokens: 42 },
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("maps earned rate-limit reset credits from account rate-limit snapshots", () =>
|
||||
Effect.gen(function* () {
|
||||
assert.strictEqual(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/rateLimits/read"],
|
||||
CodexSchema.V2GetAccountRateLimitsResponse,
|
||||
);
|
||||
|
||||
const response = {
|
||||
rateLimits: {},
|
||||
rateLimitResetCredits: {
|
||||
availableCount: 2,
|
||||
credits: [
|
||||
{
|
||||
id: "RateLimitResetCredit_1",
|
||||
resetType: "codexRateLimits",
|
||||
status: "available",
|
||||
grantedAt: 1_781_654_400,
|
||||
expiresAt: 1_784_246_400,
|
||||
title: "Full reset",
|
||||
description: "Ready to redeem",
|
||||
},
|
||||
{
|
||||
id: "RateLimitResetCredit_2",
|
||||
resetType: "unknown",
|
||||
status: "unknown",
|
||||
grantedAt: 1_781_654_401,
|
||||
expiresAt: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
} as const;
|
||||
|
||||
assert.deepEqual(yield* decodeAccountRateLimitsResponse(response), response);
|
||||
assert.deepEqual(
|
||||
yield* decodeAccountRateLimitsResponse({
|
||||
rateLimits: {},
|
||||
rateLimitResetCredits: { availableCount: 2, credits: null },
|
||||
}),
|
||||
{
|
||||
rateLimits: {},
|
||||
rateLimitResetCredits: { availableCount: 2, credits: null },
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("maps the earned rate-limit reset consume request and response", () =>
|
||||
Effect.gen(function* () {
|
||||
assert.equal(
|
||||
CodexRpc.CLIENT_REQUEST_METHODS["account/rateLimitResetCredit/consume"],
|
||||
"account/rateLimitResetCredit/consume",
|
||||
);
|
||||
assert.strictEqual(
|
||||
CodexRpc.CLIENT_REQUEST_PARAMS["account/rateLimitResetCredit/consume"],
|
||||
CodexSchema.V2ConsumeAccountRateLimitResetCreditParams,
|
||||
);
|
||||
assert.strictEqual(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/rateLimitResetCredit/consume"],
|
||||
CodexSchema.V2ConsumeAccountRateLimitResetCreditResponse,
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
yield* decodeConsumeRateLimitResetCreditParams({
|
||||
idempotencyKey: "8ae96ff3-3425-4f4c-8772-b6fd61502868",
|
||||
creditId: "RateLimitResetCredit_1",
|
||||
}),
|
||||
{
|
||||
idempotencyKey: "8ae96ff3-3425-4f4c-8772-b6fd61502868",
|
||||
creditId: "RateLimitResetCredit_1",
|
||||
},
|
||||
);
|
||||
assert.deepEqual(yield* decodeConsumeRateLimitResetCreditResponse({ outcome: "reset" }), {
|
||||
outcome: "reset",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"encodes requests without a jsonrpc field and routes inbound requests and notifications",
|
||||
() =>
|
||||
@@ -172,7 +60,7 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
const pendingInitialize = yield* transport
|
||||
.request("initialize", initializeParams)
|
||||
.pipe(Effect.forkScoped);
|
||||
assert.deepEqual(yield* decodeJson(yield* Queue.take(output)), {
|
||||
assert.deepEqual(JSON.parse(yield* Queue.take(output)), {
|
||||
id: 1,
|
||||
method: "initialize",
|
||||
params: initializeParams,
|
||||
@@ -265,7 +153,7 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.deepEqual(yield* decodeJson(yield* Queue.take(output)), {
|
||||
assert.deepEqual(JSON.parse(yield* Queue.take(output)), {
|
||||
id: 77,
|
||||
result: {
|
||||
answers: {
|
||||
@@ -280,7 +168,7 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
78,
|
||||
CodexError.CodexAppServerRequestError.methodNotFound("x/test"),
|
||||
);
|
||||
assert.deepEqual(yield* decodeJson(yield* Queue.take(output)), {
|
||||
assert.deepEqual(JSON.parse(yield* Queue.take(output)), {
|
||||
id: 78,
|
||||
error: {
|
||||
code: -32601,
|
||||
@@ -297,151 +185,13 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
|
||||
const bigintError = yield* transport.notify("x/test", 1n).pipe(Effect.flip);
|
||||
assert.instanceOf(bigintError, CodexError.CodexAppServerProtocolParseError);
|
||||
assert.equal(bigintError.operation, "encode-wire-message");
|
||||
assert.equal(bigintError.method, "x/test");
|
||||
assert.exists(bigintError.cause);
|
||||
assert.equal(
|
||||
bigintError.message,
|
||||
"Codex App Server protocol operation 'encode-wire-message' failed for method 'x/test'.",
|
||||
);
|
||||
assert.equal(bigintError.detail, "Failed to encode Codex App Server message");
|
||||
|
||||
const circular: Record<string, unknown> = {};
|
||||
circular.self = circular;
|
||||
const circularError = yield* transport.notify("x/test", circular).pipe(Effect.flip);
|
||||
assert.instanceOf(circularError, CodexError.CodexAppServerProtocolParseError);
|
||||
assert.equal(circularError.operation, "encode-wire-message");
|
||||
assert.equal(circularError.method, "x/test");
|
||||
assert.exists(circularError.cause);
|
||||
|
||||
const requestError = yield* transport.request("x/request", 1n).pipe(
|
||||
Effect.match({
|
||||
onFailure: (error) => error,
|
||||
onSuccess: () => assert.fail("Expected request encoding to fail"),
|
||||
}),
|
||||
);
|
||||
assert.instanceOf(requestError, CodexError.CodexAppServerProtocolParseError);
|
||||
assert.deepInclude(requestError, {
|
||||
operation: "encode-wire-message",
|
||||
method: "x/request",
|
||||
requestId: "1",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("correlates response errors with the originating request", () =>
|
||||
Effect.gen(function* () {
|
||||
const { stdio, input, output } = yield* makeInMemoryStdio();
|
||||
const transport = yield* CodexProtocol.makeCodexAppServerPatchedProtocol({ stdio });
|
||||
|
||||
const response = yield* transport.request("thread/start", {}).pipe(Effect.forkScoped);
|
||||
yield* Queue.take(output);
|
||||
yield* Queue.offer(
|
||||
input,
|
||||
encodeJsonl({
|
||||
id: 1,
|
||||
error: {
|
||||
code: -32602,
|
||||
message: "Invalid params",
|
||||
data: { field: "cwd" },
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const error = yield* Fiber.join(response).pipe(
|
||||
Effect.match({
|
||||
onFailure: (error) => error,
|
||||
onSuccess: () => assert.fail("Expected Codex App Server request to fail"),
|
||||
}),
|
||||
);
|
||||
assert.instanceOf(error, CodexError.CodexAppServerRequestError);
|
||||
assert.deepInclude(error, {
|
||||
code: -32602,
|
||||
errorMessage: "Invalid params",
|
||||
method: "thread/start",
|
||||
requestId: "1",
|
||||
operation: "receive-response",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("logs decode failures without copying the cause or wire payload", () =>
|
||||
Effect.gen(function* () {
|
||||
const secret = "codex-wire-secret-sentinel";
|
||||
const { stdio, input } = yield* makeInMemoryStdio();
|
||||
const events: Array<CodexProtocol.CodexAppServerProtocolLogEvent> = [];
|
||||
const termination = yield* Deferred.make<CodexError.CodexAppServerError>();
|
||||
yield* CodexProtocol.makeCodexAppServerPatchedProtocol({
|
||||
stdio,
|
||||
logIncoming: true,
|
||||
logger: (event) =>
|
||||
Effect.sync(() => {
|
||||
events.push(event);
|
||||
}),
|
||||
onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
|
||||
});
|
||||
|
||||
yield* Queue.offer(input, encoder.encode(`{"secret":"${secret}"\n`));
|
||||
yield* Deferred.await(termination);
|
||||
|
||||
const event = events.find(({ stage }) => stage === "decode_failed");
|
||||
assert.exists(event);
|
||||
assert.equal(event.direction, "incoming");
|
||||
const payload = event.payload as Record<string, unknown>;
|
||||
assert.equal(payload.operation, "decode-wire-message");
|
||||
assert.isNumber(payload.issueCount);
|
||||
assert.isArray(payload.issueKinds);
|
||||
assert.isNumber(payload.maximumPathDepth);
|
||||
assert.equal("cause" in payload, false);
|
||||
assert.equal("detail" in payload, false);
|
||||
assert.notInclude(encodeUnknownJsonString(event), secret);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("describes unroutable messages with safe structural diagnostics", () =>
|
||||
Effect.gen(function* () {
|
||||
const secret = "codex-unroutable-secret-sentinel";
|
||||
const { stdio, input } = yield* makeInMemoryStdio();
|
||||
const termination = yield* Deferred.make<CodexError.CodexAppServerError>();
|
||||
yield* CodexProtocol.makeCodexAppServerPatchedProtocol({
|
||||
stdio,
|
||||
onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
|
||||
});
|
||||
|
||||
yield* Queue.offer(
|
||||
input,
|
||||
encodeJsonl({ id: true, method: "thread/start", params: { token: secret } }),
|
||||
);
|
||||
|
||||
const error = yield* Deferred.await(termination);
|
||||
assert.instanceOf(error, CodexError.CodexAppServerProtocolParseError);
|
||||
assert.deepInclude(error, {
|
||||
operation: "route-wire-message",
|
||||
method: "thread/start",
|
||||
payloadKind: "object",
|
||||
presentFields: ["id", "method", "params"],
|
||||
});
|
||||
assert.isUndefined(error.requestId);
|
||||
assert.notProperty(error, "detail");
|
||||
assert.notProperty(error, "cause");
|
||||
assert.notInclude(error.message, secret);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("classifies an input stream ending without inventing a cause", () =>
|
||||
Effect.gen(function* () {
|
||||
const { stdio, input } = yield* makeInMemoryStdio();
|
||||
const termination = yield* Deferred.make<CodexError.CodexAppServerError>();
|
||||
yield* CodexProtocol.makeCodexAppServerPatchedProtocol({
|
||||
stdio,
|
||||
onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
|
||||
});
|
||||
|
||||
yield* Queue.end(input);
|
||||
|
||||
const error = yield* Deferred.await(termination);
|
||||
assert.instanceOf(error, CodexError.CodexAppServerInputStreamEndedError);
|
||||
assert.equal(error.message, "Codex App Server input stream ended.");
|
||||
assert.equal("cause" in error, false);
|
||||
assert.equal(circularError.detail, "Failed to encode Codex App Server message");
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -10,9 +10,6 @@ import * as Stream from "effect/Stream";
|
||||
|
||||
import * as CodexError from "./errors.ts";
|
||||
import { JsonRpcId, JsonRpcResponseEnvelope } from "./_internal/shared.ts";
|
||||
const isJsonRpcId = Schema.is(JsonRpcId);
|
||||
const isJsonRpcResponseEnvelope = Schema.is(JsonRpcResponseEnvelope);
|
||||
const isCodexAppServerError = Schema.is(CodexError.CodexAppServerError);
|
||||
|
||||
export interface CodexAppServerProtocolLogEvent {
|
||||
readonly direction: "incoming" | "outgoing";
|
||||
@@ -67,11 +64,6 @@ export interface CodexAppServerPatchedProtocol {
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>;
|
||||
}
|
||||
|
||||
interface CodexAppServerPendingRequest {
|
||||
readonly deferred: Deferred.Deferred<unknown, CodexError.CodexAppServerError>;
|
||||
readonly method: string;
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
@@ -80,7 +72,7 @@ function isIncomingRequest(value: unknown): value is CodexAppServerIncomingReque
|
||||
if (!isObject(value) || typeof value.method !== "string") {
|
||||
return false;
|
||||
}
|
||||
return isJsonRpcId(value.id);
|
||||
return Schema.is(JsonRpcId)(value.id);
|
||||
}
|
||||
|
||||
function isIncomingNotification(value: unknown): value is CodexAppServerIncomingNotification {
|
||||
@@ -88,51 +80,26 @@ function isIncomingNotification(value: unknown): value is CodexAppServerIncoming
|
||||
}
|
||||
|
||||
function isIncomingResponse(value: unknown): value is typeof JsonRpcResponseEnvelope.Type {
|
||||
return isJsonRpcResponseEnvelope(value);
|
||||
return Schema.is(JsonRpcResponseEnvelope)(value);
|
||||
}
|
||||
|
||||
const encodeJsonString = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
|
||||
const decodeJsonString = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
|
||||
|
||||
const encodeWireMessage = (
|
||||
message: Record<string, unknown>,
|
||||
): Effect.Effect<string, CodexError.CodexAppServerProtocolParseError> =>
|
||||
encodeJsonString(message).pipe(
|
||||
Effect.map((encoded) => `${encoded}\n`),
|
||||
Effect.mapError((cause) => {
|
||||
const method = typeof message.method === "string" ? message.method : undefined;
|
||||
const requestId =
|
||||
typeof message.id === "string" || typeof message.id === "number"
|
||||
? String(message.id)
|
||||
: undefined;
|
||||
return CodexError.CodexAppServerProtocolParseError.fromSchemaError(
|
||||
"encode-wire-message",
|
||||
Effect.try({
|
||||
try: () => `${JSON.stringify(message)}\n`,
|
||||
catch: (cause) =>
|
||||
new CodexError.CodexAppServerProtocolParseError({
|
||||
detail: "Failed to encode Codex App Server message",
|
||||
cause,
|
||||
{
|
||||
...(method === undefined ? {} : { method }),
|
||||
...(requestId === undefined ? {} : { requestId }),
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
});
|
||||
|
||||
const decodeWireMessage = (
|
||||
line: string,
|
||||
): Effect.Effect<unknown, CodexError.CodexAppServerProtocolParseError> =>
|
||||
decodeJsonString(line).pipe(
|
||||
Effect.mapError((cause) =>
|
||||
CodexError.CodexAppServerProtocolParseError.fromSchemaError("decode-wire-message", cause),
|
||||
),
|
||||
);
|
||||
|
||||
const normalizeIncomingError = (
|
||||
error: unknown,
|
||||
operation: CodexError.CodexAppServerTransportOperation,
|
||||
): CodexError.CodexAppServerError =>
|
||||
isCodexAppServerError(error)
|
||||
const normalizeIncomingError = (error: unknown, detail: string): CodexError.CodexAppServerError =>
|
||||
Schema.is(CodexError.CodexAppServerError)(error)
|
||||
? error
|
||||
: new CodexError.CodexAppServerTransportError({
|
||||
operation,
|
||||
detail,
|
||||
cause: error,
|
||||
});
|
||||
|
||||
@@ -155,7 +122,9 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
const outgoing = yield* Queue.unbounded<string, Cause.Done<void>>();
|
||||
const incomingNotifications = yield* Queue.unbounded<CodexAppServerIncomingNotification>();
|
||||
const incomingRequests = yield* Queue.unbounded<CodexAppServerIncomingRequest>();
|
||||
const pending = yield* Ref.make(new Map<string, CodexAppServerPendingRequest>());
|
||||
const pending = yield* Ref.make(
|
||||
new Map<string, Deferred.Deferred<unknown, CodexError.CodexAppServerError>>(),
|
||||
);
|
||||
const nextRequestId = yield* Ref.make(1);
|
||||
const remainder = yield* Ref.make("");
|
||||
const terminationHandled = yield* Ref.make(false);
|
||||
@@ -176,7 +145,7 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
const failAllPending = (error: CodexError.CodexAppServerError) =>
|
||||
Ref.get(pending).pipe(
|
||||
Effect.flatMap((current) =>
|
||||
Effect.forEach([...current.values()], ({ deferred }) => Deferred.fail(deferred, error), {
|
||||
Effect.forEach([...current.values()], (deferred) => Deferred.fail(deferred, error), {
|
||||
discard: true,
|
||||
}),
|
||||
),
|
||||
@@ -229,16 +198,18 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
|
||||
const resolvePending = (
|
||||
requestId: string,
|
||||
handler: (pendingRequest: CodexAppServerPendingRequest) => Effect.Effect<void>,
|
||||
handler: (
|
||||
deferred: Deferred.Deferred<unknown, CodexError.CodexAppServerError>,
|
||||
) => Effect.Effect<void>,
|
||||
) =>
|
||||
Ref.modify(pending, (current) => {
|
||||
const pendingRequest = current.get(requestId);
|
||||
if (!pendingRequest) {
|
||||
const deferred = current.get(requestId);
|
||||
if (!deferred) {
|
||||
return [Effect.void, current] as const;
|
||||
}
|
||||
const next = new Map(current);
|
||||
next.delete(requestId);
|
||||
return [handler(pendingRequest), next] as const;
|
||||
return [handler(deferred), next] as const;
|
||||
}).pipe(Effect.flatten);
|
||||
|
||||
const respond = (requestId: string | number, result: unknown) =>
|
||||
@@ -253,20 +224,14 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
const requestId = String(response.id);
|
||||
const protocolError = response.error;
|
||||
if (protocolError !== undefined) {
|
||||
return resolvePending(requestId, ({ deferred, method }) =>
|
||||
return resolvePending(requestId, (deferred) =>
|
||||
Deferred.fail(
|
||||
deferred,
|
||||
CodexError.CodexAppServerRequestError.fromProtocolError(
|
||||
protocolError,
|
||||
method,
|
||||
requestId,
|
||||
),
|
||||
CodexError.CodexAppServerRequestError.fromProtocolError(protocolError),
|
||||
),
|
||||
);
|
||||
}
|
||||
return resolvePending(requestId, ({ deferred }) =>
|
||||
Deferred.succeed(deferred, response.result),
|
||||
);
|
||||
return resolvePending(requestId, (deferred) => Deferred.succeed(deferred, response.result));
|
||||
};
|
||||
|
||||
const handleRequest = (request: CodexAppServerIncomingRequest) =>
|
||||
@@ -276,13 +241,7 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
? options.onRequest(request).pipe(
|
||||
Effect.matchEffect({
|
||||
onFailure: (error) =>
|
||||
respondError(
|
||||
request.id,
|
||||
CodexError.CodexAppServerRequestError.fromAppServerError(
|
||||
error,
|
||||
request.method,
|
||||
),
|
||||
),
|
||||
respondError(request.id, CodexError.normalizeToRequestError(error)),
|
||||
onSuccess: (result) => respond(request.id, result),
|
||||
}),
|
||||
)
|
||||
@@ -310,7 +269,9 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
return handleResponse(message);
|
||||
}
|
||||
return Effect.fail(
|
||||
CodexError.CodexAppServerProtocolParseError.fromUnroutableMessage(message),
|
||||
new CodexError.CodexAppServerProtocolParseError({
|
||||
detail: "Received protocol message in an unknown shape",
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -323,7 +284,16 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
stage: "raw",
|
||||
payload: line,
|
||||
}).pipe(
|
||||
Effect.flatMap(() => decodeWireMessage(line)),
|
||||
Effect.flatMap(() =>
|
||||
Effect.try({
|
||||
try: () => JSON.parse(line),
|
||||
catch: (cause) =>
|
||||
new CodexError.CodexAppServerProtocolParseError({
|
||||
detail: "Failed to decode Codex App Server wire message",
|
||||
cause,
|
||||
}),
|
||||
}),
|
||||
),
|
||||
Effect.tap((decoded) =>
|
||||
logProtocol({
|
||||
direction: "incoming",
|
||||
@@ -336,14 +306,8 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
direction: "incoming",
|
||||
stage: "decode_failed",
|
||||
payload: {
|
||||
operation: error.operation,
|
||||
...(error.method === undefined ? {} : { method: error.method }),
|
||||
...(error.requestId === undefined ? {} : { requestId: error.requestId }),
|
||||
...(error.issueCount === undefined ? {} : { issueCount: error.issueCount }),
|
||||
...(error.issueKinds === undefined ? {} : { issueKinds: error.issueKinds }),
|
||||
...(error.maximumPathDepth === undefined
|
||||
? {}
|
||||
: { maximumPathDepth: error.maximumPathDepth }),
|
||||
detail: error.detail,
|
||||
cause: error.cause,
|
||||
},
|
||||
}),
|
||||
),
|
||||
@@ -364,7 +328,7 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
Effect.matchEffect({
|
||||
onFailure: (error) =>
|
||||
handleTermination(() =>
|
||||
Effect.succeed(normalizeIncomingError(error, "read-input-stream")),
|
||||
Effect.succeed(normalizeIncomingError(error, "Codex App Server input stream failed")),
|
||||
),
|
||||
onSuccess: () =>
|
||||
Ref.get(remainder).pipe(
|
||||
@@ -375,7 +339,12 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
handleTermination(
|
||||
() =>
|
||||
options.terminationError ??
|
||||
Effect.succeed(new CodexError.CodexAppServerInputStreamEndedError({})),
|
||||
Effect.succeed(
|
||||
new CodexError.CodexAppServerTransportError({
|
||||
detail: "Codex App Server input stream ended",
|
||||
cause: new Error("Codex App Server input stream ended"),
|
||||
}),
|
||||
),
|
||||
),
|
||||
}),
|
||||
),
|
||||
@@ -392,14 +361,16 @@ export const makeCodexAppServerPatchedProtocol = Effect.fn("makeCodexAppServerPa
|
||||
(current) => [current, current + 1] as const,
|
||||
);
|
||||
const deferred = yield* Deferred.make<unknown, CodexError.CodexAppServerError>();
|
||||
yield* Ref.update(pending, (current) =>
|
||||
new Map(current).set(String(requestId), { deferred, method }),
|
||||
);
|
||||
yield* Ref.update(pending, (current) => new Map(current).set(String(requestId), deferred));
|
||||
yield* offerOutgoing({
|
||||
id: requestId,
|
||||
method,
|
||||
...(payload !== undefined ? { params: payload } : {}),
|
||||
}).pipe(Effect.tapError(() => removePending(String(requestId))));
|
||||
}).pipe(
|
||||
Effect.catch((error) =>
|
||||
removePending(String(requestId)).pipe(Effect.andThen(Effect.fail(error))),
|
||||
),
|
||||
);
|
||||
return yield* Deferred.await(deferred).pipe(
|
||||
Effect.onInterrupt(() => removePending(String(requestId))),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user