@jrkropp/codex-js 0.1.4 → 0.2.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 (864) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +57 -617
  3. package/dist/client/index.d.ts +2 -16
  4. package/dist/client/index.js +2522 -16
  5. package/dist/index.d.ts +2 -25
  6. package/dist/index.js +699 -20
  7. package/dist/internal/codex/app-server/src/bespoke_event_handling.d.ts +5 -0
  8. package/dist/internal/codex/app-server/src/connection_rpc_gate.d.ts +11 -0
  9. package/dist/internal/codex/app-server/src/dynamic_tools.d.ts +5 -0
  10. package/dist/internal/codex/app-server/src/message_processor.d.ts +88 -0
  11. package/dist/internal/codex/app-server/src/outgoing_message.d.ts +73 -0
  12. package/dist/internal/codex/app-server/src/request_processors/common.d.ts +25 -0
  13. package/dist/internal/codex/app-server/src/request_processors/mcp_processor.d.ts +32 -0
  14. package/dist/internal/codex/app-server/src/request_processors/request_errors.d.ts +9 -0
  15. package/dist/internal/codex/app-server/src/request_processors/thread_processor.d.ts +38 -0
  16. package/dist/internal/codex/app-server/src/request_processors/token_usage_replay.d.ts +22 -0
  17. package/dist/internal/codex/app-server/src/request_processors/turn_processor.d.ts +21 -0
  18. package/dist/internal/codex/app-server/src/request_processors.d.ts +5 -0
  19. package/dist/internal/codex/app-server/src/request_serialization.d.ts +7 -0
  20. package/dist/internal/codex/app-server/src/runtime.d.ts +96 -0
  21. package/dist/internal/codex/app-server/src/server_request_response.d.ts +30 -0
  22. package/dist/internal/codex/app-server/src/session_factory.d.ts +30 -0
  23. package/dist/internal/codex/app-server/src/session_task_runner.d.ts +44 -0
  24. package/dist/internal/codex/app-server/src/thread_state.d.ts +56 -0
  25. package/dist/internal/codex/app-server-client/src/lib.d.ts +48 -0
  26. package/dist/{index-77U_Oc-a.d.ts → internal/codex/app-server-client/src/pending_requests.d.ts} +7 -18
  27. package/dist/internal/codex/app-server-client/src/remote.d.ts +18 -0
  28. package/dist/{session-BRYzi8OT.d.ts → internal/codex/app-server-client/src/session.d.ts} +5 -9
  29. package/dist/{thread_event_store-C0zYzukG.d.ts → internal/codex/app-server-client/src/thread_event_store.d.ts} +14 -14
  30. package/dist/internal/codex/app-server-client/src/thread_projection.d.ts +9 -0
  31. package/dist/internal/codex/app-server-protocol/schema/typescript/AbsolutePathBuf.d.ts +10 -0
  32. package/dist/internal/codex/app-server-protocol/schema/typescript/AgentPath.d.ts +1 -0
  33. package/dist/internal/codex/app-server-protocol/schema/typescript/ApplyPatchApprovalParams.d.ts +22 -0
  34. package/dist/internal/codex/app-server-protocol/schema/typescript/ApplyPatchApprovalResponse.d.ts +4 -0
  35. package/dist/internal/codex/app-server-protocol/schema/typescript/AuthMode.d.ts +4 -0
  36. package/dist/internal/codex/app-server-protocol/schema/typescript/ClientInfo.d.ts +5 -0
  37. package/dist/internal/codex/app-server-protocol/schema/typescript/ClientNotification.d.ts +3 -0
  38. package/dist/internal/codex/app-server-protocol/schema/typescript/ClientRequest.d.ts +410 -0
  39. package/dist/internal/codex/app-server-protocol/schema/typescript/CollaborationMode.d.ts +9 -0
  40. package/dist/internal/codex/app-server-protocol/schema/typescript/ContentItem.d.ts +12 -0
  41. package/dist/internal/codex/app-server-protocol/schema/typescript/ConversationGitInfo.d.ts +5 -0
  42. package/dist/internal/codex/app-server-protocol/schema/typescript/ConversationSummary.d.ts +15 -0
  43. package/dist/internal/codex/app-server-protocol/schema/typescript/ExecCommandApprovalParams.d.ts +18 -0
  44. package/dist/internal/codex/app-server-protocol/schema/typescript/ExecCommandApprovalResponse.d.ts +4 -0
  45. package/dist/internal/codex/app-server-protocol/schema/typescript/ExecPolicyAmendment.d.ts +8 -0
  46. package/dist/internal/codex/app-server-protocol/schema/typescript/FileChange.d.ts +11 -0
  47. package/dist/internal/codex/app-server-protocol/schema/typescript/ForcedLoginMethod.d.ts +1 -0
  48. package/dist/internal/codex/app-server-protocol/schema/typescript/FunctionCallOutputBody.d.ts +2 -0
  49. package/dist/internal/codex/app-server-protocol/schema/typescript/FunctionCallOutputContentItem.d.ts +13 -0
  50. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchMatchType.d.ts +1 -0
  51. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchParams.d.ts +5 -0
  52. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchResponse.d.ts +4 -0
  53. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchResult.d.ts +12 -0
  54. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchSessionCompletedNotification.d.ts +3 -0
  55. package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchSessionUpdatedNotification.d.ts +6 -0
  56. package/dist/internal/codex/app-server-protocol/schema/typescript/GetAuthStatusParams.d.ts +4 -0
  57. package/dist/internal/codex/app-server-protocol/schema/typescript/GetAuthStatusResponse.d.ts +6 -0
  58. package/dist/internal/codex/app-server-protocol/schema/typescript/GetConversationSummaryParams.d.ts +6 -0
  59. package/dist/internal/codex/app-server-protocol/schema/typescript/GetConversationSummaryResponse.d.ts +4 -0
  60. package/dist/internal/codex/app-server-protocol/schema/typescript/GitDiffToRemoteParams.d.ts +3 -0
  61. package/dist/internal/codex/app-server-protocol/schema/typescript/GitDiffToRemoteResponse.d.ts +5 -0
  62. package/dist/internal/codex/app-server-protocol/schema/typescript/GitSha.d.ts +1 -0
  63. package/dist/internal/codex/app-server-protocol/schema/typescript/ImageDetail.d.ts +1 -0
  64. package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeCapabilities.d.ts +14 -0
  65. package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeParams.d.ts +6 -0
  66. package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeResponse.d.ts +18 -0
  67. package/dist/internal/codex/app-server-protocol/schema/typescript/InputModality.d.ts +4 -0
  68. package/dist/internal/codex/app-server-protocol/schema/typescript/InternalSessionSource.d.ts +1 -0
  69. package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellAction.d.ts +4 -0
  70. package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellExecAction.d.ts +9 -0
  71. package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellStatus.d.ts +1 -0
  72. package/dist/internal/codex/app-server-protocol/schema/typescript/MessagePhase.d.ts +7 -0
  73. package/dist/internal/codex/app-server-protocol/schema/typescript/ModeKind.d.ts +4 -0
  74. package/dist/internal/codex/app-server-protocol/schema/typescript/NetworkPolicyAmendment.d.ts +5 -0
  75. package/dist/internal/codex/app-server-protocol/schema/typescript/NetworkPolicyRuleAction.d.ts +1 -0
  76. package/dist/internal/codex/app-server-protocol/schema/typescript/ParsedCommand.d.ts +24 -0
  77. package/dist/internal/codex/app-server-protocol/schema/typescript/Personality.d.ts +1 -0
  78. package/dist/internal/codex/app-server-protocol/schema/typescript/PlanType.d.ts +1 -0
  79. package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeConversationVersion.d.ts +1 -0
  80. package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeOutputModality.d.ts +1 -0
  81. package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeVoice.d.ts +1 -0
  82. package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeVoicesList.d.ts +7 -0
  83. package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningEffort.d.ts +4 -0
  84. package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningItemContent.d.ts +7 -0
  85. package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningItemReasoningSummary.d.ts +4 -0
  86. package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningSummary.d.ts +6 -0
  87. package/dist/internal/codex/app-server-protocol/schema/typescript/RequestId.d.ts +1 -0
  88. package/dist/internal/codex/app-server-protocol/schema/typescript/Resource.d.ts +15 -0
  89. package/dist/internal/codex/app-server-protocol/schema/typescript/ResourceContent.d.ts +21 -0
  90. package/dist/internal/codex/app-server-protocol/schema/typescript/ResourceTemplate.d.ts +12 -0
  91. package/dist/internal/codex/app-server-protocol/schema/typescript/ResponseItem.d.ts +78 -0
  92. package/dist/internal/codex/app-server-protocol/schema/typescript/ReviewDecision.d.ts +14 -0
  93. package/dist/internal/codex/app-server-protocol/schema/typescript/ServerNotification.d.ts +260 -0
  94. package/dist/internal/codex/app-server-protocol/schema/typescript/ServerRequest.d.ts +50 -0
  95. package/dist/internal/codex/app-server-protocol/schema/typescript/SessionSource.d.ts +9 -0
  96. package/dist/internal/codex/app-server-protocol/schema/typescript/Settings.d.ts +9 -0
  97. package/dist/internal/codex/app-server-protocol/schema/typescript/SubAgentSource.d.ts +13 -0
  98. package/dist/internal/codex/app-server-protocol/schema/typescript/ThreadId.d.ts +1 -0
  99. package/dist/internal/codex/app-server-protocol/schema/typescript/ThreadMemoryMode.d.ts +1 -0
  100. package/dist/internal/codex/app-server-protocol/schema/typescript/Tool.d.ts +14 -0
  101. package/dist/internal/codex/app-server-protocol/schema/typescript/Verbosity.d.ts +5 -0
  102. package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchAction.d.ts +14 -0
  103. package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchContextSize.d.ts +1 -0
  104. package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchLocation.d.ts +6 -0
  105. package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchMode.d.ts +1 -0
  106. package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchToolConfig.d.ts +7 -0
  107. package/dist/internal/codex/app-server-protocol/schema/typescript/index.d.ts +77 -0
  108. package/dist/internal/codex/app-server-protocol/schema/typescript/serde_json/JsonValue.d.ts +3 -0
  109. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Account.d.ts +10 -0
  110. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountLoginCompletedNotification.d.ts +5 -0
  111. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountRateLimitsUpdatedNotification.d.ts +4 -0
  112. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountUpdatedNotification.d.ts +6 -0
  113. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ActivePermissionProfile.d.ts +18 -0
  114. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ActivePermissionProfileModification.d.ts +5 -0
  115. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AddCreditsNudgeCreditType.d.ts +1 -0
  116. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AddCreditsNudgeEmailStatus.d.ts +1 -0
  117. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalFileSystemPermissions.d.ts +14 -0
  118. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalNetworkPermissions.d.ts +3 -0
  119. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalPermissionProfile.d.ts +9 -0
  120. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AgentMessageDeltaNotification.d.ts +6 -0
  121. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AnalyticsConfig.d.ts +8 -0
  122. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppBranding.d.ts +11 -0
  123. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppInfo.d.ts +30 -0
  124. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppListUpdatedNotification.d.ts +7 -0
  125. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppMetadata.d.ts +16 -0
  126. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppReview.d.ts +3 -0
  127. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppScreenshot.d.ts +5 -0
  128. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppSummary.d.ts +10 -0
  129. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppToolApproval.d.ts +1 -0
  130. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppToolsConfig.d.ts +7 -0
  131. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ApprovalsReviewer.d.ts +8 -0
  132. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsConfig.d.ts +15 -0
  133. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsDefaultConfig.d.ts +5 -0
  134. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsListParams.d.ts +21 -0
  135. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsListResponse.d.ts +12 -0
  136. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AskForApproval.d.ts +9 -0
  137. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AutoReviewDecisionSource.d.ts +4 -0
  138. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ByteRange.d.ts +4 -0
  139. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountParams.d.ts +3 -0
  140. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountResponse.d.ts +4 -0
  141. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountStatus.d.ts +1 -0
  142. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshParams.d.ts +14 -0
  143. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshReason.d.ts +1 -0
  144. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshResponse.d.ts +5 -0
  145. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CodexErrorInfo.d.ts +28 -0
  146. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentState.d.ts +5 -0
  147. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentStatus.d.ts +1 -0
  148. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentTool.d.ts +1 -0
  149. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentToolCallStatus.d.ts +1 -0
  150. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeListParams.d.ts +4 -0
  151. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeListResponse.d.ts +7 -0
  152. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeMask.d.ts +11 -0
  153. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandAction.d.ts +19 -0
  154. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecOutputDeltaNotification.d.ts +27 -0
  155. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecOutputStream.d.ts +4 -0
  156. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecParams.d.ts +82 -0
  157. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResizeParams.d.ts +15 -0
  158. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResizeResponse.d.ts +4 -0
  159. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResponse.d.ts +21 -0
  160. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminalSize.d.ts +13 -0
  161. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminateParams.d.ts +10 -0
  162. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminateResponse.d.ts +4 -0
  163. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecWriteParams.d.ts +19 -0
  164. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecWriteResponse.d.ts +4 -0
  165. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionApprovalDecision.d.ts +11 -0
  166. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionOutputDeltaNotification.d.ts +6 -0
  167. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionRequestApprovalParams.d.ts +40 -0
  168. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionRequestApprovalResponse.d.ts +4 -0
  169. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionSource.d.ts +1 -0
  170. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionStatus.d.ts +1 -0
  171. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandMigration.d.ts +3 -0
  172. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Config.d.ts +47 -0
  173. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigBatchWriteParams.d.ts +13 -0
  174. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigEdit.d.ts +7 -0
  175. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayer.d.ts +8 -0
  176. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayerMetadata.d.ts +5 -0
  177. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayerSource.d.ts +30 -0
  178. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigReadParams.d.ts +9 -0
  179. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigReadResponse.d.ts +10 -0
  180. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigRequirements.d.ts +13 -0
  181. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigRequirementsReadResponse.d.ts +7 -0
  182. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigValueWriteParams.d.ts +12 -0
  183. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigWarningNotification.d.ts +19 -0
  184. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigWriteResponse.d.ts +12 -0
  185. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfiguredHookHandler.d.ts +11 -0
  186. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfiguredHookMatcherGroup.d.ts +5 -0
  187. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ContextCompactedNotification.d.ts +7 -0
  188. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CreditsSnapshot.d.ts +5 -0
  189. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeprecationNoticeNotification.d.ts +10 -0
  190. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyAlgorithm.d.ts +4 -0
  191. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyCreateParams.d.ts +12 -0
  192. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyCreateResponse.d.ts +14 -0
  193. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyProtectionClass.d.ts +4 -0
  194. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyProtectionPolicy.d.ts +4 -0
  195. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyPublicParams.d.ts +6 -0
  196. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyPublicResponse.d.ts +14 -0
  197. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignParams.d.ts +8 -0
  198. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignPayload.d.ts +62 -0
  199. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignResponse.d.ts +16 -0
  200. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallOutputContentItem.d.ts +7 -0
  201. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallParams.d.ts +9 -0
  202. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallResponse.d.ts +5 -0
  203. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallStatus.d.ts +1 -0
  204. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolSpec.d.ts +8 -0
  205. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ErrorNotification.d.ts +7 -0
  206. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExecPolicyAmendment.d.ts +1 -0
  207. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeature.d.ts +34 -0
  208. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetParams.d.ts +11 -0
  209. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetResponse.d.ts +8 -0
  210. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureListParams.d.ts +10 -0
  211. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureListResponse.d.ts +9 -0
  212. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureStage.d.ts +1 -0
  213. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigDetectParams.d.ts +10 -0
  214. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigDetectResponse.d.ts +4 -0
  215. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportCompletedNotification.d.ts +1 -0
  216. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportParams.d.ts +4 -0
  217. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportResponse.d.ts +1 -0
  218. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigMigrationItem.d.ts +11 -0
  219. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigMigrationItemType.d.ts +1 -0
  220. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FeedbackUploadParams.d.ts +10 -0
  221. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.d.ts +3 -0
  222. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeApprovalDecision.d.ts +1 -0
  223. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeOutputDeltaNotification.d.ts +11 -0
  224. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangePatchUpdatedNotification.d.ts +7 -0
  225. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeRequestApprovalParams.d.ts +14 -0
  226. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeRequestApprovalResponse.d.ts +4 -0
  227. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemAccessMode.d.ts +1 -0
  228. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemPath.d.ts +12 -0
  229. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemSandboxEntry.d.ts +6 -0
  230. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemSpecialPath.d.ts +16 -0
  231. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileUpdateChange.d.ts +6 -0
  232. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsChangedNotification.d.ts +14 -0
  233. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCopyParams.d.ts +18 -0
  234. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCopyResponse.d.ts +4 -0
  235. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCreateDirectoryParams.d.ts +14 -0
  236. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCreateDirectoryResponse.d.ts +4 -0
  237. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsGetMetadataParams.d.ts +10 -0
  238. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsGetMetadataResponse.d.ts +25 -0
  239. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryEntry.d.ts +17 -0
  240. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryParams.d.ts +10 -0
  241. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryResponse.d.ts +10 -0
  242. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadFileParams.d.ts +10 -0
  243. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadFileResponse.d.ts +9 -0
  244. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsRemoveParams.d.ts +18 -0
  245. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsRemoveResponse.d.ts +4 -0
  246. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsUnwatchParams.d.ts +9 -0
  247. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsUnwatchResponse.d.ts +4 -0
  248. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWatchParams.d.ts +14 -0
  249. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWatchResponse.d.ts +10 -0
  250. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWriteFileParams.d.ts +14 -0
  251. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWriteFileResponse.d.ts +4 -0
  252. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountParams.d.ts +10 -0
  253. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountRateLimitsResponse.d.ts +13 -0
  254. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountResponse.d.ts +5 -0
  255. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GitInfo.d.ts +5 -0
  256. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GrantedPermissionProfile.d.ts +6 -0
  257. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReview.d.ts +14 -0
  258. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.d.ts +37 -0
  259. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewStatus.d.ts +4 -0
  260. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianCommandSource.d.ts +1 -0
  261. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianRiskLevel.d.ts +4 -0
  262. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianUserAuthorization.d.ts +4 -0
  263. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianWarningNotification.d.ts +10 -0
  264. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookCompletedNotification.d.ts +6 -0
  265. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookErrorInfo.d.ts +4 -0
  266. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookEventName.d.ts +1 -0
  267. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookExecutionMode.d.ts +1 -0
  268. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookHandlerType.d.ts +1 -0
  269. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookMetadata.d.ts +22 -0
  270. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookMigration.d.ts +3 -0
  271. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookOutputEntry.d.ts +5 -0
  272. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.d.ts +1 -0
  273. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookPromptFragment.d.ts +4 -0
  274. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookRunStatus.d.ts +1 -0
  275. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookRunSummary.d.ts +24 -0
  276. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookScope.d.ts +1 -0
  277. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookSource.d.ts +1 -0
  278. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookStartedNotification.d.ts +6 -0
  279. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookTrustStatus.d.ts +1 -0
  280. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListEntry.d.ts +8 -0
  281. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListParams.d.ts +6 -0
  282. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListResponse.d.ts +4 -0
  283. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemCompletedNotification.d.ts +10 -0
  284. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemGuardianApprovalReviewCompletedNotification.d.ts +32 -0
  285. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemGuardianApprovalReviewStartedNotification.d.ts +30 -0
  286. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemStartedNotification.d.ts +10 -0
  287. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ListMcpServerStatusParams.d.ts +16 -0
  288. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ListMcpServerStatusResponse.d.ts +9 -0
  289. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LoginAccountParams.d.ts +27 -0
  290. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LoginAccountResponse.d.ts +23 -0
  291. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LogoutAccountResponse.d.ts +1 -0
  292. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ManagedHooksRequirements.d.ts +13 -0
  293. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceAddParams.d.ts +5 -0
  294. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceAddResponse.d.ts +6 -0
  295. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceInterface.d.ts +3 -0
  296. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceLoadErrorInfo.d.ts +5 -0
  297. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceRemoveParams.d.ts +3 -0
  298. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceRemoveResponse.d.ts +5 -0
  299. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeErrorInfo.d.ts +4 -0
  300. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeParams.d.ts +3 -0
  301. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeResponse.d.ts +7 -0
  302. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpAuthStatus.d.ts +1 -0
  303. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationArrayType.d.ts +1 -0
  304. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationBooleanSchema.d.ts +7 -0
  305. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationBooleanType.d.ts +1 -0
  306. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationConstOption.d.ts +4 -0
  307. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationEnumSchema.d.ts +4 -0
  308. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationLegacyTitledEnumSchema.d.ts +9 -0
  309. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationMultiSelectEnumSchema.d.ts +3 -0
  310. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationNumberSchema.d.ts +9 -0
  311. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationNumberType.d.ts +1 -0
  312. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationObjectType.d.ts +1 -0
  313. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationPrimitiveSchema.d.ts +5 -0
  314. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationSchema.d.ts +16 -0
  315. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationSingleSelectEnumSchema.d.ts +3 -0
  316. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringFormat.d.ts +1 -0
  317. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringSchema.d.ts +11 -0
  318. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringType.d.ts +1 -0
  319. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledEnumItems.d.ts +4 -0
  320. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledMultiSelectEnumSchema.d.ts +11 -0
  321. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledSingleSelectEnumSchema.d.ts +9 -0
  322. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledEnumItems.d.ts +5 -0
  323. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledMultiSelectEnumSchema.d.ts +11 -0
  324. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledSingleSelectEnumSchema.d.ts +8 -0
  325. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpResourceReadParams.d.ts +5 -0
  326. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpResourceReadResponse.d.ts +4 -0
  327. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationAction.d.ts +1 -0
  328. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationRequestParams.d.ts +26 -0
  329. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationRequestResponse.d.ts +15 -0
  330. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerMigration.d.ts +3 -0
  331. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginCompletedNotification.d.ts +5 -0
  332. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginParams.d.ts +5 -0
  333. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginResponse.d.ts +3 -0
  334. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerRefreshResponse.d.ts +1 -0
  335. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStartupState.d.ts +1 -0
  336. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatus.d.ts +13 -0
  337. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatusDetail.d.ts +1 -0
  338. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatusUpdatedNotification.d.ts +6 -0
  339. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerToolCallParams.d.ts +8 -0
  340. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerToolCallResponse.d.ts +7 -0
  341. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallError.d.ts +3 -0
  342. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallProgressNotification.d.ts +6 -0
  343. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallResult.d.ts +6 -0
  344. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallStatus.d.ts +1 -0
  345. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MemoryCitation.d.ts +5 -0
  346. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MemoryCitationEntry.d.ts +6 -0
  347. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MergeStrategy.d.ts +1 -0
  348. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MigrationDetails.d.ts +14 -0
  349. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Model.d.ts +26 -0
  350. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelAvailabilityNux.d.ts +3 -0
  351. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelListParams.d.ts +14 -0
  352. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelListResponse.d.ts +9 -0
  353. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelProviderCapabilitiesReadParams.d.ts +1 -0
  354. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelProviderCapabilitiesReadResponse.d.ts +5 -0
  355. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelRerouteReason.d.ts +1 -0
  356. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelReroutedNotification.d.ts +8 -0
  357. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelServiceTier.d.ts +5 -0
  358. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelUpgradeInfo.d.ts +6 -0
  359. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelVerification.d.ts +1 -0
  360. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelVerificationNotification.d.ts +6 -0
  361. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkAccess.d.ts +1 -0
  362. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkApprovalContext.d.ts +5 -0
  363. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkApprovalProtocol.d.ts +1 -0
  364. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkDomainPermission.d.ts +1 -0
  365. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkPolicyAmendment.d.ts +5 -0
  366. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkPolicyRuleAction.d.ts +1 -0
  367. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkRequirements.d.ts +40 -0
  368. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkUnixSocketPermission.d.ts +1 -0
  369. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NonSteerableTurnKind.d.ts +1 -0
  370. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/OverriddenMetadata.d.ts +7 -0
  371. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PatchApplyStatus.d.ts +1 -0
  372. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PatchChangeKind.d.ts +8 -0
  373. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionGrantScope.d.ts +1 -0
  374. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfile.d.ts +12 -0
  375. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileFileSystemPermissions.d.ts +8 -0
  376. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileModificationParams.d.ts +5 -0
  377. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileNetworkPermissions.d.ts +3 -0
  378. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileSelectionParams.d.ts +6 -0
  379. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.d.ts +10 -0
  380. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalResponse.d.ts +10 -0
  381. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PlanDeltaNotification.d.ts +10 -0
  382. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginAuthPolicy.d.ts +1 -0
  383. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginAvailability.d.ts +1 -0
  384. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginDetail.d.ts +13 -0
  385. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallParams.d.ts +6 -0
  386. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallPolicy.d.ts +1 -0
  387. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallResponse.d.ts +6 -0
  388. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInterface.d.ts +42 -0
  389. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListMarketplaceKind.d.ts +1 -0
  390. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListParams.d.ts +14 -0
  391. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListResponse.d.ts +7 -0
  392. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginMarketplaceEntry.d.ts +13 -0
  393. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginReadParams.d.ts +6 -0
  394. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginReadResponse.d.ts +4 -0
  395. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareContext.d.ts +5 -0
  396. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDeleteParams.d.ts +3 -0
  397. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDeleteResponse.d.ts +1 -0
  398. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDiscoverability.d.ts +1 -0
  399. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListItem.d.ts +7 -0
  400. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListParams.d.ts +1 -0
  401. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListResponse.d.ts +4 -0
  402. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSharePrincipal.d.ts +6 -0
  403. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSharePrincipalType.d.ts +1 -0
  404. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareSaveParams.d.ts +9 -0
  405. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareSaveResponse.d.ts +4 -0
  406. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareTarget.d.ts +5 -0
  407. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareUpdateTargetsParams.d.ts +5 -0
  408. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareUpdateTargetsResponse.d.ts +4 -0
  409. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSkillReadParams.d.ts +5 -0
  410. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSkillReadResponse.d.ts +3 -0
  411. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSource.d.ts +13 -0
  412. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSummary.d.ts +25 -0
  413. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginUninstallParams.d.ts +3 -0
  414. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginUninstallResponse.d.ts +1 -0
  415. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginsMigration.d.ts +4 -0
  416. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessExitedNotification.d.ts +39 -0
  417. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessOutputDeltaNotification.d.ts +23 -0
  418. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessOutputStream.d.ts +4 -0
  419. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessTerminalSize.d.ts +13 -0
  420. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProfileV2.d.ts +29 -0
  421. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitReachedType.d.ts +1 -0
  422. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitSnapshot.d.ts +13 -0
  423. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitWindow.d.ts +5 -0
  424. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RawResponseItemCompletedNotification.d.ts +6 -0
  425. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningEffortOption.d.ts +5 -0
  426. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningSummaryPartAddedNotification.d.ts +6 -0
  427. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningSummaryTextDeltaNotification.d.ts +7 -0
  428. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningTextDeltaNotification.d.ts +7 -0
  429. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlClientConnectionAudience.d.ts +4 -0
  430. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlClientEnrollmentAudience.d.ts +4 -0
  431. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlConnectionStatus.d.ts +1 -0
  432. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlStatusChangedNotification.d.ts +8 -0
  433. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RequestPermissionProfile.d.ts +6 -0
  434. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ResidencyRequirement.d.ts +1 -0
  435. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewDelivery.d.ts +1 -0
  436. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewStartParams.d.ts +11 -0
  437. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewStartResponse.d.ts +11 -0
  438. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewTarget.d.ts +16 -0
  439. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxMode.d.ts +1 -0
  440. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxPolicy.d.ts +17 -0
  441. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxWorkspaceWrite.d.ts +6 -0
  442. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SendAddCreditsNudgeEmailParams.d.ts +4 -0
  443. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SendAddCreditsNudgeEmailResponse.d.ts +4 -0
  444. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ServerRequestResolvedNotification.d.ts +5 -0
  445. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SessionMigration.d.ts +5 -0
  446. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SessionSource.d.ts +6 -0
  447. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillDependencies.d.ts +4 -0
  448. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillErrorInfo.d.ts +4 -0
  449. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillInterface.d.ts +9 -0
  450. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillMetadata.d.ts +17 -0
  451. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillScope.d.ts +1 -0
  452. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillSummary.d.ts +10 -0
  453. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillToolDependency.d.ts +8 -0
  454. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsChangedNotification.d.ts +7 -0
  455. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsConfigWriteParams.d.ts +12 -0
  456. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsConfigWriteResponse.d.ts +3 -0
  457. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListEntry.d.ts +7 -0
  458. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListExtraRootsForCwd.d.ts +4 -0
  459. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListParams.d.ts +15 -0
  460. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListResponse.d.ts +4 -0
  461. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SortDirection.d.ts +1 -0
  462. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SubagentMigration.d.ts +3 -0
  463. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TerminalInteractionNotification.d.ts +7 -0
  464. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextElement.d.ts +11 -0
  465. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextPosition.d.ts +10 -0
  466. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextRange.d.ts +5 -0
  467. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Thread.d.ts +84 -0
  468. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadActiveFlag.d.ts +1 -0
  469. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadApproveGuardianDeniedActionParams.d.ts +8 -0
  470. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadApproveGuardianDeniedActionResponse.d.ts +1 -0
  471. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchiveParams.d.ts +3 -0
  472. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchiveResponse.d.ts +1 -0
  473. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchivedNotification.d.ts +3 -0
  474. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadClosedNotification.d.ts +3 -0
  475. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadCompactStartParams.d.ts +3 -0
  476. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadCompactStartResponse.d.ts +1 -0
  477. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadForkParams.d.ts +38 -0
  478. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadForkResponse.d.ts +26 -0
  479. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoal.d.ts +11 -0
  480. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalClearedNotification.d.ts +3 -0
  481. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalStatus.d.ts +1 -0
  482. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalUpdatedNotification.d.ts +6 -0
  483. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadInjectItemsParams.d.ts +8 -0
  484. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadInjectItemsResponse.d.ts +1 -0
  485. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadItem.d.ts +180 -0
  486. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadListParams.d.ts +51 -0
  487. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadListResponse.d.ts +16 -0
  488. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadLoadedListParams.d.ts +10 -0
  489. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadLoadedListResponse.d.ts +11 -0
  490. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataGitInfoUpdateParams.d.ts +17 -0
  491. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataUpdateParams.d.ts +10 -0
  492. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataUpdateResponse.d.ts +4 -0
  493. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadNameUpdatedNotification.d.ts +4 -0
  494. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadReadParams.d.ts +7 -0
  495. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadReadResponse.d.ts +4 -0
  496. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeAudioChunk.d.ts +10 -0
  497. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeClosedNotification.d.ts +7 -0
  498. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeErrorNotification.d.ts +7 -0
  499. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeItemAddedNotification.d.ts +8 -0
  500. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeOutputAudioDeltaNotification.d.ts +8 -0
  501. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeSdpNotification.d.ts +7 -0
  502. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeStartTransport.d.ts +13 -0
  503. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeStartedNotification.d.ts +9 -0
  504. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeTranscriptDeltaNotification.d.ts +12 -0
  505. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeTranscriptDoneNotification.d.ts +12 -0
  506. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadResumeParams.d.ts +37 -0
  507. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadResumeResponse.d.ts +26 -0
  508. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRollbackParams.d.ts +10 -0
  509. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRollbackResponse.d.ts +11 -0
  510. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSetNameParams.d.ts +4 -0
  511. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSetNameResponse.d.ts +1 -0
  512. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadShellCommandParams.d.ts +10 -0
  513. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadShellCommandResponse.d.ts +1 -0
  514. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSortKey.d.ts +1 -0
  515. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSource.d.ts +1 -0
  516. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSourceKind.d.ts +1 -0
  517. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartParams.d.ts +31 -0
  518. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartResponse.d.ts +26 -0
  519. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartSource.d.ts +1 -0
  520. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartedNotification.d.ts +4 -0
  521. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStatus.d.ts +11 -0
  522. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStatusChangedNotification.d.ts +5 -0
  523. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadTokenUsage.d.ts +6 -0
  524. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadTokenUsageUpdatedNotification.d.ts +6 -0
  525. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchiveParams.d.ts +3 -0
  526. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchiveResponse.d.ts +4 -0
  527. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchivedNotification.d.ts +3 -0
  528. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeParams.d.ts +3 -0
  529. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeResponse.d.ts +4 -0
  530. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeStatus.d.ts +1 -0
  531. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TokenUsageBreakdown.d.ts +7 -0
  532. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputAnswer.d.ts +6 -0
  533. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputOption.d.ts +7 -0
  534. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputParams.d.ts +10 -0
  535. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputQuestion.d.ts +12 -0
  536. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputResponse.d.ts +9 -0
  537. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolsV2.d.ts +5 -0
  538. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Turn.d.ts +32 -0
  539. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnCompletedNotification.d.ts +5 -0
  540. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnDiffUpdatedNotification.d.ts +9 -0
  541. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnEnvironmentParams.d.ts +5 -0
  542. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnError.d.ts +6 -0
  543. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnInterruptParams.d.ts +4 -0
  544. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnInterruptResponse.d.ts +1 -0
  545. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnItemsView.d.ts +1 -0
  546. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanStep.d.ts +5 -0
  547. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanStepStatus.d.ts +1 -0
  548. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanUpdatedNotification.d.ts +7 -0
  549. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartParams.d.ts +44 -0
  550. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartResponse.d.ts +4 -0
  551. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartedNotification.d.ts +5 -0
  552. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStatus.d.ts +1 -0
  553. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnSteerParams.d.ts +9 -0
  554. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnSteerResponse.d.ts +3 -0
  555. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/UserInput.d.ts +23 -0
  556. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WarningNotification.d.ts +10 -0
  557. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WebSearchAction.d.ts +14 -0
  558. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxReadiness.d.ts +1 -0
  559. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxReadinessResponse.d.ts +4 -0
  560. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupCompletedNotification.d.ts +6 -0
  561. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupMode.d.ts +1 -0
  562. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupStartParams.d.ts +6 -0
  563. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupStartResponse.d.ts +3 -0
  564. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsWorldWritableWarningNotification.d.ts +5 -0
  565. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WriteStatus.d.ts +1 -0
  566. package/dist/internal/codex/app-server-protocol/schema/typescript/v2/index.d.ts +457 -0
  567. package/dist/internal/codex/app-server-protocol/src/protocol/common.d.ts +36 -0
  568. package/dist/internal/codex/app-server-protocol/src/protocol/event-mapping.d.ts +41 -0
  569. package/dist/internal/codex/app-server-protocol/src/protocol/index.d.ts +3 -0
  570. package/dist/internal/codex/app-server-protocol/src/protocol/thread-resume.d.ts +11 -0
  571. package/dist/internal/codex/app-server-transport/src/outgoing_message.d.ts +27 -0
  572. package/dist/internal/codex/app-server-transport/src/transport/mod.d.ts +78 -0
  573. package/dist/internal/codex/codex-api/src/common.d.ts +100 -0
  574. package/dist/internal/codex/codex-api/src/endpoint/responses.d.ts +28 -0
  575. package/dist/internal/codex/codex-api/src/endpoint/responses_websocket.d.ts +54 -0
  576. package/dist/internal/codex/codex-api/src/error.d.ts +21 -0
  577. package/dist/internal/codex/codex-api/src/index.d.ts +9 -0
  578. package/dist/internal/codex/codex-api/src/provider.d.ts +22 -0
  579. package/dist/internal/codex/codex-api/src/rate_limits.d.ts +3 -0
  580. package/dist/internal/codex/codex-api/src/requests/responses.d.ts +16 -0
  581. package/dist/internal/codex/codex-api/src/sse/responses.d.ts +13 -0
  582. package/dist/internal/codex/codex-api/src/stream_events_utils.d.ts +23 -0
  583. package/dist/internal/codex/codex-mcp/src/auth_elicitation.d.ts +41 -0
  584. package/dist/internal/codex/codex-mcp/src/codex_apps.d.ts +57 -0
  585. package/dist/internal/codex/codex-mcp/src/connection_manager.d.ts +72 -0
  586. package/dist/internal/codex/codex-mcp/src/elicitation.d.ts +77 -0
  587. package/dist/internal/codex/codex-mcp/src/mcp/auth.d.ts +64 -0
  588. package/dist/internal/codex/codex-mcp/src/mcp/mod.d.ts +16 -0
  589. package/dist/internal/codex/codex-mcp/src/rmcp_client.d.ts +221 -0
  590. package/dist/internal/codex/codex-mcp/src/tools.d.ts +37 -0
  591. package/dist/internal/codex/config/src/config_toml.d.ts +14 -0
  592. package/dist/internal/codex/config/src/index.d.ts +7 -0
  593. package/dist/internal/codex/config/src/loader/mod.d.ts +21 -0
  594. package/dist/internal/codex/config/src/merge.d.ts +22 -0
  595. package/dist/internal/codex/config/src/permissions_toml.d.ts +6 -0
  596. package/dist/internal/codex/config/src/profile_toml.d.ts +1 -0
  597. package/dist/internal/codex/config/src/thread_config.d.ts +43 -0
  598. package/dist/internal/codex/config/src/types.d.ts +121 -0
  599. package/dist/internal/codex/core/src/agent/agent_resolver.d.ts +3 -0
  600. package/dist/internal/codex/core/src/agent/control.d.ts +76 -0
  601. package/dist/internal/codex/core/src/agent/mailbox.d.ts +28 -0
  602. package/dist/internal/codex/core/src/agent/mod.d.ts +6 -0
  603. package/dist/internal/codex/core/src/agent/registry.d.ts +54 -0
  604. package/dist/internal/codex/core/src/agent/role.d.ts +19 -0
  605. package/dist/internal/codex/core/src/agent/status.d.ts +3 -0
  606. package/dist/internal/codex/core/src/auth.d.ts +65 -0
  607. package/dist/internal/codex/core/src/client.d.ts +129 -0
  608. package/dist/internal/codex/core/src/collaboration-mode-presets.d.ts +9 -0
  609. package/dist/internal/codex/core/src/compact-task-runner.d.ts +18 -0
  610. package/dist/internal/codex/core/src/compact.d.ts +12 -0
  611. package/dist/internal/codex/core/src/config/agent_roles.d.ts +6 -0
  612. package/dist/internal/codex/core/src/config/managed_features.d.ts +7 -0
  613. package/dist/internal/codex/core/src/config/mod.d.ts +9 -0
  614. package/dist/internal/codex/core/src/config/network_proxy_spec.d.ts +5 -0
  615. package/dist/internal/codex/core/src/config/permissions.d.ts +30 -0
  616. package/dist/internal/codex/core/src/config-types.d.ts +28 -0
  617. package/dist/internal/codex/core/src/context/collaboration-mode-instructions.d.ts +10 -0
  618. package/dist/internal/codex/core/src/context/context-updates.d.ts +10 -0
  619. package/dist/internal/codex/core/src/context/environment-context.d.ts +24 -0
  620. package/dist/internal/codex/core/src/context/fragment.d.ts +22 -0
  621. package/dist/internal/codex/core/src/context/permissions-instructions.d.ts +8 -0
  622. package/dist/internal/codex/core/src/context/prompt-context.d.ts +8 -0
  623. package/dist/internal/codex/core/src/context/turn-aborted.d.ts +3 -0
  624. package/dist/internal/codex/core/src/context/user-instructions.d.ts +7 -0
  625. package/dist/internal/codex/core/src/context_manager/history.d.ts +60 -0
  626. package/dist/internal/codex/core/src/context_manager/normalize.d.ts +6 -0
  627. package/dist/internal/codex/core/src/event-mapping.d.ts +9 -0
  628. package/dist/internal/codex/core/src/exec-output.d.ts +20 -0
  629. package/dist/internal/codex/core/src/goals/index.d.ts +2 -0
  630. package/dist/internal/codex/core/src/goals/runtime.d.ts +32 -0
  631. package/dist/internal/codex/core/src/goals/types.d.ts +95 -0
  632. package/dist/internal/codex/core/src/goals.d.ts +1 -0
  633. package/dist/internal/codex/core/src/hooks/dispatcher.d.ts +5 -0
  634. package/dist/internal/codex/core/src/hooks/index.d.ts +4 -0
  635. package/dist/internal/codex/core/src/hooks/output-parser.d.ts +9 -0
  636. package/dist/internal/codex/core/src/hooks/runtime.d.ts +125 -0
  637. package/dist/internal/codex/core/src/hooks/types.d.ts +40 -0
  638. package/dist/internal/codex/core/src/ids.d.ts +5 -0
  639. package/dist/internal/codex/core/src/index.d.ts +98 -0
  640. package/dist/internal/codex/core/src/items.d.ts +137 -0
  641. package/dist/internal/codex/core/src/mcp/index.d.ts +10 -0
  642. package/dist/internal/codex/core/src/mcp/manager.d.ts +73 -0
  643. package/dist/internal/codex/core/src/mcp/types.d.ts +165 -0
  644. package/dist/internal/codex/core/src/mcp.d.ts +1 -0
  645. package/dist/internal/codex/core/src/memory.d.ts +21 -0
  646. package/dist/internal/codex/core/src/model-provider.d.ts +193 -0
  647. package/dist/internal/codex/core/src/models.d.ts +158 -0
  648. package/dist/internal/codex/core/src/plan-mode.d.ts +1 -0
  649. package/dist/internal/codex/core/src/protocol/dynamic_tools.d.ts +48 -0
  650. package/dist/internal/codex/core/src/protocol/user_input.d.ts +30 -0
  651. package/dist/internal/codex/core/src/protocol.d.ts +893 -0
  652. package/dist/internal/codex/core/src/rendered-thread.d.ts +30 -0
  653. package/dist/internal/codex/core/src/request_permissions.d.ts +52 -0
  654. package/dist/internal/codex/core/src/request_user_input.d.ts +47 -0
  655. package/dist/internal/codex/core/src/session/rollout-reconstruction.d.ts +11 -0
  656. package/dist/internal/codex/core/src/session/session-settings.d.ts +29 -0
  657. package/dist/internal/codex/core/src/session/session.d.ts +226 -0
  658. package/dist/internal/codex/core/src/session/turn-context.d.ts +71 -0
  659. package/dist/internal/codex/core/src/session/turn-timing.d.ts +12 -0
  660. package/dist/internal/codex/core/src/session/turn.d.ts +35 -0
  661. package/dist/internal/codex/core/src/state/session.d.ts +40 -0
  662. package/dist/internal/codex/core/src/state/turn.d.ts +83 -0
  663. package/dist/internal/codex/core/src/stream-parser.d.ts +36 -0
  664. package/dist/internal/codex/core/src/stream_events_utils.d.ts +43 -0
  665. package/dist/internal/codex/core/src/tasks/compact.d.ts +26 -0
  666. package/dist/internal/codex/core/src/tasks/mod.d.ts +43 -0
  667. package/dist/internal/codex/core/src/tasks/regular.d.ts +27 -0
  668. package/dist/internal/codex/core/src/templates.d.ts +12 -0
  669. package/dist/{thread-history-builder-zW0zeqcS.d.ts → internal/codex/core/src/thread-history-builder.d.ts} +14 -16
  670. package/dist/internal/codex/core/src/thread-store/index.d.ts +3 -0
  671. package/dist/{live-thread-BMvlflzM.d.ts → internal/codex/core/src/thread-store/live-thread.d.ts} +7 -8
  672. package/dist/{store-AGRxhgQ3.d.ts → internal/codex/core/src/thread-store/store.d.ts} +3 -6
  673. package/dist/{types-BTeabLYr.d.ts → internal/codex/core/src/thread-store/types.d.ts} +25 -26
  674. package/dist/internal/codex/core/src/tools/code_mode/execute_handler.d.ts +7 -0
  675. package/dist/internal/codex/core/src/tools/code_mode/execute_spec.d.ts +13 -0
  676. package/dist/internal/codex/core/src/tools/code_mode/mod.d.ts +5 -0
  677. package/dist/internal/codex/core/src/tools/code_mode/response_adapter.d.ts +2 -0
  678. package/dist/internal/codex/core/src/tools/code_mode/wait_handler.d.ts +7 -0
  679. package/dist/internal/codex/core/src/tools/code_mode/wait_spec.d.ts +13 -0
  680. package/dist/internal/codex/core/src/tools/context.d.ts +155 -0
  681. package/dist/internal/codex/core/src/tools/events.d.ts +50 -0
  682. package/dist/internal/codex/core/src/tools/handlers/apply_patch.d.ts +14 -0
  683. package/dist/internal/codex/core/src/tools/handlers/apply_patch_spec.d.ts +16 -0
  684. package/dist/internal/codex/core/src/tools/handlers/dynamic.d.ts +17 -0
  685. package/dist/internal/codex/core/src/tools/handlers/goal.d.ts +20 -0
  686. package/dist/internal/codex/core/src/tools/handlers/goal_spec.d.ts +51 -0
  687. package/dist/internal/codex/core/src/tools/handlers/mcp.d.ts +23 -0
  688. package/dist/internal/codex/core/src/tools/handlers/mcp_resource.d.ts +24 -0
  689. package/dist/internal/codex/core/src/tools/handlers/mcp_resource_spec.d.ts +61 -0
  690. package/dist/internal/codex/core/src/tools/handlers/multi_agents.d.ts +50 -0
  691. package/dist/internal/codex/core/src/tools/handlers/multi_agents_common.d.ts +3 -0
  692. package/dist/internal/codex/core/src/tools/handlers/multi_agents_spec.d.ts +5 -0
  693. package/dist/internal/codex/core/src/tools/handlers/multi_agents_v2.d.ts +1 -0
  694. package/dist/internal/codex/core/src/tools/handlers/plan.d.ts +8 -0
  695. package/dist/internal/codex/core/src/tools/handlers/plan_spec.d.ts +35 -0
  696. package/dist/internal/codex/core/src/tools/handlers/request_permissions.d.ts +7 -0
  697. package/dist/internal/codex/core/src/tools/handlers/request_permissions_spec.d.ts +1 -0
  698. package/dist/internal/codex/core/src/tools/handlers/request_plugin_install.d.ts +8 -0
  699. package/dist/internal/codex/core/src/tools/handlers/request_plugin_install_spec.d.ts +12 -0
  700. package/dist/internal/codex/core/src/tools/handlers/request_user_input.d.ts +13 -0
  701. package/dist/internal/codex/core/src/tools/handlers/request_user_input_spec.d.ts +1 -0
  702. package/dist/internal/codex/core/src/tools/handlers/shell_spec.d.ts +60 -0
  703. package/dist/internal/codex/core/src/tools/handlers/test_sync.d.ts +1 -0
  704. package/dist/internal/codex/core/src/tools/handlers/test_sync_spec.d.ts +12 -0
  705. package/dist/internal/codex/core/src/tools/handlers/tool_search.d.ts +28 -0
  706. package/dist/internal/codex/core/src/tools/handlers/tool_search_spec.d.ts +21 -0
  707. package/dist/internal/codex/core/src/tools/handlers/unavailable_tool.d.ts +10 -0
  708. package/dist/internal/codex/core/src/tools/handlers/unified_exec/exec_command.d.ts +13 -0
  709. package/dist/internal/codex/core/src/tools/handlers/unified_exec/write_stdin.d.ts +8 -0
  710. package/dist/internal/codex/core/src/tools/handlers/unified_exec.d.ts +2 -0
  711. package/dist/internal/codex/core/src/tools/hook_names.d.ts +6 -0
  712. package/dist/internal/codex/core/src/tools/hosted_spec.d.ts +9 -0
  713. package/dist/internal/codex/core/src/tools/network_approval.d.ts +11 -0
  714. package/dist/internal/codex/core/src/tools/orchestrator.d.ts +28 -0
  715. package/dist/internal/codex/core/src/tools/parallel.d.ts +33 -0
  716. package/dist/internal/codex/core/src/tools/registry.d.ts +27 -0
  717. package/dist/internal/codex/core/src/tools/responses_api.d.ts +34 -0
  718. package/dist/internal/codex/core/src/tools/router.d.ts +50 -0
  719. package/dist/internal/codex/core/src/tools/runtimes/apply_patch.d.ts +2 -0
  720. package/dist/internal/codex/core/src/tools/runtimes/mod.d.ts +4 -0
  721. package/dist/internal/codex/core/src/tools/runtimes/shell.d.ts +2 -0
  722. package/dist/internal/codex/core/src/tools/runtimes/unified_exec.d.ts +2 -0
  723. package/dist/internal/codex/core/src/tools/sandboxing.d.ts +36 -0
  724. package/dist/internal/codex/core/src/tools/spec.d.ts +10 -0
  725. package/dist/internal/codex/core/src/tools/spec_plan.d.ts +2 -0
  726. package/dist/internal/codex/core/src/tools/spec_plan_types.d.ts +93 -0
  727. package/dist/internal/codex/core/src/tools/tool_dispatch_trace.d.ts +12 -0
  728. package/dist/internal/codex/core/src/tools/tool_name.d.ts +17 -0
  729. package/dist/internal/codex/core/src/tools/tool_search_entry.d.ts +35 -0
  730. package/dist/internal/codex/core/src/tools/tool_spec.d.ts +29 -0
  731. package/dist/{mod-DYVLSWO4.d.ts → internal/codex/thread-store/src/in_memory.d.ts} +8 -39
  732. package/dist/internal/codex/thread-store/src/index.d.ts +6 -0
  733. package/dist/internal/codex/thread-store/src/local/mod.d.ts +32 -0
  734. package/dist/internal/codex/utils/output-truncation/src/lib.d.ts +19 -0
  735. package/dist/internal/codex/utils/string/src/lib.d.ts +1 -0
  736. package/dist/internal/codex/utils/string/src/truncate.d.ts +5 -0
  737. package/dist/runtime/index.d.ts +47 -0
  738. package/dist/server/index.d.ts +2 -29
  739. package/dist/server/index.js +20488 -15
  740. package/dist/testing/index.d.ts +2 -9
  741. package/dist/testing/index.js +1698 -15
  742. package/package.json +61 -152
  743. package/dist/ClientNotification-B6-FhXQf.d.ts +0 -5
  744. package/dist/DynamicToolCallResponse-82DFjES2.d.ts +0 -8
  745. package/dist/DynamicToolSpec-CfnhqAYK.d.ts +0 -29
  746. package/dist/PermissionsRequestApprovalResponse-DxzPPDRb.d.ts +0 -55
  747. package/dist/ProviderStatusBanner-BlP6lzwE.d.ts +0 -441
  748. package/dist/ServerRequest-B5cKVJjr.d.ts +0 -2181
  749. package/dist/ThreadResumeResponse-DvmE1juU.d.ts +0 -1542
  750. package/dist/ToolRequestUserInputQuestion-CeZa5X1J.d.ts +0 -23
  751. package/dist/ToolRequestUserInputResponse-zcPLwbiK.d.ts +0 -17
  752. package/dist/TurnSteerResponse-0kBCfplh.d.ts +0 -209
  753. package/dist/WebSearchToolConfig-D3ep0625.d.ts +0 -18
  754. package/dist/chat-runtime-9RkXHC_w.d.ts +0 -382
  755. package/dist/chunk-2DZRMCI2.js +0 -1258
  756. package/dist/chunk-2DZRMCI2.js.map +0 -1
  757. package/dist/chunk-4DPLJPB5.js +0 -396
  758. package/dist/chunk-4DPLJPB5.js.map +0 -1
  759. package/dist/chunk-5JMJ6OI5.js +0 -3
  760. package/dist/chunk-5JMJ6OI5.js.map +0 -1
  761. package/dist/chunk-6ZMJ34KE.js +0 -1153
  762. package/dist/chunk-6ZMJ34KE.js.map +0 -1
  763. package/dist/chunk-CGBS37IU.js +0 -128
  764. package/dist/chunk-CGBS37IU.js.map +0 -1
  765. package/dist/chunk-DCMKA2A6.js +0 -18
  766. package/dist/chunk-DCMKA2A6.js.map +0 -1
  767. package/dist/chunk-DYLHN3HG.js +0 -937
  768. package/dist/chunk-DYLHN3HG.js.map +0 -1
  769. package/dist/chunk-FN3SWHRH.js +0 -934
  770. package/dist/chunk-FN3SWHRH.js.map +0 -1
  771. package/dist/chunk-LWQNX4LI.js +0 -13755
  772. package/dist/chunk-LWQNX4LI.js.map +0 -1
  773. package/dist/chunk-NCI4MAWZ.js +0 -7733
  774. package/dist/chunk-NCI4MAWZ.js.map +0 -1
  775. package/dist/chunk-O44XP7LH.js +0 -214
  776. package/dist/chunk-O44XP7LH.js.map +0 -1
  777. package/dist/chunk-PST3ZWX2.js +0 -555
  778. package/dist/chunk-PST3ZWX2.js.map +0 -1
  779. package/dist/chunk-SYPHCDRD.js +0 -1133
  780. package/dist/chunk-SYPHCDRD.js.map +0 -1
  781. package/dist/chunk-V4BMZWBM.js +0 -2401
  782. package/dist/chunk-V4BMZWBM.js.map +0 -1
  783. package/dist/chunk-W7S6HFCQ.js +0 -1983
  784. package/dist/chunk-W7S6HFCQ.js.map +0 -1
  785. package/dist/chunk-YHVCFD2D.js +0 -117
  786. package/dist/chunk-YHVCFD2D.js.map +0 -1
  787. package/dist/chunk-Z63UPBS3.js +0 -152
  788. package/dist/chunk-Z63UPBS3.js.map +0 -1
  789. package/dist/chunk-ZX5OIIJX.js +0 -3
  790. package/dist/chunk-ZX5OIIJX.js.map +0 -1
  791. package/dist/client/index.js.map +0 -1
  792. package/dist/codex-rs/app-server/index.d.ts +0 -161
  793. package/dist/codex-rs/app-server/index.js +0 -13
  794. package/dist/codex-rs/app-server/index.js.map +0 -1
  795. package/dist/codex-rs/app-server-protocol/index.d.ts +0 -1722
  796. package/dist/codex-rs/app-server-protocol/index.js +0 -6
  797. package/dist/codex-rs/app-server-protocol/index.js.map +0 -1
  798. package/dist/codex-rs/app-server-protocol/protocol.d.ts +0 -19
  799. package/dist/codex-rs/app-server-protocol/protocol.js +0 -4
  800. package/dist/codex-rs/app-server-protocol/protocol.js.map +0 -1
  801. package/dist/codex-rs/codex-api/index.d.ts +0 -104
  802. package/dist/codex-rs/codex-api/index.js +0 -11
  803. package/dist/codex-rs/codex-api/index.js.map +0 -1
  804. package/dist/codex-rs/config/index.d.ts +0 -88
  805. package/dist/codex-rs/config/index.js +0 -4
  806. package/dist/codex-rs/config/index.js.map +0 -1
  807. package/dist/codex-rs/core/config/index.d.ts +0 -61
  808. package/dist/codex-rs/core/config/index.js +0 -5
  809. package/dist/codex-rs/core/config/index.js.map +0 -1
  810. package/dist/codex-rs/core/index.d.ts +0 -1393
  811. package/dist/codex-rs/core/index.js +0 -11
  812. package/dist/codex-rs/core/index.js.map +0 -1
  813. package/dist/codex-rs/model-provider/index.d.ts +0 -2
  814. package/dist/codex-rs/model-provider/index.js +0 -4
  815. package/dist/codex-rs/model-provider/index.js.map +0 -1
  816. package/dist/codex-rs/models-manager/index.d.ts +0 -2
  817. package/dist/codex-rs/models-manager/index.js +0 -4
  818. package/dist/codex-rs/models-manager/index.js.map +0 -1
  819. package/dist/codex-rs/parity.d.ts +0 -26
  820. package/dist/codex-rs/parity.js +0 -3
  821. package/dist/codex-rs/parity.js.map +0 -1
  822. package/dist/codex-rs/thread-store/index.d.ts +0 -5
  823. package/dist/codex-rs/thread-store/index.js +0 -4
  824. package/dist/codex-rs/thread-store/index.js.map +0 -1
  825. package/dist/codex-rs/unsupported.d.ts +0 -15
  826. package/dist/codex-rs/unsupported.js +0 -22
  827. package/dist/codex-rs/unsupported.js.map +0 -1
  828. package/dist/codex-rs/utils/output-truncation.d.ts +0 -21
  829. package/dist/codex-rs/utils/output-truncation.js +0 -4
  830. package/dist/codex-rs/utils/output-truncation.js.map +0 -1
  831. package/dist/codex-rs/utils/string.d.ts +0 -7
  832. package/dist/codex-rs/utils/string.js +0 -3
  833. package/dist/codex-rs/utils/string.js.map +0 -1
  834. package/dist/common-CTyph5x8.d.ts +0 -40
  835. package/dist/event-mapping-CbISdQ1D.d.ts +0 -43
  836. package/dist/history-CfM-4V7b.d.ts +0 -1654
  837. package/dist/index-CoDZosq0.d.ts +0 -261
  838. package/dist/index.js.map +0 -1
  839. package/dist/lib-nXlaKiS-.d.ts +0 -48
  840. package/dist/merge-B_AWVmnI.d.ts +0 -24
  841. package/dist/plan-mode-Cv6KWb_S.d.ts +0 -14
  842. package/dist/proposed-plan-DpN1ma0Y.d.ts +0 -53
  843. package/dist/protocol-mpBcYHrm.d.ts +0 -1655
  844. package/dist/react/index.d.ts +0 -81
  845. package/dist/react/index.js +0 -19
  846. package/dist/react/index.js.map +0 -1
  847. package/dist/remote-ClZbq9KN.d.ts +0 -21
  848. package/dist/rendered-thread-AOxw3V5b.d.ts +0 -29
  849. package/dist/responses_websocket-BhxSgCzK.d.ts +0 -183
  850. package/dist/runtime-Cm6ml53h.d.ts +0 -528
  851. package/dist/server/index.js.map +0 -1
  852. package/dist/shadcn/index.d.ts +0 -68
  853. package/dist/shadcn/index.js +0 -334
  854. package/dist/shadcn/index.js.map +0 -1
  855. package/dist/sidebar-DMMij22z.d.ts +0 -87
  856. package/dist/spec_plan_types-CmsJ-Tfn.d.ts +0 -260
  857. package/dist/styles.css +0 -1
  858. package/dist/t3code/apps/web/components/chat.d.ts +0 -508
  859. package/dist/t3code/apps/web/components/chat.js +0 -12
  860. package/dist/t3code/apps/web/components/chat.js.map +0 -1
  861. package/dist/t3code/apps/web/index.d.ts +0 -12
  862. package/dist/t3code/apps/web/index.js +0 -13
  863. package/dist/t3code/apps/web/index.js.map +0 -1
  864. package/dist/testing/index.js.map +0 -1
