clay-server 5.2.0-beta.1 → 5.2.0-beta.11

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 (608) hide show
  1. package/README.md +0 -4
  2. package/lib/account-auth-socket.js +1 -0
  3. package/lib/builtin-mates.js +19 -16
  4. package/lib/bundled-skills/clay-agent-browser/SKILL.md +6 -2
  5. package/lib/canonical-clay-record-authority.js +15 -0
  6. package/lib/canonical-clay-scheduling-authority.js +19 -0
  7. package/lib/claude-hook-installer.js +1 -239
  8. package/lib/claude-jsonl-watcher.js +1 -204
  9. package/lib/clay-control-presentation-binding.js +96 -0
  10. package/lib/clay-control-presentation.js +128 -0
  11. package/lib/clay-control-target-projection.js +26 -0
  12. package/lib/clay-mate-chat-receipts.js +26 -0
  13. package/lib/clay-mate-chat.js +88 -0
  14. package/lib/clay-mate-knowledge-input.js +26 -0
  15. package/lib/clay-mate-knowledge.js +95 -0
  16. package/lib/clay-mate-lifecycle.js +95 -0
  17. package/lib/clay-product-control-input.js +33 -0
  18. package/lib/clay-product-control-tools.js +52 -0
  19. package/lib/clay-product-control.js +250 -0
  20. package/lib/clay-project-lifecycle.js +154 -0
  21. package/lib/clay-project-record-input.js +44 -0
  22. package/lib/clay-project-records.js +84 -0
  23. package/lib/clay-scheduling-input.js +21 -0
  24. package/lib/clay-scheduling-receipts.js +26 -0
  25. package/lib/clay-scheduling.js +119 -0
  26. package/lib/clay-screen-controls.js +104 -0
  27. package/lib/clay-skill-install.js +1 -33
  28. package/lib/clay-vendor-usage.js +44 -0
  29. package/lib/clay-workspace-controls.js +84 -0
  30. package/lib/clay-workspace-input.js +17 -0
  31. package/lib/clay-workspace-receipts.js +26 -0
  32. package/lib/cli-sessions.js +1 -300
  33. package/lib/codex-defaults.js +1 -28
  34. package/lib/context-usage.js +3 -2
  35. package/lib/contextual-screen-snapshot.js +38 -0
  36. package/lib/daemon-project-access.js +11 -0
  37. package/lib/daemon-project-lifecycle-callbacks.js +15 -0
  38. package/lib/daemon-project-lifecycle.js +262 -0
  39. package/lib/daemon-projects.js +1 -1
  40. package/lib/daemon.js +78 -276
  41. package/lib/default-ai-runtime.js +4 -8
  42. package/lib/dm-digest-cursor.js +120 -0
  43. package/lib/email-mcp-server.js +1 -1
  44. package/lib/github-star-count.js +147 -0
  45. package/lib/issues-service.js +29 -15
  46. package/lib/kiro-defaults.js +1 -22
  47. package/lib/knowledge-db-import-validation.js +46 -0
  48. package/lib/knowledge-db-import.js +99 -0
  49. package/lib/knowledge-db-service.js +24 -33
  50. package/lib/knowledge-db-storage-nedb-maintenance.js +99 -0
  51. package/lib/knowledge-db-storage-nedb.js +66 -0
  52. package/lib/knowledge-db-storage.js +72 -0
  53. package/lib/knowledge-db-validation.js +0 -0
  54. package/lib/knowledge-document-index.js +2 -1
  55. package/lib/knowledge-file-store.js +7 -1
  56. package/lib/knowledge-product-operations.js +46 -0
  57. package/lib/mate-avatar-catalog.js +12 -0
  58. package/lib/mate-avatar-migration.js +41 -0
  59. package/lib/mate-context-service.js +138 -0
  60. package/lib/mate-context-tools.js +21 -0
  61. package/lib/mate-creation-mcp-server.js +2 -0
  62. package/lib/mate-knowledge-canonical-access.js +10 -0
  63. package/lib/mate-knowledge-mate-bound.js +53 -0
  64. package/lib/mate-knowledge-mcp-server.js +55 -8
  65. package/lib/mate-knowledge-service.js +16 -34
  66. package/lib/mate-knowledge-text-tools.js +106 -0
  67. package/lib/mate-lifecycle-service.js +94 -0
  68. package/lib/mate-message-delivery.js +43 -0
  69. package/lib/mate-ready-creation.js +9 -1
  70. package/lib/mate-schedule-input.js +29 -0
  71. package/lib/mate-schedule-lifecycle.js +151 -0
  72. package/lib/mate-scheduling.js +103 -0
  73. package/lib/mates.js +18 -6
  74. package/lib/mcp-agent-tools.js +117 -0
  75. package/lib/mcp-connection-store.js +119 -15
  76. package/lib/mcp-import-credentials.js +31 -0
  77. package/lib/mcp-local-transport.js +13 -0
  78. package/lib/mcp-oauth.js +8 -6
  79. package/lib/mcp-proxy.js +2 -32
  80. package/lib/mcp-query-bridge.js +30 -0
  81. package/lib/mcp-remote-connections.js +74 -20
  82. package/lib/mcp-source-adapters.js +1 -0
  83. package/lib/mcp-source-context.js +1 -0
  84. package/lib/mcp-source-discovery.js +1 -0
  85. package/lib/mcp-source-plugins.js +1 -0
  86. package/lib/mcp-source-restrictions.js +1 -0
  87. package/lib/mcp-tool-policy.js +9 -0
  88. package/lib/notes-checklist.js +92 -0
  89. package/lib/notes.js +51 -4
  90. package/lib/os-user-diagnostics.js +2 -4
  91. package/lib/os-users.js +24 -70
  92. package/lib/pane-pending-interactions.js +20 -0
  93. package/lib/pane-session-activation.js +114 -0
  94. package/lib/pane-session-transport.js +26 -0
  95. package/lib/project-admin-overview.js +51 -0
  96. package/lib/project-ask-user.js +8 -4
  97. package/lib/project-connection.js +14 -10
  98. package/lib/project-control-git-view.js +12 -0
  99. package/lib/project-debate.js +1 -0
  100. package/lib/project-delegated-follow-up.js +2 -1
  101. package/lib/project-directory-claim.js +65 -0
  102. package/lib/project-file-operations.js +61 -0
  103. package/lib/project-filesystem.js +15 -85
  104. package/lib/project-full-access.js +23 -2
  105. package/lib/project-http.js +7 -4
  106. package/lib/project-knowledge.js +32 -18
  107. package/lib/project-lifecycle-operations.js +98 -0
  108. package/lib/project-lifecycle-process-witness.js +32 -0
  109. package/lib/project-lifecycle-runtime.js +50 -0
  110. package/lib/project-linux-access.js +22 -0
  111. package/lib/project-logs-canonical-clay.js +27 -0
  112. package/lib/project-logs-clay-query.js +16 -0
  113. package/lib/project-logs-schema.js +4 -2
  114. package/lib/project-logs-service.js +8 -7
  115. package/lib/project-logs.js +1 -0
  116. package/lib/project-loop.js +1 -0
  117. package/lib/project-mate-chat-control.js +55 -0
  118. package/lib/project-mate-creation-proposal.js +18 -3
  119. package/lib/project-mate-interaction.js +40 -62
  120. package/lib/project-mcp.js +54 -16
  121. package/lib/project-models.js +14 -31
  122. package/lib/project-notifications.js +76 -17
  123. package/lib/project-ownership.js +77 -0
  124. package/lib/project-pair-result-delivery.js +14 -3
  125. package/lib/project-pair-usage.js +12 -13
  126. package/lib/project-pending-message-queue.js +4 -1
  127. package/lib/project-product-control.js +89 -0
  128. package/lib/project-product-session-queue.js +46 -0
  129. package/lib/project-push-access.js +28 -0
  130. package/lib/project-scheduled-message-queue.js +30 -0
  131. package/lib/project-scheduled-messages.js +67 -68
  132. package/lib/project-scheduled-task-control.js +83 -0
  133. package/lib/project-scheduled-tasks.js +13 -2
  134. package/lib/project-scheduling-access.js +10 -0
  135. package/lib/project-session-actions.js +65 -0
  136. package/lib/project-session-delete.js +8 -1
  137. package/lib/project-session-document.js +27 -7
  138. package/lib/project-session-github.js +63 -19
  139. package/lib/project-session-history-actions.js +167 -0
  140. package/lib/project-session-linear.js +14 -6
  141. package/lib/project-session-notes.js +40 -11
  142. package/lib/project-session-pair.js +1 -1
  143. package/lib/project-session-runtime-actions.js +64 -0
  144. package/lib/project-session-spawn.js +2 -3
  145. package/lib/project-session-vendor.js +55 -0
  146. package/lib/project-sessions.js +160 -290
  147. package/lib/project-shared-browser.js +78 -17
  148. package/lib/project-start-protocol.js +29 -0
  149. package/lib/project-studio-presentation.js +58 -0
  150. package/lib/project-user-message.js +67 -1
  151. package/lib/project-vendor-login.js +8 -36
  152. package/lib/project-workspace-operations.js +126 -0
  153. package/lib/project-workspace-query.js +19 -2
  154. package/lib/project.js +181 -45
  155. package/lib/public/app.js +71 -17
  156. package/lib/public/appearance-bootstrap.js +16 -0
  157. package/lib/public/css/clay-tool-activity.css +51 -0
  158. package/lib/public/css/clay-workspace.css +29 -0
  159. package/lib/public/css/command-palette.css +12 -33
  160. package/lib/public/css/contextual-clay.css +240 -0
  161. package/lib/public/css/filebrowser.css +1 -1
  162. package/lib/public/css/home-debate-planning.css +2 -0
  163. package/lib/public/css/home-mate-creation.css +5 -0
  164. package/lib/public/css/input.css +6 -0
  165. package/lib/public/css/mate-avatar-gallery.css +12 -0
  166. package/lib/public/css/mate-conversation.css +10 -5
  167. package/lib/public/css/mate-loading-scene.css +21 -0
  168. package/lib/public/css/messages.css +6 -2
  169. package/lib/public/css/overlays.css +68 -258
  170. package/lib/public/css/project-admin-overview.css +13 -0
  171. package/lib/public/css/project-mate-creation.css +5 -6
  172. package/lib/public/css/project-start.css +108 -0
  173. package/lib/public/css/projects-hub.css +53 -14
  174. package/lib/public/css/session-folders.css +11 -0
  175. package/lib/public/css/session-github.css +46 -1
  176. package/lib/public/css/settings-shell.css +103 -0
  177. package/lib/public/css/shared-browser.css +35 -1
  178. package/lib/public/css/sidebar.css +7 -0
  179. package/lib/public/css/sticky-notes.css +87 -1
  180. package/lib/public/css/title-bar.css +79 -0
  181. package/lib/public/index.html +61 -68
  182. package/lib/public/mate-avatars/B01.png +0 -0
  183. package/lib/public/mate-avatars/B02.png +0 -0
  184. package/lib/public/mate-avatars/B03.png +0 -0
  185. package/lib/public/mate-avatars/B04.png +0 -0
  186. package/lib/public/mate-avatars/B05.png +0 -0
  187. package/lib/public/mate-avatars/B06.png +0 -0
  188. package/lib/public/mate-avatars/B07.png +0 -0
  189. package/lib/public/mate-avatars/B08.png +0 -0
  190. package/lib/public/mate-avatars/B09.png +0 -0
  191. package/lib/public/mate-avatars/B10.png +0 -0
  192. package/lib/public/mate-avatars/B11.png +0 -0
  193. package/lib/public/mate-avatars/B12.png +0 -0
  194. package/lib/public/mate-avatars/B13.png +0 -0
  195. package/lib/public/mate-avatars/B14.png +0 -0
  196. package/lib/public/mate-avatars/B15.png +0 -0
  197. package/lib/public/mate-avatars/B16.png +0 -0
  198. package/lib/public/mate-avatars/B17.png +0 -0
  199. package/lib/public/mate-avatars/B18.png +0 -0
  200. package/lib/public/mate-avatars/B19.png +0 -0
  201. package/lib/public/mate-avatars/B20.png +0 -0
  202. package/lib/public/mate-avatars/B21.png +0 -0
  203. package/lib/public/mate-avatars/B22.png +0 -0
  204. package/lib/public/mate-avatars/B23.png +0 -0
  205. package/lib/public/mate-avatars/B24.png +0 -0
  206. package/lib/public/mate-avatars/B25.png +0 -0
  207. package/lib/public/mate-avatars/B26.png +0 -0
  208. package/lib/public/mate-avatars/B27.png +0 -0
  209. package/lib/public/mate-avatars/B28.png +0 -0
  210. package/lib/public/mate-avatars/B29.png +0 -0
  211. package/lib/public/mate-avatars/B30.png +0 -0
  212. package/lib/public/mate-avatars/B31.png +0 -0
  213. package/lib/public/mate-avatars/B32.png +0 -0
  214. package/lib/public/mate-avatars/B33.png +0 -0
  215. package/lib/public/mate-avatars/B34.png +0 -0
  216. package/lib/public/mate-avatars/B35.png +0 -0
  217. package/lib/public/mate-avatars/B36.png +0 -0
  218. package/lib/public/mate-avatars/B37.png +0 -0
  219. package/lib/public/mate-avatars/B38.png +0 -0
  220. package/lib/public/mate-avatars/B39.png +0 -0
  221. package/lib/public/mate-avatars/B40.png +0 -0
  222. package/lib/public/mate-avatars/B41.png +0 -0
  223. package/lib/public/mate-avatars/B42.png +0 -0
  224. package/lib/public/mate-avatars/B43.png +0 -0
  225. package/lib/public/mate-avatars/B44.png +0 -0
  226. package/lib/public/mate-avatars/B45.png +0 -0
  227. package/lib/public/mate-avatars/B46.png +0 -0
  228. package/lib/public/mate-avatars/B47.png +0 -0
  229. package/lib/public/mate-avatars/B48.png +0 -0
  230. package/lib/public/mate-avatars/C01.png +0 -0
  231. package/lib/public/mate-avatars/C02.png +0 -0
  232. package/lib/public/mate-avatars/C03.png +0 -0
  233. package/lib/public/mate-avatars/C04.png +0 -0
  234. package/lib/public/mate-avatars/C05.png +0 -0
  235. package/lib/public/mate-avatars/C06.png +0 -0
  236. package/lib/public/mate-avatars/C07.png +0 -0
  237. package/lib/public/mate-avatars/C08.png +0 -0
  238. package/lib/public/mate-avatars/C09.png +0 -0
  239. package/lib/public/mate-avatars/C10.png +0 -0
  240. package/lib/public/mate-avatars/C11.png +0 -0
  241. package/lib/public/mate-avatars/C12.png +0 -0
  242. package/lib/public/mate-avatars/C13.png +0 -0
  243. package/lib/public/mate-avatars/C14.png +0 -0
  244. package/lib/public/mate-avatars/C15.png +0 -0
  245. package/lib/public/mate-avatars/C16.png +0 -0
  246. package/lib/public/mate-avatars/C17.png +0 -0
  247. package/lib/public/mate-avatars/C18.png +0 -0
  248. package/lib/public/mate-avatars/C19.png +0 -0
  249. package/lib/public/mate-avatars/C20.png +0 -0
  250. package/lib/public/mate-avatars/C21.png +0 -0
  251. package/lib/public/mate-avatars/C22.png +0 -0
  252. package/lib/public/mate-avatars/C23.png +0 -0
  253. package/lib/public/mate-avatars/C24.png +0 -0
  254. package/lib/public/mate-avatars/C25.png +0 -0
  255. package/lib/public/mate-avatars/C26.png +0 -0
  256. package/lib/public/mate-avatars/C27.png +0 -0
  257. package/lib/public/mate-avatars/C28.png +0 -0
  258. package/lib/public/mate-avatars/C29.png +0 -0
  259. package/lib/public/mate-avatars/C30.png +0 -0
  260. package/lib/public/mate-avatars/C31.png +0 -0
  261. package/lib/public/mate-avatars/C32.png +0 -0
  262. package/lib/public/mate-avatars/C33.png +0 -0
  263. package/lib/public/mate-avatars/C34.png +0 -0
  264. package/lib/public/mate-avatars/C35.png +0 -0
  265. package/lib/public/mate-avatars/C36.png +0 -0
  266. package/lib/public/mate-avatars/C37.png +0 -0
  267. package/lib/public/mate-avatars/C38.png +0 -0
  268. package/lib/public/mate-avatars/C39.png +0 -0
  269. package/lib/public/mate-avatars/C40.png +0 -0
  270. package/lib/public/mate-avatars/C41.png +0 -0
  271. package/lib/public/mate-avatars/C42.png +0 -0
  272. package/lib/public/mate-avatars/C43.png +0 -0
  273. package/lib/public/mate-avatars/C44.png +0 -0
  274. package/lib/public/mate-avatars/C45.png +0 -0
  275. package/lib/public/mate-avatars/C46.png +0 -0
  276. package/lib/public/mate-avatars/C47.png +0 -0
  277. package/lib/public/mate-avatars/C48.png +0 -0
  278. package/lib/public/mate-avatars/catalog.json +482 -0
  279. package/lib/public/mate-avatars/lead-clay.png +0 -0
  280. package/lib/public/modules/admin-settings-invitations.js +2 -2
  281. package/lib/public/modules/admin-settings-projects.js +8 -4
  282. package/lib/public/modules/admin-settings-ui.js +20 -4
  283. package/lib/public/modules/admin-settings-users.js +4 -4
  284. package/lib/public/modules/app-connection.js +11 -1
  285. package/lib/public/modules/app-favicon.js +18 -9
  286. package/lib/public/modules/app-header.js +7 -4
  287. package/lib/public/modules/app-home-hub.js +2 -1
  288. package/lib/public/modules/app-loop-ui.js +2 -0
  289. package/lib/public/modules/app-message-router.js +22 -1
  290. package/lib/public/modules/app-messages.js +125 -19
  291. package/lib/public/modules/app-misc.js +3 -1
  292. package/lib/public/modules/app-notifications.js +11 -5
  293. package/lib/public/modules/app-panels.js +61 -123
  294. package/lib/public/modules/app-projects.js +14 -407
  295. package/lib/public/modules/app-rate-limit.js +19 -28
  296. package/lib/public/modules/app-rendering.js +4 -3
  297. package/lib/public/modules/avatar.js +15 -41
  298. package/lib/public/modules/chat-render-runtime.js +20 -0
  299. package/lib/public/modules/clay-browser-links.js +47 -0
  300. package/lib/public/modules/clay-control-activity.js +214 -0
  301. package/lib/public/modules/clay-control-copy.js +36 -0
  302. package/lib/public/modules/clay-control-detail-targets.js +44 -0
  303. package/lib/public/modules/clay-control-object-targets.js +52 -0
  304. package/lib/public/modules/clay-control-target-visibility.js +12 -0
  305. package/lib/public/modules/clay-control-targets.js +44 -0
  306. package/lib/public/modules/clay-log-links.js +23 -0
  307. package/lib/public/modules/clay-navigation-render.js +52 -0
  308. package/lib/public/modules/clay-owner-navigation.js +33 -0
  309. package/lib/public/modules/clay-session-links.js +31 -0
  310. package/lib/public/modules/clay-studio-bridge.js +20 -0
  311. package/lib/public/modules/clay-studio-document.js +67 -0
  312. package/lib/public/modules/clay-studio-render.js +146 -0
  313. package/lib/public/modules/clay-tool-activity.js +140 -0
  314. package/lib/public/modules/clay-tool-presentation.js +343 -0
  315. package/lib/public/modules/command-palette.js +162 -40
  316. package/lib/public/modules/contextual-ask-session.js +26 -0
  317. package/lib/public/modules/contextual-clay-geometry.js +155 -0
  318. package/lib/public/modules/contextual-clay-session.js +130 -0
  319. package/lib/public/modules/contextual-clay-workspace.js +169 -0
  320. package/lib/public/modules/contextual-clay.js +252 -0
  321. package/lib/public/modules/contextual-composer.js +91 -0
  322. package/lib/public/modules/contextual-mate-context.js +117 -0
  323. package/lib/public/modules/contextual-mate-hint.js +40 -0
  324. package/lib/public/modules/contextual-mate-identity.js +23 -0
  325. package/lib/public/modules/contextual-mate-sessions.js +134 -0
  326. package/lib/public/modules/contextual-search.js +137 -0
  327. package/lib/public/modules/contextual-session-citations.js +58 -0
  328. package/lib/public/modules/debate.js +1 -0
  329. package/lib/public/modules/default-ai.js +11 -3
  330. package/lib/public/modules/elicitation-form.js +5 -0
  331. package/lib/public/modules/filebrowser.js +20 -1
  332. package/lib/public/modules/generation-stop.js +8 -5
  333. package/lib/public/modules/git-panel.js +3 -1
  334. package/lib/public/modules/github-star.js +66 -0
  335. package/lib/public/modules/history-replay-batch.js +13 -1
  336. package/lib/public/modules/home-debate-live.js +2 -0
  337. package/lib/public/modules/home-debate-planning.js +7 -7
  338. package/lib/public/modules/home-mate-avatar-editor.js +127 -208
  339. package/lib/public/modules/home-mate-chat.js +8 -6
  340. package/lib/public/modules/home-mate-creation.js +73 -1
  341. package/lib/public/modules/home-mate-settings.js +19 -12
  342. package/lib/public/modules/icon-strip-tooltip.js +2 -1
  343. package/lib/public/modules/input.js +88 -10
  344. package/lib/public/modules/issues-render.js +3 -2
  345. package/lib/public/modules/knowledge-db-workbench.js +4 -4
  346. package/lib/public/modules/markdown.js +6 -34
  347. package/lib/public/modules/mate-avatar-catalog.js +97 -0
  348. package/lib/public/modules/mate-knowledge-workbench.js +1 -1
  349. package/lib/public/modules/mate-loading-scene.js +17 -0
  350. package/lib/public/modules/mate-management.js +40 -7
  351. package/lib/public/modules/mcp-connection-view.js +31 -13
  352. package/lib/public/modules/mcp-discovery-view.js +31 -0
  353. package/lib/public/modules/mcp-ui.js +23 -4
  354. package/lib/public/modules/mention.js +3 -0
  355. package/lib/public/modules/message-delivery.js +20 -2
  356. package/lib/public/modules/model-picker.js +2 -0
  357. package/lib/public/modules/pane-activation.js +214 -0
  358. package/lib/public/modules/pane-binding.js +82 -0
  359. package/lib/public/modules/pane-bridge.js +7 -4
  360. package/lib/public/modules/pane-browser-bridge.js +22 -0
  361. package/lib/public/modules/pane-file-bridge.js +4 -0
  362. package/lib/public/modules/pane-issue-bridge.js +4 -1
  363. package/lib/public/modules/pending-message-queue.js +1 -0
  364. package/lib/public/modules/permission-control.js +5 -4
  365. package/lib/public/modules/personal-settings-dialog.js +7 -1
  366. package/lib/public/modules/product-review.js +26 -0
  367. package/lib/public/modules/profile.js +12 -241
  368. package/lib/public/modules/project-access-recovery.js +17 -0
  369. package/lib/public/modules/project-admin-overview.js +21 -0
  370. package/lib/public/modules/project-chat-identity.js +13 -4
  371. package/lib/public/modules/project-logs-render.js +3 -0
  372. package/lib/public/modules/project-mate-creation-workspace.js +13 -4
  373. package/lib/public/modules/project-mate-navigation.js +144 -22
  374. package/lib/public/modules/project-session-visibility-settings.js +19 -16
  375. package/lib/public/modules/project-settings.js +119 -129
  376. package/lib/public/modules/project-start-dialog.js +130 -0
  377. package/lib/public/modules/project-start-folder-state.js +78 -0
  378. package/lib/public/modules/project-start-folder-view.js +190 -0
  379. package/lib/public/modules/project-start-forms.js +66 -0
  380. package/lib/public/modules/project-start-path.js +60 -0
  381. package/lib/public/modules/project-start-state.js +54 -0
  382. package/lib/public/modules/project-start-submit.js +67 -0
  383. package/lib/public/modules/projects-hub-view.js +33 -14
  384. package/lib/public/modules/projects-hub.js +10 -6
  385. package/lib/public/modules/rewind.js +5 -0
  386. package/lib/public/modules/scheduled-tasks.js +2 -0
  387. package/lib/public/modules/scheduler.js +2 -0
  388. package/lib/public/modules/search-clay-chat.js +5 -440
  389. package/lib/public/modules/server-settings.js +36 -91
  390. package/lib/public/modules/session-actions.js +5 -2
  391. package/lib/public/modules/session-context-menu.js +5 -0
  392. package/lib/public/modules/session-create-form.js +10 -10
  393. package/lib/public/modules/session-folder-layout.js +1 -1
  394. package/lib/public/modules/session-folder-view-menu.js +9 -0
  395. package/lib/public/modules/session-github.js +85 -14
  396. package/lib/public/modules/session-rich-drafts.js +21 -0
  397. package/lib/public/modules/session-switch-defer.js +67 -0
  398. package/lib/public/modules/session-work-primary.js +51 -0
  399. package/lib/public/modules/settings-defaults.js +27 -28
  400. package/lib/public/modules/settings-project-target.js +56 -0
  401. package/lib/public/modules/settings-select.js +1 -1
  402. package/lib/public/modules/settings-shell-registry.js +88 -0
  403. package/lib/public/modules/settings-shell-view.js +104 -0
  404. package/lib/public/modules/settings-shell.js +342 -0
  405. package/lib/public/modules/shared-browser-settings.js +112 -0
  406. package/lib/public/modules/shared-browser-tabs.js +13 -3
  407. package/lib/public/modules/shared-browser.js +29 -6
  408. package/lib/public/modules/sidebar-mobile.js +12 -33
  409. package/lib/public/modules/sidebar-projects.js +3 -1
  410. package/lib/public/modules/sidebar-session-folders-ui.js +1 -1
  411. package/lib/public/modules/sidebar-sessions.js +1 -0
  412. package/lib/public/modules/split-group-restore.js +68 -0
  413. package/lib/public/modules/split-pair-ui.js +1 -0
  414. package/lib/public/modules/split-pane-reconciler.js +15 -0
  415. package/lib/public/modules/split-pane-renderer.js +87 -6
  416. package/lib/public/modules/split-session-boundary.js +1 -1
  417. package/lib/public/modules/split-view.js +60 -68
  418. package/lib/public/modules/sticky-note-markdown.js +72 -6
  419. package/lib/public/modules/sticky-notes-actions.js +30 -0
  420. package/lib/public/modules/sticky-notes-browser.js +9 -2
  421. package/lib/public/modules/sticky-notes-card.js +23 -7
  422. package/lib/public/modules/sticky-notes-checklist.js +116 -0
  423. package/lib/public/modules/sticky-notes-editor.js +108 -44
  424. package/lib/public/modules/sticky-notes-shared.js +50 -2
  425. package/lib/public/modules/sticky-notes-state.js +66 -0
  426. package/lib/public/modules/sticky-notes.js +34 -51
  427. package/lib/public/modules/stt-controller.js +4 -1
  428. package/lib/public/modules/stt-recording.js +1 -1
  429. package/lib/public/modules/stt.js +7 -2
  430. package/lib/public/modules/terminal.js +9 -0
  431. package/lib/public/modules/theme.js +18 -3
  432. package/lib/public/modules/thinking-lifecycle.js +33 -3
  433. package/lib/public/modules/thinking-view.js +23 -1
  434. package/lib/public/modules/tools.js +60 -11
  435. package/lib/public/modules/tui-grab.js +1 -2
  436. package/lib/public/modules/user-settings-appearance.js +10 -3
  437. package/lib/public/modules/user-settings-editors.js +1 -1
  438. package/lib/public/modules/user-settings-layout.js +14 -30
  439. package/lib/public/modules/user-settings-preferences.js +6 -2
  440. package/lib/public/modules/user-settings-profile.js +13 -3
  441. package/lib/public/modules/user-settings.js +18 -84
  442. package/lib/public/modules/vendor-login-browser.js +5 -3
  443. package/lib/public/modules/vendor-login.js +2 -2
  444. package/lib/public/modules/vendor-priority.js +15 -1
  445. package/lib/public/modules/vendor-usage-format.js +93 -0
  446. package/lib/public/modules/vendor-usage-list.js +45 -0
  447. package/lib/public/modules/vendor-usage-model.js +215 -0
  448. package/lib/public/modules/vendor-usage-overview.js +312 -0
  449. package/lib/public/modules/wireframe-workbench.js +5 -2
  450. package/lib/public/muse-avatar.svg +4 -0
  451. package/lib/public/style.css +14 -6
  452. package/lib/public/sw.js +3 -1
  453. package/lib/public/welcome-art/conversation-desk.png +0 -0
  454. package/lib/public/welcome-art/mate-clay.png +0 -0
  455. package/lib/public/welcome-art/project-clay.png +0 -0
  456. package/lib/safe-bash-commands.js +3 -45
  457. package/lib/scheduled-task-records.js +3 -1
  458. package/lib/scheduler.js +2 -0
  459. package/lib/sdk-bridge.js +348 -402
  460. package/lib/sdk-foreground-admission.js +16 -0
  461. package/lib/sdk-mcp-descriptors.js +2 -37
  462. package/lib/sdk-message-processor.js +61 -18
  463. package/lib/sdk-quota-snapshot.js +21 -3
  464. package/lib/sdk-response-recovery.js +1 -0
  465. package/lib/sdk-worker.js +2 -677
  466. package/lib/server-admin.js +63 -16
  467. package/lib/server-appearance-settings.js +13 -1
  468. package/lib/server-contextual-clay-settings.js +40 -0
  469. package/lib/server-contextual-mate-sessions.js +70 -0
  470. package/lib/server-dm.js +2 -1
  471. package/lib/server-github-stars.js +39 -0
  472. package/lib/server-global-ws.js +26 -32
  473. package/lib/server-home-chat-events.js +18 -4
  474. package/lib/server-home-chat.js +22 -20
  475. package/lib/server-home-clay-entry.js +23 -4
  476. package/lib/server-home-clay-session-links.js +29 -9
  477. package/lib/server-home-mate-creation.js +1 -0
  478. package/lib/server-home-mcp-consent.js +14 -0
  479. package/lib/server-mates.js +25 -62
  480. package/lib/server-owner-ui.js +118 -0
  481. package/lib/server-path-access.js +38 -0
  482. package/lib/server-project-removal.js +22 -0
  483. package/lib/server-settings.js +6 -1
  484. package/lib/server.js +167 -43
  485. package/lib/session-config-transition.js +45 -0
  486. package/lib/session-folders.js +7 -2
  487. package/lib/session-fork-history.js +21 -0
  488. package/lib/session-github.js +9 -2
  489. package/lib/session-hygiene.js +3 -35
  490. package/lib/session-notes-mcp-server.js +26 -4
  491. package/lib/session-notes-writes.js +88 -0
  492. package/lib/session-permission-mode.js +4 -3
  493. package/lib/session-skill-scope.js +11 -0
  494. package/lib/session-visibility.js +25 -10
  495. package/lib/session-work-primary.js +50 -0
  496. package/lib/sessions.js +66 -99
  497. package/lib/shared-browser-cookie-sync.js +32 -0
  498. package/lib/shared-browser-cookies.js +79 -0
  499. package/lib/shared-browser-runtime.js +25 -9
  500. package/lib/shared-browser-storage-sync.js +43 -0
  501. package/lib/shared-browser-storage.js +101 -0
  502. package/lib/shared-browser-tools.js +2 -1
  503. package/lib/shared-browser-worker.js +46 -10
  504. package/lib/terminal-manager.js +65 -6
  505. package/lib/tool-llm.js +1 -1
  506. package/lib/tui-transcript-index.js +1 -132
  507. package/lib/users-contextual-clay-preferences.js +31 -0
  508. package/lib/users-permissions.js +2 -8
  509. package/lib/users.js +7 -0
  510. package/lib/vendor-login-browser.js +1 -11
  511. package/lib/vendor-usage-acp-readers.js +97 -0
  512. package/lib/vendor-usage-capabilities.js +88 -0
  513. package/lib/vendor-usage-http-readers.js +214 -0
  514. package/lib/vendor-usage-metrics.js +47 -0
  515. package/lib/vendor-usage-native-readers.js +106 -0
  516. package/lib/vendor-usage-overview.js +406 -0
  517. package/lib/vendor-usage-service.js +281 -0
  518. package/lib/workspace-assignment-service.js +25 -0
  519. package/lib/workspace-query-access.js +4 -1
  520. package/lib/workspace-query-mcp-server.js +1 -1
  521. package/lib/workspace-query-service.js +13 -2
  522. package/lib/ws-request.js +1 -0
  523. package/lib/ws-schema.js +22 -4
  524. package/lib/yoke/acp-agent-profiles.js +7 -5
  525. package/lib/yoke/adapters/antigravity.js +3 -14
  526. package/lib/yoke/adapters/claude-query-contract.js +9 -0
  527. package/lib/yoke/adapters/claude.js +66 -50
  528. package/lib/yoke/adapters/codex-query-contract.js +25 -0
  529. package/lib/yoke/adapters/codex.js +98 -123
  530. package/lib/yoke/adapters/kiro.js +3 -1
  531. package/lib/yoke/adapters/muse-query-contract.js +7 -0
  532. package/lib/yoke/adapters/muse.js +122 -0
  533. package/lib/yoke/auth-events.js +17 -0
  534. package/lib/yoke/claude-hook-installer.js +272 -0
  535. package/lib/yoke/claude-jsonl-watcher.js +204 -0
  536. package/lib/yoke/claude-maintenance.js +55 -0
  537. package/lib/yoke/claude-permission-patterns.js +53 -0
  538. package/lib/yoke/claude-response-recovery.js +155 -0
  539. package/lib/yoke/claude-transcript-hygiene.js +34 -0
  540. package/lib/yoke/claude-worker-startup.js +28 -0
  541. package/lib/yoke/clay-skill-install.js +33 -0
  542. package/lib/yoke/cli-sessions.js +300 -0
  543. package/lib/yoke/codex-app-server.js +7 -12
  544. package/lib/yoke/codex-dynamic-tool-names.js +80 -0
  545. package/lib/yoke/codex-idle-recovery.js +81 -1
  546. package/lib/yoke/codex-model-catalog.js +37 -3
  547. package/lib/yoke/codex-recovery-admission.js +164 -0
  548. package/lib/yoke/configuration.js +13 -0
  549. package/lib/yoke/discovery.js +70 -0
  550. package/lib/yoke/errors.js +8 -0
  551. package/lib/yoke/host-environment.js +7 -0
  552. package/lib/yoke/index.js +9 -51
  553. package/lib/yoke/interface.js +116 -0
  554. package/lib/yoke/kiro-acp-server.js +5 -5
  555. package/lib/yoke/legacy-sessions.js +89 -0
  556. package/lib/yoke/login-protocol.js +25 -0
  557. package/lib/yoke/maintenance.js +12 -0
  558. package/lib/yoke/mcp-proxy.js +32 -0
  559. package/lib/yoke/mcp-source-adapters.js +91 -0
  560. package/lib/yoke/mcp-source-context.js +42 -0
  561. package/lib/yoke/mcp-source-discovery.js +169 -0
  562. package/lib/yoke/mcp-source-plugins.js +68 -0
  563. package/lib/yoke/mcp-source-restrictions.js +47 -0
  564. package/lib/yoke/mcp-tool-policy-normalize.js +28 -0
  565. package/lib/yoke/model-preferences.js +6 -0
  566. package/lib/yoke/muse-artifacts.js +36 -0
  567. package/lib/yoke/muse-controls.js +50 -0
  568. package/lib/yoke/muse-input.js +64 -0
  569. package/lib/yoke/muse-items.js +157 -0
  570. package/lib/yoke/muse-policy.js +52 -0
  571. package/lib/yoke/muse-query.js +428 -0
  572. package/lib/yoke/muse-runtime.js +211 -0
  573. package/lib/yoke/muse-services.js +92 -0
  574. package/lib/yoke/muse-skills.js +79 -0
  575. package/lib/yoke/muse-turns.js +71 -0
  576. package/lib/yoke/options/acp.js +2 -0
  577. package/lib/yoke/options/antigravity.js +2 -0
  578. package/lib/yoke/options/claude.js +21 -0
  579. package/lib/yoke/options/codex-defaults.js +29 -0
  580. package/lib/yoke/options/codex-settings.js +21 -0
  581. package/lib/yoke/options/codex.js +6 -0
  582. package/lib/yoke/options/kiro-defaults.js +22 -0
  583. package/lib/yoke/options/kiro.js +5 -0
  584. package/lib/yoke/options/muse.js +5 -0
  585. package/lib/yoke/provider-contract.js +5 -0
  586. package/lib/yoke/providers/antigravity-executable.js +8 -0
  587. package/lib/yoke/providers/claude-executable.js +40 -0
  588. package/lib/yoke/providers/claude-model-descriptions.js +34 -0
  589. package/lib/yoke/providers/claude-process.js +97 -0
  590. package/lib/yoke/providers/claude-provision.js +75 -0
  591. package/lib/yoke/providers/codex-errors.js +8 -0
  592. package/lib/yoke/providers/muse-executable.js +17 -0
  593. package/lib/yoke/provisioning.js +6 -0
  594. package/lib/yoke/query-options.js +10 -0
  595. package/lib/yoke/response-recovery.js +41 -0
  596. package/lib/yoke/sdk-mcp-descriptors.js +37 -0
  597. package/lib/yoke/sdk-server-factory.js +7 -0
  598. package/lib/yoke/session-history.js +8 -0
  599. package/lib/yoke/session-tool-transport.js +34 -13
  600. package/lib/yoke/settings.js +23 -0
  601. package/lib/yoke/source-locations.js +4 -0
  602. package/lib/yoke/title-query.js +18 -7
  603. package/lib/yoke/tui-transcript-index.js +132 -0
  604. package/lib/yoke/usage.js +48 -0
  605. package/lib/yoke/user-input.js +13 -0
  606. package/lib/yoke/vendor-registry.js +87 -3
  607. package/package.json +11 -4
  608. package/lib/public/modules/server-settings-navigation.js +0 -39
