@gkorepanov/ccodex 0.4.18 → 0.4.20

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 (353) hide show
  1. package/README.md +2 -2
  2. package/config/compatibility.json +5 -5
  3. package/dist/claude/developerInstructions.d.ts +2 -0
  4. package/dist/claude/developerInstructions.js +9 -0
  5. package/dist/claude/developerInstructions.js.map +1 -0
  6. package/dist/claude/modelCatalog.d.ts +4 -0
  7. package/dist/claude/modelCatalog.js +14 -0
  8. package/dist/claude/modelCatalog.js.map +1 -1
  9. package/dist/claude/modelSelection.d.ts +14 -0
  10. package/dist/claude/modelSelection.js +26 -0
  11. package/dist/claude/modelSelection.js.map +1 -1
  12. package/dist/claude/resultClassifier.js +4 -1
  13. package/dist/claude/resultClassifier.js.map +1 -1
  14. package/dist/claude/service.d.ts +32 -2
  15. package/dist/claude/service.js +188 -71
  16. package/dist/claude/service.js.map +1 -1
  17. package/dist/claude/session/codexRollout.js +40 -1
  18. package/dist/claude/session/codexRollout.js.map +1 -1
  19. package/dist/claude/session/commands.d.ts +9 -1
  20. package/dist/claude/session/providerRuntimeFactory.js +19 -3
  21. package/dist/claude/session/providerRuntimeFactory.js.map +1 -1
  22. package/dist/claude/session/session.d.ts +5 -0
  23. package/dist/claude/session/session.js +58 -17
  24. package/dist/claude/session/session.js.map +1 -1
  25. package/dist/claude/toolMapper.js +1 -1
  26. package/dist/claude/toolMapper.js.map +1 -1
  27. package/dist/cli/args.d.ts +1 -0
  28. package/dist/cli/args.js +24 -1
  29. package/dist/cli/args.js.map +1 -1
  30. package/dist/cli/main.js +3 -1
  31. package/dist/cli/main.js.map +1 -1
  32. package/dist/codex/generated/ClientRequest.d.ts +117 -1
  33. package/dist/codex/generated/ImageGenerationFailure.d.ts +5 -0
  34. package/dist/codex/generated/ImageGenerationFailure.js +3 -0
  35. package/dist/codex/generated/ImageGenerationFailure.js.map +1 -0
  36. package/dist/codex/generated/ImageGenerationItem.d.ts +3 -0
  37. package/dist/codex/generated/InitializeCapabilities.d.ts +10 -1
  38. package/dist/codex/generated/PathUri.d.ts +4 -3
  39. package/dist/codex/generated/PlanType.d.ts +1 -1
  40. package/dist/codex/generated/ResponseItem.d.ts +1 -0
  41. package/dist/codex/generated/ResponseItemRuntimeSchema.js +2 -2
  42. package/dist/codex/generated/ResponseItemRuntimeSchema.js.map +1 -1
  43. package/dist/codex/generated/ReviewDecision.d.ts +1 -1
  44. package/dist/codex/generated/ServerNotification.d.ts +20 -0
  45. package/dist/codex/generated/ServerNotificationEnvelope.d.ts +20 -0
  46. package/dist/codex/generated/index.d.ts +1 -0
  47. package/dist/codex/generated/index.js.map +1 -1
  48. package/dist/codex/generated/v2/AccountLoginCompletedNotification.d.ts +2 -0
  49. package/dist/codex/generated/v2/AgentMessageDelivery.d.ts +1 -0
  50. package/dist/codex/generated/v2/AgentMessageDelivery.js +3 -0
  51. package/dist/codex/generated/v2/AgentMessageDelivery.js.map +1 -0
  52. package/dist/codex/generated/v2/AppsReadParams.d.ts +4 -0
  53. package/dist/codex/generated/v2/AutoReviewRequirements.d.ts +4 -0
  54. package/dist/codex/generated/v2/AutoReviewRequirements.js +3 -0
  55. package/dist/codex/generated/v2/AutoReviewRequirements.js.map +1 -0
  56. package/dist/codex/generated/v2/AwsCredentialType.d.ts +1 -0
  57. package/dist/codex/generated/v2/AwsCredentialType.js +3 -0
  58. package/dist/codex/generated/v2/AwsCredentialType.js.map +1 -0
  59. package/dist/codex/generated/v2/BedrockAwsProfile.d.ts +4 -0
  60. package/dist/codex/generated/v2/BedrockAwsProfile.js +3 -0
  61. package/dist/codex/generated/v2/BedrockAwsProfile.js.map +1 -0
  62. package/dist/codex/generated/v2/BedrockDiscoverParams.d.ts +1 -0
  63. package/dist/codex/generated/v2/BedrockDiscoverParams.js +3 -0
  64. package/dist/codex/generated/v2/BedrockDiscoverParams.js.map +1 -0
  65. package/dist/codex/generated/v2/BedrockDiscoverResponse.d.ts +6 -0
  66. package/dist/codex/generated/v2/BedrockDiscoverResponse.js +3 -0
  67. package/dist/codex/generated/v2/BedrockDiscoverResponse.js.map +1 -0
  68. package/dist/codex/generated/v2/BedrockEnvironmentCredential.d.ts +5 -0
  69. package/dist/codex/generated/v2/BedrockEnvironmentCredential.js +3 -0
  70. package/dist/codex/generated/v2/BedrockEnvironmentCredential.js.map +1 -0
  71. package/dist/codex/generated/v2/BedrockSetupParams.d.ts +16 -0
  72. package/dist/codex/generated/v2/BedrockSetupParams.js +3 -0
  73. package/dist/codex/generated/v2/BedrockSetupParams.js.map +1 -0
  74. package/dist/codex/generated/v2/BedrockSetupResponse.d.ts +1 -0
  75. package/dist/codex/generated/v2/BedrockSetupResponse.js +3 -0
  76. package/dist/codex/generated/v2/BedrockSetupResponse.js.map +1 -0
  77. package/dist/codex/generated/v2/CliAuthCredentialsStoreMode.d.ts +1 -0
  78. package/dist/codex/generated/v2/CliAuthCredentialsStoreMode.js +3 -0
  79. package/dist/codex/generated/v2/CliAuthCredentialsStoreMode.js.map +1 -0
  80. package/dist/codex/generated/v2/CodexErrorInfo.d.ts +1 -1
  81. package/dist/codex/generated/v2/CommandAction.d.ts +2 -2
  82. package/dist/codex/generated/v2/ConfigLayerSource.d.ts +6 -0
  83. package/dist/codex/generated/v2/ConfigRequirements.d.ts +5 -0
  84. package/dist/codex/generated/v2/ConfiguredHookHandler.d.ts +10 -0
  85. package/dist/codex/generated/v2/DesktopOnboardingEntrypoint.d.ts +1 -0
  86. package/dist/codex/generated/v2/DesktopOnboardingEntrypoint.js +3 -0
  87. package/dist/codex/generated/v2/DesktopOnboardingEntrypoint.js.map +1 -0
  88. package/dist/codex/generated/v2/ExternalAgentConfigDetectResponse.d.ts +2 -0
  89. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordParams.d.ts +2 -2
  90. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordSuccessParams.d.ts +11 -0
  91. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordSuccessParams.js +3 -0
  92. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordSuccessParams.js.map +1 -0
  93. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordTypeResultParams.d.ts +8 -0
  94. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordTypeResultParams.js +3 -0
  95. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordTypeResultParams.js.map +1 -0
  96. package/dist/codex/generated/v2/ExternalAgentConfigImportItemTypeSuccess.d.ts +4 -0
  97. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorCandidate.d.ts +6 -0
  98. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorCandidate.js +3 -0
  99. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorCandidate.js.map +1 -0
  100. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorSource.d.ts +1 -0
  101. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorSource.js +3 -0
  102. package/dist/codex/generated/v2/ExternalAgentDetectedConnectorSource.js.map +1 -0
  103. package/dist/codex/generated/v2/GetAccountTokenUsageParams.d.ts +6 -0
  104. package/dist/codex/generated/v2/GetAccountTokenUsageParams.js +3 -0
  105. package/dist/codex/generated/v2/GetAccountTokenUsageParams.js.map +1 -0
  106. package/dist/codex/generated/v2/GetAccountTokenUsageResponse.d.ts +5 -0
  107. package/dist/codex/generated/v2/HookHandlerType.d.ts +1 -1
  108. package/dist/codex/generated/v2/HookMetadata.d.ts +13 -4
  109. package/dist/codex/generated/v2/McpAuthStatus.d.ts +1 -1
  110. package/dist/codex/generated/v2/McpResourceReadParams.d.ts +5 -0
  111. package/dist/codex/generated/v2/McpResourceReadResponse.d.ts +4 -0
  112. package/dist/codex/generated/v2/McpServerOauthClientRegistration.d.ts +1 -0
  113. package/dist/codex/generated/v2/McpServerOauthClientRegistration.js +3 -0
  114. package/dist/codex/generated/v2/McpServerOauthClientRegistration.js.map +1 -0
  115. package/dist/codex/generated/v2/McpServerOauthLoginParams.d.ts +5 -0
  116. package/dist/codex/generated/v2/McpServerStatus.d.ts +1 -0
  117. package/dist/codex/generated/v2/Model.d.ts +6 -0
  118. package/dist/codex/generated/v2/ModelUpgradeInfo.d.ts +4 -0
  119. package/dist/codex/generated/v2/MultiAgentVersion.d.ts +4 -0
  120. package/dist/codex/generated/v2/MultiAgentVersion.js +3 -0
  121. package/dist/codex/generated/v2/MultiAgentVersion.js.map +1 -0
  122. package/dist/codex/generated/v2/PluginDisabledReason.d.ts +1 -0
  123. package/dist/codex/generated/v2/PluginDisabledReason.js +3 -0
  124. package/dist/codex/generated/v2/PluginDisabledReason.js.map +1 -0
  125. package/dist/codex/generated/v2/PluginInstallParams.d.ts +4 -0
  126. package/dist/codex/generated/v2/PluginSearchParams.d.ts +9 -0
  127. package/dist/codex/generated/v2/PluginSearchParams.js +3 -0
  128. package/dist/codex/generated/v2/PluginSearchParams.js.map +1 -0
  129. package/dist/codex/generated/v2/PluginSearchResponse.d.ts +5 -0
  130. package/dist/codex/generated/v2/PluginSearchResponse.js +3 -0
  131. package/dist/codex/generated/v2/PluginSearchResponse.js.map +1 -0
  132. package/dist/codex/generated/v2/PluginSearchResult.d.ts +7 -0
  133. package/dist/codex/generated/v2/PluginSearchResult.js +3 -0
  134. package/dist/codex/generated/v2/PluginSearchResult.js.map +1 -0
  135. package/dist/codex/generated/v2/PluginSearchScope.d.ts +1 -0
  136. package/dist/codex/generated/v2/PluginSearchScope.js +3 -0
  137. package/dist/codex/generated/v2/PluginSearchScope.js.map +1 -0
  138. package/dist/codex/generated/v2/PluginSummary.d.ts +13 -0
  139. package/dist/codex/generated/v2/Project.d.ts +12 -0
  140. package/dist/codex/generated/v2/Project.js +3 -0
  141. package/dist/codex/generated/v2/Project.js.map +1 -0
  142. package/dist/codex/generated/v2/ProjectChangeType.d.ts +1 -0
  143. package/dist/codex/generated/v2/ProjectChangeType.js +3 -0
  144. package/dist/codex/generated/v2/ProjectChangeType.js.map +1 -0
  145. package/dist/codex/generated/v2/ProjectChangedNotification.d.ts +5 -0
  146. package/dist/codex/generated/v2/ProjectChangedNotification.js +3 -0
  147. package/dist/codex/generated/v2/ProjectChangedNotification.js.map +1 -0
  148. package/dist/codex/generated/v2/ProjectCreateParams.d.ts +9 -0
  149. package/dist/codex/generated/v2/ProjectCreateParams.js +3 -0
  150. package/dist/codex/generated/v2/ProjectCreateParams.js.map +1 -0
  151. package/dist/codex/generated/v2/ProjectCreateResponse.d.ts +4 -0
  152. package/dist/codex/generated/v2/ProjectCreateResponse.js +3 -0
  153. package/dist/codex/generated/v2/ProjectCreateResponse.js.map +1 -0
  154. package/dist/codex/generated/v2/ProjectDeleteParams.d.ts +3 -0
  155. package/dist/codex/generated/v2/ProjectDeleteParams.js +3 -0
  156. package/dist/codex/generated/v2/ProjectDeleteParams.js.map +1 -0
  157. package/dist/codex/generated/v2/ProjectDeleteResponse.d.ts +1 -0
  158. package/dist/codex/generated/v2/ProjectDeleteResponse.js +3 -0
  159. package/dist/codex/generated/v2/ProjectDeleteResponse.js.map +1 -0
  160. package/dist/codex/generated/v2/ProjectImportParams.d.ts +10 -0
  161. package/dist/codex/generated/v2/ProjectImportParams.js +3 -0
  162. package/dist/codex/generated/v2/ProjectImportParams.js.map +1 -0
  163. package/dist/codex/generated/v2/ProjectImportResponse.d.ts +4 -0
  164. package/dist/codex/generated/v2/ProjectImportResponse.js +3 -0
  165. package/dist/codex/generated/v2/ProjectImportResponse.js.map +1 -0
  166. package/dist/codex/generated/v2/ProjectListParams.d.ts +4 -0
  167. package/dist/codex/generated/v2/ProjectListParams.js +3 -0
  168. package/dist/codex/generated/v2/ProjectListParams.js.map +1 -0
  169. package/dist/codex/generated/v2/ProjectListResponse.d.ts +5 -0
  170. package/dist/codex/generated/v2/ProjectListResponse.js +3 -0
  171. package/dist/codex/generated/v2/ProjectListResponse.js.map +1 -0
  172. package/dist/codex/generated/v2/ProjectMoveParams.d.ts +4 -0
  173. package/dist/codex/generated/v2/ProjectMoveParams.js +3 -0
  174. package/dist/codex/generated/v2/ProjectMoveParams.js.map +1 -0
  175. package/dist/codex/generated/v2/ProjectMoveResponse.d.ts +1 -0
  176. package/dist/codex/generated/v2/ProjectMoveResponse.js +3 -0
  177. package/dist/codex/generated/v2/ProjectMoveResponse.js.map +1 -0
  178. package/dist/codex/generated/v2/ProjectReadParams.d.ts +3 -0
  179. package/dist/codex/generated/v2/ProjectReadParams.js +3 -0
  180. package/dist/codex/generated/v2/ProjectReadParams.js.map +1 -0
  181. package/dist/codex/generated/v2/ProjectReadResponse.d.ts +4 -0
  182. package/dist/codex/generated/v2/ProjectReadResponse.js +3 -0
  183. package/dist/codex/generated/v2/ProjectReadResponse.js.map +1 -0
  184. package/dist/codex/generated/v2/ProjectRoot.d.ts +4 -0
  185. package/dist/codex/generated/v2/ProjectRoot.js +3 -0
  186. package/dist/codex/generated/v2/ProjectRoot.js.map +1 -0
  187. package/dist/codex/generated/v2/ProjectUpdateParams.d.ts +9 -0
  188. package/dist/codex/generated/v2/ProjectUpdateParams.js +3 -0
  189. package/dist/codex/generated/v2/ProjectUpdateParams.js.map +1 -0
  190. package/dist/codex/generated/v2/ProjectUpdateResponse.d.ts +4 -0
  191. package/dist/codex/generated/v2/ProjectUpdateResponse.js +3 -0
  192. package/dist/codex/generated/v2/ProjectUpdateResponse.js.map +1 -0
  193. package/dist/codex/generated/v2/QueuedSubmission.d.ts +6 -0
  194. package/dist/codex/generated/v2/QueuedSubmission.js +3 -0
  195. package/dist/codex/generated/v2/QueuedSubmission.js.map +1 -0
  196. package/dist/codex/generated/v2/ServerDiagnosticsGauge.d.ts +4 -0
  197. package/dist/codex/generated/v2/ServerDiagnosticsGauge.js +3 -0
  198. package/dist/codex/generated/v2/ServerDiagnosticsGauge.js.map +1 -0
  199. package/dist/codex/generated/v2/ServerDiagnosticsParams.d.ts +1 -0
  200. package/dist/codex/generated/v2/ServerDiagnosticsParams.js +3 -0
  201. package/dist/codex/generated/v2/ServerDiagnosticsParams.js.map +1 -0
  202. package/dist/codex/generated/v2/ServerDiagnosticsProcess.d.ts +5 -0
  203. package/dist/codex/generated/v2/ServerDiagnosticsProcess.js +3 -0
  204. package/dist/codex/generated/v2/ServerDiagnosticsProcess.js.map +1 -0
  205. package/dist/codex/generated/v2/ServerDiagnosticsResponse.d.ts +6 -0
  206. package/dist/codex/generated/v2/ServerDiagnosticsResponse.js +3 -0
  207. package/dist/codex/generated/v2/ServerDiagnosticsResponse.js.map +1 -0
  208. package/dist/codex/generated/v2/StrictReviewRequiredNotification.d.ts +8 -0
  209. package/dist/codex/generated/v2/StrictReviewRequiredNotification.js +3 -0
  210. package/dist/codex/generated/v2/StrictReviewRequiredNotification.js.map +1 -0
  211. package/dist/codex/generated/v2/Thread.d.ts +11 -2
  212. package/dist/codex/generated/v2/ThreadBackgroundTerminal.d.ts +2 -2
  213. package/dist/codex/generated/v2/ThreadItem.d.ts +3 -0
  214. package/dist/codex/generated/v2/ThreadListParams.d.ts +8 -2
  215. package/dist/codex/generated/v2/ThreadMetadataUpdateParams.d.ts +5 -4
  216. package/dist/codex/generated/v2/ThreadProjectUpdatedNotification.d.ts +4 -0
  217. package/dist/codex/generated/v2/ThreadProjectUpdatedNotification.js +3 -0
  218. package/dist/codex/generated/v2/ThreadProjectUpdatedNotification.js.map +1 -0
  219. package/dist/codex/generated/v2/ThreadQueueAddParams.d.ts +6 -0
  220. package/dist/codex/generated/v2/ThreadQueueAddParams.js +3 -0
  221. package/dist/codex/generated/v2/ThreadQueueAddParams.js.map +1 -0
  222. package/dist/codex/generated/v2/ThreadQueueAddResponse.d.ts +4 -0
  223. package/dist/codex/generated/v2/ThreadQueueAddResponse.js +3 -0
  224. package/dist/codex/generated/v2/ThreadQueueAddResponse.js.map +1 -0
  225. package/dist/codex/generated/v2/ThreadQueueChangedNotification.d.ts +3 -0
  226. package/dist/codex/generated/v2/ThreadQueueChangedNotification.js +3 -0
  227. package/dist/codex/generated/v2/ThreadQueueChangedNotification.js.map +1 -0
  228. package/dist/codex/generated/v2/ThreadQueueDeleteParams.d.ts +4 -0
  229. package/dist/codex/generated/v2/ThreadQueueDeleteParams.js +3 -0
  230. package/dist/codex/generated/v2/ThreadQueueDeleteParams.js.map +1 -0
  231. package/dist/codex/generated/v2/ThreadQueueDeleteResponse.d.ts +3 -0
  232. package/dist/codex/generated/v2/ThreadQueueDeleteResponse.js +3 -0
  233. package/dist/codex/generated/v2/ThreadQueueDeleteResponse.js.map +1 -0
  234. package/dist/codex/generated/v2/ThreadQueueListParams.d.ts +11 -0
  235. package/dist/codex/generated/v2/ThreadQueueListParams.js +3 -0
  236. package/dist/codex/generated/v2/ThreadQueueListParams.js.map +1 -0
  237. package/dist/codex/generated/v2/ThreadQueueListResponse.d.ts +8 -0
  238. package/dist/codex/generated/v2/ThreadQueueListResponse.js +3 -0
  239. package/dist/codex/generated/v2/ThreadQueueListResponse.js.map +1 -0
  240. package/dist/codex/generated/v2/ThreadQueueReorderParams.d.ts +4 -0
  241. package/dist/codex/generated/v2/ThreadQueueReorderParams.js +3 -0
  242. package/dist/codex/generated/v2/ThreadQueueReorderParams.js.map +1 -0
  243. package/dist/codex/generated/v2/ThreadQueueReorderResponse.d.ts +1 -0
  244. package/dist/codex/generated/v2/ThreadQueueReorderResponse.js +3 -0
  245. package/dist/codex/generated/v2/ThreadQueueReorderResponse.js.map +1 -0
  246. package/dist/codex/generated/v2/ThreadQueueStartParams.d.ts +4 -0
  247. package/dist/codex/generated/v2/ThreadQueueStartParams.js +3 -0
  248. package/dist/codex/generated/v2/ThreadQueueStartParams.js.map +1 -0
  249. package/dist/codex/generated/v2/ThreadQueueStartResponse.d.ts +4 -0
  250. package/dist/codex/generated/v2/ThreadQueueStartResponse.js +3 -0
  251. package/dist/codex/generated/v2/ThreadQueueStartResponse.js.map +1 -0
  252. package/dist/codex/generated/v2/ThreadQueueUpdateParams.d.ts +6 -0
  253. package/dist/codex/generated/v2/ThreadQueueUpdateParams.js +3 -0
  254. package/dist/codex/generated/v2/ThreadQueueUpdateParams.js.map +1 -0
  255. package/dist/codex/generated/v2/ThreadQueueUpdateResponse.d.ts +4 -0
  256. package/dist/codex/generated/v2/ThreadQueueUpdateResponse.js +3 -0
  257. package/dist/codex/generated/v2/ThreadQueueUpdateResponse.js.map +1 -0
  258. package/dist/codex/generated/v2/ThreadRealtimeStartParams.d.ts +13 -0
  259. package/dist/codex/generated/v2/ThreadResumeResponse.d.ts +4 -4
  260. package/dist/codex/generated/v2/ThreadRevertParams.d.ts +12 -0
  261. package/dist/codex/generated/v2/ThreadRevertParams.js +3 -0
  262. package/dist/codex/generated/v2/ThreadRevertParams.js.map +1 -0
  263. package/dist/codex/generated/v2/ThreadRevertResponse.d.ts +22 -0
  264. package/dist/codex/generated/v2/ThreadRevertResponse.js +3 -0
  265. package/dist/codex/generated/v2/ThreadRevertResponse.js.map +1 -0
  266. package/dist/codex/generated/v2/ThreadRevertedNotification.d.ts +3 -0
  267. package/dist/codex/generated/v2/ThreadRevertedNotification.js +3 -0
  268. package/dist/codex/generated/v2/ThreadRevertedNotification.js.map +1 -0
  269. package/dist/codex/generated/v2/ThreadSearchParams.d.ts +2 -2
  270. package/dist/codex/generated/v2/ThreadSearchSortKey.d.ts +1 -0
  271. package/dist/codex/generated/v2/ThreadSearchSortKey.js +3 -0
  272. package/dist/codex/generated/v2/ThreadSearchSortKey.js.map +1 -0
  273. package/dist/codex/generated/v2/ThreadSection.d.ts +18 -0
  274. package/dist/codex/generated/v2/ThreadSection.js +3 -0
  275. package/dist/codex/generated/v2/ThreadSection.js.map +1 -0
  276. package/dist/codex/generated/v2/ThreadSectionAppearance.d.ts +7 -0
  277. package/dist/codex/generated/v2/ThreadSectionAppearance.js +3 -0
  278. package/dist/codex/generated/v2/ThreadSectionAppearance.js.map +1 -0
  279. package/dist/codex/generated/v2/ThreadSectionCreateParams.d.ts +11 -0
  280. package/dist/codex/generated/v2/ThreadSectionCreateParams.js +3 -0
  281. package/dist/codex/generated/v2/ThreadSectionCreateParams.js.map +1 -0
  282. package/dist/codex/generated/v2/ThreadSectionCreateResponse.d.ts +7 -0
  283. package/dist/codex/generated/v2/ThreadSectionCreateResponse.js +3 -0
  284. package/dist/codex/generated/v2/ThreadSectionCreateResponse.js.map +1 -0
  285. package/dist/codex/generated/v2/ThreadSectionDeleteParams.d.ts +9 -0
  286. package/dist/codex/generated/v2/ThreadSectionDeleteParams.js +3 -0
  287. package/dist/codex/generated/v2/ThreadSectionDeleteParams.js.map +1 -0
  288. package/dist/codex/generated/v2/ThreadSectionDeleteResponse.d.ts +4 -0
  289. package/dist/codex/generated/v2/ThreadSectionDeleteResponse.js +3 -0
  290. package/dist/codex/generated/v2/ThreadSectionDeleteResponse.js.map +1 -0
  291. package/dist/codex/generated/v2/ThreadSectionListParams.d.ts +13 -0
  292. package/dist/codex/generated/v2/ThreadSectionListParams.js +3 -0
  293. package/dist/codex/generated/v2/ThreadSectionListParams.js.map +1 -0
  294. package/dist/codex/generated/v2/ThreadSectionListResponse.d.ts +11 -0
  295. package/dist/codex/generated/v2/ThreadSectionListResponse.js +3 -0
  296. package/dist/codex/generated/v2/ThreadSectionListResponse.js.map +1 -0
  297. package/dist/codex/generated/v2/ThreadSectionMoveParams.d.ts +17 -0
  298. package/dist/codex/generated/v2/ThreadSectionMoveParams.js +3 -0
  299. package/dist/codex/generated/v2/ThreadSectionMoveParams.js.map +1 -0
  300. package/dist/codex/generated/v2/ThreadSectionMoveResponse.d.ts +1 -0
  301. package/dist/codex/generated/v2/ThreadSectionMoveResponse.js +3 -0
  302. package/dist/codex/generated/v2/ThreadSectionMoveResponse.js.map +1 -0
  303. package/dist/codex/generated/v2/ThreadSectionUpdateParams.d.ts +18 -0
  304. package/dist/codex/generated/v2/ThreadSectionUpdateParams.js +3 -0
  305. package/dist/codex/generated/v2/ThreadSectionUpdateParams.js.map +1 -0
  306. package/dist/codex/generated/v2/ThreadSectionUpdateResponse.d.ts +7 -0
  307. package/dist/codex/generated/v2/ThreadSectionUpdateResponse.js +3 -0
  308. package/dist/codex/generated/v2/ThreadSectionUpdateResponse.js.map +1 -0
  309. package/dist/codex/generated/v2/ThreadSortKey.d.ts +1 -1
  310. package/dist/codex/generated/v2/ThreadStartParams.d.ts +5 -0
  311. package/dist/codex/generated/v2/ThreadUsage.d.ts +7 -0
  312. package/dist/codex/generated/v2/ThreadUsage.js +3 -0
  313. package/dist/codex/generated/v2/ThreadUsage.js.map +1 -0
  314. package/dist/codex/generated/v2/ThreadUsageBreakdownGroup.d.ts +11 -0
  315. package/dist/codex/generated/v2/ThreadUsageBreakdownGroup.js +3 -0
  316. package/dist/codex/generated/v2/ThreadUsageBreakdownGroup.js.map +1 -0
  317. package/dist/codex/generated/v2/ToolRequestUserInputParams.d.ts +4 -0
  318. package/dist/codex/generated/v2/index.d.ts +79 -0
  319. package/dist/daemon/probe.js +1 -1
  320. package/dist/desktop/launchConfig.d.ts +1 -0
  321. package/dist/desktop/launchConfig.js +71 -0
  322. package/dist/desktop/launchConfig.js.map +1 -0
  323. package/dist/desktop/stdioFrontend.d.ts +1 -0
  324. package/dist/desktop/stdioFrontend.js +6 -2
  325. package/dist/desktop/stdioFrontend.js.map +1 -1
  326. package/dist/gateway/clientConnection.js +63 -36
  327. package/dist/gateway/clientConnection.js.map +1 -1
  328. package/dist/gateway/stockRpc.d.ts +2 -0
  329. package/dist/gateway/stockRpc.js +13 -0
  330. package/dist/gateway/stockRpc.js.map +1 -1
  331. package/dist/gateway/threadList.js +7 -2
  332. package/dist/gateway/threadList.js.map +1 -1
  333. package/dist/gateway/transientNotice.js +3 -1
  334. package/dist/gateway/transientNotice.js.map +1 -1
  335. package/dist/handoff/lineageStore.d.ts +2 -8
  336. package/dist/handoff/lineageStore.js +2 -8
  337. package/dist/handoff/lineageStore.js.map +1 -1
  338. package/dist/handoff/providerEpochs.js +4 -5
  339. package/dist/handoff/providerEpochs.js.map +1 -1
  340. package/dist/handoff/service.d.ts +6 -1
  341. package/dist/handoff/service.js +42 -28
  342. package/dist/handoff/service.js.map +1 -1
  343. package/dist/protocol/appContext.d.ts +1 -0
  344. package/dist/protocol/appContext.js +5 -0
  345. package/dist/protocol/appContext.js.map +1 -0
  346. package/dist/runtime/dependencies.js +1 -1
  347. package/dist/store/sqliteStore.js +18 -1
  348. package/dist/store/sqliteStore.js.map +1 -1
  349. package/dist/store/threadFilter.js +11 -2
  350. package/dist/store/threadFilter.js.map +1 -1
  351. package/legal/THIRD_PARTY_NOTICES.md +234 -240
  352. package/package.json +6 -6
  353. package/skills/workforce/SKILL.md +51 -24