@@ -1,15 +1,1698 @@
1
- export { ThreadEventStore } from '../chunk-6ZMJ34KE.js';
2
- export { InMemoryThreadStore, LocalThreadStore } from '../chunk-4DPLJPB5.js';
3
- import '../chunk-V4BMZWBM.js';
4
- import '../chunk-LWQNX4LI.js';
5
- import '../chunk-PST3ZWX2.js';
6
- import '../chunk-Z63UPBS3.js';
7
- import '../chunk-YHVCFD2D.js';
8
- import '../chunk-DCMKA2A6.js';
9
- import '../chunk-CGBS37IU.js';
10
- import '../chunk-2DZRMCI2.js';
11
- export { createRenderedThreadState, renderThreadFromHistory } from '../chunk-DYLHN3HG.js';
12
- import '../chunk-SYPHCDRD.js';
13
- import '../chunk-O44XP7LH.js';
14
- //# sourceMappingURL=index.js.map
15
- //# sourceMappingURL=index.js.map
1
+ // src/internal/codex/core/src/event-mapping.ts
2
+ function isContextualUserMessageContent(message) {
3
+ return message.some(isContextualUserFragment);
4
+ }
5
+ function parseUserMessage(id, message) {
6
+ if (isContextualUserMessageContent(message)) {
7
+ return null;
8
+ }
9
+ const content = [];
10
+ for (const [index, contentItem] of message.entries()) {
11
+ if (contentItem.type === "input_text") {
12
+ if ((isLocalImageOpenTagText(contentItem.text) || isImageOpenTagText(contentItem.text)) && message[index + 1]?.type === "input_image" || index > 0 && (isLocalImageCloseTagText(contentItem.text) || isImageCloseTagText(contentItem.text)) && message[index - 1]?.type === "input_image") {
13
+ continue;
14
+ }
15
+ content.push({
16
+ type: "text",
17
+ text: contentItem.text,
18
+ text_elements: []
19
+ });
20
+ continue;
21
+ }
22
+ if (contentItem.type === "input_image") {
23
+ content.push({
24
+ type: "image",
25
+ image_url: contentItem.image_url
26
+ });
27
+ }
28
+ }
29
+ return {
30
+ type: "UserMessage",
31
+ id: id ?? "",
32
+ content
33
+ };
34
+ }
35
+ function parseAgentMessage(id, message, phase) {
36
+ const content = [];
37
+ for (const contentItem of message) {
38
+ if (contentItem.type === "input_text" || contentItem.type === "output_text") {
39
+ content.push({ type: "Text", text: contentItem.text });
40
+ }
41
+ }
42
+ return {
43
+ type: "AgentMessage",
44
+ id: id ?? "",
45
+ content,
46
+ phase: phase ?? null,
47
+ memory_citation: null
48
+ };
49
+ }
50
+ function parseVisibleHookPromptMessage(id, message) {
51
+ const fragments = [];
52
+ for (const contentItem of message) {
53
+ if (contentItem.type !== "input_text") {
54
+ return null;
55
+ }
56
+ const fragment = parseHookPromptFragment(contentItem.text);
57
+ if (fragment) {
58
+ fragments.push(fragment);
59
+ continue;
60
+ }
61
+ if (isStandardContextualUserText(contentItem.text)) {
62
+ continue;
63
+ }
64
+ return null;
65
+ }
66
+ if (fragments.length === 0) {
67
+ return null;
68
+ }
69
+ return {
70
+ type: "HookPrompt",
71
+ id: id ?? "",
72
+ fragments
73
+ };
74
+ }
75
+ function parseTurnItem(item) {
76
+ switch (item.type) {
77
+ case "message":
78
+ if (item.role === "user") {
79
+ return parseVisibleHookPromptMessage(item.id, item.content) ?? parseUserMessage(item.id, item.content);
80
+ }
81
+ if (item.role === "assistant" || !item.role) {
82
+ return parseAgentMessage(item.id, item.content, item.phase);
83
+ }
84
+ return null;
85
+ case "reasoning":
86
+ return parseReasoningItem(item);
87
+ case "web_search_call":
88
+ return parseWebSearchCall(item);
89
+ case "image_generation_call":
90
+ return parseImageGenerationCall(item);
91
+ default:
92
+ return null;
93
+ }
94
+ }
95
+ function parseReasoningItem(item) {
96
+ return {
97
+ type: "Reasoning",
98
+ id: item.id ?? "",
99
+ summary_text: item.summary.flatMap((entry) => {
100
+ if (typeof entry.text === "string") {
101
+ return [entry.text];
102
+ }
103
+ return [];
104
+ }),
105
+ raw_content: (item.content ?? []).flatMap((entry) => {
106
+ if ((entry.type === "reasoning_text" || entry.type === "text") && typeof entry.text === "string") {
107
+ return [entry.text];
108
+ }
109
+ return [];
110
+ })
111
+ };
112
+ }
113
+ function parseWebSearchCall(item) {
114
+ const action = webSearchActionFromRecord(item.action);
115
+ return {
116
+ type: "WebSearch",
117
+ id: item.id ?? "",
118
+ query: webSearchActionDetail(action),
119
+ action
120
+ };
121
+ }
122
+ function parseImageGenerationCall(item) {
123
+ return {
124
+ type: "ImageGeneration",
125
+ id: item.id,
126
+ status: item.status,
127
+ revised_prompt: item.revised_prompt ?? void 0,
128
+ result: item.result,
129
+ saved_path: item.saved_path
130
+ };
131
+ }
132
+ function webSearchActionFromRecord(action) {
133
+ if (!action) {
134
+ return { type: "other" };
135
+ }
136
+ if (action.type === "search") {
137
+ return {
138
+ type: "search",
139
+ ...typeof action.query === "string" ? { query: action.query } : {},
140
+ ...Array.isArray(action.queries) ? { queries: action.queries.filter(isString) } : {}
141
+ };
142
+ }
143
+ if (action.type === "open_page") {
144
+ return {
145
+ type: "open_page",
146
+ ...typeof action.url === "string" ? { url: action.url } : {}
147
+ };
148
+ }
149
+ if (action.type === "find_in_page") {
150
+ return {
151
+ type: "find_in_page",
152
+ ...typeof action.url === "string" ? { url: action.url } : {},
153
+ ...typeof action.pattern === "string" ? { pattern: action.pattern } : {}
154
+ };
155
+ }
156
+ return { type: "other" };
157
+ }
158
+ function webSearchActionDetail(action) {
159
+ switch (action.type) {
160
+ case "search":
161
+ return action.query ?? action.queries?.join(", ") ?? "";
162
+ case "open_page":
163
+ return action.url ?? "";
164
+ case "find_in_page": {
165
+ const pattern = action.pattern ?? "";
166
+ const url = action.url ?? "";
167
+ return pattern && url ? `'${pattern}' in ${url}` : pattern || url;
168
+ }
169
+ case "other":
170
+ return "";
171
+ }
172
+ }
173
+ function isContextualUserFragment(contentItem) {
174
+ return contentItem.type === "input_text" && (parseHookPromptFragment(contentItem.text) !== null || isStandardContextualUserText(contentItem.text));
175
+ }
176
+ function isStandardContextualUserText(text) {
177
+ const trimmed = text.trimStart();
178
+ return trimmed.startsWith("# AGENTS.md instructions for ") || trimmed.startsWith("<environment_context>") || trimmed.startsWith("<skill>") || trimmed.startsWith("<user_shell_command>") || trimmed.startsWith("<turn_aborted>") || trimmed.startsWith("<thread_goal_budget_limit>") || trimmed.startsWith("<subagent_notification>");
179
+ }
180
+ function parseHookPromptFragment(text) {
181
+ const trimmed = text.trim();
182
+ const match = trimmed.match(
183
+ /^<hook_prompt\s+hook_run_id=(["'])(.*?)\1>([\s\S]*)<\/hook_prompt>$/u
184
+ );
185
+ if (!match) {
186
+ return null;
187
+ }
188
+ const hookRunId = decodeXmlEntities(match[2] ?? "").trim();
189
+ if (!hookRunId) {
190
+ return null;
191
+ }
192
+ return {
193
+ hookRunId,
194
+ text: decodeXmlEntities(match[3] ?? "")
195
+ };
196
+ }
197
+ function isImageOpenTagText(text) {
198
+ return text === "<image>";
199
+ }
200
+ function isImageCloseTagText(text) {
201
+ return text === "</image>";
202
+ }
203
+ function isLocalImageOpenTagText(text) {
204
+ return text.startsWith("<image name=") && text.endsWith(">");
205
+ }
206
+ function isLocalImageCloseTagText(text) {
207
+ return isImageCloseTagText(text);
208
+ }
209
+ function decodeXmlEntities(value) {
210
+ return value.replaceAll("&amp;", "&").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", '"').replaceAll("&apos;", "'");
211
+ }
212
+ function isString(value) {
213
+ return typeof value === "string";
214
+ }
215
+
216
+ // src/internal/codex/core/src/thread-history-builder.ts
217
+ var ThreadHistoryBuilder = class _ThreadHistoryBuilder {
218
+ turns = [];
219
+ next_item_index = 1;
220
+ static fromTurns(turns) {
221
+ const builder = new _ThreadHistoryBuilder();
222
+ builder.turns = turns.map((turn) => ({
223
+ ...cloneTurn(turn),
224
+ opened_explicitly: true
225
+ }));
226
+ builder.next_item_index = nextItemIndexFromTurns(turns);
227
+ return builder;
228
+ }
229
+ handle_rollout_item(item, index = this.next_item_index) {
230
+ if (item.type === "event_msg") {
231
+ this.handle_event(item.payload, `rollout-${index}`);
232
+ return;
233
+ }
234
+ if (item.type === "response_item") {
235
+ this.handle_response_item(item.payload, `response-${index}`);
236
+ return;
237
+ }
238
+ if (item.type === "compacted") {
239
+ this.append_to_current_turn({
240
+ type: "ContextCompaction",
241
+ id: `compacted-${index}`
242
+ });
243
+ }
244
+ }
245
+ handle_event(event, eventId = `event-${this.next_item_index}`) {
246
+ switch (event.type) {
247
+ case "turn_started":
248
+ this.open_explicit_turn(event.turn_id);
249
+ if (event.started_at !== void 0 && event.started_at !== null) {
250
+ const turn = this.turn_by_id(event.turn_id);
251
+ if (turn) {
252
+ turn.started_at = event.started_at;
253
+ }
254
+ }
255
+ return;
256
+ case "turn_complete":
257
+ this.complete_turn(event.turn_id, {
258
+ status: "completed",
259
+ completed_at: event.completed_at ?? null,
260
+ duration_ms: event.duration_ms ?? null
261
+ });
262
+ return;
263
+ case "turn_aborted":
264
+ this.complete_turn(event.turn_id, {
265
+ status: "interrupted",
266
+ completed_at: event.completed_at ?? event.aborted_at ?? null,
267
+ duration_ms: event.duration_ms ?? null
268
+ });
269
+ return;
270
+ case "user_message":
271
+ this.append_user_message(userMessageTurnItem(event, userMessageId(eventId)), {
272
+ replaceDuplicate: true
273
+ });
274
+ return;
275
+ case "agent_message":
276
+ this.upsert_agent_message({
277
+ type: "AgentMessage",
278
+ id: agentMessageId(eventId),
279
+ content: [{ type: "Text", text: event.message }],
280
+ phase: event.phase ?? null,
281
+ memory_citation: event.memory_citation ?? null
282
+ });
283
+ return;
284
+ case "item_started":
285
+ this.upsert_item_in_turn(event.turn_id, event.item, {
286
+ started: true
287
+ });
288
+ return;
289
+ case "item_completed":
290
+ this.upsert_item_in_turn(event.turn_id, completedItem(event.item));
291
+ return;
292
+ case "agent_message_content_delta":
293
+ this.apply_agent_message_delta(event.item_id, event.delta);
294
+ return;
295
+ case "plan_delta":
296
+ this.apply_plan_delta(event.item_id, event.delta);
297
+ return;
298
+ case "exec_command_begin":
299
+ this.upsert_item_in_turn(event.turn_id, {
300
+ type: "CommandExecution",
301
+ id: event.call_id,
302
+ command: event.command,
303
+ cwd: event.cwd,
304
+ status: "in_progress"
305
+ });
306
+ return;
307
+ case "exec_command_output_delta":
308
+ this.apply_exec_command_output_delta(event);
309
+ return;
310
+ case "exec_command_end":
311
+ this.apply_exec_command_end(event);
312
+ return;
313
+ case "patch_apply_updated":
314
+ this.upsert_item_in_current_or_existing_turn(event.call_id, {
315
+ type: "FileChange",
316
+ id: event.call_id,
317
+ changes: event.changes,
318
+ status: event.status ?? null,
319
+ auto_approved: false,
320
+ stdout: event.stdout ?? "",
321
+ stderr: event.stderr ?? ""
322
+ });
323
+ return;
324
+ case "dynamic_tool_call_request":
325
+ this.upsert_item_in_turn(event.turn_id, dynamicToolRequestTurnItem(event));
326
+ return;
327
+ case "dynamic_tool_call_response":
328
+ this.upsert_item_in_turn(event.turn_id, {
329
+ type: "DynamicToolCall",
330
+ id: event.call_id,
331
+ namespace: event.namespace ?? null,
332
+ tool: event.tool,
333
+ arguments: event.arguments,
334
+ status: event.success ? "completed" : "failed",
335
+ content_items: event.content_items,
336
+ success: event.success,
337
+ duration: event.duration
338
+ });
339
+ return;
340
+ case "mcp_tool_call_progress":
341
+ this.upsert_item_in_turn(event.turn_id, {
342
+ type: "McpToolCall",
343
+ id: event.call_id,
344
+ server: event.server_name,
345
+ tool: event.tool_name,
346
+ arguments: {},
347
+ status: "inProgress",
348
+ result: event.progress ?? event.message ?? null
349
+ });
350
+ return;
351
+ case "image_generation_end":
352
+ this.upsert_item_in_current_or_existing_turn(
353
+ event.call_id,
354
+ imageGenerationTurnItem(event, eventId)
355
+ );
356
+ return;
357
+ case "error": {
358
+ const turn = this.active_turn();
359
+ if (turn) {
360
+ turn.status = "failed";
361
+ turn.error = {
362
+ message: event.message,
363
+ codex_error_info: event.codex_error_info ?? null
364
+ };
365
+ }
366
+ return;
367
+ }
368
+ default:
369
+ return;
370
+ }
371
+ }
372
+ handle_response_item(item, id) {
373
+ const turnItem = parseTurnItem(item);
374
+ if (!turnItem) {
375
+ return;
376
+ }
377
+ const itemWithFallbackId = turnItem.id.length > 0 ? turnItem : { ...turnItem, id };
378
+ if (itemWithFallbackId.type === "AgentMessage") {
379
+ this.upsert_agent_message(itemWithFallbackId);
380
+ return;
381
+ }
382
+ if (itemWithFallbackId.type === "UserMessage") {
383
+ this.append_user_message(itemWithFallbackId, {
384
+ replaceDuplicate: false
385
+ });
386
+ return;
387
+ }
388
+ this.append_to_current_turn(itemWithFallbackId);
389
+ }
390
+ active_turn_snapshot() {
391
+ const turn = this.active_turn();
392
+ return turn ? stripInternalTurn(turn) : null;
393
+ }
394
+ active_turn_position() {
395
+ const turn = this.active_turn();
396
+ return turn ? this.turns.indexOf(turn) : null;
397
+ }
398
+ finish() {
399
+ return this.turns.map(stripInternalTurn);
400
+ }
401
+ has_active_turn() {
402
+ return this.active_turn() !== null;
403
+ }
404
+ reset() {
405
+ this.turns = [];
406
+ this.next_item_index = 1;
407
+ }
408
+ open_explicit_turn(turnId) {
409
+ const existing = this.turns.find((turn) => turn.id === turnId);
410
+ if (existing) {
411
+ existing.status = "in_progress";
412
+ existing.opened_explicitly = true;
413
+ return;
414
+ }
415
+ this.turns.push(newTurn(turnId, true));
416
+ }
417
+ complete_turn(turnId, input) {
418
+ const turn = this.turn_by_id(turnId) ?? this.ensure_turn(turnId, true);
419
+ turn.status = input.status;
420
+ turn.completed_at = input.completed_at;
421
+ turn.duration_ms = input.duration_ms;
422
+ }
423
+ append_user_message(item, options) {
424
+ const active = this.active_turn();
425
+ if (!active || !active.opened_explicitly && active.items.length > 0) {
426
+ this.turns.push(newTurn(`turn-${this.turns.length + 1}`, false));
427
+ }
428
+ const turn = this.active_turn() ?? this.ensure_turn();
429
+ const lastItem = turn.items.at(-1);
430
+ if (lastItem?.type === "UserMessage" && userMessageFingerprint(lastItem) === userMessageFingerprint(item)) {
431
+ if (options.replaceDuplicate) {
432
+ turn.items[turn.items.length - 1] = item;
433
+ }
434
+ return;
435
+ }
436
+ turn.items.push(item);
437
+ }
438
+ upsert_agent_message(item) {
439
+ const turn = this.ensure_turn();
440
+ const lastItem = turn.items.at(-1);
441
+ if (item.phase === "streaming") {
442
+ if (lastItem?.type === "AgentMessage" && lastItem.phase === "streaming") {
443
+ turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
444
+ return;
445
+ }
446
+ turn.items.push({ ...item, id: `streaming-${item.id}` });
447
+ return;
448
+ }
449
+ if (lastItem?.type === "AgentMessage" && lastItem.phase === "streaming") {
450
+ turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
451
+ return;
452
+ }
453
+ if (lastItem?.type === "AgentMessage" && agentMessageText(lastItem) === agentMessageText(item)) {
454
+ turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
455
+ return;
456
+ }
457
+ turn.items.push(item);
458
+ }
459
+ upsert_item_in_turn(turnId, item, options = {}) {
460
+ const turn = turnId ? this.ensure_turn(turnId, true) : this.ensure_turn();
461
+ upsertItem(turn, options.started ? startedItem(item) : item);
462
+ }
463
+ upsert_item_in_current_or_existing_turn(itemId, item) {
464
+ const existingTurn = this.turns.find(
465
+ (turn) => turn.items.some((candidate) => candidate.id === itemId)
466
+ );
467
+ upsertItem(existingTurn ?? this.ensure_turn(), item);
468
+ }
469
+ append_to_current_turn(item) {
470
+ this.ensure_turn().items.push(item);
471
+ }
472
+ apply_agent_message_delta(itemId, delta) {
473
+ const existing = this.find_item(itemId);
474
+ if (!existing || existing.item.type !== "AgentMessage") {
475
+ this.append_to_current_turn({
476
+ type: "AgentMessage",
477
+ id: itemId,
478
+ content: [{ type: "Text", text: delta }],
479
+ phase: "streaming",
480
+ memory_citation: null
481
+ });
482
+ return;
483
+ }
484
+ const item = existing.item;
485
+ const lastContent = item.content.at(-1);
486
+ const nextContent = lastContent?.type === "Text" ? [
487
+ ...item.content.slice(0, -1),
488
+ { type: "Text", text: `${lastContent.text}${delta}` }
489
+ ] : [...item.content, { type: "Text", text: delta }];
490
+ existing.turn.items[existing.index] = {
491
+ ...item,
492
+ content: nextContent,
493
+ phase: "streaming"
494
+ };
495
+ }
496
+ apply_plan_delta(itemId, delta) {
497
+ const existing = this.find_item(itemId);
498
+ if (!existing || existing.item.type !== "Plan") {
499
+ this.append_to_current_turn({ type: "Plan", id: itemId, text: delta });
500
+ return;
501
+ }
502
+ existing.turn.items[existing.index] = {
503
+ ...existing.item,
504
+ text: `${existing.item.text}${delta}`
505
+ };
506
+ }
507
+ apply_exec_command_output_delta(msg) {
508
+ const existing = this.find_item(msg.call_id);
509
+ if (!existing || existing.item.type !== "CommandExecution") {
510
+ return;
511
+ }
512
+ existing.turn.items[existing.index] = {
513
+ ...existing.item,
514
+ stdout: msg.stream === "stdout" ? `${existing.item.stdout ?? ""}${msg.chunk}` : existing.item.stdout,
515
+ stderr: msg.stream === "stderr" ? `${existing.item.stderr ?? ""}${msg.chunk}` : existing.item.stderr
516
+ };
517
+ }
518
+ apply_exec_command_end(msg) {
519
+ const existing = this.find_item(msg.call_id);
520
+ const item = existing?.item.type === "CommandExecution" ? existing.item : null;
521
+ const turn = msg.turn_id ? this.ensure_turn(msg.turn_id, true) : existing?.turn ?? this.ensure_turn();
522
+ upsertItem(turn, {
523
+ type: "CommandExecution",
524
+ id: msg.call_id,
525
+ command: item?.command ?? [],
526
+ cwd: item?.cwd ?? "",
527
+ status: msg.status === "completed" ? "completed" : msg.status === "cancelled" ? "cancelled" : "failed",
528
+ stdout: msg.stdout ?? msg.output?.stdout.text ?? item?.stdout ?? "",
529
+ stderr: msg.stderr ?? msg.output?.stderr.text ?? item?.stderr ?? "",
530
+ exit_code: msg.exit_code,
531
+ duration_ms: msg.duration_ms ?? msg.output?.duration_ms ?? null
532
+ });
533
+ }
534
+ ensure_turn(id, explicit = false) {
535
+ if (id) {
536
+ const existing = this.turn_by_id(id);
537
+ if (existing) {
538
+ return existing;
539
+ }
540
+ const turn2 = newTurn(id, explicit);
541
+ this.turns.push(turn2);
542
+ return turn2;
543
+ }
544
+ const active = this.active_turn();
545
+ if (active) {
546
+ return active;
547
+ }
548
+ const turn = newTurn(`turn-${this.turns.length + 1}`, false);
549
+ this.turns.push(turn);
550
+ return turn;
551
+ }
552
+ active_turn() {
553
+ for (let index = this.turns.length - 1; index >= 0; index -= 1) {
554
+ const turn = this.turns[index];
555
+ if (turn?.status === "in_progress") {
556
+ return turn;
557
+ }
558
+ }
559
+ return null;
560
+ }
561
+ turn_by_id(id) {
562
+ return this.turns.find((turn) => turn.id === id) ?? null;
563
+ }
564
+ find_item(itemId) {
565
+ for (const turn of this.turns) {
566
+ const index = turn.items.findIndex((item) => item.id === itemId);
567
+ if (index !== -1) {
568
+ return { turn, item: turn.items[index], index };
569
+ }
570
+ }
571
+ return null;
572
+ }
573
+ };
574
+ function flattenTurnsToTurnItems(turns) {
575
+ return turns.flatMap((turn) => turn.items);
576
+ }
577
+ function applyEventToTurns(turns, event, eventId) {
578
+ const builder = ThreadHistoryBuilder.fromTurns(turns);
579
+ builder.handle_event(event, eventId);
580
+ return builder.finish();
581
+ }
582
+ function applyResponseItemToTurns(turns, item, id) {
583
+ const builder = ThreadHistoryBuilder.fromTurns(turns);
584
+ builder.handle_response_item(item, id);
585
+ return builder.finish();
586
+ }
587
+ function appendCompactionTurnToTurns(turns, id) {
588
+ const builder = ThreadHistoryBuilder.fromTurns(turns);
589
+ builder.handle_rollout_item({ type: "compacted", payload: { message: "" } }, 0);
590
+ const next = builder.finish();
591
+ const last = next.at(-1);
592
+ if (last?.items.at(-1)?.type === "ContextCompaction") {
593
+ last.items[last.items.length - 1] = { type: "ContextCompaction", id };
594
+ }
595
+ return next;
596
+ }
597
+ function newTurn(id, openedExplicitly) {
598
+ return {
599
+ id,
600
+ items: [],
601
+ items_view: "full",
602
+ status: "in_progress",
603
+ error: null,
604
+ started_at: null,
605
+ completed_at: null,
606
+ duration_ms: null,
607
+ opened_explicitly: openedExplicitly
608
+ };
609
+ }
610
+ function stripInternalTurn(turn) {
611
+ const { opened_explicitly, ...publicTurn } = turn;
612
+ return cloneTurn(publicTurn);
613
+ }
614
+ function cloneTurn(turn) {
615
+ return {
616
+ ...turn,
617
+ items: turn.items.map((item) => structuredClone(item)),
618
+ error: turn.error ? { ...turn.error } : null
619
+ };
620
+ }
621
+ function nextItemIndexFromTurns(turns) {
622
+ return turns.reduce((count, turn) => count + turn.items.length, 0) + 1;
623
+ }
624
+ function upsertItem(turn, item) {
625
+ const index = turn.items.findIndex((candidate) => candidate.id === item.id);
626
+ if (index === -1) {
627
+ turn.items.push(item);
628
+ return;
629
+ }
630
+ turn.items[index] = item;
631
+ }
632
+ function startedItem(item) {
633
+ return item.type === "AgentMessage" ? { ...item, phase: item.phase ?? "streaming" } : item;
634
+ }
635
+ function completedItem(item) {
636
+ return item.type === "AgentMessage" ? { ...item, phase: item.phase ?? null } : item;
637
+ }
638
+ function dynamicToolRequestTurnItem(request) {
639
+ return {
640
+ type: "DynamicToolCall",
641
+ id: request.call_id,
642
+ namespace: request.namespace ?? null,
643
+ tool: request.tool,
644
+ arguments: request.arguments,
645
+ status: "inProgress",
646
+ content_items: null,
647
+ success: null,
648
+ duration: null
649
+ };
650
+ }
651
+ function userMessageId(eventId) {
652
+ return `user-${eventId}`;
653
+ }
654
+ function agentMessageId(eventId) {
655
+ return `agent-${eventId}`;
656
+ }
657
+ function userMessageTurnItem(msg, id) {
658
+ return {
659
+ type: "UserMessage",
660
+ id,
661
+ content: userInputFromUserMessage(msg)
662
+ };
663
+ }
664
+ function userInputFromUserMessage(msg) {
665
+ const items = [];
666
+ if (msg.message.length > 0) {
667
+ items.push({
668
+ type: "text",
669
+ text: msg.message,
670
+ text_elements: msg.text_elements
671
+ });
672
+ }
673
+ for (const imageUrl of msg.images ?? []) {
674
+ items.push({ type: "image", image_url: imageUrl });
675
+ }
676
+ for (const path of msg.local_images ?? []) {
677
+ items.push({ type: "local_image", path });
678
+ }
679
+ return items;
680
+ }
681
+ function imageGenerationTurnItem(msg, id) {
682
+ return {
683
+ type: "ImageGeneration",
684
+ id: msg.call_id || id,
685
+ status: msg.status,
686
+ revised_prompt: msg.revised_prompt,
687
+ result: msg.result,
688
+ saved_path: msg.saved_path
689
+ };
690
+ }
691
+ function agentMessageText(item) {
692
+ return item.content.map((part) => part.text).join("");
693
+ }
694
+ function userMessageFingerprint(item) {
695
+ return item.content.map((content) => {
696
+ if (content.type === "text") {
697
+ return `text:${content.text}`;
698
+ }
699
+ if (content.type === "image") {
700
+ return `image:${content.image_url}`;
701
+ }
702
+ if (content.type === "local_image") {
703
+ return `local_image:${content.path}`;
704
+ }
705
+ if (content.type === "skill") {
706
+ return `skill:${content.name}:${content.path}`;
707
+ }
708
+ return `mention:${content.name}:${content.path}`;
709
+ }).join("\n");
710
+ }
711
+
712
+ // src/internal/codex/core/src/rendered-thread.ts
713
+ function createRenderedThreadState(threadId) {
714
+ return {
715
+ thread_id: threadId,
716
+ turns: [],
717
+ items: [],
718
+ pending_request_user_input: null,
719
+ pending_request_permissions: null,
720
+ pending_dynamic_tool_call_requests: [],
721
+ running_turn_ids: [],
722
+ warnings: [],
723
+ errors: [],
724
+ last_history_fingerprint: null,
725
+ connection_status: "idle"
726
+ };
727
+ }
728
+ function renderThreadFromHistory(history) {
729
+ let state = createRenderedThreadState(history.thread_id);
730
+ for (const [index, item] of history.items.entries()) {
731
+ state = applyRolloutItemToRenderedThread(state, item, index);
732
+ }
733
+ return {
734
+ ...state,
735
+ running_turn_ids: [],
736
+ last_history_fingerprint: fingerprintRolloutItems(history.items)
737
+ };
738
+ }
739
+ function applyRolloutItemToRenderedThread(state, item, index = state.items.length) {
740
+ if (item.type === "event_msg") {
741
+ return applyEventMsgToRenderedThread(state, item.payload, {
742
+ event_id: `rollout-${index}`
743
+ });
744
+ }
745
+ if (item.type === "response_item") {
746
+ return withTurns(
747
+ state,
748
+ applyResponseItemToTurns(state.turns, item.payload, `response-${index}`)
749
+ );
750
+ }
751
+ if (item.type === "compacted") {
752
+ return withTurns(
753
+ state,
754
+ appendCompactionTurnToTurns(state.turns, `compacted-${index}`)
755
+ );
756
+ }
757
+ return state;
758
+ }
759
+ function applyEventMsgToRenderedThread(state, msg, options = {}) {
760
+ const eventId = options.event_id ?? `event-${state.items.length}`;
761
+ const hadActiveTurn = hasActiveTurn(state.turns);
762
+ const next = withTurns(state, applyEventToTurns(state.turns, msg, eventId));
763
+ switch (msg.type) {
764
+ case "turn_started":
765
+ return {
766
+ ...next,
767
+ running_turn_ids: addUnique(next.running_turn_ids, msg.turn_id)
768
+ };
769
+ case "turn_complete":
770
+ return clearPendingForTurn(
771
+ {
772
+ ...next,
773
+ running_turn_ids: next.running_turn_ids.filter(
774
+ (turnId) => turnId !== msg.turn_id
775
+ )
776
+ },
777
+ msg.turn_id
778
+ );
779
+ case "turn_aborted":
780
+ return clearPendingForTurn(
781
+ {
782
+ ...next,
783
+ running_turn_ids: next.running_turn_ids.filter(
784
+ (turnId) => turnId !== msg.turn_id
785
+ )
786
+ },
787
+ msg.turn_id
788
+ );
789
+ case "request_user_input":
790
+ return {
791
+ ...next,
792
+ pending_request_user_input: {
793
+ call_id: msg.call_id,
794
+ turn_id: msg.turn_id,
795
+ questions: msg.questions.map((question) => ({
796
+ ...question,
797
+ options: question.options.map((option) => ({ ...option }))
798
+ }))
799
+ }
800
+ };
801
+ case "request_permissions":
802
+ return {
803
+ ...next,
804
+ pending_request_permissions: {
805
+ call_id: msg.call_id,
806
+ turn_id: msg.turn_id,
807
+ reason: msg.reason ?? null,
808
+ permissions: JSON.parse(JSON.stringify(msg.permissions)),
809
+ cwd: msg.cwd ?? null
810
+ }
811
+ };
812
+ case "dynamic_tool_call_request":
813
+ return {
814
+ ...next,
815
+ pending_dynamic_tool_call_requests: upsertDynamicToolCallRequest(
816
+ next.pending_dynamic_tool_call_requests,
817
+ msg
818
+ )
819
+ };
820
+ case "dynamic_tool_call_response":
821
+ return {
822
+ ...next,
823
+ pending_dynamic_tool_call_requests: next.pending_dynamic_tool_call_requests.filter(
824
+ (request) => request.call_id !== msg.call_id
825
+ )
826
+ };
827
+ case "warning":
828
+ return {
829
+ ...next,
830
+ warnings: [...next.warnings, msg.message]
831
+ };
832
+ case "error":
833
+ return hadActiveTurn ? next : {
834
+ ...next,
835
+ errors: [...next.errors, msg.message]
836
+ };
837
+ default:
838
+ return next;
839
+ }
840
+ }
841
+ function fingerprintRolloutItems(items) {
842
+ const last = items.at(-1);
843
+ return `${items.length}:${hashString(JSON.stringify(last ?? null))}`;
844
+ }
845
+ function withTurns(state, turns) {
846
+ const nextTurns = turns.map((turn) => ({
847
+ ...turn,
848
+ items: turn.items.map((item) => structuredClone(item)),
849
+ error: turn.error ? { ...turn.error } : null
850
+ }));
851
+ return {
852
+ ...state,
853
+ turns: nextTurns,
854
+ items: flattenTurnsToTurnItems(nextTurns)
855
+ };
856
+ }
857
+ function clearPendingForTurn(state, turnId) {
858
+ return {
859
+ ...state,
860
+ pending_request_user_input: state.pending_request_user_input?.turn_id === turnId ? null : state.pending_request_user_input,
861
+ pending_dynamic_tool_call_requests: state.pending_dynamic_tool_call_requests.filter(
862
+ (request) => request.turn_id !== turnId
863
+ ),
864
+ pending_request_permissions: state.pending_request_permissions?.turn_id === turnId ? null : state.pending_request_permissions
865
+ };
866
+ }
867
+ function upsertDynamicToolCallRequest(requests, request) {
868
+ return [
869
+ ...requests.filter((item) => item.call_id !== request.call_id),
870
+ {
871
+ call_id: request.call_id,
872
+ turn_id: request.turn_id,
873
+ started_at_ms: request.started_at_ms,
874
+ namespace: request.namespace ?? null,
875
+ tool: request.tool,
876
+ arguments: request.arguments
877
+ }
878
+ ];
879
+ }
880
+ function hasActiveTurn(turns) {
881
+ return turns.some((turn) => turn.status === "in_progress");
882
+ }
883
+ function addUnique(values, value) {
884
+ return values.includes(value) ? values : [...values, value];
885
+ }
886
+ function hashString(value) {
887
+ let hash = 0;
888
+ for (let index = 0; index < value.length; index += 1) {
889
+ hash = hash * 31 + value.charCodeAt(index) >>> 0;
890
+ }
891
+ return hash.toString(16);
892
+ }
893
+
894
+ // src/internal/codex/app-server-client/src/thread_event_store.ts
895
+ var ThreadEventStore = class _ThreadEventStore {
896
+ accountRateLimits = null;
897
+ activeTurnIds = /* @__PURE__ */ new Set();
898
+ bufferedEvents = [];
899
+ connectionStatus = "idle";
900
+ errors = [];
901
+ pendingRequests = /* @__PURE__ */ new Map();
902
+ resolvedRequestIds = [];
903
+ thread = null;
904
+ tokenUsage = null;
905
+ turns = [];
906
+ warnings = [];
907
+ static fromThread(thread) {
908
+ const store = new _ThreadEventStore();
909
+ store.setThread(thread);
910
+ return store;
911
+ }
912
+ applyNotification(notification) {
913
+ applyServerNotificationToThreadEventStore(this, notification);
914
+ return this.snapshot();
915
+ }
916
+ applyRequest(request) {
917
+ applyServerRequestToThreadEventStore(this, request);
918
+ return this.snapshot();
919
+ }
920
+ setConnectionStatus(status) {
921
+ this.connectionStatus = status;
922
+ return this.snapshot();
923
+ }
924
+ setThread(thread) {
925
+ this.thread = cloneThread(thread);
926
+ this.turns = thread.turns.map(cloneTurn2);
927
+ this.activeTurnIds = new Set(
928
+ this.turns.filter((turn) => turn.status === "inProgress").map((turn) => turn.id)
929
+ );
930
+ return this.snapshot();
931
+ }
932
+ snapshot() {
933
+ return {
934
+ activeTurnIds: [...this.activeTurnIds],
935
+ accountRateLimits: this.accountRateLimits ? { ...this.accountRateLimits } : null,
936
+ bufferedEvents: [...this.bufferedEvents],
937
+ connectionStatus: this.connectionStatus,
938
+ errors: [...this.errors],
939
+ pendingRequests: [...this.pendingRequests.values()],
940
+ resolvedRequestIds: [...this.resolvedRequestIds],
941
+ thread: this.thread ? cloneThread(this.thread) : null,
942
+ tokenUsage: this.tokenUsage ? {
943
+ ...this.tokenUsage,
944
+ tokenUsage: cloneThreadTokenUsage(this.tokenUsage.tokenUsage)
945
+ } : null,
946
+ turns: this.turns.map(cloneTurn2),
947
+ warnings: [...this.warnings]
948
+ };
949
+ }
950
+ noteNotification(notification) {
951
+ this.bufferedEvents = [...this.bufferedEvents, { notification, type: "notification" }];
952
+ switch (notification.method) {
953
+ case "thread/started":
954
+ this.setThread(notification.params.thread);
955
+ return;
956
+ case "thread/status/changed":
957
+ if (this.thread) {
958
+ this.thread = { ...this.thread, status: notification.params.status };
959
+ }
960
+ return;
961
+ case "thread/name/updated":
962
+ if (this.thread) {
963
+ this.thread = { ...this.thread, name: notification.params.threadName ?? null };
964
+ }
965
+ return;
966
+ case "thread/archived":
967
+ case "thread/unarchived":
968
+ case "thread/closed":
969
+ case "thread/goal/updated":
970
+ case "thread/goal/cleared":
971
+ return;
972
+ case "thread/tokenUsage/updated":
973
+ this.tokenUsage = {
974
+ threadId: notification.params.threadId,
975
+ tokenUsage: cloneThreadTokenUsage(notification.params.tokenUsage),
976
+ turnId: notification.params.turnId,
977
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
978
+ };
979
+ return;
980
+ case "turn/started":
981
+ this.upsertTurn(notification.params.turn);
982
+ this.activeTurnIds.add(notification.params.turn.id);
983
+ return;
984
+ case "turn/diff/updated":
985
+ case "turn/plan/updated":
986
+ this.ensureTurn(notification.params.turnId);
987
+ return;
988
+ case "turn/completed":
989
+ this.upsertTurn(notification.params.turn);
990
+ this.activeTurnIds.delete(notification.params.turn.id);
991
+ if (notification.params.turn.error?.message) {
992
+ this.errors = appendUnique(this.errors, notification.params.turn.error.message);
993
+ }
994
+ return;
995
+ case "item/started":
996
+ case "item/completed":
997
+ this.upsertItem(notification.params.turnId, notification.params.item);
998
+ return;
999
+ case "item/agentMessage/delta":
1000
+ this.applyAgentMessageDelta(
1001
+ notification.params.turnId,
1002
+ notification.params.itemId,
1003
+ notification.params.delta
1004
+ );
1005
+ return;
1006
+ case "item/plan/delta":
1007
+ this.applyPlanDelta(
1008
+ notification.params.turnId,
1009
+ notification.params.itemId,
1010
+ notification.params.delta
1011
+ );
1012
+ return;
1013
+ case "item/reasoning/summaryPartAdded":
1014
+ this.applyReasoningSummaryPartAdded(
1015
+ notification.params.turnId,
1016
+ notification.params.itemId,
1017
+ notification.params.summaryIndex
1018
+ );
1019
+ return;
1020
+ case "item/reasoning/summaryTextDelta":
1021
+ this.applyReasoningSummaryTextDelta(
1022
+ notification.params.turnId,
1023
+ notification.params.itemId,
1024
+ notification.params.summaryIndex,
1025
+ notification.params.delta
1026
+ );
1027
+ return;
1028
+ case "item/reasoning/textDelta":
1029
+ this.applyReasoningTextDelta(
1030
+ notification.params.turnId,
1031
+ notification.params.itemId,
1032
+ notification.params.contentIndex,
1033
+ notification.params.delta
1034
+ );
1035
+ return;
1036
+ case "item/commandExecution/outputDelta":
1037
+ this.applyCommandOutputDelta(
1038
+ notification.params.turnId,
1039
+ notification.params.itemId,
1040
+ notification.params.delta
1041
+ );
1042
+ return;
1043
+ case "item/fileChange/outputDelta":
1044
+ this.ensureTurn(notification.params.turnId);
1045
+ return;
1046
+ case "item/fileChange/patchUpdated":
1047
+ this.applyFileChangePatchUpdated(
1048
+ notification.params.turnId,
1049
+ notification.params.itemId,
1050
+ notification.params.changes
1051
+ );
1052
+ return;
1053
+ case "item/mcpToolCall/progress":
1054
+ case "item/commandExecution/terminalInteraction":
1055
+ case "command/exec/outputDelta":
1056
+ case "process/outputDelta":
1057
+ case "process/exited":
1058
+ case "rawResponseItem/completed":
1059
+ case "hook/started":
1060
+ case "hook/completed":
1061
+ case "item/autoApprovalReview/started":
1062
+ case "item/autoApprovalReview/completed":
1063
+ return;
1064
+ case "thread/compacted":
1065
+ this.upsertItem(notification.params.turnId, {
1066
+ id: `compacted-${notification.params.turnId}`,
1067
+ type: "contextCompaction"
1068
+ });
1069
+ return;
1070
+ case "serverRequest/resolved":
1071
+ this.pendingRequests.delete(notification.params.requestId);
1072
+ this.resolvedRequestIds = appendUnique(
1073
+ this.resolvedRequestIds,
1074
+ notification.params.requestId
1075
+ );
1076
+ return;
1077
+ case "warning":
1078
+ this.warnings = appendUnique(this.warnings, notification.params.message);
1079
+ return;
1080
+ case "error":
1081
+ this.errors = appendUnique(this.errors, notification.params.error.message);
1082
+ return;
1083
+ case "guardianWarning":
1084
+ this.warnings = appendUnique(this.warnings, notification.params.message);
1085
+ return;
1086
+ case "deprecationNotice":
1087
+ this.warnings = appendUnique(this.warnings, notification.params.summary);
1088
+ return;
1089
+ case "configWarning":
1090
+ this.warnings = appendUnique(this.warnings, notification.params.summary);
1091
+ return;
1092
+ case "account/rateLimits/updated":
1093
+ this.accountRateLimits = { ...notification.params.rateLimits };
1094
+ return;
1095
+ case "thread/realtime/started":
1096
+ case "thread/realtime/itemAdded":
1097
+ case "thread/realtime/transcript/delta":
1098
+ case "thread/realtime/transcript/done":
1099
+ case "thread/realtime/outputAudio/delta":
1100
+ case "thread/realtime/sdp":
1101
+ case "thread/realtime/error":
1102
+ case "thread/realtime/closed":
1103
+ case "fs/changed":
1104
+ case "model/rerouted":
1105
+ case "model/verification":
1106
+ case "mcpServer/oauthLogin/completed":
1107
+ case "mcpServer/startupStatus/updated":
1108
+ case "fuzzyFileSearch/sessionUpdated":
1109
+ case "fuzzyFileSearch/sessionCompleted":
1110
+ case "windows/worldWritableWarning":
1111
+ case "windowsSandbox/setupCompleted":
1112
+ return;
1113
+ default:
1114
+ if (notificationThreadId(notification)) {
1115
+ this.warnings = appendUnique(
1116
+ this.warnings,
1117
+ `Unsupported Codex app-server notification: ${notification.method}`
1118
+ );
1119
+ }
1120
+ return;
1121
+ }
1122
+ }
1123
+ noteRequest(request) {
1124
+ this.bufferedEvents = [...this.bufferedEvents, { request, type: "request" }];
1125
+ this.pendingRequests.set(request.id, request);
1126
+ }
1127
+ upsertTurn(turn) {
1128
+ const index = this.turns.findIndex((candidate) => candidate.id === turn.id);
1129
+ if (index === -1) {
1130
+ this.turns = [...this.turns, cloneTurn2(turn)];
1131
+ return;
1132
+ }
1133
+ const current = this.turns[index];
1134
+ this.turns = replaceAt(this.turns, index, {
1135
+ ...current,
1136
+ ...turn,
1137
+ items: turn.items.length > 0 ? turn.items.map(cloneThreadItem) : current.items
1138
+ });
1139
+ }
1140
+ upsertItem(turnId, item) {
1141
+ const turn = this.ensureTurn(turnId);
1142
+ const itemIndex = turn.items.findIndex((candidate) => candidate.id === item.id);
1143
+ const nextItems = itemIndex === -1 ? [...turn.items, cloneThreadItem(item)] : replaceAt(turn.items, itemIndex, cloneThreadItem(item));
1144
+ this.replaceTurn({ ...turn, items: nextItems, itemsView: "full" });
1145
+ }
1146
+ applyAgentMessageDelta(turnId, itemId, delta) {
1147
+ const turn = this.ensureTurn(turnId);
1148
+ const item = turn.items.find((candidate) => candidate.id === itemId);
1149
+ if (item?.type === "agentMessage") {
1150
+ this.upsertItem(turnId, { ...item, text: `${item.text}${delta}` });
1151
+ return;
1152
+ }
1153
+ this.upsertItem(turnId, {
1154
+ id: itemId,
1155
+ memoryCitation: null,
1156
+ phase: "commentary",
1157
+ text: delta,
1158
+ type: "agentMessage"
1159
+ });
1160
+ }
1161
+ applyPlanDelta(turnId, itemId, delta) {
1162
+ const turn = this.ensureTurn(turnId);
1163
+ const item = turn.items.find((candidate) => candidate.id === itemId);
1164
+ if (item?.type === "plan") {
1165
+ this.upsertItem(turnId, { ...item, text: `${item.text}${delta}` });
1166
+ return;
1167
+ }
1168
+ this.upsertItem(turnId, {
1169
+ id: itemId,
1170
+ text: delta,
1171
+ type: "plan"
1172
+ });
1173
+ }
1174
+ applyReasoningSummaryPartAdded(turnId, itemId, summaryIndex) {
1175
+ const item = this.reasoningItem(turnId, itemId);
1176
+ const summary = replaceAtOrAppend(item.summary, summaryIndex, "");
1177
+ this.upsertItem(turnId, { ...item, summary });
1178
+ }
1179
+ applyReasoningSummaryTextDelta(turnId, itemId, summaryIndex, delta) {
1180
+ const item = this.reasoningItem(turnId, itemId);
1181
+ const current = item.summary[summaryIndex] ?? "";
1182
+ const summary = replaceAtOrAppend(item.summary, summaryIndex, `${current}${delta}`);
1183
+ this.upsertItem(turnId, { ...item, summary });
1184
+ }
1185
+ applyReasoningTextDelta(turnId, itemId, contentIndex, delta) {
1186
+ const item = this.reasoningItem(turnId, itemId);
1187
+ const current = item.content[contentIndex] ?? "";
1188
+ const content = replaceAtOrAppend(item.content, contentIndex, `${current}${delta}`);
1189
+ this.upsertItem(turnId, { ...item, content });
1190
+ }
1191
+ applyCommandOutputDelta(turnId, itemId, delta) {
1192
+ const turn = this.ensureTurn(turnId);
1193
+ const item = turn.items.find((candidate) => candidate.id === itemId);
1194
+ if (item?.type !== "commandExecution") {
1195
+ return;
1196
+ }
1197
+ this.upsertItem(turnId, {
1198
+ ...item,
1199
+ aggregatedOutput: `${item.aggregatedOutput ?? ""}${delta}`
1200
+ });
1201
+ }
1202
+ applyFileChangePatchUpdated(turnId, itemId, changes) {
1203
+ const turn = this.ensureTurn(turnId);
1204
+ const item = turn.items.find((candidate) => candidate.id === itemId);
1205
+ if (item?.type !== "fileChange") {
1206
+ return;
1207
+ }
1208
+ this.upsertItem(turnId, { ...item, changes });
1209
+ }
1210
+ reasoningItem(turnId, itemId) {
1211
+ const turn = this.ensureTurn(turnId);
1212
+ const item = turn.items.find((candidate) => candidate.id === itemId);
1213
+ if (item?.type === "reasoning") {
1214
+ return item;
1215
+ }
1216
+ return {
1217
+ content: [],
1218
+ id: itemId,
1219
+ summary: [],
1220
+ type: "reasoning"
1221
+ };
1222
+ }
1223
+ ensureTurn(turnId) {
1224
+ const existing = this.turns.find((turn2) => turn2.id === turnId);
1225
+ if (existing) {
1226
+ return existing;
1227
+ }
1228
+ const turn = {
1229
+ completedAt: null,
1230
+ durationMs: null,
1231
+ error: null,
1232
+ id: turnId,
1233
+ items: [],
1234
+ itemsView: "full",
1235
+ startedAt: null,
1236
+ status: "inProgress"
1237
+ };
1238
+ this.turns = [...this.turns, turn];
1239
+ this.activeTurnIds.add(turnId);
1240
+ return turn;
1241
+ }
1242
+ replaceTurn(turn) {
1243
+ const index = this.turns.findIndex((candidate) => candidate.id === turn.id);
1244
+ this.turns = index === -1 ? [...this.turns, turn] : replaceAt(this.turns, index, turn);
1245
+ }
1246
+ };
1247
+ function applyServerNotificationToThreadEventStore(store, notification) {
1248
+ store.noteNotification(notification);
1249
+ return store.snapshot();
1250
+ }
1251
+ function applyServerRequestToThreadEventStore(store, request) {
1252
+ store.noteRequest(request);
1253
+ return store.snapshot();
1254
+ }
1255
+ function notificationThreadId(notification) {
1256
+ if (notification.method === "thread/started") {
1257
+ return notification.params.thread.id;
1258
+ }
1259
+ if ("params" in notification && notification.params && typeof notification.params === "object") {
1260
+ const threadId = notification.params.threadId;
1261
+ return typeof threadId === "string" ? threadId : null;
1262
+ }
1263
+ return null;
1264
+ }
1265
+ function cloneThread(thread) {
1266
+ return {
1267
+ ...thread,
1268
+ turns: thread.turns.map(cloneTurn2)
1269
+ };
1270
+ }
1271
+ function cloneTurn2(turn) {
1272
+ return {
1273
+ ...turn,
1274
+ items: turn.items.map(cloneThreadItem)
1275
+ };
1276
+ }
1277
+ function cloneThreadItem(item) {
1278
+ return { ...item };
1279
+ }
1280
+ function cloneThreadTokenUsage(tokenUsage) {
1281
+ return {
1282
+ last: { ...tokenUsage.last },
1283
+ modelContextWindow: tokenUsage.modelContextWindow,
1284
+ total: { ...tokenUsage.total }
1285
+ };
1286
+ }
1287
+ function replaceAt(items, index, item) {
1288
+ return [...items.slice(0, index), item, ...items.slice(index + 1)];
1289
+ }
1290
+ function replaceAtOrAppend(items, index, item) {
1291
+ if (index < items.length) {
1292
+ return replaceAt(items, index, item);
1293
+ }
1294
+ return [...items, item];
1295
+ }
1296
+ function appendUnique(items, item) {
1297
+ return items.includes(item) ? [...items] : [...items, item];
1298
+ }
1299
+
1300
+ // src/internal/codex/core/src/memory.ts
1301
+ var ThreadMemoryMode = {
1302
+ Enabled: "Enabled"};
1303
+
1304
+ // src/internal/codex/thread-store/src/in_memory.ts
1305
+ var stores = /* @__PURE__ */ new Map();
1306
+ var InMemoryThreadStore = class _InMemoryThreadStore {
1307
+ state = {
1308
+ calls: emptyCalls(),
1309
+ createdThreads: /* @__PURE__ */ new Map(),
1310
+ histories: /* @__PURE__ */ new Map(),
1311
+ rolloutPaths: /* @__PURE__ */ new Map(),
1312
+ threads: /* @__PURE__ */ new Map()
1313
+ };
1314
+ static forId(id) {
1315
+ const existing = stores.get(id);
1316
+ if (existing) {
1317
+ return existing;
1318
+ }
1319
+ const store = new _InMemoryThreadStore();
1320
+ stores.set(id, store);
1321
+ return store;
1322
+ }
1323
+ static removeId(id) {
1324
+ const store = stores.get(id) ?? null;
1325
+ stores.delete(id);
1326
+ return store;
1327
+ }
1328
+ calls() {
1329
+ return { ...this.state.calls };
1330
+ }
1331
+ snapshot() {
1332
+ return {
1333
+ createdThreads: Array.from(this.state.createdThreads.entries()),
1334
+ histories: Array.from(this.state.histories.entries()).map(
1335
+ ([threadId, items]) => [threadId, [...items]]
1336
+ ),
1337
+ rolloutPaths: Array.from(this.state.rolloutPaths.entries()),
1338
+ threads: Array.from(this.state.threads.entries()).map(
1339
+ ([threadId, thread]) => [threadId, { ...thread }]
1340
+ )
1341
+ };
1342
+ }
1343
+ restoreSnapshot(snapshot) {
1344
+ this.state.createdThreads = new Map(snapshot.createdThreads);
1345
+ this.state.histories = new Map(
1346
+ snapshot.histories.map(([threadId, items]) => [threadId, [...items]])
1347
+ );
1348
+ this.state.rolloutPaths = new Map(snapshot.rolloutPaths);
1349
+ this.state.threads = new Map(
1350
+ snapshot.threads.map(([threadId, thread]) => [threadId, { ...thread }])
1351
+ );
1352
+ }
1353
+ async createThread(params) {
1354
+ this.state.calls.createThread += 1;
1355
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1356
+ this.state.createdThreads.set(params.thread_id, params);
1357
+ this.state.histories.set(params.thread_id, []);
1358
+ this.state.threads.set(params.thread_id, {
1359
+ archived_at: null,
1360
+ created_at: now,
1361
+ cwd: String(params.metadata.cwd ?? "/"),
1362
+ forked_from_id: params.forked_from_id ?? null,
1363
+ history: null,
1364
+ model: stringOrNull(params.metadata.model),
1365
+ model_provider: params.metadata.model_provider,
1366
+ name: null,
1367
+ preview: "",
1368
+ reasoning_effort: stringOrNull(params.metadata.reasoning_effort),
1369
+ source: params.source,
1370
+ thread_id: params.thread_id,
1371
+ thread_source: params.thread_source ?? null,
1372
+ token_usage: null,
1373
+ updated_at: now
1374
+ });
1375
+ }
1376
+ async resumeThread(params) {
1377
+ this.state.calls.resumeThread += 1;
1378
+ if (!this.state.threads.has(params.thread_id)) {
1379
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1380
+ this.state.threads.set(params.thread_id, {
1381
+ archived_at: null,
1382
+ created_at: now,
1383
+ cwd: String(params.metadata.cwd ?? "/"),
1384
+ history: null,
1385
+ model: stringOrNull(params.metadata.model),
1386
+ model_provider: params.metadata.model_provider,
1387
+ preview: "",
1388
+ source: "appServer",
1389
+ thread_id: params.thread_id,
1390
+ token_usage: lastTokenInfoFromRolloutItems(params.history ?? []),
1391
+ updated_at: now
1392
+ });
1393
+ }
1394
+ this.state.histories.set(
1395
+ params.thread_id,
1396
+ [...params.history ?? this.state.histories.get(params.thread_id) ?? []]
1397
+ );
1398
+ this.updateThreadTokenUsage(
1399
+ params.thread_id,
1400
+ params.history ?? this.state.histories.get(params.thread_id) ?? []
1401
+ );
1402
+ if (params.rollout_path) {
1403
+ this.state.rolloutPaths.set(params.rollout_path, params.thread_id);
1404
+ }
1405
+ }
1406
+ async appendItems(params) {
1407
+ this.state.calls.appendItems += 1;
1408
+ this.history(params.thread_id).push(...params.items);
1409
+ this.updateThreadTokenUsage(params.thread_id, params.items);
1410
+ this.touch(params.thread_id);
1411
+ }
1412
+ async persistThread(threadId) {
1413
+ this.state.calls.persistThread += 1;
1414
+ }
1415
+ async flushThread(threadId) {
1416
+ this.state.calls.flushThread += 1;
1417
+ }
1418
+ async shutdownThread(threadId) {
1419
+ this.state.calls.shutdownThread += 1;
1420
+ }
1421
+ async discardThread(threadId) {
1422
+ this.state.calls.discardThread += 1;
1423
+ }
1424
+ async loadHistory(params) {
1425
+ this.state.calls.loadHistory += 1;
1426
+ return {
1427
+ items: [...this.history(params.thread_id)],
1428
+ thread_id: params.thread_id
1429
+ };
1430
+ }
1431
+ async readThread(params) {
1432
+ this.state.calls.readThread += 1;
1433
+ return this.storedThread(params.thread_id, params.include_history);
1434
+ }
1435
+ async readThreadByRolloutPath(params) {
1436
+ this.state.calls.readThreadByRolloutPath += 1;
1437
+ const threadId = this.state.rolloutPaths.get(params.rollout_path);
1438
+ if (!threadId) {
1439
+ throw new Error(`Unknown rollout path: ${params.rollout_path}`);
1440
+ }
1441
+ return this.storedThread(threadId, params.include_history);
1442
+ }
1443
+ async listThreads(params) {
1444
+ this.state.calls.listThreads += 1;
1445
+ const items = Array.from(this.state.threads.values()).filter((thread) => params.archived || !thread.archived_at).sort(
1446
+ (left, right) => params.sort_direction === "Asc" ? left.created_at.localeCompare(right.created_at) : right.created_at.localeCompare(left.created_at)
1447
+ ).slice(0, params.page_size).map((thread) => ({ ...thread, history: null }));
1448
+ return { items, next_cursor: null };
1449
+ }
1450
+ async updateThreadMetadata(params) {
1451
+ this.state.calls.updateThreadMetadata += 1;
1452
+ const thread = this.storedThread(params.thread_id, false);
1453
+ const next = {
1454
+ ...thread,
1455
+ name: params.patch.name ?? thread.name,
1456
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
1457
+ };
1458
+ if (params.patch.memory_mode === ThreadMemoryMode.Enabled) {
1459
+ next.preview = thread.preview;
1460
+ }
1461
+ this.state.threads.set(params.thread_id, next);
1462
+ return { ...next };
1463
+ }
1464
+ async archiveThread(params) {
1465
+ this.state.calls.archiveThread += 1;
1466
+ const thread = this.storedThread(params.thread_id, false);
1467
+ this.state.threads.set(params.thread_id, {
1468
+ ...thread,
1469
+ archived_at: (/* @__PURE__ */ new Date()).toISOString()
1470
+ });
1471
+ }
1472
+ async unarchiveThread(params) {
1473
+ this.state.calls.unarchiveThread += 1;
1474
+ const thread = this.storedThread(params.thread_id, false);
1475
+ const next = { ...thread, archived_at: null };
1476
+ this.state.threads.set(params.thread_id, next);
1477
+ return next;
1478
+ }
1479
+ history(threadId) {
1480
+ const history = this.state.histories.get(threadId);
1481
+ if (!history) {
1482
+ throw new Error(`Thread not found: ${threadId}`);
1483
+ }
1484
+ return history;
1485
+ }
1486
+ storedThread(threadId, includeHistory) {
1487
+ const thread = this.state.threads.get(threadId);
1488
+ if (!thread) {
1489
+ throw new Error(`Thread not found: ${threadId}`);
1490
+ }
1491
+ return {
1492
+ ...thread,
1493
+ history: includeHistory ? { items: [...this.history(threadId)], thread_id: threadId } : null
1494
+ };
1495
+ }
1496
+ touch(threadId) {
1497
+ const thread = this.state.threads.get(threadId);
1498
+ if (thread) {
1499
+ this.state.threads.set(threadId, {
1500
+ ...thread,
1501
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
1502
+ });
1503
+ }
1504
+ }
1505
+ updateThreadTokenUsage(threadId, items) {
1506
+ const info = lastTokenInfoFromRolloutItems(items);
1507
+ if (!info) {
1508
+ return;
1509
+ }
1510
+ const thread = this.state.threads.get(threadId);
1511
+ if (!thread) {
1512
+ return;
1513
+ }
1514
+ this.state.threads.set(threadId, {
1515
+ ...thread,
1516
+ token_usage: info
1517
+ });
1518
+ }
1519
+ };
1520
+ function emptyCalls() {
1521
+ return {
1522
+ archiveThread: 0,
1523
+ appendItems: 0,
1524
+ createThread: 0,
1525
+ discardThread: 0,
1526
+ flushThread: 0,
1527
+ listThreads: 0,
1528
+ loadHistory: 0,
1529
+ persistThread: 0,
1530
+ readThread: 0,
1531
+ readThreadByRolloutPath: 0,
1532
+ resumeThread: 0,
1533
+ shutdownThread: 0,
1534
+ unarchiveThread: 0,
1535
+ updateThreadMetadata: 0
1536
+ };
1537
+ }
1538
+ function stringOrNull(value) {
1539
+ return typeof value === "string" ? value : null;
1540
+ }
1541
+ function lastTokenInfoFromRolloutItems(items) {
1542
+ for (let index = items.length - 1; index >= 0; index -= 1) {
1543
+ const item = items[index];
1544
+ if (item?.type === "event_msg" && item.payload.type === "token_count" && item.payload.info) {
1545
+ return item.payload.info;
1546
+ }
1547
+ }
1548
+ return null;
1549
+ }
1550
+
1551
+ // src/internal/codex/thread-store/src/local/mod.ts
1552
+ var LocalThreadStore = class extends InMemoryThreadStore {
1553
+ constructor(config) {
1554
+ super();
1555
+ this.config = config;
1556
+ }
1557
+ config;
1558
+ stateDb() {
1559
+ return null;
1560
+ }
1561
+ async createThread(params) {
1562
+ await this.load();
1563
+ await super.createThread(params);
1564
+ this.attachRolloutPath(params.thread_id);
1565
+ await this.save();
1566
+ }
1567
+ async resumeThread(params) {
1568
+ await this.load();
1569
+ await super.resumeThread({
1570
+ ...params,
1571
+ rollout_path: params.rollout_path ?? this.rolloutPath(params.thread_id)
1572
+ });
1573
+ this.attachRolloutPath(params.thread_id, params.rollout_path ?? void 0);
1574
+ await this.save();
1575
+ }
1576
+ async appendItems(params) {
1577
+ await this.load();
1578
+ await super.appendItems(params);
1579
+ await this.save();
1580
+ }
1581
+ async persistThread(threadId) {
1582
+ await this.load();
1583
+ await super.persistThread(threadId);
1584
+ await this.save();
1585
+ }
1586
+ async flushThread(threadId) {
1587
+ await this.load();
1588
+ await super.flushThread(threadId);
1589
+ await this.save();
1590
+ }
1591
+ async shutdownThread(threadId) {
1592
+ await this.load();
1593
+ await super.shutdownThread(threadId);
1594
+ await this.save();
1595
+ }
1596
+ async discardThread(threadId) {
1597
+ await this.load();
1598
+ await super.discardThread(threadId);
1599
+ await this.save();
1600
+ }
1601
+ async loadHistory(params) {
1602
+ await this.load();
1603
+ return super.loadHistory(params);
1604
+ }
1605
+ async readThread(params) {
1606
+ await this.load();
1607
+ return super.readThread(params);
1608
+ }
1609
+ async readThreadByRolloutPath(params) {
1610
+ await this.load();
1611
+ return super.readThreadByRolloutPath(params);
1612
+ }
1613
+ async listThreads(params) {
1614
+ await this.load();
1615
+ return super.listThreads(params);
1616
+ }
1617
+ async updateThreadMetadata(params) {
1618
+ await this.load();
1619
+ const thread = await super.updateThreadMetadata(params);
1620
+ await this.save();
1621
+ return thread;
1622
+ }
1623
+ async archiveThread(params) {
1624
+ await this.load();
1625
+ await super.archiveThread(params);
1626
+ await this.save();
1627
+ }
1628
+ async unarchiveThread(params) {
1629
+ await this.load();
1630
+ const thread = await super.unarchiveThread(params);
1631
+ await this.save();
1632
+ return thread;
1633
+ }
1634
+ liveRolloutPath(threadId) {
1635
+ return this.rolloutPath(threadId);
1636
+ }
1637
+ attachRolloutPath(threadId, rolloutPath) {
1638
+ const snapshot = this.snapshot();
1639
+ const path = rolloutPath ?? this.rolloutPath(threadId);
1640
+ const threads = snapshot.threads.map(
1641
+ ([candidateThreadId, thread]) => [
1642
+ candidateThreadId,
1643
+ candidateThreadId === threadId ? { ...thread, rollout_path: path } : thread
1644
+ ]
1645
+ );
1646
+ const rolloutPaths = new Map(snapshot.rolloutPaths);
1647
+ rolloutPaths.set(path, threadId);
1648
+ this.restoreSnapshot({
1649
+ ...snapshot,
1650
+ rolloutPaths: Array.from(rolloutPaths.entries()),
1651
+ threads
1652
+ });
1653
+ }
1654
+ async load() {
1655
+ try {
1656
+ const { readFile } = await nodeFsPromises();
1657
+ const raw = await readFile(this.storePath(), "utf8");
1658
+ const data = JSON.parse(raw);
1659
+ this.restoreSnapshot(data);
1660
+ } catch (error) {
1661
+ if (error.code === "ENOENT") {
1662
+ return;
1663
+ }
1664
+ throw error;
1665
+ }
1666
+ }
1667
+ async save() {
1668
+ const { mkdir, writeFile } = await nodeFsPromises();
1669
+ const path = this.storePath();
1670
+ await mkdir(dirname(path), { recursive: true });
1671
+ const data = {
1672
+ version: 1,
1673
+ ...this.snapshot()
1674
+ };
1675
+ await writeFile(path, `${JSON.stringify(data, null, 2)}
1676
+ `, "utf8");
1677
+ }
1678
+ rolloutPath(threadId) {
1679
+ return `${this.config.codex_home.replace(/\/+$/, "")}/sessions/${threadId}.jsonl`;
1680
+ }
1681
+ storePath() {
1682
+ return `${this.config.codex_home.replace(/\/+$/, "")}/thread-store/store.json`;
1683
+ }
1684
+ };
1685
+ async function nodeFsPromises() {
1686
+ const moduleName = "node:fs/promises";
1687
+ return import(
1688
+ /* @vite-ignore */
1689
+ moduleName
1690
+ );
1691
+ }
1692
+ function dirname(path) {
1693
+ const normalized = path.replace(/\/+$/, "");
1694
+ const separatorIndex = normalized.lastIndexOf("/");
1695
+ return separatorIndex <= 0 ? "/" : normalized.slice(0, separatorIndex);
1696
+ }
1697
+
1698
+ export { InMemoryThreadStore, LocalThreadStore, ThreadEventStore, createRenderedThreadState, renderThreadFromHistory };