@@ -4,6 +4,7 @@
4
4
  // This is the ONLY file (besides claude-worker.js) that imports the SDK.
5
5
  // Also manages worker processes for OS-level user isolation.
6
6
 
7
+ var attachWorkerStartup = require("../claude-worker-startup").attachWorkerStartup;
7
8
  var bindQueryAbort = require("../query-abort").bindAbort;
8
9
  var path = require("path");
9
10
  var fs = require("fs");
@@ -527,7 +528,7 @@ function flattenEvent(raw) {
527
528
  // --- rate_limit_event ---
528
529
  if (raw.type === "rate_limit_event" && raw.rate_limit_info) {
529
530
  base.yokeType = "rate_limit";
530
- base.rateLimitInfo = raw.rate_limit_info;
531
+ base.rateLimitInfo = Object.assign({}, raw.rate_limit_info, { isUsingOverage: raw.rate_limit_info.isUsingOverage === true || raw.rate_limit_info.overageInUse === true });
531
532
  return base;
532
533
  }
533
534
 
@@ -600,6 +601,8 @@ function createQueryHandle(rawQuery, messageQueue, abortController) {
600
601
  var correlation = claudeCorrelation.createCorrelation();
601
602
  var closed = false;
602
603
  var removeAbort = function () {};
604
+ var resolveStopped;
605
+ var stopped = new Promise(function(resolve) { resolveStopped = resolve; });
603
606
  var handle = {
604
607
  // Opaque adapter state (null for in-process queries)
605
608
  _adapterState: null,
@@ -610,12 +613,13 @@ function createQueryHandle(rawQuery, messageQueue, abortController) {
610
613
  return {
611
614
  next: function() {
612
615
  return rawIter.next().then(function(result) {
613
- if (result.done) { closed = true; removeAbort(); }
616
+ if (result.done) { closed = true; removeAbort(); resolveStopped(); }
614
617
  if (result.done) return result;
615
618
  return { value: correlation.result(result.value, flattenEvent(result.value)), done: false };
616
619
  }, function(err) {
617
620
  closed = true;
618
621
  removeAbort();
622
+ resolveStopped();
619
623
  throw err;
620
624
  });
621
625
  },
@@ -700,6 +704,15 @@ function createQueryHandle(rawQuery, messageQueue, abortController) {
700
704
  return Promise.resolve(null);
701
705
  },
702
706
 
707
+ // Account plan usage through the SDK's usage call, which the SDK marks
708
+ // experimental: guarded by capability, resolves null when absent, and the
709
+ // caller validates the shape. Transcript scanning is skipped.
710
+ getAccountUsage: function() {
711
+ var method = rawQuery && rawQuery.usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET;
712
+ if (typeof method === "function") return Promise.resolve(method.call(rawQuery, { skipBehaviors: true }));
713
+ return Promise.resolve(null);
714
+ },
715
+
703
716
  supportedModels: function() {
704
717
  if (rawQuery && typeof rawQuery.supportedModels === "function") {
705
718
  return rawQuery.supportedModels();
@@ -715,6 +728,11 @@ function createQueryHandle(rawQuery, messageQueue, abortController) {
715
728
  }
716
729
  },
717
730
 
731
+ stopAndWait: function() {
732
+ handle.abort();
733
+ return stopped;
734
+ },
735
+
718
736
  close: function() {
719
737
  closed = true;
720
738
  removeAbort();
@@ -818,9 +836,7 @@ function spawnWorker(linuxUser, workerScriptPath, cwd) {
818
836
  buffer: "",
819
837
  };
820
838
 
821
- worker.readyPromise = new Promise(function(resolve) {
822
- worker._readyResolve = resolve;
823
- });
839
+ attachWorkerStartup(worker);
824
840
 
825
841
  // Resolves when the worker process actually exits.
826
842
  // Used to prevent spawning a new worker before the old one finishes
@@ -860,8 +876,16 @@ function spawnWorker(linuxUser, workerScriptPath, cwd) {
860
876
  });
861
877
  connection.on("error", function(err) {
862
878
  console.error("[yoke/claude] Worker connection error:", err.message);
879
+ if (worker._readyReject) worker._readyReject(err);
880
+ });
881
+ connection.on("close", function() {
882
+ if (worker._readyReject) worker._readyReject(new Error("Claude worker connection closed before ready."));
863
883
  });
864
884
  });
885
+ worker.server.on("error", function(error) {
886
+ if (worker._readyReject) worker._readyReject(error);
887
+ cleanupWorker(worker);
888
+ });
865
889
 
866
890
  worker.server.listen(socketPath, function() {
867
891
  console.log("[PERF] spawnWorker: socket listen ready +" + (Date.now() - spawnT0) + "ms");
@@ -892,6 +916,14 @@ function spawnWorker(linuxUser, workerScriptPath, cwd) {
892
916
  });
893
917
  worker.process = spawn(workerSpawn.command, workerSpawn.args, workerSpawn.options);
894
918
 
919
+ worker.process.on("error", function(error) {
920
+ if (worker._readyReject) worker._readyReject(error);
921
+ worker.messageHandlers.forEach(function(handler) { handler({ type: "query_error", error: error.message, _fallback: true }); });
922
+ cleanupWorker(worker);
923
+ // Only a spawn failure proves that no child execution exists. Other
924
+ // ChildProcess errors (for example a failed signal) are not exit evidence.
925
+ if (!worker.process.pid && worker._exitResolve) { worker._exitResolve(); worker._exitResolve = null; }
926
+ });
895
927
  worker.process.stdout.on("data", function(data) {
896
928
  console.log("[sdk-worker:" + linuxUser + "] " + data.toString().trim());
897
929
  });
@@ -905,9 +937,8 @@ function spawnWorker(linuxUser, workerScriptPath, cwd) {
905
937
  worker.process.on("exit", function(code, signal) {
906
938
  console.log("[yoke/claude] Worker for " + linuxUser + " exited (code=" + code + ", signal=" + signal + ")" + (worker._stderrBuf ? " stderr: " + worker._stderrBuf.trim() : ""));
907
939
  // Reject readyPromise if worker dies before becoming ready
908
- if (!worker.ready && worker._readyResolve) {
909
- worker._readyResolve = null;
910
- // Let the readyPromise hang; the query_error handler will clean up
940
+ if (!worker.ready && worker._readyReject) {
941
+ worker._readyReject(new Error("Claude worker exited before ready (code=" + code + ")."));
911
942
  }
912
943
  // Notify message handlers about unexpected exit so sessions don't hang.
913
944
  // Always dispatch a fallback query_error. The handler is idempotent:
@@ -1082,6 +1113,9 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1082
1113
  var iterWaiting = null;
1083
1114
  var iterEnded = false;
1084
1115
  var iterError = null;
1116
+ var resolveStopped;
1117
+ var stopped = new Promise(function(resolve) { resolveStopped = resolve; });
1118
+ if (worker.exitPromise) worker.exitPromise.then(resolveStopped);
1085
1119
 
1086
1120
  // Pending request/response correlation for handle methods that need a
1087
1121
  // result from the worker (e.g. rewindFiles). Each entry is keyed by a
@@ -1299,6 +1333,8 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1299
1333
  }
1300
1334
 
1301
1335
  case "query_done":
1336
+ if (worker._abortTimeout) { clearTimeout(worker._abortTimeout); worker._abortTimeout = null; }
1337
+ resolveStopped();
1302
1338
  rejectPendingPermissionModes(new Error("Worker query ended while changing permission mode"));
1303
1339
  console.log("[yoke/claude] IPC query_done received, pid=" + (worker.process ? worker.process.pid : "?"));
1304
1340
  worker._queryEnded = true;
@@ -1306,6 +1342,10 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1306
1342
  break;
1307
1343
 
1308
1344
  case "query_error": {
1345
+ if (!msg._fallback) {
1346
+ if (worker._abortTimeout) { clearTimeout(worker._abortTimeout); worker._abortTimeout = null; }
1347
+ resolveStopped();
1348
+ }
1309
1349
  rejectPendingPermissionModes(new Error(msg.error || "Worker exited while changing permission mode"));
1310
1350
  console.log("[yoke/claude] IPC query_error received, pid=" + (worker.process ? worker.process.pid : "?") + " _fallback=" + !!msg._fallback + " _queryEnded=" + worker._queryEnded + " error=" + (msg.error || "").substring(0, 100));
1311
1351
  // Skip fallback errors from exit handler if we already handled the real one
@@ -1451,6 +1491,9 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1451
1491
  return iterEnded ? Promise.resolve(null) : contextRequests.request(options);
1452
1492
  },
1453
1493
 
1494
+ // The OS-isolated worker protocol has no account usage request.
1495
+ getAccountUsage: function() { return Promise.resolve(null); },
1496
+
1454
1497
  supportedModels: function() {
1455
1498
  return Promise.resolve([]);
1456
1499
  },
@@ -1472,6 +1515,11 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1472
1515
  }, 5000);
1473
1516
  },
1474
1517
 
1518
+ stopAndWait: function() {
1519
+ handle.abort();
1520
+ return stopped;
1521
+ },
1522
+
1475
1523
  close: function() {
1476
1524
  rejectPendingPermissionModes(new Error("Worker query closed while changing permission mode"));
1477
1525
  // End the iterator
@@ -1507,43 +1555,7 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool,
1507
1555
 
1508
1556
  // --- Adapter factory ---
1509
1557
 
1510
- function resolveClaudeBinaryPath() {
1511
- // 1. Explicit env var override
1512
- if (process.env.CLAUDE_CODE_PATH && fs.existsSync(process.env.CLAUDE_CODE_PATH)) {
1513
- return process.env.CLAUDE_CODE_PATH;
1514
- }
1515
-
1516
- // 2. `which claude` in the daemon's PATH
1517
- try {
1518
- var result = require("child_process").execSync("which claude", { encoding: "utf8", timeout: 5000 }).trim();
1519
- if (result && fs.existsSync(result)) return result;
1520
- } catch (e) {}
1521
-
1522
- // 3. Common per-user and system locations (best-effort fallback for the daemon user)
1523
- var home = process.env.HOME || "";
1524
- var candidates = [];
1525
- if (home) {
1526
- candidates.push(home + "/.npm-global/bin/claude");
1527
- candidates.push(home + "/.local/bin/claude");
1528
- candidates.push(home + "/.volta/bin/claude");
1529
- candidates.push(home + "/.bun/bin/claude");
1530
- candidates.push(home + "/bin/claude");
1531
- }
1532
- candidates.push("/usr/local/bin/claude");
1533
- candidates.push("/usr/bin/claude");
1534
- candidates.push("/opt/homebrew/bin/claude");
1535
- for (var i = 0; i < candidates.length; i++) {
1536
- try { if (fs.existsSync(candidates[i])) return candidates[i]; } catch (e) {}
1537
- }
1538
-
1539
- // 4. Bundled CLI entry from the SDK's peer
1540
- try {
1541
- var resolved = require.resolve("@anthropic-ai/claude-code/cli.js");
1542
- if (resolved && fs.existsSync(resolved)) return resolved;
1543
- } catch (e) {}
1544
-
1545
- return null;
1546
- }
1558
+ var resolveClaudeBinaryPath = require("../providers/claude-executable").resolve;
1547
1559
 
1548
1560
  function createClaudeAdapter(opts) {
1549
1561
  var _cwd = (opts && opts.cwd) || process.cwd();
@@ -1556,6 +1568,7 @@ function createClaudeAdapter(opts) {
1556
1568
 
1557
1569
  var adapter = {
1558
1570
  vendor: "claude",
1571
+ queryContract: require("./claude-query-contract"),
1559
1572
  userInputCapability: { mode: "native", native: true, transport: "AskUserQuestion/onElicitation" },
1560
1573
 
1561
1574
  // Path to worker script (sdk-bridge uses this to spawn worker processes)
@@ -1642,7 +1655,7 @@ function createClaudeAdapter(opts) {
1642
1655
 
1643
1656
  try {
1644
1657
  var models = await stream.supportedModels();
1645
- result.models = models || [];
1658
+ result.models = require("../providers/claude-model-descriptions").list(models);
1646
1659
  _cachedModels = result.models;
1647
1660
  } catch (e) {
1648
1661
  // supportedModels may fail, models list will be empty
@@ -1909,7 +1922,10 @@ function createClaudeAdapter(opts) {
1909
1922
 
1910
1923
  // Wait for worker to be ready before sending query_start
1911
1924
  if (!reusingWorker) {
1912
- await worker.readyPromise;
1925
+ try { await worker.readyPromise; } catch (error) {
1926
+ worker.kill();
1927
+ throw error;
1928
+ }
1913
1929
  }
1914
1930
 
1915
1931
  // Build serializable query options (no callbacks, no AbortController).
@@ -1954,7 +1970,7 @@ function createClaudeAdapter(opts) {
1954
1970
  warmupDone = true;
1955
1971
  var r = msg.result || {};
1956
1972
  resolve({
1957
- models: r.models || [],
1973
+ models: require("../providers/claude-model-descriptions").list(r.models),
1958
1974
  defaultModel: r.model || "",
1959
1975
  skills: r.skills || [],
1960
1976
  slashCommands: r.slashCommands || [],
@@ -2071,7 +2087,7 @@ function createClaudeAdapter(opts) {
2071
2087
 
2072
2088
  try {
2073
2089
  var models = await stream.supportedModels();
2074
- result.models = models || [];
2090
+ result.models = require("../providers/claude-model-descriptions").list(models);
2075
2091
  _cachedModels = result.models;
2076
2092
  } catch (e) {
2077
2093
  // supportedModels may fail, models list will be empty
@@ -2122,7 +2138,7 @@ function createClaudeAdapter(opts) {
2122
2138
  warmupDone = true;
2123
2139
  var r = msg.result || {};
2124
2140
  resolve({
2125
- models: r.models || [],
2141
+ models: require("../providers/claude-model-descriptions").list(r.models),
2126
2142
  defaultModel: r.model || "",
2127
2143
  skills: r.skills || [],
2128
2144
  slashCommands: r.slashCommands || [],
@@ -0,0 +1,25 @@
1
+ // Codex restores dynamic definitions from the original thread catalog.
2
+ // Keep persisted legacy field names here so old conversations remain readable.
3
+ var fields = {
4
+ schedules: "codexDynamicToolCatalogVersion",
5
+ questions: "codexUserInputToolCatalogVersion",
6
+ browser: "codexSharedBrowserToolCatalogVersion",
7
+ issues: "codexIssuesToolCatalogVersion",
8
+ knowledge: "codexYouToolCatalogVersion",
9
+ linear: "codexLinearToolCatalogVersion",
10
+ notes: "codexNotesToolCatalogVersion",
11
+ };
12
+ module.exports = {
13
+ toolTransport: "dynamic",
14
+ catalogLifetime: "conversation",
15
+ externalToolTransport: "dynamic",
16
+ defaultUserInputMode: "fallback",
17
+ questionGuidance: require("../user-input-guidance").codexQuestionGuidance,
18
+ catalogVersion: function (session, family) { return Number(session[fields[family]] || 0); },
19
+ recordCatalog: function (session, versions) {
20
+ Object.keys(versions).forEach(function (family) {
21
+ if (fields[family]) session[fields[family]] = versions[family];
22
+ });
23
+ },
24
+ staleCatalogReason: "This Codex conversation predates Clay's scheduled-task tool catalog. Start a new conversation to use the assisted interview; manual task creation remains available here.",
25
+ };
@@ -17,6 +17,7 @@ var createTurnStop = require("../codex-turn-stop").createTurnStop;
17
17
  var idleRecovery = require("../codex-idle-recovery");
18
18
  var modelCatalog = require("../codex-model-catalog");
19
19
  var normalizeQuotaSnapshot = require("../codex-rate-limits").normalizeSnapshot;
20
+ var dynamicToolNames = require("../codex-dynamic-tool-names");
20
21
 
21
22
  // --- Reasoning defaults ---
22
23
  // Reasoning summaries are the only readable thinking channel Codex offers:
@@ -33,7 +34,7 @@ var normalizeQuotaSnapshot = require("../codex-rate-limits").normalizeSnapshot;
33
34
  var CODEX_REASONING_DEFAULTS = {
34
35
  model_reasoning_summary: "detailed",
35
36
  };
36
- var DEFAULT_CODEX_MODEL = "gpt-6-astra";
37
+ var DEFAULT_CODEX_MODEL = modelCatalog.DEFAULT_MODEL;
37
38
  var CODEX_QUERY_BOUND_TOOL_CAPABILITY = { mode: "dynamic", resume: "session-mcp-recovery" };
38
39
  var CODEX_NOTE_TOOLS = {
39
40
  list_notes: true,
@@ -622,6 +623,8 @@ function flattenEvent(notification, state) {
622
623
  // Dynamic tools are supplied by Clay for a specific thread, such as the
623
624
  // Driver's pair-session controls.
624
625
  if (item.type === "dynamicToolCall" || item.type === "dynamic_tool_call") {
626
+ // Activity shows the original Clay name, not the Codex wire alias.
627
+ var dynamicDisplayName = state.dynamicToolCatalog ? state.dynamicToolCatalog.displayName(item.tool) : item.tool;
625
628
  if (!state.toolBlocks[item.id]) {
626
629
  state.blockCounter++;
627
630
  state.toolBlocks[item.id] = "blk_" + state.blockCounter;
@@ -630,13 +633,13 @@ function flattenEvent(notification, state) {
630
633
  yokeType: "tool_start",
631
634
  blockId: dynamicBlockId,
632
635
  toolId: item.id,
633
- toolName: item.tool || "session_tool",
636
+ toolName: dynamicDisplayName || "session_tool",
634
637
  });
635
638
  events.push({
636
639
  yokeType: "tool_executing",
637
640
  blockId: dynamicBlockId,
638
641
  toolId: item.id,
639
- toolName: item.tool || "session_tool",
642
+ toolName: dynamicDisplayName || "session_tool",
640
643
  input: item.arguments || {},
641
644
  });
642
645
  }
@@ -968,6 +971,15 @@ function createCodexQueryHandle(appServer, queryOpts) {
968
971
  // server request and waits for the client to execute and answer it.
969
972
  if (method === "item/tool/call") {
970
973
  var dynamicParams = msg.params || {};
974
+ var resolvedDynamicTool = (state.dynamicToolCatalog || dynamicToolNames.createCatalog([])).resolve(dynamicParams.tool, dynamicParams.namespace);
975
+ if (resolvedDynamicTool.error) {
976
+ appServer.respond(msg.id, {
977
+ contentItems: [{ type: "inputText", text: "Error: " + resolvedDynamicTool.error }],
978
+ success: false,
979
+ });
980
+ return;
981
+ }
982
+ var dynamicToolName = resolvedDynamicTool.name;
971
983
  if (!callDynamicTool) {
972
984
  appServer.respond(msg.id, {
973
985
  contentItems: [{ type: "inputText", text: "Session tool handler is unavailable" }],
@@ -976,7 +988,7 @@ function createCodexQueryHandle(appServer, queryOpts) {
976
988
  return;
977
989
  }
978
990
  function executeDynamicTool() {
979
- return Promise.resolve(callDynamicTool(dynamicParams.tool, dynamicParams.arguments || {})).then(function (result) {
991
+ return Promise.resolve(callDynamicTool(dynamicToolName, dynamicParams.arguments || {})).then(function (result) {
980
992
  var content = result && Array.isArray(result.content) ? result.content : [];
981
993
  var contentItems = content.map(function (item) {
982
994
  return { type: "inputText", text: item && item.text ? item.text : JSON.stringify(item) };
@@ -987,7 +999,7 @@ function createCodexQueryHandle(appServer, queryOpts) {
987
999
  appServer.respond(msg.id, { contentItems: contentItems, success: !(result && result.isError) });
988
1000
  });
989
1001
  }
990
- var permissionToolName = canonicalDynamicPermissionToolName(dynamicParams.tool);
1002
+ var permissionToolName = canonicalDynamicPermissionToolName(dynamicToolName);
991
1003
  var permission = canUseTool
992
1004
  ? Promise.resolve(canUseTool(permissionToolName, dynamicParams.arguments || {}, {
993
1005
  toolUseID: dynamicParams.callId || String(msg.id),
@@ -1158,13 +1170,15 @@ function createCodexQueryHandle(appServer, queryOpts) {
1158
1170
  if (queryOpts.webSearchMode) {
1159
1171
  threadParams.webSearchMode = queryOpts.webSearchMode;
1160
1172
  }
1161
- if (Array.isArray(queryOpts.dynamicTools) && queryOpts.dynamicTools.length > 0) {
1162
- threadParams.dynamicTools = queryOpts.dynamicTools.map(function (tool) {
1173
+ // Built on resume too: the persisted catalog uses the same aliases.
1174
+ state.dynamicToolCatalog = dynamicToolNames.createCatalog(Array.isArray(queryOpts.dynamicTools) ? queryOpts.dynamicTools : []);
1175
+ if (state.dynamicToolCatalog.advertised.length > 0) {
1176
+ threadParams.dynamicTools = state.dynamicToolCatalog.advertised.map(function (entry) {
1163
1177
  return {
1164
1178
  type: "function",
1165
- name: tool.name,
1166
- description: tool.description || tool.name,
1167
- inputSchema: dynamicInputSchema(tool.inputSchema),
1179
+ name: entry.name,
1180
+ description: entry.def.description || entry.def.name,
1181
+ inputSchema: dynamicInputSchema(entry.def.inputSchema),
1168
1182
  };
1169
1183
  });
1170
1184
  }
@@ -1343,6 +1357,8 @@ function createCodexQueryHandle(appServer, queryOpts) {
1343
1357
  return { threadId: state.threadId, revision: inputRevision };
1344
1358
  },
1345
1359
 
1360
+ getRecoveryThreadId: function() { return state.threadId || queryOpts.resumeSessionId || null; },
1361
+
1346
1362
  retireIdleForRecovery: function() {
1347
1363
  handle.endInput();
1348
1364
  return loopFinished;
@@ -1461,11 +1477,23 @@ function createCodexAdapter(opts) {
1461
1477
  var _refCount = 0;
1462
1478
  var _lastActiveAt = Date.now();
1463
1479
  var _shuttingDown = false;
1480
+ var _recoveryIdleShutdown = null;
1464
1481
  var _activeQueries = [];
1465
- var _recoveryHandoff = null;
1466
- var _recoveryRuntimes = [];
1467
- var _recoveryCleanup = Promise.resolve();
1468
- var _recoveryCleanupTasks = [];
1482
+ var recoveryAdmission = require("../codex-recovery-admission").attachRecoveryAdmission({
1483
+ state: function() { return { epoch: _shutdownEpoch, shuttingDown: _shuttingDown, retiring: _recoveryIdleShutdown === _shutdownEpoch,
1484
+ initializing: _initializing, refCount: _refCount, server: _appServer, entries: _activeQueries.slice() }; },
1485
+ shutdownError: createShutdownError,
1486
+ stopIdle: async function() {
1487
+ _recoveryIdleShutdown = _shutdownEpoch;
1488
+ try { return await adapter.shutdownIfIdle(0); }
1489
+ finally { _recoveryIdleShutdown = null; }
1490
+ },
1491
+ createRuntime: function(queryOpts) {
1492
+ return createCodexAdapter(Object.assign({}, _defaultInitOpts, {
1493
+ recoveryRuntime: true, recoverySessionMcpServer: queryOpts.sessionMcpServer,
1494
+ }));
1495
+ },
1496
+ });
1469
1497
 
1470
1498
  function scopedSkillOptions(env) {
1471
1499
  if (!_runtimeLinuxUser) return { env: env };
@@ -1541,106 +1569,10 @@ function createCodexAdapter(opts) {
1541
1569
  updateLastActiveAt();
1542
1570
  }
1543
1571
 
1544
- function retainRecoveryRuntime(runtime) {
1545
- _recoveryRuntimes.push(runtime);
1546
- }
1547
-
1548
- function removeRecoveryRuntime(runtime) {
1549
- var next = [];
1550
- for (var i = 0; i < _recoveryRuntimes.length; i++) {
1551
- if (_recoveryRuntimes[i] !== runtime) next.push(_recoveryRuntimes[i]);
1552
- }
1553
- _recoveryRuntimes = next;
1554
- }
1555
-
1556
- function cleanupRecoveryRuntime(runtime) {
1557
- for (var i = 0; i < _recoveryCleanupTasks.length; i++) {
1558
- if (_recoveryCleanupTasks[i].runtime === runtime) return _recoveryCleanupTasks[i].promise;
1559
- }
1560
- var task = { runtime: runtime, promise: null };
1561
- _recoveryCleanupTasks.push(task);
1562
- var priorCleanup = _recoveryCleanup;
1563
- task.promise = Promise.resolve(priorCleanup).catch(function() {
1564
- return null;
1565
- }).then(function() {
1566
- return runtime.shutdown();
1567
- }).catch(function(error) {
1568
- console.error("[yoke/codex] Isolated recovery runtime shutdown failed:", error.message || error);
1569
- }).then(function() {
1570
- removeRecoveryRuntime(runtime);
1571
- var remainingTasks = [];
1572
- for (var ti = 0; ti < _recoveryCleanupTasks.length; ti++) {
1573
- if (_recoveryCleanupTasks[ti] !== task) remainingTasks.push(_recoveryCleanupTasks[ti]);
1574
- }
1575
- _recoveryCleanupTasks = remainingTasks;
1576
- });
1577
- _recoveryCleanup = task.promise;
1578
- return task.promise;
1579
- }
1580
-
1581
- function shutdownRecoveryRuntimes() {
1582
- var runtimes = _recoveryRuntimes.slice();
1583
- if (!runtimes.length) return _recoveryCleanup;
1584
- return Promise.all(runtimes.map(function(runtime) {
1585
- return cleanupRecoveryRuntime(runtime);
1586
- })).then(function() {
1587
- _recoveryRuntimes = [];
1588
- });
1589
- }
1590
-
1591
- async function createIsolatedRecoveryQuery(queryOpts) {
1592
- var shutdownEpoch = _shutdownEpoch;
1593
- function checkCurrent() {
1594
- idleRecovery.checkAbort(queryOpts);
1595
- if (_shuttingDown || shutdownEpoch !== _shutdownEpoch) throw createShutdownError();
1596
- }
1597
- var releaseHandoff;
1598
- var priorHandoff = _recoveryHandoff;
1599
- var myHandoff = new Promise(function(resolve) { releaseHandoff = resolve; });
1600
- _recoveryHandoff = myHandoff;
1601
- await (priorHandoff || Promise.resolve());
1602
- try {
1603
- await _recoveryCleanup;
1604
- checkCurrent();
1605
- if (!_initializing && _refCount > 0) {
1606
- await idleRecovery.retireIdleQueries(_activeQueries.slice(), _appServer, checkCurrent);
1607
- }
1608
- checkCurrent();
1609
- if (_refCount > 0 || _initializing) {
1610
- throw new Error("Codex resumed-tool recovery is waiting for an active shared runtime; retry after its current queries finish.");
1611
- }
1612
- if (_appServer) {
1613
- var stopped = await adapter.shutdownIfIdle(0);
1614
- if (!stopped) throw new Error("Codex resumed-tool recovery could not safely release the shared runtime; retry after its current queries finish.");
1615
- }
1616
- checkCurrent();
1617
- var recoveryRuntime = createCodexAdapter(Object.assign({}, _defaultInitOpts, {
1618
- recoveryRuntime: true,
1619
- recoverySessionMcpServer: queryOpts.sessionMcpServer,
1620
- }));
1621
- retainRecoveryRuntime(recoveryRuntime);
1622
- var recoveryOpts = Object.assign({}, queryOpts, {
1623
- isolatedRecovery: true,
1624
- onRuntimeFinished: function() {
1625
- return cleanupRecoveryRuntime(recoveryRuntime);
1626
- },
1627
- });
1628
- try {
1629
- return await recoveryRuntime.createQuery(recoveryOpts);
1630
- } catch (error) {
1631
- await cleanupRecoveryRuntime(recoveryRuntime);
1632
- throw error;
1633
- }
1634
- } finally {
1635
- releaseHandoff();
1636
- if (_recoveryHandoff === myHandoff) _recoveryHandoff = null;
1637
- }
1638
- }
1639
-
1640
1572
  function buildReadyResponse(skillNames) {
1641
1573
  return {
1642
1574
  models: _cachedModels,
1643
- defaultModel: DEFAULT_CODEX_MODEL,
1575
+ defaultModel: modelCatalog.defaultModel(_cachedModels),
1644
1576
  skills: skillNames || [],
1645
1577
  slashCommands: skillNames || [],
1646
1578
  fastModeState: null,
@@ -1764,6 +1696,7 @@ function createCodexAdapter(opts) {
1764
1696
  var adapter = {
1765
1697
  vendor: "codex",
1766
1698
  queryBoundToolCapability: CODEX_QUERY_BOUND_TOOL_CAPABILITY,
1699
+ queryContract: require("./codex-query-contract"),
1767
1700
  userInputCapability: { mode: "native", native: true, transport: "item/tool/requestUserInput" },
1768
1701
 
1769
1702
  init: function(initOpts) {
@@ -1777,12 +1710,14 @@ function createCodexAdapter(opts) {
1777
1710
  if (_runtimeLinuxUser && requestedLinuxUser && requestedLinuxUser !== _runtimeLinuxUser) {
1778
1711
  return Promise.reject(new Error("Codex runtime user mismatch"));
1779
1712
  }
1780
- if (_shuttingDown) {
1713
+ if (_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) {
1781
1714
  return Promise.reject(createShutdownError());
1782
1715
  }
1783
- if (_recoveryHandoff) {
1716
+ try { recoveryAdmission.checkSharedExit(); }
1717
+ catch (error) { return Promise.reject(error); }
1718
+ if (recoveryAdmission.pending()) {
1784
1719
  var initEpoch = _shutdownEpoch;
1785
- return _recoveryHandoff.then(function() {
1720
+ return recoveryAdmission.pending().then(function() {
1786
1721
  if (initEpoch !== _shutdownEpoch) throw createShutdownError();
1787
1722
  return adapter.init(initOpts);
1788
1723
  });
@@ -1963,6 +1898,10 @@ function createCodexAdapter(opts) {
1963
1898
  return null;
1964
1899
  },
1965
1900
 
1901
+ retireIdleForRecovery: function(checkCurrent) {
1902
+ return idleRecovery.retireIdleQueries(_activeQueries.slice(), _appServer, checkCurrent);
1903
+ },
1904
+
1966
1905
  createQuery: async function(queryOpts) {
1967
1906
  var requestedLinuxUser = queryOpts && queryOpts.linuxUser;
1968
1907
  if (!_runtimeLinuxUser && requestedLinuxUser) {
@@ -1974,28 +1913,37 @@ function createCodexAdapter(opts) {
1974
1913
  if (_runtimeLinuxUser && requestedLinuxUser && requestedLinuxUser !== _runtimeLinuxUser) {
1975
1914
  throw new Error("Codex runtime user mismatch");
1976
1915
  }
1977
- if (_shuttingDown) {
1916
+ if (_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) {
1978
1917
  throw createShutdownError();
1979
1918
  }
1980
1919
  if (queryOpts && queryOpts.sessionMcpServer && queryOpts.resumeSessionId && !queryOpts.isolatedRecovery) {
1981
- return createIsolatedRecoveryQuery(queryOpts);
1920
+ return recoveryAdmission.createQuery(queryOpts);
1982
1921
  }
1983
1922
  var queryEpoch = _shutdownEpoch;
1923
+ function checkAdmission() {
1924
+ idleRecovery.checkAbort(queryOpts || {});
1925
+ if ((_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) || queryEpoch !== _shutdownEpoch) throw createShutdownError();
1926
+ }
1984
1927
  // Recheck after every await: recovery may replace the runtime while an
1985
1928
  // ordinary start is waiting for initialization or an earlier handoff.
1986
1929
  while (true) {
1987
1930
  idleRecovery.checkAbort(queryOpts || {});
1988
- if (_shuttingDown || queryEpoch !== _shutdownEpoch) throw createShutdownError();
1989
- if (_recoveryHandoff) {
1990
- await _recoveryHandoff;
1931
+ if ((_shuttingDown && _recoveryIdleShutdown !== _shutdownEpoch) || queryEpoch !== _shutdownEpoch) throw createShutdownError();
1932
+ recoveryAdmission.checkSharedExit();
1933
+ if (recoveryAdmission.pending()) {
1934
+ await idleRecovery.wait(recoveryAdmission.pending(), checkAdmission);
1935
+ continue;
1936
+ }
1937
+ if (queryOpts.resumeSessionId && recoveryAdmission.hasTarget(queryOpts.resumeSessionId)) {
1938
+ await recoveryAdmission.waitForTarget(queryOpts);
1991
1939
  continue;
1992
1940
  }
1993
1941
  if (_initializing && _initPromise) {
1994
- await _initPromise;
1942
+ await idleRecovery.wait(_initPromise, checkAdmission);
1995
1943
  continue;
1996
1944
  }
1997
1945
  if (!_appServer || !_appServer.started) {
1998
- await adapter.init(queryOpts || {});
1946
+ await idleRecovery.wait(adapter.init(queryOpts || {}), checkAdmission);
1999
1947
  continue;
2000
1948
  }
2001
1949
  break;
@@ -2009,7 +1957,7 @@ function createCodexAdapter(opts) {
2009
1957
  throw new Error("[yoke/codex] Adapter not initialized. Call init() first.");
2010
1958
  }
2011
1959
 
2012
- var model = queryOpts.model || DEFAULT_CODEX_MODEL;
1960
+ var model = queryOpts.model || modelCatalog.defaultModel(_cachedModels);
2013
1961
  var ac = queryOpts.abortController || new AbortController();
2014
1962
  var activeEntry = {
2015
1963
  abort: function() {
@@ -2102,6 +2050,25 @@ function createCodexAdapter(opts) {
2102
2050
  return { handle: handle, backendPersistence: "ephemeral" };
2103
2051
  },
2104
2052
 
2053
+ // Reads the account's own quota through the already-running app-server;
2054
+ // it never starts a runtime and never starts a turn. Routed to the mapped
2055
+ // OS user's runtime exactly like the other per-owner operations.
2056
+ readAccountRateLimits: async function(opts) {
2057
+ var requestedLinuxUser = opts && opts.linuxUser;
2058
+ if (requestedLinuxUser) {
2059
+ // Throws on a runtime bound to a different OS user; never answers from another identity.
2060
+ var userRuntime = getUserRuntime(requestedLinuxUser);
2061
+ if (userRuntime !== adapter) return userRuntime.readAccountRateLimits(withoutLinuxUser(opts));
2062
+ }
2063
+ if (_requiresLinuxUser) throw new Error("Codex requires a mapped Linux user while OS-user isolation is enabled");
2064
+ if (!_appServer || !_appServer.started) {
2065
+ var idle = new Error("Codex has not started in this project yet; open a Codex session to read account usage.");
2066
+ idle.failureKind = "runtime_idle";
2067
+ throw idle;
2068
+ }
2069
+ return _appServer.send("account/rateLimits/read", { excludeResetCreditDetails: true }, 15000);
2070
+ },
2071
+
2105
2072
  // --- Title generation ---
2106
2073
  generateTitle: async function(messages, opts) {
2107
2074
  var requestedLinuxUser = opts && opts.linuxUser;
@@ -2174,12 +2141,20 @@ function createCodexAdapter(opts) {
2174
2141
  },
2175
2142
 
2176
2143
  // Shutdown the app-server process
2144
+ shutdownForRecovery: async function() {
2145
+ var proc = _appServer && _appServer.proc;
2146
+ await adapter.shutdown();
2147
+ if (proc && proc.exitCode === null && proc.signalCode === null) {
2148
+ throw new Error('Codex recovery runtime exit could not be confirmed; its thread remains reserved.');
2149
+ }
2150
+ },
2151
+
2177
2152
  shutdown: function() {
2178
2153
  _shutdownEpoch++;
2179
2154
  return Promise.all([
2180
2155
  beginShutdown(true),
2181
2156
  shutdownUserRuntimes("shutdown"),
2182
- shutdownRecoveryRuntimes(),
2157
+ recoveryAdmission.shutdown(),
2183
2158
  ]).then(function() { return true; });
2184
2159
  },
2185
2160