@@ -14,16 +14,17 @@ import { SdkTranscriptBrancher, } from "./transcriptBrancher.js";
14
14
  import { ClaudeRateLimitCoordinator, } from "./rateLimits.js";
15
15
  import { isClaudeStatusCommand } from "./statusCommand.js";
16
16
  import { systemNoticeText } from "../gateway/transientNotice.js";
17
- import { claudeCatalogId, normalizeClaudeModelIdentifier, normalizeClaudeServiceTier, resolveClaudeModel, } from "./modelSelection.js";
17
+ import { claudeCatalogId, normalizeClaudeModelIdentifier, normalizeClaudeServiceTier, pickClaudeModelReplacement, resolveClaudeModel, } from "./modelSelection.js";
18
18
  import { ClaudeOutputAdapter } from "./session/outputAdapter.js";
19
19
  import { branchRevision, ClaudeSessionRepository } from "./session/repository.js";
20
- import { ClaudeSession } from "./session/session.js";
20
+ import { ActiveClaudeTurnError, ClaudeSession } from "./session/session.js";
21
21
  import { ShellRunner } from "./session/shellRunner.js";
22
22
  import { ClaudeSessionRegistry } from "./sessionRegistry.js";
23
23
  import { validateResponseItems } from "./responseItemValidation.js";
