mcp-codex-worker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/README.md +135 -0
  2. package/bin/mcp-codex-worker.mjs +17 -0
  3. package/dist/src/app.d.ts +29 -0
  4. package/dist/src/app.js +353 -0
  5. package/dist/src/app.js.map +1 -0
  6. package/dist/src/config/defaults.d.ts +11 -0
  7. package/dist/src/config/defaults.js +12 -0
  8. package/dist/src/config/defaults.js.map +1 -0
  9. package/dist/src/index.d.ts +2 -0
  10. package/dist/src/index.js +64 -0
  11. package/dist/src/index.js.map +1 -0
  12. package/dist/src/mcp/tool-definitions.d.ts +180 -0
  13. package/dist/src/mcp/tool-definitions.js +241 -0
  14. package/dist/src/mcp/tool-definitions.js.map +1 -0
  15. package/dist/src/services/app-server-client.d.ts +65 -0
  16. package/dist/src/services/app-server-client.js +511 -0
  17. package/dist/src/services/app-server-client.js.map +1 -0
  18. package/dist/src/services/codex-runtime.d.ts +84 -0
  19. package/dist/src/services/codex-runtime.js +371 -0
  20. package/dist/src/services/codex-runtime.js.map +1 -0
  21. package/dist/src/services/fleet-mode.d.ts +3 -0
  22. package/dist/src/services/fleet-mode.js +21 -0
  23. package/dist/src/services/fleet-mode.js.map +1 -0
  24. package/dist/src/services/model-catalog.d.ts +22 -0
  25. package/dist/src/services/model-catalog.js +51 -0
  26. package/dist/src/services/model-catalog.js.map +1 -0
  27. package/dist/src/services/profile-manager.d.ts +29 -0
  28. package/dist/src/services/profile-manager.js +82 -0
  29. package/dist/src/services/profile-manager.js.map +1 -0
  30. package/dist/src/types/codex.d.ts +50 -0
  31. package/dist/src/types/codex.js +2 -0
  32. package/dist/src/types/codex.js.map +1 -0
  33. package/package.json +53 -0
  34. package/src/app.ts +417 -0
  35. package/src/config/defaults.ts +14 -0
  36. package/src/index.ts +84 -0
  37. package/src/mcp/tool-definitions.ts +280 -0
  38. package/src/protocol/AbsolutePathBuf.ts +14 -0
  39. package/src/protocol/AgentPath.ts +5 -0
  40. package/src/protocol/ApplyPatchApprovalParams.ts +21 -0
  41. package/src/protocol/ApplyPatchApprovalResponse.ts +6 -0
  42. package/src/protocol/AuthMode.ts +8 -0
  43. package/src/protocol/ClientInfo.ts +5 -0
  44. package/src/protocol/ClientNotification.ts +5 -0
  45. package/src/protocol/ClientRequest.ts +67 -0
  46. package/src/protocol/CollaborationMode.ts +10 -0
  47. package/src/protocol/ContentItem.ts +5 -0
  48. package/src/protocol/ConversationGitInfo.ts +5 -0
  49. package/src/protocol/ConversationSummary.ts +8 -0
  50. package/src/protocol/ExecCommandApprovalParams.ts +16 -0
  51. package/src/protocol/ExecCommandApprovalResponse.ts +6 -0
  52. package/src/protocol/ExecPolicyAmendment.ts +12 -0
  53. package/src/protocol/FileChange.ts +5 -0
  54. package/src/protocol/ForcedLoginMethod.ts +5 -0
  55. package/src/protocol/FunctionCallOutputBody.ts +6 -0
  56. package/src/protocol/FunctionCallOutputContentItem.ts +10 -0
  57. package/src/protocol/FuzzyFileSearchMatchType.ts +5 -0
  58. package/src/protocol/FuzzyFileSearchParams.ts +5 -0
  59. package/src/protocol/FuzzyFileSearchResponse.ts +6 -0
  60. package/src/protocol/FuzzyFileSearchResult.ts +9 -0
  61. package/src/protocol/FuzzyFileSearchSessionCompletedNotification.ts +5 -0
  62. package/src/protocol/FuzzyFileSearchSessionUpdatedNotification.ts +6 -0
  63. package/src/protocol/GetAuthStatusParams.ts +5 -0
  64. package/src/protocol/GetAuthStatusResponse.ts +6 -0
  65. package/src/protocol/GetConversationSummaryParams.ts +6 -0
  66. package/src/protocol/GetConversationSummaryResponse.ts +6 -0
  67. package/src/protocol/GhostCommit.ts +8 -0
  68. package/src/protocol/GitDiffToRemoteParams.ts +5 -0
  69. package/src/protocol/GitDiffToRemoteResponse.ts +6 -0
  70. package/src/protocol/GitSha.ts +5 -0
  71. package/src/protocol/ImageDetail.ts +5 -0
  72. package/src/protocol/InitializeCapabilities.ts +17 -0
  73. package/src/protocol/InitializeParams.ts +7 -0
  74. package/src/protocol/InitializeResponse.ts +20 -0
  75. package/src/protocol/InputModality.ts +8 -0
  76. package/src/protocol/LocalShellAction.ts +6 -0
  77. package/src/protocol/LocalShellExecAction.ts +5 -0
  78. package/src/protocol/LocalShellStatus.ts +5 -0
  79. package/src/protocol/MessagePhase.ts +11 -0
  80. package/src/protocol/ModeKind.ts +8 -0
  81. package/src/protocol/NetworkPolicyAmendment.ts +6 -0
  82. package/src/protocol/NetworkPolicyRuleAction.ts +5 -0
  83. package/src/protocol/ParsedCommand.ts +12 -0
  84. package/src/protocol/Personality.ts +5 -0
  85. package/src/protocol/PlanType.ts +5 -0
  86. package/src/protocol/RealtimeConversationVersion.ts +5 -0
  87. package/src/protocol/ReasoningEffort.ts +8 -0
  88. package/src/protocol/ReasoningItemContent.ts +5 -0
  89. package/src/protocol/ReasoningItemReasoningSummary.ts +5 -0
  90. package/src/protocol/ReasoningSummary.ts +10 -0
  91. package/src/protocol/RequestId.ts +5 -0
  92. package/src/protocol/Resource.ts +9 -0
  93. package/src/protocol/ResourceTemplate.ts +9 -0
  94. package/src/protocol/ResponseItem.ts +18 -0
  95. package/src/protocol/ReviewDecision.ts +10 -0
  96. package/src/protocol/ServerNotification.ts +60 -0
  97. package/src/protocol/ServerRequest.ts +18 -0
  98. package/src/protocol/ServiceTier.ts +5 -0
  99. package/src/protocol/SessionSource.ts +6 -0
  100. package/src/protocol/Settings.ts +9 -0
  101. package/src/protocol/SubAgentSource.ts +7 -0
  102. package/src/protocol/ThreadId.ts +5 -0
  103. package/src/protocol/Tool.ts +9 -0
  104. package/src/protocol/Verbosity.ts +9 -0
  105. package/src/protocol/WebSearchAction.ts +5 -0
  106. package/src/protocol/WebSearchContextSize.ts +5 -0
  107. package/src/protocol/WebSearchLocation.ts +5 -0
  108. package/src/protocol/WebSearchMode.ts +5 -0
  109. package/src/protocol/WebSearchToolConfig.ts +7 -0
  110. package/src/protocol/index.ts +75 -0
  111. package/src/protocol/serde_json/JsonValue.ts +5 -0
  112. package/src/protocol/v2/Account.ts +6 -0
  113. package/src/protocol/v2/AccountLoginCompletedNotification.ts +5 -0
  114. package/src/protocol/v2/AccountRateLimitsUpdatedNotification.ts +6 -0
  115. package/src/protocol/v2/AccountUpdatedNotification.ts +7 -0
  116. package/src/protocol/v2/AdditionalFileSystemPermissions.ts +6 -0
  117. package/src/protocol/v2/AdditionalNetworkPermissions.ts +5 -0
  118. package/src/protocol/v2/AdditionalPermissionProfile.ts +7 -0
  119. package/src/protocol/v2/AgentMessageDeltaNotification.ts +5 -0
  120. package/src/protocol/v2/AnalyticsConfig.ts +6 -0
  121. package/src/protocol/v2/AppBranding.ts +8 -0
  122. package/src/protocol/v2/AppInfo.ts +19 -0
  123. package/src/protocol/v2/AppListUpdatedNotification.ts +9 -0
  124. package/src/protocol/v2/AppMetadata.ts +7 -0
  125. package/src/protocol/v2/AppReview.ts +5 -0
  126. package/src/protocol/v2/AppScreenshot.ts +5 -0
  127. package/src/protocol/v2/AppSummary.ts +8 -0
  128. package/src/protocol/v2/AppToolApproval.ts +5 -0
  129. package/src/protocol/v2/AppToolsConfig.ts +6 -0
  130. package/src/protocol/v2/ApprovalsReviewer.ts +12 -0
  131. package/src/protocol/v2/AppsConfig.ts +8 -0
  132. package/src/protocol/v2/AppsDefaultConfig.ts +5 -0
  133. package/src/protocol/v2/AppsListParams.ts +24 -0
  134. package/src/protocol/v2/AppsListResponse.ts +14 -0
  135. package/src/protocol/v2/AskForApproval.ts +5 -0
  136. package/src/protocol/v2/ByteRange.ts +5 -0
  137. package/src/protocol/v2/CancelLoginAccountParams.ts +5 -0
  138. package/src/protocol/v2/CancelLoginAccountResponse.ts +6 -0
  139. package/src/protocol/v2/CancelLoginAccountStatus.ts +5 -0
  140. package/src/protocol/v2/ChatgptAuthTokensRefreshParams.ts +16 -0
  141. package/src/protocol/v2/ChatgptAuthTokensRefreshReason.ts +5 -0
  142. package/src/protocol/v2/ChatgptAuthTokensRefreshResponse.ts +5 -0
  143. package/src/protocol/v2/CodexErrorInfo.ts +12 -0
  144. package/src/protocol/v2/CollabAgentState.ts +6 -0
  145. package/src/protocol/v2/CollabAgentStatus.ts +5 -0
  146. package/src/protocol/v2/CollabAgentTool.ts +5 -0
  147. package/src/protocol/v2/CollabAgentToolCallStatus.ts +5 -0
  148. package/src/protocol/v2/CollaborationModeMask.ts +10 -0
  149. package/src/protocol/v2/CommandAction.ts +5 -0
  150. package/src/protocol/v2/CommandExecOutputDeltaNotification.ts +30 -0
  151. package/src/protocol/v2/CommandExecOutputStream.ts +8 -0
  152. package/src/protocol/v2/CommandExecParams.ts +97 -0
  153. package/src/protocol/v2/CommandExecResizeParams.ts +18 -0
  154. package/src/protocol/v2/CommandExecResizeResponse.ts +8 -0
  155. package/src/protocol/v2/CommandExecResponse.ts +24 -0
  156. package/src/protocol/v2/CommandExecTerminalSize.ts +16 -0
  157. package/src/protocol/v2/CommandExecTerminateParams.ts +13 -0
  158. package/src/protocol/v2/CommandExecTerminateResponse.ts +8 -0
  159. package/src/protocol/v2/CommandExecWriteParams.ts +22 -0
  160. package/src/protocol/v2/CommandExecWriteResponse.ts +8 -0
  161. package/src/protocol/v2/CommandExecutionApprovalDecision.ts +7 -0
  162. package/src/protocol/v2/CommandExecutionOutputDeltaNotification.ts +5 -0
  163. package/src/protocol/v2/CommandExecutionRequestApprovalParams.ts +57 -0
  164. package/src/protocol/v2/CommandExecutionRequestApprovalResponse.ts +6 -0
  165. package/src/protocol/v2/CommandExecutionSource.ts +5 -0
  166. package/src/protocol/v2/CommandExecutionStatus.ts +5 -0
  167. package/src/protocol/v2/Config.ts +23 -0
  168. package/src/protocol/v2/ConfigBatchWriteParams.ts +14 -0
  169. package/src/protocol/v2/ConfigEdit.ts +7 -0
  170. package/src/protocol/v2/ConfigLayer.ts +7 -0
  171. package/src/protocol/v2/ConfigLayerMetadata.ts +6 -0
  172. package/src/protocol/v2/ConfigLayerSource.ts +16 -0
  173. package/src/protocol/v2/ConfigReadParams.ts +11 -0
  174. package/src/protocol/v2/ConfigReadResponse.ts +8 -0
  175. package/src/protocol/v2/ConfigRequirements.ts +9 -0
  176. package/src/protocol/v2/ConfigRequirementsReadResponse.ts +10 -0
  177. package/src/protocol/v2/ConfigValueWriteParams.ts +11 -0
  178. package/src/protocol/v2/ConfigWarningNotification.ts +22 -0
  179. package/src/protocol/v2/ConfigWriteResponse.ts +12 -0
  180. package/src/protocol/v2/ContextCompactedNotification.ts +8 -0
  181. package/src/protocol/v2/CreditsSnapshot.ts +5 -0
  182. package/src/protocol/v2/DeprecationNoticeNotification.ts +13 -0
  183. package/src/protocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
  184. package/src/protocol/v2/DynamicToolCallParams.ts +6 -0
  185. package/src/protocol/v2/DynamicToolCallResponse.ts +6 -0
  186. package/src/protocol/v2/DynamicToolCallStatus.ts +5 -0
  187. package/src/protocol/v2/DynamicToolSpec.ts +6 -0
  188. package/src/protocol/v2/ErrorNotification.ts +6 -0
  189. package/src/protocol/v2/ExecPolicyAmendment.ts +5 -0
  190. package/src/protocol/v2/ExperimentalFeature.ts +37 -0
  191. package/src/protocol/v2/ExperimentalFeatureEnablementSetParams.ts +12 -0
  192. package/src/protocol/v2/ExperimentalFeatureEnablementSetResponse.ts +9 -0
  193. package/src/protocol/v2/ExperimentalFeatureListParams.ts +13 -0
  194. package/src/protocol/v2/ExperimentalFeatureListResponse.ts +11 -0
  195. package/src/protocol/v2/ExperimentalFeatureStage.ts +5 -0
  196. package/src/protocol/v2/ExternalAgentConfigDetectParams.ts +13 -0
  197. package/src/protocol/v2/ExternalAgentConfigDetectResponse.ts +6 -0
  198. package/src/protocol/v2/ExternalAgentConfigImportParams.ts +6 -0
  199. package/src/protocol/v2/ExternalAgentConfigImportResponse.ts +5 -0
  200. package/src/protocol/v2/ExternalAgentConfigMigrationItem.ts +10 -0
  201. package/src/protocol/v2/ExternalAgentConfigMigrationItemType.ts +5 -0
  202. package/src/protocol/v2/FeedbackUploadParams.ts +5 -0
  203. package/src/protocol/v2/FeedbackUploadResponse.ts +5 -0
  204. package/src/protocol/v2/FileChangeApprovalDecision.ts +5 -0
  205. package/src/protocol/v2/FileChangeOutputDeltaNotification.ts +5 -0
  206. package/src/protocol/v2/FileChangeRequestApprovalParams.ts +14 -0
  207. package/src/protocol/v2/FileChangeRequestApprovalResponse.ts +6 -0
  208. package/src/protocol/v2/FileUpdateChange.ts +6 -0
  209. package/src/protocol/v2/FsChangedNotification.ts +17 -0
  210. package/src/protocol/v2/FsCopyParams.ts +21 -0
  211. package/src/protocol/v2/FsCopyResponse.ts +8 -0
  212. package/src/protocol/v2/FsCreateDirectoryParams.ts +17 -0
  213. package/src/protocol/v2/FsCreateDirectoryResponse.ts +8 -0
  214. package/src/protocol/v2/FsGetMetadataParams.ts +13 -0
  215. package/src/protocol/v2/FsGetMetadataResponse.ts +24 -0
  216. package/src/protocol/v2/FsReadDirectoryEntry.ts +20 -0
  217. package/src/protocol/v2/FsReadDirectoryParams.ts +13 -0
  218. package/src/protocol/v2/FsReadDirectoryResponse.ts +13 -0
  219. package/src/protocol/v2/FsReadFileParams.ts +13 -0
  220. package/src/protocol/v2/FsReadFileResponse.ts +12 -0
  221. package/src/protocol/v2/FsRemoveParams.ts +21 -0
  222. package/src/protocol/v2/FsRemoveResponse.ts +8 -0
  223. package/src/protocol/v2/FsUnwatchParams.ts +12 -0
  224. package/src/protocol/v2/FsUnwatchResponse.ts +8 -0
  225. package/src/protocol/v2/FsWatchParams.ts +13 -0
  226. package/src/protocol/v2/FsWatchResponse.ts +17 -0
  227. package/src/protocol/v2/FsWriteFileParams.ts +17 -0
  228. package/src/protocol/v2/FsWriteFileResponse.ts +8 -0
  229. package/src/protocol/v2/GetAccountParams.ts +13 -0
  230. package/src/protocol/v2/GetAccountRateLimitsResponse.ts +14 -0
  231. package/src/protocol/v2/GetAccountResponse.ts +6 -0
  232. package/src/protocol/v2/GitInfo.ts +5 -0
  233. package/src/protocol/v2/GrantedPermissionProfile.ts +7 -0
  234. package/src/protocol/v2/GuardianApprovalReview.ts +12 -0
  235. package/src/protocol/v2/GuardianApprovalReviewStatus.ts +8 -0
  236. package/src/protocol/v2/GuardianRiskLevel.ts +8 -0
  237. package/src/protocol/v2/HookCompletedNotification.ts +6 -0
  238. package/src/protocol/v2/HookEventName.ts +5 -0
  239. package/src/protocol/v2/HookExecutionMode.ts +5 -0
  240. package/src/protocol/v2/HookHandlerType.ts +5 -0
  241. package/src/protocol/v2/HookOutputEntry.ts +6 -0
  242. package/src/protocol/v2/HookOutputEntryKind.ts +5 -0
  243. package/src/protocol/v2/HookPromptFragment.ts +5 -0
  244. package/src/protocol/v2/HookRunStatus.ts +5 -0
  245. package/src/protocol/v2/HookRunSummary.ts +11 -0
  246. package/src/protocol/v2/HookScope.ts +5 -0
  247. package/src/protocol/v2/HookStartedNotification.ts +6 -0
  248. package/src/protocol/v2/ItemCompletedNotification.ts +6 -0
  249. package/src/protocol/v2/ItemGuardianApprovalReviewCompletedNotification.ts +15 -0
  250. package/src/protocol/v2/ItemGuardianApprovalReviewStartedNotification.ts +15 -0
  251. package/src/protocol/v2/ItemStartedNotification.ts +6 -0
  252. package/src/protocol/v2/ListMcpServerStatusParams.ts +13 -0
  253. package/src/protocol/v2/ListMcpServerStatusResponse.ts +11 -0
  254. package/src/protocol/v2/LoginAccountParams.ts +21 -0
  255. package/src/protocol/v2/LoginAccountResponse.ts +17 -0
  256. package/src/protocol/v2/LogoutAccountResponse.ts +5 -0
  257. package/src/protocol/v2/MarketplaceInterface.ts +5 -0
  258. package/src/protocol/v2/MarketplaceLoadErrorInfo.ts +6 -0
  259. package/src/protocol/v2/McpAuthStatus.ts +5 -0
  260. package/src/protocol/v2/McpElicitationArrayType.ts +5 -0
  261. package/src/protocol/v2/McpElicitationBooleanSchema.ts +6 -0
  262. package/src/protocol/v2/McpElicitationBooleanType.ts +5 -0
  263. package/src/protocol/v2/McpElicitationConstOption.ts +5 -0
  264. package/src/protocol/v2/McpElicitationEnumSchema.ts +8 -0
  265. package/src/protocol/v2/McpElicitationLegacyTitledEnumSchema.ts +6 -0
  266. package/src/protocol/v2/McpElicitationMultiSelectEnumSchema.ts +7 -0
  267. package/src/protocol/v2/McpElicitationNumberSchema.ts +6 -0
  268. package/src/protocol/v2/McpElicitationNumberType.ts +5 -0
  269. package/src/protocol/v2/McpElicitationObjectType.ts +5 -0
  270. package/src/protocol/v2/McpElicitationPrimitiveSchema.ts +9 -0
  271. package/src/protocol/v2/McpElicitationSchema.ts +13 -0
  272. package/src/protocol/v2/McpElicitationSingleSelectEnumSchema.ts +7 -0
  273. package/src/protocol/v2/McpElicitationStringFormat.ts +5 -0
  274. package/src/protocol/v2/McpElicitationStringSchema.ts +7 -0
  275. package/src/protocol/v2/McpElicitationStringType.ts +5 -0
  276. package/src/protocol/v2/McpElicitationTitledEnumItems.ts +6 -0
  277. package/src/protocol/v2/McpElicitationTitledMultiSelectEnumSchema.ts +7 -0
  278. package/src/protocol/v2/McpElicitationTitledSingleSelectEnumSchema.ts +7 -0
  279. package/src/protocol/v2/McpElicitationUntitledEnumItems.ts +6 -0
  280. package/src/protocol/v2/McpElicitationUntitledMultiSelectEnumSchema.ts +7 -0
  281. package/src/protocol/v2/McpElicitationUntitledSingleSelectEnumSchema.ts +6 -0
  282. package/src/protocol/v2/McpServerElicitationAction.ts +5 -0
  283. package/src/protocol/v2/McpServerElicitationRequestParams.ts +16 -0
  284. package/src/protocol/v2/McpServerElicitationRequestResponse.ts +17 -0
  285. package/src/protocol/v2/McpServerOauthLoginCompletedNotification.ts +5 -0
  286. package/src/protocol/v2/McpServerOauthLoginParams.ts +5 -0
  287. package/src/protocol/v2/McpServerOauthLoginResponse.ts +5 -0
  288. package/src/protocol/v2/McpServerRefreshResponse.ts +5 -0
  289. package/src/protocol/v2/McpServerStartupState.ts +5 -0
  290. package/src/protocol/v2/McpServerStatus.ts +9 -0
  291. package/src/protocol/v2/McpServerStatusUpdatedNotification.ts +6 -0
  292. package/src/protocol/v2/McpToolCallError.ts +5 -0
  293. package/src/protocol/v2/McpToolCallProgressNotification.ts +5 -0
  294. package/src/protocol/v2/McpToolCallResult.ts +6 -0
  295. package/src/protocol/v2/McpToolCallStatus.ts +5 -0
  296. package/src/protocol/v2/MemoryCitation.ts +6 -0
  297. package/src/protocol/v2/MemoryCitationEntry.ts +5 -0
  298. package/src/protocol/v2/MergeStrategy.ts +5 -0
  299. package/src/protocol/v2/Model.ts +10 -0
  300. package/src/protocol/v2/ModelAvailabilityNux.ts +5 -0
  301. package/src/protocol/v2/ModelListParams.ts +17 -0
  302. package/src/protocol/v2/ModelListResponse.ts +11 -0
  303. package/src/protocol/v2/ModelRerouteReason.ts +5 -0
  304. package/src/protocol/v2/ModelReroutedNotification.ts +6 -0
  305. package/src/protocol/v2/ModelUpgradeInfo.ts +5 -0
  306. package/src/protocol/v2/NetworkAccess.ts +5 -0
  307. package/src/protocol/v2/NetworkApprovalContext.ts +6 -0
  308. package/src/protocol/v2/NetworkApprovalProtocol.ts +5 -0
  309. package/src/protocol/v2/NetworkDomainPermission.ts +5 -0
  310. package/src/protocol/v2/NetworkPolicyAmendment.ts +6 -0
  311. package/src/protocol/v2/NetworkPolicyRuleAction.ts +5 -0
  312. package/src/protocol/v2/NetworkRequirements.ts +32 -0
  313. package/src/protocol/v2/NetworkUnixSocketPermission.ts +5 -0
  314. package/src/protocol/v2/NonSteerableTurnKind.ts +5 -0
  315. package/src/protocol/v2/OverriddenMetadata.ts +7 -0
  316. package/src/protocol/v2/PatchApplyStatus.ts +5 -0
  317. package/src/protocol/v2/PatchChangeKind.ts +5 -0
  318. package/src/protocol/v2/PermissionGrantScope.ts +5 -0
  319. package/src/protocol/v2/PermissionsRequestApprovalParams.ts +6 -0
  320. package/src/protocol/v2/PermissionsRequestApprovalResponse.ts +7 -0
  321. package/src/protocol/v2/PlanDeltaNotification.ts +9 -0
  322. package/src/protocol/v2/PluginAuthPolicy.ts +5 -0
  323. package/src/protocol/v2/PluginDetail.ts +9 -0
  324. package/src/protocol/v2/PluginInstallParams.ts +10 -0
  325. package/src/protocol/v2/PluginInstallPolicy.ts +5 -0
  326. package/src/protocol/v2/PluginInstallResponse.ts +7 -0
  327. package/src/protocol/v2/PluginInterface.ts +11 -0
  328. package/src/protocol/v2/PluginListParams.ts +16 -0
  329. package/src/protocol/v2/PluginListResponse.ts +7 -0
  330. package/src/protocol/v2/PluginMarketplaceEntry.ts +8 -0
  331. package/src/protocol/v2/PluginReadParams.ts +6 -0
  332. package/src/protocol/v2/PluginReadResponse.ts +6 -0
  333. package/src/protocol/v2/PluginSource.ts +6 -0
  334. package/src/protocol/v2/PluginSummary.ts +9 -0
  335. package/src/protocol/v2/PluginUninstallParams.ts +9 -0
  336. package/src/protocol/v2/PluginUninstallResponse.ts +5 -0
  337. package/src/protocol/v2/ProfileV2.ts +19 -0
  338. package/src/protocol/v2/RateLimitSnapshot.ts +8 -0
  339. package/src/protocol/v2/RateLimitWindow.ts +5 -0
  340. package/src/protocol/v2/RawResponseItemCompletedNotification.ts +6 -0
  341. package/src/protocol/v2/ReadOnlyAccess.ts +6 -0
  342. package/src/protocol/v2/ReasoningEffortOption.ts +6 -0
  343. package/src/protocol/v2/ReasoningSummaryPartAddedNotification.ts +5 -0
  344. package/src/protocol/v2/ReasoningSummaryTextDeltaNotification.ts +5 -0
  345. package/src/protocol/v2/ReasoningTextDeltaNotification.ts +5 -0
  346. package/src/protocol/v2/RequestPermissionProfile.ts +7 -0
  347. package/src/protocol/v2/ResidencyRequirement.ts +5 -0
  348. package/src/protocol/v2/ReviewDelivery.ts +5 -0
  349. package/src/protocol/v2/ReviewStartParams.ts +12 -0
  350. package/src/protocol/v2/ReviewStartResponse.ts +13 -0
  351. package/src/protocol/v2/ReviewTarget.ts +9 -0
  352. package/src/protocol/v2/SandboxMode.ts +5 -0
  353. package/src/protocol/v2/SandboxPolicy.ts +8 -0
  354. package/src/protocol/v2/SandboxWorkspaceWrite.ts +5 -0
  355. package/src/protocol/v2/ServerRequestResolvedNotification.ts +6 -0
  356. package/src/protocol/v2/SessionSource.ts +6 -0
  357. package/src/protocol/v2/SkillDependencies.ts +6 -0
  358. package/src/protocol/v2/SkillErrorInfo.ts +5 -0
  359. package/src/protocol/v2/SkillInterface.ts +5 -0
  360. package/src/protocol/v2/SkillMetadata.ts +12 -0
  361. package/src/protocol/v2/SkillScope.ts +5 -0
  362. package/src/protocol/v2/SkillSummary.ts +6 -0
  363. package/src/protocol/v2/SkillToolDependency.ts +5 -0
  364. package/src/protocol/v2/SkillsChangedNotification.ts +11 -0
  365. package/src/protocol/v2/SkillsConfigWriteParams.ts +14 -0
  366. package/src/protocol/v2/SkillsConfigWriteResponse.ts +5 -0
  367. package/src/protocol/v2/SkillsListEntry.ts +7 -0
  368. package/src/protocol/v2/SkillsListExtraRootsForCwd.ts +5 -0
  369. package/src/protocol/v2/SkillsListParams.ts +18 -0
  370. package/src/protocol/v2/SkillsListResponse.ts +6 -0
  371. package/src/protocol/v2/TerminalInteractionNotification.ts +5 -0
  372. package/src/protocol/v2/TextElement.ts +14 -0
  373. package/src/protocol/v2/TextPosition.ts +13 -0
  374. package/src/protocol/v2/TextRange.ts +6 -0
  375. package/src/protocol/v2/Thread.ts +72 -0
  376. package/src/protocol/v2/ThreadActiveFlag.ts +5 -0
  377. package/src/protocol/v2/ThreadArchiveParams.ts +5 -0
  378. package/src/protocol/v2/ThreadArchiveResponse.ts +5 -0
  379. package/src/protocol/v2/ThreadArchivedNotification.ts +5 -0
  380. package/src/protocol/v2/ThreadClosedNotification.ts +5 -0
  381. package/src/protocol/v2/ThreadCompactStartParams.ts +5 -0
  382. package/src/protocol/v2/ThreadCompactStartResponse.ts +5 -0
  383. package/src/protocol/v2/ThreadForkParams.ts +34 -0
  384. package/src/protocol/v2/ThreadForkResponse.ts +15 -0
  385. package/src/protocol/v2/ThreadItem.ts +100 -0
  386. package/src/protocol/v2/ThreadListParams.ts +43 -0
  387. package/src/protocol/v2/ThreadListResponse.ts +11 -0
  388. package/src/protocol/v2/ThreadLoadedListParams.ts +13 -0
  389. package/src/protocol/v2/ThreadLoadedListResponse.ts +14 -0
  390. package/src/protocol/v2/ThreadMetadataGitInfoUpdateParams.ts +20 -0
  391. package/src/protocol/v2/ThreadMetadataUpdateParams.ts +12 -0
  392. package/src/protocol/v2/ThreadMetadataUpdateResponse.ts +6 -0
  393. package/src/protocol/v2/ThreadNameUpdatedNotification.ts +5 -0
  394. package/src/protocol/v2/ThreadReadParams.ts +9 -0
  395. package/src/protocol/v2/ThreadReadResponse.ts +6 -0
  396. package/src/protocol/v2/ThreadRealtimeAudioChunk.ts +8 -0
  397. package/src/protocol/v2/ThreadRealtimeClosedNotification.ts +8 -0
  398. package/src/protocol/v2/ThreadRealtimeErrorNotification.ts +8 -0
  399. package/src/protocol/v2/ThreadRealtimeItemAddedNotification.ts +9 -0
  400. package/src/protocol/v2/ThreadRealtimeOutputAudioDeltaNotification.ts +9 -0
  401. package/src/protocol/v2/ThreadRealtimeStartedNotification.ts +9 -0
  402. package/src/protocol/v2/ThreadRealtimeTranscriptUpdatedNotification.ts +9 -0
  403. package/src/protocol/v2/ThreadResumeParams.ts +43 -0
  404. package/src/protocol/v2/ThreadResumeResponse.ts +15 -0
  405. package/src/protocol/v2/ThreadRollbackParams.ts +12 -0
  406. package/src/protocol/v2/ThreadRollbackResponse.ts +14 -0
  407. package/src/protocol/v2/ThreadSetNameParams.ts +5 -0
  408. package/src/protocol/v2/ThreadSetNameResponse.ts +5 -0
  409. package/src/protocol/v2/ThreadShellCommandParams.ts +12 -0
  410. package/src/protocol/v2/ThreadShellCommandResponse.ts +5 -0
  411. package/src/protocol/v2/ThreadSortKey.ts +5 -0
  412. package/src/protocol/v2/ThreadSourceKind.ts +5 -0
  413. package/src/protocol/v2/ThreadStartParams.ts +23 -0
  414. package/src/protocol/v2/ThreadStartResponse.ts +15 -0
  415. package/src/protocol/v2/ThreadStartedNotification.ts +6 -0
  416. package/src/protocol/v2/ThreadStatus.ts +6 -0
  417. package/src/protocol/v2/ThreadStatusChangedNotification.ts +6 -0
  418. package/src/protocol/v2/ThreadTokenUsage.ts +6 -0
  419. package/src/protocol/v2/ThreadTokenUsageUpdatedNotification.ts +6 -0
  420. package/src/protocol/v2/ThreadUnarchiveParams.ts +5 -0
  421. package/src/protocol/v2/ThreadUnarchiveResponse.ts +6 -0
  422. package/src/protocol/v2/ThreadUnarchivedNotification.ts +5 -0
  423. package/src/protocol/v2/ThreadUnsubscribeParams.ts +5 -0
  424. package/src/protocol/v2/ThreadUnsubscribeResponse.ts +6 -0
  425. package/src/protocol/v2/ThreadUnsubscribeStatus.ts +5 -0
  426. package/src/protocol/v2/TokenUsageBreakdown.ts +5 -0
  427. package/src/protocol/v2/ToolRequestUserInputAnswer.ts +8 -0
  428. package/src/protocol/v2/ToolRequestUserInputOption.ts +8 -0
  429. package/src/protocol/v2/ToolRequestUserInputParams.ts +9 -0
  430. package/src/protocol/v2/ToolRequestUserInputQuestion.ts +9 -0
  431. package/src/protocol/v2/ToolRequestUserInputResponse.ts +9 -0
  432. package/src/protocol/v2/ToolsV2.ts +6 -0
  433. package/src/protocol/v2/Turn.ts +18 -0
  434. package/src/protocol/v2/TurnCompletedNotification.ts +6 -0
  435. package/src/protocol/v2/TurnDiffUpdatedNotification.ts +9 -0
  436. package/src/protocol/v2/TurnError.ts +6 -0
  437. package/src/protocol/v2/TurnInterruptParams.ts +5 -0
  438. package/src/protocol/v2/TurnInterruptResponse.ts +5 -0
  439. package/src/protocol/v2/TurnPlanStep.ts +6 -0
  440. package/src/protocol/v2/TurnPlanStepStatus.ts +5 -0
  441. package/src/protocol/v2/TurnPlanUpdatedNotification.ts +6 -0
  442. package/src/protocol/v2/TurnStartParams.ts +54 -0
  443. package/src/protocol/v2/TurnStartResponse.ts +6 -0
  444. package/src/protocol/v2/TurnStartedNotification.ts +6 -0
  445. package/src/protocol/v2/TurnStatus.ts +5 -0
  446. package/src/protocol/v2/TurnSteerParams.ts +11 -0
  447. package/src/protocol/v2/TurnSteerResponse.ts +5 -0
  448. package/src/protocol/v2/UserInput.ts +10 -0
  449. package/src/protocol/v2/WebSearchAction.ts +5 -0
  450. package/src/protocol/v2/WindowsSandboxSetupCompletedNotification.ts +6 -0
  451. package/src/protocol/v2/WindowsSandboxSetupMode.ts +5 -0
  452. package/src/protocol/v2/WindowsSandboxSetupStartParams.ts +7 -0
  453. package/src/protocol/v2/WindowsSandboxSetupStartResponse.ts +5 -0
  454. package/src/protocol/v2/WindowsWorldWritableWarningNotification.ts +5 -0
  455. package/src/protocol/v2/WriteStatus.ts +5 -0
  456. package/src/protocol/v2/index.ts +346 -0
  457. package/src/services/app-server-client.ts +636 -0
  458. package/src/services/codex-runtime.ts +500 -0
  459. package/src/services/fleet-mode.ts +29 -0
  460. package/src/services/model-catalog.ts +86 -0
  461. package/src/services/profile-manager.ts +113 -0
  462. package/src/types/codex.ts +57 -0