24
24
  import { providerUnavailableMessage, } from "../runtime/providerAvailability.js";
25
25
  import { isCCodexStateCommand, stateModelName, } from "../state/stateCommand.js";
26
26
  import { syncedCollaborationMode, threadSettings } from "./threadSettings.js";
27
+ import { claudeDeveloperInstructions } from "./developerInstructions.js";
27
28
  function recordValue(value) {
28
29
  return value && typeof value === "object" ? value : undefined;
29
30
  }
@@ -158,7 +159,9 @@ function threadResponse(record, includeTurns) {
158
159
  ...settings,
159
160
  thread: {
160
161
  ...record.thread,
161
- isPinned: record.thread.isPinned ?? false,
162
+ section: record.thread.section ?? null,
163
+ sectionEnteredAt: record.thread.sectionEnteredAt ?? null,
164
+ projectId: record.thread.projectId ?? null,
162
165
  canAcceptDirectInput: record.thread.parentThreadId ? false : true,
163
166
  turns: includeTurns ? record.thread.turns : [],
164
167
  },
@@ -302,10 +305,12 @@ export class ClaudeService {
302
305
  interactiveQuestions: this.config.features?.interactiveQuestions ?? true,
303
306
  resolveChildModel: (model) => {
304
307
  const value = normalizeClaudeModelIdentifier(model);
305
- const modelPickerId = this.modelCatalog?.cachedPickerId?.(value)
306
- ?? (value.startsWith(this.config.modelPrefix) ? value : `${this.config.modelPrefix}${value}`);
308
+ const modelPickerId = value.startsWith(this.config.modelPrefix) ? value : `${this.config.modelPrefix}${value}`;
307
309
  const claudeModelValue = resolveClaudeModel(this.config, modelPickerId);
308
- return claudeModelValue ? { modelPickerId, claudeModelValue } : undefined;
310
+ if (!claudeModelValue)
311
+ return undefined;
312
+ const lookup = this.cachedCatalogLookup(claudeModelValue);
313
+ return lookup ? this.catalogSelection(modelPickerId, claudeModelValue, lookup) : { modelPickerId, claudeModelValue };
309
314
  },
310
315
  }));
311
316
  const records = this.store.allThreadRecords();
@@ -417,11 +422,47 @@ export class ClaudeService {
417
422
  return threadSettings(this.withCatalogModel(this.requireRecord(threadId, false)));
418
423
  }
419
424
  withCatalogModel(record) {
420
- const modelPickerId = this.modelCatalog?.cachedPickerId?.(record.resolvedModel ?? record.claudeModelValue);
421
- if (!modelPickerId || modelPickerId === record.modelPickerId)
425
+ const lookup = this.cachedCatalogLookup(record.resolvedModel ?? record.claudeModelValue);
426
+ if (!lookup)
422
427
  return record;
423
- const claudeModelValue = resolveClaudeModel(this.config, modelPickerId);
424
- return claudeModelValue ? { ...record, modelPickerId, claudeModelValue } : record;
428
+ const selection = this.catalogSelection(record.modelPickerId, record.claudeModelValue, lookup);
429
+ return selection.modelPickerId === record.modelPickerId ? record : { ...record, ...selection };
430
+ }
431
+ /** Finds the catalog entry for a Claude model value, migrating retired ids onto the closest current model. */
432
+ catalogLookup(models, claudeModelValue) {
433
+ const catalog = this.modelCatalog;
434
+ const cached = catalog.cachedPickerId?.(claudeModelValue);
435
+ if (cached)
436
+ return { id: cached, model: models.find((candidate) => candidate.id === cached), reason: "exact" };
437
+ const prefix = this.config.modelPrefix;
438
+ const strip = (id) => id.slice(prefix.length);
439
+ const defaultId = catalog.defaultModelId?.();
440
+ const replacement = pickClaudeModelReplacement(claudeModelValue, models.map((candidate) => strip(candidate.id)), defaultId && strip(defaultId));
441
+ const model = replacement && models.find((candidate) => strip(candidate.id) === replacement.value);
442
+ return model ? { id: model.id, model, reason: replacement.reason } : undefined;
443
+ }
444
+ cachedCatalogLookup(claudeModelValue) {
445
+ return this.modelCatalog && this.catalogLookup(this.modelCatalog.cachedModels?.() ?? [], claudeModelValue);
446
+ }
447
+ catalogSelection(modelPickerId, claudeModelValue, lookup) {
448
+ const prefix = this.config.modelPrefix;
449
+ if (lookup.id === `${prefix}${claudeModelValue}` || lookup.id === claudeCatalogId(this.config, modelPickerId))
450
+ return { modelPickerId, claudeModelValue };
451
+ this.logger.warn("claude.model.migrated", { from: modelPickerId, to: lookup.id, reason: lookup.reason });
452
+ return { modelPickerId: lookup.id, claudeModelValue: lookup.id.slice(prefix.length) };
453
+ }
454
+ /** Persists a catalog migration for a stored thread so its runtime starts on a model the account still has. */
455
+ async migrateStoredModel(threadId) {
456
+ if (!this.modelCatalog)
457
+ return;
458
+ const record = this.requireRecord(threadId, false);
459
+ const models = await this.modelCatalog.list().catch(() => undefined);
460
+ const lookup = models && this.catalogLookup(models, record.claudeModelValue);
461
+ if (!lookup)
462
+ return;
463
+ const selection = this.catalogSelection(record.modelPickerId, record.claudeModelValue, lookup);
464
+ if (selection.modelPickerId !== record.modelPickerId)
465
+ await this.applySettings({ threadId, model: selection.modelPickerId });
425
466
  }