@@ -0,0 +1,180 @@
1
+ import { z } from 'zod';
2
+ declare const threadStartSchema: z.ZodObject<{
3
+ model: z.ZodOptional<z.ZodString>;
4
+ cwd: z.ZodOptional<z.ZodString>;
5
+ developer_instructions: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ model?: string | undefined;
8
+ cwd?: string | undefined;
9
+ developer_instructions?: string | undefined;
10
+ }, {
11
+ model?: string | undefined;
12
+ cwd?: string | undefined;
13
+ developer_instructions?: string | undefined;
14
+ }>;
15
+ declare const threadResumeSchema: z.ZodObject<{
16
+ thread_id: z.ZodString;
17
+ model: z.ZodOptional<z.ZodString>;
18
+ cwd: z.ZodOptional<z.ZodString>;
19
+ developer_instructions: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ thread_id: string;
22
+ model?: string | undefined;
23
+ cwd?: string | undefined;
24
+ developer_instructions?: string | undefined;
25
+ }, {
26
+ thread_id: string;
27
+ model?: string | undefined;
28
+ cwd?: string | undefined;
29
+ developer_instructions?: string | undefined;
30
+ }>;
31
+ declare const threadReadSchema: z.ZodObject<{
32
+ thread_id: z.ZodString;
33
+ include_turns: z.ZodOptional<z.ZodBoolean>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ thread_id: string;
36
+ include_turns?: boolean | undefined;
37
+ }, {
38
+ thread_id: string;
39
+ include_turns?: boolean | undefined;
40
+ }>;
41
+ declare const threadListSchema: z.ZodObject<{
42
+ limit: z.ZodOptional<z.ZodNumber>;
43
+ cursor: z.ZodOptional<z.ZodString>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ limit?: number | undefined;
46
+ cursor?: string | undefined;
47
+ }, {
48
+ limit?: number | undefined;
49
+ cursor?: string | undefined;
50
+ }>;
51
+ declare const turnStartSchema: z.ZodObject<{
52
+ thread_id: z.ZodString;
53
+ user_input: z.ZodString;
54
+ model: z.ZodOptional<z.ZodString>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ thread_id: string;
57
+ user_input: string;
58
+ model?: string | undefined;
59
+ }, {
60
+ thread_id: string;
61
+ user_input: string;
62
+ model?: string | undefined;
63
+ }>;
64
+ declare const turnSteerSchema: z.ZodObject<{
65
+ thread_id: z.ZodString;
66
+ expected_turn_id: z.ZodString;
67
+ user_input: z.ZodString;
68
+ }, "strip", z.ZodTypeAny, {
69
+ thread_id: string;
70
+ user_input: string;
71
+ expected_turn_id: string;
72
+ }, {
73
+ thread_id: string;
74
+ user_input: string;
75
+ expected_turn_id: string;
76
+ }>;
77
+ declare const turnInterruptSchema: z.ZodObject<{
78
+ thread_id: z.ZodString;
79
+ turn_id: z.ZodString;
80
+ }, "strip", z.ZodTypeAny, {
81
+ thread_id: string;
82
+ turn_id: string;
83
+ }, {
84
+ thread_id: string;
85
+ turn_id: string;
86
+ }>;
87
+ declare const requestListSchema: z.ZodObject<{
88
+ include_resolved: z.ZodOptional<z.ZodBoolean>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ include_resolved?: boolean | undefined;
91
+ }, {
92
+ include_resolved?: boolean | undefined;
93
+ }>;
94
+ declare const requestReadSchema: z.ZodObject<{
95
+ request_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ request_id: string | number;
98
+ }, {
99
+ request_id: string | number;
100
+ }>;
101
+ declare const requestRespondSchema: z.ZodObject<{
102
+ request_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
103
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
104
+ decision: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
105
+ answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
106
+ answers: z.ZodArray<z.ZodString, "many">;
107
+ }, "strip", z.ZodTypeAny, {
108
+ answers: string[];
109
+ }, {
110
+ answers: string[];
111
+ }>>>;
112
+ action: z.ZodOptional<z.ZodEnum<["accept", "decline", "cancel"]>>;
113
+ content: z.ZodOptional<z.ZodUnknown>;
114
+ meta: z.ZodOptional<z.ZodUnknown>;
115
+ scope: z.ZodOptional<z.ZodEnum<["turn", "session"]>>;
116
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ request_id: string | number;
119
+ payload?: Record<string, unknown> | undefined;
120
+ decision?: string | Record<string, unknown> | undefined;
121
+ answers?: Record<string, {
122
+ answers: string[];
123
+ }> | undefined;
124
+ action?: "accept" | "decline" | "cancel" | undefined;
125
+ content?: unknown;
126
+ meta?: unknown;
127
+ scope?: "turn" | "session" | undefined;
128
+ permissions?: Record<string, unknown> | undefined;
129
+ }, {
130
+ request_id: string | number;
131
+ payload?: Record<string, unknown> | undefined;
132
+ decision?: string | Record<string, unknown> | undefined;
133
+ answers?: Record<string, {
134
+ answers: string[];
135
+ }> | undefined;
136
+ action?: "accept" | "decline" | "cancel" | undefined;
137
+ content?: unknown;
138
+ meta?: unknown;
139
+ scope?: "turn" | "session" | undefined;
140
+ permissions?: Record<string, unknown> | undefined;
141
+ }>;
142
+ declare const waitSchema: z.ZodObject<{
143
+ operation_id: z.ZodOptional<z.ZodString>;
144
+ thread_id: z.ZodOptional<z.ZodString>;
145
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
146
+ poll_interval_ms: z.ZodOptional<z.ZodNumber>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ thread_id?: string | undefined;
149
+ operation_id?: string | undefined;
150
+ timeout_ms?: number | undefined;
151
+ poll_interval_ms?: number | undefined;
152
+ }, {
153
+ thread_id?: string | undefined;
154
+ operation_id?: string | undefined;
155
+ timeout_ms?: number | undefined;
156
+ poll_interval_ms?: number | undefined;
157
+ }>;
158
+ export interface ToolDefinition {
159
+ name: string;
160
+ description: string;
161
+ inputSchema: {
162
+ type: 'object';
163
+ properties?: Record<string, unknown>;
164
+ required?: string[];
165
+ };
166
+ validate: (value: unknown) => unknown;
167
+ }
168
+ export declare function createToolDefinitions(modelIds: string[]): ToolDefinition[];
169
+ export type ThreadStartInput = z.infer<typeof threadStartSchema>;
170
+ export type ThreadResumeInput = z.infer<typeof threadResumeSchema>;
171
+ export type ThreadReadInput = z.infer<typeof threadReadSchema>;
172
+ export type ThreadListInput = z.infer<typeof threadListSchema>;
173
+ export type TurnStartInput = z.infer<typeof turnStartSchema>;
174
+ export type TurnSteerInput = z.infer<typeof turnSteerSchema>;
175
+ export type TurnInterruptInput = z.infer<typeof turnInterruptSchema>;
176
+ export type RequestListInput = z.infer<typeof requestListSchema>;
177
+ export type RequestReadInput = z.infer<typeof requestReadSchema>;
178
+ export type RequestRespondInput = z.infer<typeof requestRespondSchema>;
179
+ export type WaitInput = z.infer<typeof waitSchema>;
180
+ export {};
@@ -0,0 +1,241 @@
1
+ import { z } from 'zod';
2
+ const jsonSchema = { type: 'object' };
3
+ const threadStartSchema = z.object({
4
+ model: z.string().optional(),
5
+ cwd: z.string().optional(),
6
+ developer_instructions: z.string().optional(),
7
+ });
8
+ const threadResumeSchema = z.object({
9
+ thread_id: z.string().min(1),
10
+ model: z.string().optional(),
11
+ cwd: z.string().optional(),
12
+ developer_instructions: z.string().optional(),
13
+ });
14
+ const threadReadSchema = z.object({
15
+ thread_id: z.string().min(1),
16
+ include_turns: z.boolean().optional(),
17
+ });
18
+ const threadListSchema = z.object({
19
+ limit: z.number().int().positive().max(100).optional(),
20
+ cursor: z.string().optional(),
21
+ });
22
+ const turnStartSchema = z.object({
23
+ thread_id: z.string().min(1),
24
+ user_input: z.string().min(1),
25
+ model: z.string().optional(),
26
+ });
27
+ const turnSteerSchema = z.object({
28
+ thread_id: z.string().min(1),
29
+ expected_turn_id: z.string().min(1),
30
+ user_input: z.string().min(1),
31
+ });
32
+ const turnInterruptSchema = z.object({
33
+ thread_id: z.string().min(1),
34
+ turn_id: z.string().min(1),
35
+ });
36
+ const requestListSchema = z.object({
37
+ include_resolved: z.boolean().optional(),
38
+ });
39
+ const requestReadSchema = z.object({
40
+ request_id: z.union([z.string(), z.number()]),
41
+ });
42
+ const requestRespondSchema = z.object({
43
+ request_id: z.union([z.string(), z.number()]),
44
+ payload: z.record(z.string(), z.unknown()).optional(),
45
+ decision: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
46
+ answers: z.record(z.string(), z.object({ answers: z.array(z.string()) })).optional(),
47
+ action: z.enum(['accept', 'decline', 'cancel']).optional(),
48
+ content: z.unknown().optional(),
49
+ meta: z.unknown().optional(),
50
+ scope: z.enum(['turn', 'session']).optional(),
51
+ permissions: z.record(z.string(), z.unknown()).optional(),
52
+ });
53
+ const waitSchema = z.object({
54
+ operation_id: z.string().optional(),
55
+ thread_id: z.string().optional(),
56
+ timeout_ms: z.number().int().positive().max(300_000).optional(),
57
+ poll_interval_ms: z.number().int().positive().max(5_000).optional(),
58
+ });
59
+ function objectSchema(properties, required = []) {
60
+ return {
61
+ type: 'object',
62
+ properties,
63
+ ...(required.length > 0 ? { required } : {}),
64
+ };
65
+ }
66
+ export function createToolDefinitions(modelIds) {
67
+ return [
68
+ {
69
+ name: 'thread-start',
70
+ description: [
71
+ 'Create a new Codex conversation thread.',
72
+ 'Each thread is an independent agent workspace. Launch multiple threads in parallel to work on different tasks concurrently.',
73
+ 'Returns thread_id for use with turn-start.',
74
+ ].join(' '),
75
+ inputSchema: objectSchema({
76
+ model: {
77
+ type: 'string',
78
+ ...(modelIds.length > 0 ? { enum: modelIds } : {}),
79
+ description: 'Model to use for this thread. If omitted, Codex uses the account default.',
80
+ },
81
+ cwd: {
82
+ type: 'string',
83
+ description: 'Working directory for the agent. Defaults to server process cwd.',
84
+ },
85
+ developer_instructions: {
86
+ type: 'string',
87
+ description: 'System-level instructions injected before user messages. Use for constraints, coding style, or scope boundaries.',
88
+ },
89
+ }),
90
+ validate: (value) => threadStartSchema.parse(value),
91
+ },
92
+ {
93
+ name: 'thread-resume',
94
+ description: 'Resume an existing Codex thread that was previously started. Reloads context and reconnects the agent to the conversation.',
95
+ inputSchema: objectSchema({
96
+ thread_id: { type: 'string', minLength: 1, description: 'ID of the thread to resume.' },
97
+ model: {
98
+ type: 'string',
99
+ ...(modelIds.length > 0 ? { enum: modelIds } : {}),
100
+ description: 'Optionally switch model when resuming.',
101
+ },
102
+ cwd: { type: 'string', description: 'Override working directory for the resumed thread.' },
103
+ developer_instructions: { type: 'string', description: 'Update system instructions on resume.' },
104
+ }, ['thread_id']),
105
+ validate: (value) => threadResumeSchema.parse(value),
106
+ },
107
+ {
108
+ name: 'thread-read',
109
+ description: 'Read a thread and its conversation history. Use include_turns=true to get full turn details.',
110
+ inputSchema: objectSchema({
111
+ thread_id: { type: 'string', minLength: 1, description: 'Thread to read.' },
112
+ include_turns: { type: 'boolean', description: 'Include full turn history. Defaults to true.' },
113
+ }, ['thread_id']),
114
+ validate: (value) => threadReadSchema.parse(value),
115
+ },
116
+ {
117
+ name: 'thread-list',
118
+ description: 'List recent Codex threads. Use to discover existing conversations before starting new ones.',
119
+ inputSchema: objectSchema({
120
+ limit: { type: 'integer', minimum: 1, maximum: 100, description: 'Max threads to return. Default 50.' },
121
+ cursor: { type: 'string', description: 'Pagination cursor from a previous response.' },
122
+ }),
123
+ validate: (value) => threadListSchema.parse(value),
124
+ },
125
+ {
126
+ name: 'turn-start',
127
+ description: [
128
+ 'Send a user message to an active thread, starting a new agent turn.',
129
+ 'The agent will execute autonomously — use wait or turn-steer to monitor or redirect.',
130
+ 'For parallel work, start turns on multiple threads simultaneously.',
131
+ ].join(' '),
132
+ inputSchema: objectSchema({
133
+ thread_id: { type: 'string', minLength: 1, description: 'Thread to send the message to.' },
134
+ user_input: { type: 'string', minLength: 1, description: 'The user message or task instruction.' },
135
+ model: {
136
+ type: 'string',
137
+ ...(modelIds.length > 0 ? { enum: modelIds } : {}),
138
+ description: 'Override model for this turn only.',
139
+ },
140
+ }, ['thread_id', 'user_input']),
141
+ validate: (value) => turnStartSchema.parse(value),
142
+ },
143
+ {
144
+ name: 'turn-steer',
145
+ description: 'Redirect an in-progress turn with new instructions. The agent adjusts its approach without losing prior context.',
146
+ inputSchema: objectSchema({
147
+ thread_id: { type: 'string', minLength: 1, description: 'Thread containing the active turn.' },
148
+ expected_turn_id: { type: 'string', minLength: 1, description: 'Turn ID to steer. Must be the currently active turn.' },
149
+ user_input: { type: 'string', minLength: 1, description: 'New instructions to redirect the agent.' },
150
+ }, ['thread_id', 'expected_turn_id', 'user_input']),
151
+ validate: (value) => turnSteerSchema.parse(value),
152
+ },
153
+ {
154
+ name: 'turn-interrupt',
155
+ description: 'Stop an active turn immediately. Use when the agent is heading in the wrong direction or a task should be cancelled.',
156
+ inputSchema: objectSchema({
157
+ thread_id: { type: 'string', minLength: 1, description: 'Thread containing the turn.' },
158
+ turn_id: { type: 'string', minLength: 1, description: 'Turn ID to interrupt.' },
159
+ }, ['thread_id', 'turn_id']),
160
+ validate: (value) => turnInterruptSchema.parse(value),
161
+ },
162
+ {
163
+ name: 'model-list',
164
+ description: 'List all available models for the authenticated Codex account.',
165
+ inputSchema: jsonSchema,
166
+ validate: (value) => value ?? {},
167
+ },
168
+ {
169
+ name: 'account-read',
170
+ description: 'Read the authenticated Codex account details — username, plan, and capabilities.',
171
+ inputSchema: jsonSchema,
172
+ validate: (value) => value ?? {},
173
+ },
174
+ {
175
+ name: 'account-rate-limits-read',
176
+ description: 'Read current rate limit status for the Codex account. Check before launching many parallel threads.',
177
+ inputSchema: jsonSchema,
178
+ validate: (value) => value ?? {},
179
+ },
180
+ {
181
+ name: 'skills-list',
182
+ description: 'List registered Codex skills available in this session.',
183
+ inputSchema: jsonSchema,
184
+ validate: (value) => value ?? {},
185
+ },
186
+ {
187
+ name: 'app-list',
188
+ description: 'List Codex apps available in this session.',
189
+ inputSchema: jsonSchema,
190
+ validate: (value) => value ?? {},
191
+ },
192
+ {
193
+ name: 'request-list',
194
+ description: 'List pending Codex server requests awaiting approval (command execution, file changes, permissions). Check this after starting turns — agents often need permission to proceed.',
195
+ inputSchema: objectSchema({
196
+ include_resolved: { type: 'boolean', description: 'Include already-resolved requests. Default false.' },
197
+ }),
198
+ validate: (value) => requestListSchema.parse(value),
199
+ },
200
+ {
201
+ name: 'request-read',
202
+ description: 'Read details of a specific pending server request. Use to understand what the agent is asking before responding.',
203
+ inputSchema: objectSchema({
204
+ request_id: { type: ['string', 'number'], description: 'ID of the pending request.' },
205
+ }, ['request_id']),
206
+ validate: (value) => requestReadSchema.parse(value),
207
+ },
208
+ {
209
+ name: 'request-respond',
210
+ description: [
211
+ 'Respond to a pending Codex server request (approve commands, grant permissions, answer questions).',
212
+ 'The response shape depends on the request method. For command/file approvals use decision="accept".',
213
+ 'For permission grants use scope and permissions. The tool auto-builds the right payload shape for common methods.',
214
+ ].join(' '),
215
+ inputSchema: objectSchema({
216
+ request_id: { type: ['string', 'number'], description: 'ID of the request to respond to.' },
217
+ payload: { type: 'object', description: 'Raw response payload. Overrides all other fields if provided.' },
218
+ decision: { type: ['string', 'object'], description: 'For approval requests: "accept", "decline", or a structured decision.' },
219
+ answers: { type: 'object', description: 'For user input requests: map of question keys to answer arrays.' },
220
+ action: { type: 'string', enum: ['accept', 'decline', 'cancel'], description: 'For elicitation requests.' },
221
+ content: { description: 'Content payload for elicitation responses.' },
222
+ meta: { description: 'Metadata for elicitation responses.' },
223
+ scope: { type: 'string', enum: ['turn', 'session'], description: 'Permission grant scope. Default "session".' },
224
+ permissions: { type: 'object', description: 'Permission map for permission approval requests.' },
225
+ }, ['request_id']),
226
+ validate: (value) => requestRespondSchema.parse(value),
227
+ },
228
+ {
229
+ name: 'wait',
230
+ description: 'Block until a Codex operation completes or a pending request appears. Use after turn-start to wait for the agent to finish or ask for approval. Provide either operation_id or thread_id.',
231
+ inputSchema: objectSchema({
232
+ operation_id: { type: 'string', description: 'Operation ID to wait on (from a turn-start response).' },
233
+ thread_id: { type: 'string', description: 'Thread ID to wait on — polls until thread status is no longer active.' },
234
+ timeout_ms: { type: 'integer', minimum: 1, maximum: 300000, description: 'Max wait time in ms. Default 120,000 (2 minutes).' },
235
+ poll_interval_ms: { type: 'integer', minimum: 1, maximum: 5000, description: 'Poll interval in ms. Default 250.' },
236
+ }),
237
+ validate: (value) => waitSchema.parse(value),
238
+ },
239
+ ];
240
+ }
241
+ //# sourceMappingURL=tool-definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-definitions.js","sourceRoot":"","sources":["../../../src/mcp/tool-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAiB,EAAE,CAAC;AAE/C,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,C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G,EAAE,CAAC,YAAY,CAAC,CAAC;YAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC;SACvD;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,2LAA2L;YACxM,WAAW,EAAE,YAAY,CAAC;gBACxB,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uDAAuD,EAAE;gBACtG,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uEAAuE,EAAE;gBACnH,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,mDAAmD,EAAE;gBAC9H,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE;aACnH,CAAC;YACF,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;SAC7C;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import type { PendingServerRequest, RequestId, RuntimeOperation } from '../types/codex.js';
3
+ interface RequestOptions {
4
+ timeoutMs?: number | undefined;
5
+ }
6
+ interface RequestWithBridgeOptions extends RequestOptions {
7
+ threadId?: string | undefined;
8
+ bridgeTimeoutMs?: number | undefined;
9
+ }
10
+ interface WaitOptions {
11
+ timeoutMs?: number | undefined;
12
+ pollIntervalMs?: number | undefined;
13
+ }
14
+ export interface AppServerClientOptions {
15
+ command: string;
16
+ args: string[];
17
+ env: NodeJS.ProcessEnv;
18
+ codexHome: string;
19
+ appName?: string | undefined;
20
+ appVersion?: string | undefined;
21
+ }
22
+ export interface BridgedOperationResult {
23
+ status: 'completed' | 'pending_request' | 'running';
24
+ operationId: string;
25
+ requestId: RequestId;
26
+ pendingRequestIds: RequestId[];
27
+ result?: unknown;
28
+ }
29
+ export declare class AppServerClient extends EventEmitter {
30
+ private readonly options;
31
+ private readonly pendingRequests;
32
+ private readonly serverRequests;
33
+ private readonly operations;
34
+ private readonly operationsByRequestId;
35
+ private readonly threadEvents;
36
+ private process?;
37
+ private nextRequestCounter;
38
+ private nextOperationCounter;
39
+ private buffer;
40
+ private started;
41
+ constructor(options: AppServerClientOptions);
42
+ start(): Promise<void>;
43
+ stop(): Promise<void>;
44
+ request(method: string, params: unknown, options?: RequestOptions): Promise<unknown>;
45
+ requestWithBridge(method: string, params: unknown, options?: RequestWithBridgeOptions): Promise<BridgedOperationResult>;
46
+ waitForOperation(operationId: string, options?: WaitOptions): Promise<RuntimeOperation>;
47
+ getOperation(operationId: string): RuntimeOperation | undefined;
48
+ listOperations(): RuntimeOperation[];
49
+ listServerRequests(includeResolved?: boolean): PendingServerRequest[];
50
+ getServerRequest(id: RequestId): PendingServerRequest | undefined;
51
+ respondToServerRequest(id: RequestId, payload: unknown): Promise<void>;
52
+ getThreadEvents(threadId: string): unknown[];
53
+ private sendRequest;
54
+ private consumeStdout;
55
+ private handleMessage;
56
+ private resolveClientRequest;
57
+ private storeServerRequest;
58
+ private handleNotification;
59
+ private updateOperationsFromNotification;
60
+ private extractThreadIdFromParams;
61
+ private extractTurnId;
62
+ private extractTurnError;
63
+ private writeLine;
64
+ }
65
+ export {};