426
467
  sideSnapshot(sourceThreadId, targetThreadId, visibleForkedFromId) {
427
468
  const record = this.requireRecord(sourceThreadId, false);
@@ -530,6 +571,7 @@ export class ClaudeService {
530
571
  : {}),
531
572
  });
532
573
  }
574
+ await this.migrateStoredModel(threadId);
533
575
  await (await this.sessions.getOrCreate(threadId)).materializeRuntime();
534
576
  record = await this.sessions.submit(threadId, { type: "readThread", includeTurns: true });
535
577
  record = this.withCatalogModel(record);
@@ -629,6 +671,39 @@ export class ClaudeService {
629
671
  throw error;
630
672
  }
631
673
  }
674
+ async prepareAppTurn(params) {
675
+ try {
676
+ return await this.prepareTurn(params);
677
+ }
678
+ catch (error) {
679
+ if (!(error instanceof ActiveClaudeTurnError))
680
+ throw error;
681
+ const { turnId } = await this.steerTurn({
682
+ threadId: params.threadId,
683
+ input: params.input,
684
+ expectedTurnId: error.turnId,
685
+ ...(params.clientUserMessageId === undefined
686
+ ? {}
687
+ : { clientUserMessageId: params.clientUserMessageId }),
688
+ ...(params.responsesapiClientMetadata === undefined
689
+ ? {}
690
+ : { responsesapiClientMetadata: params.responsesapiClientMetadata }),
691
+ ...(params.additionalContext === undefined
692
+ ? {}
693
+ : { additionalContext: params.additionalContext }),
694
+ });
695
+ const turn = this.requireRecord(params.threadId, true).thread.turns
696
+ .find((candidate) => candidate.id === turnId);
697
+ if (!turn)
698
+ throw new Error(`Active Claude turn '${turnId}' disappeared after steering.`);
699
+ return {
700
+ response: { turn },
701
+ announce: () => Promise.resolve(),
702
+ start: () => undefined,
703
+ startAndWait: () => Promise.resolve(),
704
+ };
705
+ }
706
+ }
632
707
  async prepareStatusTurn(params, render) {
633
708
  this.requireIndependentThread(params.threadId, "start a status turn in");
634
709
  if (!isClaudeStatusCommand(params.input))
@@ -933,9 +1008,20 @@ export class ClaudeService {
933
1008
  }
934
1009
  updateThreadMetadata(params) {
935
1010
  this.requireIndependentThread(params.threadId, "update metadata for");
1011
+ if (params.projectId !== undefined && params.projectId !== null && params.projectId !== "") {
1012
+ throw invalidParams("Projects are not supported for Claude threads.");
1013
+ }
936
1014
  return this.sessions.submit(params.threadId, {
937
1015
  type: "threadAdmin",
938
- command: { kind: "metadata", gitInfo: params.gitInfo, isPinned: params.isPinned },
1016
+ command: { kind: "metadata", gitInfo: params.gitInfo },
1017
+ });
1018
+ }
1019
+ /** Section registry stays stock-owned; CCodex records only the membership. */
1020
+ setThreadSection(threadId, section) {
1021
+ this.requireIndependentThread(threadId, "move into a section");
1022
+ return this.sessions.submit(threadId, {
1023
+ type: "threadAdmin",
1024
+ command: { kind: "metadata", gitInfo: undefined, section },
939
1025
  });
940
1026
  }
941
1027
  async archiveThread(threadId) {
@@ -1115,9 +1201,8 @@ export class ClaudeService {
1115
1201
  if (sourceRecord.thread.ephemeral && !sidePromotion) {
1116
1202
  throw invalidParams("Forking this ephemeral Claude source thread is not supported.");
1117
1203
  }
1118
- const modelPickerId = params.model ?? sourceRecord.modelPickerId;
1119
- const claudeModelValue = resolveClaudeModel(this.config, modelPickerId);
1120
- if (!claudeModelValue)
1204
+ const requestedModel = params.model ?? sourceRecord.modelPickerId;
1205
+ if (!resolveClaudeModel(this.config, requestedModel))
1121
1206
  throw invalidParams("Cannot fork a Claude thread to a Codex model.");
1122
1207
  const activeSideFork = Boolean(params.ephemeral === true && params.excludeTurns === true
1123
1208
  && params.threadSource === "user" && !params.lastTurnId && !params.beforeTurnId);
@@ -1161,8 +1246,10 @@ export class ClaudeService {
1161
1246
  const sourceBoundaries = source.boundaries.filter((entry) => stableSelectedIds.has(entry.turnId));
1162
1247
  const revisionTurns = sourceTurns.filter((turn) => stableSelectedIds.has(turn.id));
1163
1248
  const revision = branchRevision(sourceRecord, sourceBoundaries, revisionTurns);
1164
- const serviceTier = normalizeClaudeServiceTier(this.config, modelPickerId, params.serviceTier === undefined ? sourceRecord.serviceTier : params.serviceTier);
1165
- await this.validateModelSettings(modelPickerId, sourceRecord.reasoningEffort, serviceTier);
1249
+ const requestedServiceTier = normalizeClaudeServiceTier(this.config, requestedModel, params.serviceTier === undefined ? sourceRecord.serviceTier : params.serviceTier);
1250
+ const { modelPickerId, claudeModelValue, reasoningEffort, serviceTier } = await this.resolveModelSettings(requestedModel, sourceRecord.reasoningEffort, requestedServiceTier);
1251
+ if (serviceTier !== requestedServiceTier)
1252
+ throw invalidParams(`Claude model '${requestedModel}' does not support the fast service tier.`);
1166
1253
  const boundary = selectedBoundary?.messageUuid ?? sourceBoundaries.at(-1)?.messageUuid;
1167
1254
  const branch = boundary
1168
1255
  ? await this.transcripts.forkWithProvenance(sourceRecord.claudeSessionId, boundary, sourceRecord.thread.cwd, sourceBoundaries.map((entry) => entry.messageUuid), boundaryCorrelations(this.store, sourceRecord, sourceBoundaries))
@@ -1186,7 +1273,8 @@ export class ClaudeService {
1186
1273
  });
1187
1274
  const threadId = uuidv7();
1188
1275
  const thread = {
1189
- ...sourceRecord.thread, id: threadId, ephemeral: params.ephemeral ?? false, isPinned: false,
1276
+ ...sourceRecord.thread, id: threadId, ephemeral: params.ephemeral ?? false,
1277
+ section: null, sectionEnteredAt: null, projectId: null,
1190
1278
  sessionId: threadId, forkedFromId: visibleForkedFromId,
1191
1279
  cwd, modelProvider: "claude", createdAt, updatedAt: createdAt, recencyAt: createdAt,
1192
1280
  status: params.ephemeral ? { type: "idle" } : { type: "notLoaded" },
@@ -1199,7 +1287,7 @@ export class ClaudeService {
1199
1287
  const copiedTurns = sourceTurns.map((turn) => forkProjection(turn, thread.id));
1200
1288
  const record = {
1201
1289
  ...sourceRecord, thread, runtimeWorkspaceRoots,
1202
- claudeSessionId: branch.sessionId, modelPickerId, claudeModelValue, serviceTier,
1290
+ claudeSessionId: branch.sessionId, modelPickerId, claudeModelValue, serviceTier, reasoningEffort,
1203
1291
  approvalPolicy: params.approvalPolicy ?? sourceRecord.approvalPolicy,
1204
1292
  approvalsReviewer: approvalsReviewer(params.approvalsReviewer, sourceRecord.approvalsReviewer),
1205
1293
  sandboxPolicy: params.permissions
@@ -1208,8 +1296,8 @@ export class ClaudeService {
1208
1296
  ? sandboxPolicy(params.sandbox, cwd, runtimeWorkspaceRoots)
1209
1297
  : inheritedSandboxPolicy(sourceRecord.sandboxPolicy, cwd, runtimeWorkspaceRoots),
1210
1298
  baseInstructions: params.baseInstructions === undefined ? sourceRecord.baseInstructions : params.baseInstructions,
1211
- developerInstructions: params.developerInstructions === undefined
1212
- ? sourceRecord.developerInstructions : params.developerInstructions,
1299
+ developerInstructions: claudeDeveloperInstructions(params.developerInstructions === undefined
1300
+ ? sourceRecord.developerInstructions : params.developerInstructions),
1213
1301
  lastClaudeMessageUuid: null, lastCompletedTurnId: null,
1214
1302
  };
1215
1303
  let responseRecord;
@@ -1247,21 +1335,42 @@ export class ClaudeService {
1247
1335
  return threadResponse(responseRecord, !params.excludeTurns);
1248
1336
  }
1249
1337
  async rollbackThread(params) {
1250
- this.requireIndependentThread(params.threadId, "roll back");
1251
- const source = await this.sessions.submit(params.threadId, { type: "snapshotBranch" });
1252
- const sourceRecord = source.record;
1253
- if (sourceRecord.thread.ephemeral)
1254
- throw invalidParams("Rolling back an ephemeral Claude thread is not supported.");
1338
+ const source = await this.truncationSource(params.threadId, "roll back");
1255
1339
  if (!Number.isInteger(params.numTurns) || params.numTurns < 1)
1256
1340
  throw invalidParams("numTurns must be at least 1.");
1257
- if (params.numTurns > sourceRecord.thread.turns.length)
1341
+ if (params.numTurns > source.record.thread.turns.length)
1258
1342
  throw invalidParams("Cannot remove more turns than the Claude thread contains.");
1259
- const sourceSession = await this.sessions.getOrCreate(params.threadId);
1260
- if ((await sourceSession.runtimeInspection())?.quiescent === false)
1261
- throw invalidParams("Cannot roll back a Claude thread with an active turn.");
1262
- const keepCount = sourceRecord.thread.turns.length - params.numTurns;
1263
- const retained = sourceRecord.thread.turns.slice(0, keepCount);
1264
- const retainedIds = new Set(retained.map((turn) => turn.id));
1343
+ const committed = await this.truncateThread(source, source.record.thread.turns.length - params.numTurns);
1344
+ return { thread: committed.thread };
1345
+ }
1346
+ /** `thread/revert`: drops `beforeTurnId` and every later turn; the App hydrates retained history via the cursors. */
1347
+ async revertThread(params) {
1348
+ const source = await this.truncationSource(params.threadId, "revert");
1349
+ const keepCount = source.record.thread.turns.findIndex((turn) => turn.id === params.beforeTurnId);
1350
+ if (keepCount === -1)
1351
+ throw invalidParams(`Unknown Claude turn '${params.beforeTurnId}'.`);
1352
+ const retained = (await this.truncateThread(source, keepCount)).thread;
1353
+ return {
1354
+ thread: { ...retained, turns: [] },
1355
+ turnsBackwardsCursor: retained.turns.length ? turnCursor(retained.turns.at(-1).id, true) : null,
1356
+ itemsBackwardsCursor: retained.turns.some((turn) => turn.items.length) ? "hyb-item:0" : null,
1357
+ };
1358
+ }
1359
+ async truncationSource(threadId, verb) {
1360
+ this.requireIndependentThread(threadId, verb);
1361
+ const snapshot = await this.sessions.submit(threadId, { type: "snapshotBranch" });
1362
+ if (snapshot.record.thread.ephemeral)
1363
+ throw invalidParams(`Cannot ${verb} an ephemeral Claude thread.`);
1364
+ const session = await this.sessions.getOrCreate(threadId);
1365
+ if ((await session.runtimeInspection())?.quiescent === false)
1366
+ throw invalidParams(`Cannot ${verb} a Claude thread with an active turn.`);
1367
+ return { ...snapshot, session };
1368
+ }
1369
+ /** Keeps the first `keepCount` turns by forking the transcript at the last retained provider boundary. */
1370
+ async truncateThread(source, keepCount) {
1371
+ const sourceRecord = source.record;
1372
+ const threadId = sourceRecord.thread.id;
1373
+ const retainedIds = new Set(sourceRecord.thread.turns.slice(0, keepCount).map((turn) => turn.id));
1265
1374
  const sourceBoundaries = source.boundaries.filter((entry) => retainedIds.has(entry.turnId));
1266
1375
  const boundary = sourceBoundaries.at(-1)?.messageUuid;
1267
1376
  const branch = boundary
@@ -1269,7 +1378,7 @@ export class ClaudeService {
1269
1378
  : { sessionId: uuidv7(), uuidMap: new Map() };
1270
1379
  let committed;
1271
1380
  try {
1272
- committed = await this.sessions.submit(params.threadId, {
1381
+ committed = await this.sessions.submit(threadId, {
1273
1382
  type: "commitRollback", expectedRevision: source.revision, replacementSessionId: branch.sessionId,
1274
1383
  keepCount, sourceBoundaries, uuidMap: [...branch.uuidMap],
1275
1384
  });
@@ -1278,13 +1387,13 @@ export class ClaudeService {
1278
1387
  await this.transcripts.delete(branch.sessionId, sourceRecord.thread.cwd).catch(() => undefined);
1279
1388
  throw error;
1280
1389
  }
1281
- if (sourceSession.isLoaded) {
1282
- await sourceSession.retireRuntimeSilently().catch((error) => {
1283
- this.logger.warn("claude.rollback.old-runtime-retire-failed", { threadId: params.threadId, error: String(error) });
1390
+ if (source.session.isLoaded) {
1391
+ await source.session.retireRuntimeSilently().catch((error) => {
1392
+ this.logger.warn("claude.rollback.old-runtime-retire-failed", { threadId, error: String(error) });
1284
1393
  });
1285
1394
  }
1286
- await this.transcripts.delete(sourceRecord.claudeSessionId, sourceRecord.thread.cwd).catch((error) => this.logger.warn("claude.rollback.old-session-delete-failed", { threadId: params.threadId, error: String(error) }));
1287
- return { thread: committed.thread };
1395
+ await this.transcripts.delete(sourceRecord.claudeSessionId, sourceRecord.thread.cwd).catch((error) => this.logger.warn("claude.rollback.old-session-delete-failed", { threadId, error: String(error) }));
1396
+ return committed;
1288
1397
  }
1289
1398
  prepareGoalSet(params) {
1290
1399
  this.requireIndependentThread(params.threadId, "set a goal on");
@@ -1603,7 +1712,9 @@ export class ClaudeService {
1603
1712
  if (!native)
1604
1713
  return {
1605
1714
  ...record.thread,
1606
- isPinned: record.thread.isPinned ?? false,
1715
+ section: record.thread.section ?? null,
1716
+ sectionEnteredAt: record.thread.sectionEnteredAt ?? null,
1717
+ projectId: record.thread.projectId ?? null,
1607
1718
  canAcceptDirectInput: record.thread.parentThreadId ? false : true,
1608
1719
  };
1609
1720
  const createdAt = native.createdAt === undefined
@@ -1612,7 +1723,9 @@ export class ClaudeService {
1612
1723
  const updatedAt = Math.floor(native.lastModified / 1_000);
1613
1724
  return {
1614
1725
  ...record.thread,
1615
- isPinned: record.thread.isPinned ?? false,
1726
+ section: record.thread.section ?? null,
1727
+ sectionEnteredAt: record.thread.sectionEnteredAt ?? null,
1728
+ projectId: record.thread.projectId ?? null,
1616
1729
  canAcceptDirectInput: record.thread.parentThreadId ? false : true,
1617
1730
  name: record.thread.name || native.customTitle || native.summary,
1618
1731
  preview: native.firstPrompt ?? record.thread.preview,
@@ -1670,17 +1783,15 @@ export class ClaudeService {
1670
1783
  return undefined;
1671
1784
  }
1672
1785
  async newThreadRecord(params, settings) {
1673
- const modelPickerId = params.model;
1674
- const claudeModelValue = modelPickerId && resolveClaudeModel(this.config, modelPickerId);
1675
- if (!modelPickerId || !claudeModelValue)
1786
+ const requestedModel = params.model;
1787
+ if (!requestedModel || !resolveClaudeModel(this.config, requestedModel))
1676
1788
  throw invalidParams("Claude thread requires a configured Claude model or alias.");
1677
1789
  if (params.permissions && params.sandbox)
1678
1790
  throw invalidParams("Claude thread start cannot combine permissions with sandbox.");
1679
- const requestedServiceTier = normalizeClaudeServiceTier(this.config, modelPickerId, params.serviceTier);
1791
+ const requestedServiceTier = normalizeClaudeServiceTier(this.config, requestedModel, params.serviceTier);
1680
1792
  if (requestedServiceTier !== null && requestedServiceTier !== "default" && requestedServiceTier !== "fast")
1681
1793
  throw invalidParams(`Unsupported Claude service tier '${requestedServiceTier}'.`);
1682
- const reasoningEffort = settings?.effort ?? null;
1683
- const serviceTier = await this.validatedServiceTier(modelPickerId, reasoningEffort, requestedServiceTier);
1794
+ const { modelPickerId, claudeModelValue, reasoningEffort, serviceTier } = await this.resolveModelSettings(requestedModel, settings?.effort ?? null, requestedServiceTier);
1684
1795
  const createdAt = nowSeconds();
1685
1796
  const workspace = workspaceSelection(params);
1686
1797
  const { cwd, runtimeWorkspaceRoots } = workspace;
@@ -1693,7 +1804,9 @@ export class ClaudeService {
1693
1804
  parentThreadId: null,
1694
1805
  preview: "",
1695
1806
  ephemeral: params.ephemeral ?? false,
1696
- isPinned: false,
1807
+ section: null,
1808
+ sectionEnteredAt: null,
1809
+ projectId: null,
1697
1810
  historyMode: params.historyMode ?? "legacy",
1698
1811
  modelProvider: "claude",
1699
1812
  createdAt,
@@ -1723,7 +1836,7 @@ export class ClaudeService {
1723
1836
  ? permissionProfileSandboxPolicy(params.permissions, cwd, runtimeWorkspaceRoots)
1724
1837
  : sandboxPolicy(params.sandbox, cwd, runtimeWorkspaceRoots),
1725
1838
  baseInstructions: params.baseInstructions ?? null,
1726
- developerInstructions: params.developerInstructions ?? null,
1839
+ developerInstructions: claudeDeveloperInstructions(params.developerInstructions),
1727
1840
  personality: settings?.personality ?? params.personality ?? null,
1728
1841
  resolvedModel: null,
1729
1842
  lastClaudeMessageUuid: null,
@@ -1769,11 +1882,10 @@ export class ClaudeService {
1769
1882
  const session = await this.sessions.getOrCreate(params.threadId);
1770
1883
  for (;;) {
1771
1884
  const before = await this.sessions.submit(params.threadId, { type: "readThread", includeTurns: false });
1772
- const modelPickerId = params.model ?? before.modelPickerId;
1773
- const claudeModelValue = resolveClaudeModel(this.config, modelPickerId);
1774
- if (!claudeModelValue)
1885
+ const requestedModel = params.model ?? before.modelPickerId;
1886
+ if (!resolveClaudeModel(this.config, requestedModel))
1775
1887
  throw invalidParams("Cannot switch a Claude thread to a Codex model.");
1776
- const requestedServiceTier = normalizeClaudeServiceTier(this.config, modelPickerId, params.serviceTier === undefined ? before.serviceTier : params.serviceTier);
1888
+ const requestedServiceTier = normalizeClaudeServiceTier(this.config, requestedModel, params.serviceTier === undefined ? before.serviceTier : params.serviceTier);
1777
1889
  if (requestedServiceTier !== null && requestedServiceTier !== "default" && requestedServiceTier !== "fast")
1778
1890
  throw invalidParams(`Unsupported Claude service tier '${requestedServiceTier}'.`);
1779
1891
  const { cwd, runtimeWorkspaceRoots } = workspaceSelection(params, {
@@ -1783,8 +1895,7 @@ export class ClaudeService {
1783
1895
  const workspaceChanged = cwd !== before.thread.cwd
1784
1896
  || runtimeWorkspaceRoots.length !== storedWorkspaceRoots(before).length
1785
1897
  || runtimeWorkspaceRoots.some((root, index) => root !== storedWorkspaceRoots(before)[index]);
1786
- const reasoningEffort = params.effort === undefined ? before.reasoningEffort : params.effort;
1787
- const serviceTier = await this.validatedServiceTier(modelPickerId, reasoningEffort, requestedServiceTier);
1898
+ const { modelPickerId, claudeModelValue, reasoningEffort, serviceTier } = await this.resolveModelSettings(requestedModel, params.effort === undefined ? before.reasoningEffort : params.effort, requestedServiceTier, params.effort !== undefined);
1788
1899
  syncCanonicalSettings = requestedServiceTier === "fast" && serviceTier !== "fast";
1789
1900
  const collaborationMode = params.collaborationMode === undefined
1790
1901
  ? before.collaborationMode
@@ -1839,24 +1950,30 @@ export class ClaudeService {
1839
1950
  }
1840
1951
  }
1841
1952
  }
1842
- async validatedServiceTier(modelId, effort, serviceTier) {
1953
+ /**
1954
+ * Resolves requested model settings against the account catalog. A model id the catalog no longer
1955
+ * lists is migrated onto its closest current entry instead of failing the request, and an effort the
1956
+ * target model does not support is coerced to that model's default unless it was requested explicitly.
1957
+ */
1958
+ async resolveModelSettings(modelPickerId, effort, serviceTier, explicitEffort = false) {
1959
+ const claudeModelValue = resolveClaudeModel(this.config, modelPickerId);
1843
1960
  if (!this.modelCatalog)
1844
- return serviceTier;
1845
- const catalogId = claudeCatalogId(this.config, modelId);
1846
- const model = (await this.modelCatalog.list()).find((candidate) => candidate.id === catalogId);
1847
- if (!model)
1848
- throw invalidParams(`Claude model '${modelId}' is not present in the current account catalog.`);
1849
- if (effort && !model.supportedReasoningEfforts.some((level) => level.reasoningEffort === effort)) {
1850
- throw invalidParams(`Claude model '${modelId}' does not support effort '${effort}'.`);
1851
- }
1852
- return serviceTier === "fast" && !model.serviceTiers.some((tier) => tier.id === "fast")
1853
- ? null
1854
- : serviceTier;
1855
- }
1856
- async validateModelSettings(modelId, effort, serviceTier) {
1857
- if (await this.validatedServiceTier(modelId, effort, serviceTier) !== serviceTier) {
1858
- throw invalidParams(`Claude model '${modelId}' does not support the fast service tier.`);
1859
- }
1961
+ return { modelPickerId, claudeModelValue, reasoningEffort: effort, serviceTier };
1962
+ const lookup = this.catalogLookup(await this.modelCatalog.list(), claudeModelValue);
1963
+ const model = lookup?.model;
1964
+ if (!lookup || !model)
1965
+ throw invalidParams(`Claude model '${modelPickerId}' is not present in the current account catalog.`);
1966
+ const selection = this.catalogSelection(modelPickerId, claudeModelValue, lookup);
1967
+ const effortSupported = !effort || model.supportedReasoningEfforts.some((level) => level.reasoningEffort === effort);
1968
+ if (!effortSupported && explicitEffort && selection.modelPickerId === modelPickerId)
1969
+ throw invalidParams(`Claude model '${modelPickerId}' does not support effort '${effort}'.`);
1970
+ if (!effortSupported)
1971
+ this.logger.warn("claude.effort.coerced", { model: model.id, from: effort, to: model.defaultReasoningEffort });
1972
+ return {
1973
+ ...selection,
1974
+ reasoningEffort: effortSupported ? effort : model.supportedReasoningEfforts.length ? model.defaultReasoningEffort : null,
1975
+ serviceTier: serviceTier === "fast" && !model.serviceTiers.some((tier) => tier.id === "fast") ? null : serviceTier,
1976
+ };
1860
1977
  }
1861
1978
  async readStandaloneRateLimitStatus() {
1862
1979
  const abort = new AbortController();