ryco-cli 0.1.13 → 0.1.14

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 (215) hide show
  1. package/dist/{AcpNativeLogging-Ba9Nn9Re.mjs → AcpNativeLogging-D3fe64a6.mjs} +1 -1
  2. package/dist/{AcpNativeLogging-Be1KGJfF.cjs → AcpNativeLogging-vLtnq5f1.cjs} +1 -1
  3. package/dist/{AzureDevOpsSourceControlProvider-CVj-F-pW.cjs → AzureDevOpsSourceControlProvider-BtezW57t.cjs} +2 -2
  4. package/dist/{AzureDevOpsSourceControlProvider-CGlK6M0b.mjs → AzureDevOpsSourceControlProvider-WNUDtsur.mjs} +2 -2
  5. package/dist/{BitbucketSourceControlProvider-CEZEd4PX.cjs → BitbucketSourceControlProvider-BWzNM0jW.cjs} +2 -2
  6. package/dist/{BitbucketSourceControlProvider-BV6iRDi7.mjs → BitbucketSourceControlProvider-tbbUFKz3.mjs} +2 -2
  7. package/dist/{ClaudeDriver-lBU7EyUX.cjs → ClaudeDriver-BTvdJvam.cjs} +170 -7
  8. package/dist/{ClaudeDriver-rooMNrJz.mjs → ClaudeDriver-CG5ngU5z.mjs} +171 -8
  9. package/dist/{CodexDriver-DBz2rPXb.mjs → CodexDriver-49o7TA-C.mjs} +4 -4
  10. package/dist/{CodexDriver-CZCIJSLV.cjs → CodexDriver-CFxwJNXx.cjs} +3 -3
  11. package/dist/{CodexTextGeneration-BeG7ymPC.mjs → CodexTextGeneration-C0t4xcPO.mjs} +2 -2
  12. package/dist/{CodexTextGeneration-BvIcyD1P.cjs → CodexTextGeneration-CedcXf9a.cjs} +1 -1
  13. package/dist/{CopilotDriver-CX5zhEdZ.cjs → CopilotDriver-B8J_ovCX.cjs} +20 -16
  14. package/dist/{CopilotDriver-D36vbGbn.mjs → CopilotDriver-Cu1B1skB.mjs} +21 -17
  15. package/dist/{CursorDriver-DWuuOSkJ.mjs → CursorDriver-P_A8uQki.mjs} +4 -4
  16. package/dist/{CursorDriver-CPBVeesr.cjs → CursorDriver-zlKHPy1_.cjs} +3 -3
  17. package/dist/{ForgejoSourceControlProvider-CeN7Snfr.mjs → ForgejoSourceControlProvider-DLhJZtq9.mjs} +2 -2
  18. package/dist/{ForgejoSourceControlProvider-CzmmcAZO.cjs → ForgejoSourceControlProvider-szJ-dvsD.cjs} +2 -2
  19. package/dist/{GitHubSourceControlProvider-DfFR9O2o.cjs → GitHubSourceControlProvider-3ofb6HsF.cjs} +2 -2
  20. package/dist/{GitHubSourceControlProvider-Dmz1LJct.mjs → GitHubSourceControlProvider-D5MQQPCJ.mjs} +2 -2
  21. package/dist/{GitLabSourceControlProvider-C21lwphV.mjs → GitLabSourceControlProvider-DLkxeob5.mjs} +2 -2
  22. package/dist/{GitLabSourceControlProvider-DGoelNmL.cjs → GitLabSourceControlProvider-DkupZH5G.cjs} +2 -2
  23. package/dist/{GrokDriver-CIXj_4ry.cjs → GrokDriver-CTUNclwp.cjs} +3 -3
  24. package/dist/{GrokDriver-qKX1a63G.mjs → GrokDriver-D8KoMY76.mjs} +4 -4
  25. package/dist/{OpenCodeDriver-CbdswhqU.mjs → OpenCodeDriver-B7htxutj.mjs} +92 -27
  26. package/dist/{OpenCodeDriver-DDEuwtXl.cjs → OpenCodeDriver-pXM8bSct.cjs} +91 -26
  27. package/dist/{SourceControlProviderDiscoveryCatalog-DJWDCoup.cjs → SourceControlProviderDiscoveryCatalog-Bj_sZfmB.cjs} +1 -1
  28. package/dist/{SourceControlProviderDiscoveryCatalog-4_4yahsa.mjs → SourceControlProviderDiscoveryCatalog-C6Fn7rZE.mjs} +1 -1
  29. package/dist/bin.cjs +1113 -312
  30. package/dist/bin.mjs +1115 -315
  31. package/dist/client/assets/{AccountSettings-Be5_48k0.js → AccountSettings-CinnQaX-.js} +1 -1
  32. package/dist/client/assets/{AiFocusSettings-DIpQXLW2.js → AiFocusSettings-UbXOywZg.js} +1 -1
  33. package/dist/client/assets/{AnimatedHeight-BIsV_Z3J.js → AnimatedHeight-DCad8EQ2.js} +1 -1
  34. package/dist/client/assets/AppearanceSettings-CTh8Z8nz.js +1 -0
  35. package/dist/client/assets/{BranchToolbar.logic-D7slG_zJ.js → BranchToolbar.logic-37EnknDD.js} +1 -1
  36. package/dist/client/assets/ChatRightPanel-DUwLYKbp.js +27 -0
  37. package/dist/client/assets/{ChatThreadRouteView-CocRstME.js → ChatThreadRouteView-C43W0PEz.js} +1 -1
  38. package/dist/client/assets/CommandPaletteDialog-IHOe0hOG.js +1 -0
  39. package/dist/client/assets/{CompositeItem-F3NGn6aG.js → CompositeItem-ClLCuzeJ.js} +1 -1
  40. package/dist/client/assets/{CompositeRoot-CmJGfRtc.js → CompositeRoot-Bdsr9eHn.js} +1 -1
  41. package/dist/client/assets/{ConnectionsSettings-CXabxSaH.js → ConnectionsSettings-tmBjGOPj.js} +2 -2
  42. package/dist/client/assets/{DiagnosticsSettings-CZ3vY43G.js → DiagnosticsSettings-CbCEgaau.js} +1 -1
  43. package/dist/client/assets/{DialogHandle-C4uSr9wX.js → DialogHandle-CitVLvYq.js} +1 -1
  44. package/dist/client/assets/{DialogPopup-Dck8r8Hn.js → DialogPopup-CfaEr9jv.js} +1 -1
  45. package/dist/client/assets/DialogRoot-CyEOjgGH.js +1 -0
  46. package/dist/client/assets/{DialogTitle-CCedPAjV.js → DialogTitle-BUkU0qXf.js} +1 -1
  47. package/dist/client/assets/{DialogTrigger-CYJ7_YcV.js → DialogTrigger-CEjWue7M.js} +1 -1
  48. package/dist/client/assets/{DialogViewport-D-CrTM-P.js → DialogViewport-Cyc_ye5w.js} +1 -1
  49. package/dist/client/assets/{DraftChatThreadRouteView-D8Bt3Qnq.js → DraftChatThreadRouteView-BSA67nKa.js} +1 -1
  50. package/dist/client/assets/{ExternalIdentityWeb.logic-D64j70NH.js → ExternalIdentityWeb.logic-BqdBjAua.js} +1 -1
  51. package/dist/client/assets/GlassSurface-B3cq28tB.js +1 -0
  52. package/dist/client/assets/{HostedConnectionControls-DxAXv0Hd.js → HostedConnectionControls-S2Wr9fiZ.js} +1 -1
  53. package/dist/client/assets/HostedHubRoot-DK9zP4tJ.js +1 -0
  54. package/dist/client/assets/{HostedNativeAuthorizationRoute-CTQe7Vjt.js → HostedNativeAuthorizationRoute-CKnLbCOH.js} +1 -1
  55. package/dist/client/assets/{HostedRelayTrustNotice-BldMySVi.js → HostedRelayTrustNotice-CbF_SOpf.js} +1 -1
  56. package/dist/client/assets/{Icons-CT3nd2MA.js → Icons-DZpTOLIb.js} +1 -1
  57. package/dist/client/assets/{IntegrationsSettingsPanel-D6f3KoqM.js → IntegrationsSettingsPanel-BdBEGIyL.js} +1 -1
  58. package/dist/client/assets/KeybindingsSettings-Bye1H9Sx.js +7 -0
  59. package/dist/client/assets/{McpServersSettings-B7YqVvV4.js → McpServersSettings-D0U0g2q7.js} +1 -1
  60. package/dist/client/assets/{MobileSheet-CkeG6_SP.js → MobileSheet-BPvuTPR6.js} +1 -1
  61. package/dist/client/assets/{NewWorktreeDialog-CKr2ioue.js → NewWorktreeDialog-C_xJCZWF.js} +1 -1
  62. package/dist/client/assets/{NoActiveThreadState-BD-eNmfn.js → NoActiveThreadState-Cfn_Wwnf.js} +1 -1
  63. package/dist/client/assets/{NodeSecuritySettings-FWM_SeDi.js → NodeSecuritySettings-DUQNZJqJ.js} +1 -1
  64. package/dist/client/assets/{OpinionatedPluginsSettings-BtZQF4Ze.js → OpinionatedPluginsSettings-D44efcv7.js} +1 -1
  65. package/dist/client/assets/{PhoneGetAppInterstitial-CooQgpSw.js → PhoneGetAppInterstitial-CzduFI4-.js} +1 -1
  66. package/dist/client/assets/{PhoneGetAppInterstitialBackdrop-B8vfJdZd.js → PhoneGetAppInterstitialBackdrop-CJ44QRCp.js} +1 -1
  67. package/dist/client/assets/PhoneHome-BLEJm5TG.js +1 -0
  68. package/dist/client/assets/PhoneSettingsSurface-CqetLTIm.js +1 -0
  69. package/dist/client/assets/{ProjectFavicon-qZGdjYCM.js → ProjectFavicon-DrBXI2cH.js} +1 -1
  70. package/dist/client/assets/{ProviderModelPicker-D0w23uWo.js → ProviderModelPicker-CyID3P1C.js} +1 -1
  71. package/dist/client/assets/{ProviderUpdateLaunchNotification.logic-BkoRegCn.js → ProviderUpdateLaunchNotification.logic-C6VoLD-w.js} +1 -1
  72. package/dist/client/assets/ProvidersSettingsPanel-BHmpXUIM.js +1 -0
  73. package/dist/client/assets/{RedactedSensitiveText-CxtaUiKH.js → RedactedSensitiveText-CZwFEoNn.js} +1 -1
  74. package/dist/client/assets/RootAppShell-BVXRShhe.js +6 -0
  75. package/dist/client/assets/{RycoLetterMark-Bk0kvGJ_.js → RycoLetterMark-C-fvI9UB.js} +1 -1
  76. package/dist/client/assets/SettingsDialog-CnETTu23.js +1 -0
  77. package/dist/client/assets/{SettingsPanels-Dr4f2y9l.js → SettingsPanels-C3HDrmQq.js} +3 -3
  78. package/dist/client/assets/{SettingsPanels.editor-B2x4U4rW.js → SettingsPanels.editor-DI8Z5rsl.js} +1 -1
  79. package/dist/client/assets/SourceControlSettings-BG4tsvql.js +1 -0
  80. package/dist/client/assets/{StatisticsPage-Bjouapmf.js → StatisticsPage-dy_aYqvS.js} +1 -1
  81. package/dist/client/assets/{StatisticsPanel-D_khPph6.js → StatisticsPanel-CeRJBu65.js} +1 -1
  82. package/dist/client/assets/{StatisticsSettingsLink-Cx43bOeo.js → StatisticsSettingsLink-ChlwCDG0.js} +1 -1
  83. package/dist/client/assets/ThreadStatusIndicators-D-ioX09X.js +0 -0
  84. package/dist/client/assets/{ThreadTerminalDrawer-DDHEuRGB.js → ThreadTerminalDrawer-BvGaRxBP.js} +1 -1
  85. package/dist/client/assets/{ThreadWorkspacePanel-QF3KwbGm.js → ThreadWorkspacePanel-BAWm7mGl.js} +2 -2
  86. package/dist/client/assets/{ToolbarRootContext-BgqqXVly.js → ToolbarRootContext-k-_m5nCN.js} +1 -1
  87. package/dist/client/assets/{WorkItemsTab-AOVwVvb7.js → WorkItemsTab-Q2V2EuvK.js} +12 -12
  88. package/dist/client/assets/{alert-LqMhbdE9.js → alert-BymbRVPf.js} +1 -1
  89. package/dist/client/assets/{alert-dialog-DxoA6ky8.js → alert-dialog-Gym8_p4Q.js} +1 -1
  90. package/dist/client/assets/appearancePreferences-BhNRCg6W.js +1 -0
  91. package/dist/client/assets/authorization-BwQZHweJ.js +1 -0
  92. package/dist/client/assets/{badge-CXw6fWrB.js → badge-BQI7J3Sg.js} +1 -1
  93. package/dist/client/assets/{branding-BDfN6Spd.js → branding-DqHDcyzW.js} +1 -1
  94. package/dist/client/assets/{button-BAbJxRzt.js → button-Wf_1nfeu.js} +1 -1
  95. package/dist/client/assets/{capabilities-3zgirmmI.js → capabilities-BrllgEYz.js} +1 -1
  96. package/dist/client/assets/{chatThreadActions-DQ8aOQ1g.js → chatThreadActions-BGkJmj6T.js} +1 -1
  97. package/dist/client/assets/{collapsible-dxy6kc2k.js → collapsible-GOpRckDq.js} +1 -1
  98. package/dist/client/assets/{command-CGNKG_Oe.js → command-Dx5YM54H.js} +1 -1
  99. package/dist/client/assets/composerDraftStore-DC2r8dcu.js +11 -0
  100. package/dist/client/assets/{data-list-CYKBxN62.js → data-list-BSiCZBKn.js} +1 -1
  101. package/dist/client/assets/{desktopUpdateAtoms-CyfPW2jg.js → desktopUpdateAtoms-DkmoIGr0.js} +1 -1
  102. package/dist/client/assets/{desktopWorkspace-DHUZEpfy.js → desktopWorkspace-Ddm531g5.js} +1 -1
  103. package/dist/client/assets/{device-B_qvyvtW.js → device-B0aqBYM1.js} +1 -1
  104. package/dist/client/assets/{dialog-DQsYchqu.js → dialog-CUxw5AxI.js} +1 -1
  105. package/dist/client/assets/{draft-input-CkzOk8BY.js → draft-input-CpfrGQ1h.js} +1 -1
  106. package/dist/client/assets/editorPreferences-SOMXdQpi.js +1 -0
  107. package/dist/client/assets/{empty-DwzqNgCP.js → empty-D420OZA9.js} +1 -1
  108. package/dist/client/assets/{env-B4arEvJg.js → env-Bf33qXdb.js} +1 -1
  109. package/dist/client/assets/{getPseudoElementBounds-X62ElHN8.js → getPseudoElementBounds-nDGTWECG.js} +1 -1
  110. package/dist/client/assets/{group-D9ER9giz.js → group-Cq4Llttm.js} +1 -1
  111. package/dist/client/assets/{index-CQmEMMQH.js → index-BL8_ra0g.js} +2 -2
  112. package/dist/client/assets/{input-CHEwW3oH.js → input-Dl4N9ZfE.js} +1 -1
  113. package/dist/client/assets/{kbd-DCGQZk18.js → kbd-CqoZVQfv.js} +1 -1
  114. package/dist/client/assets/{keybindings-CWJ7E9ZI.js → keybindings-DQzcPjMv.js} +1 -1
  115. package/dist/client/assets/{label-CVFHsLFO.js → label-x5DgpBI_.js} +1 -1
  116. package/dist/client/assets/{lib-qiiNMGgU.js → lib-BXIqHSZx.js} +1 -1
  117. package/dist/client/assets/{liquidGlass-CPsvmaF0.js → liquidGlass-yFkZrRk5.js} +1 -1
  118. package/dist/client/assets/{logging-M8H3z7rQ.js → logging-CZlHfeu2.js} +1 -1
  119. package/dist/client/assets/main-B7T7on1T.css +2 -0
  120. package/dist/client/assets/main-J4YlUJad.js +9 -0
  121. package/dist/client/assets/{menu-Dvxh8sD5.js → menu-BuDpxm_Q.js} +1 -1
  122. package/dist/client/assets/{popover-CuH9Yrj3.js → popover-DuprDUaB.js} +1 -1
  123. package/dist/client/assets/primary-CJx2nSkc.js +2 -0
  124. package/dist/client/assets/projectPaths-DrelgodZ.js +1 -0
  125. package/dist/client/assets/{providerDriverMeta-I0TSo-QI.js → providerDriverMeta-D27Koh7Q.js} +1 -1
  126. package/dist/client/assets/{providerIconUtils-X0Z3EK-Q.js → providerIconUtils-CtOHwjWL.js} +1 -1
  127. package/dist/client/assets/providerInstances-BPwEwwpF.js +1 -0
  128. package/dist/client/assets/providerModels-BPwEwwpF.js +1 -0
  129. package/dist/client/assets/{qr-code-Bddq6K7S.js → qr-code-BVfzPOP3.js} +1 -1
  130. package/dist/client/assets/{radio-group-CBZFr4C8.js → radio-group-rgmJqPI7.js} +1 -1
  131. package/dist/client/assets/{resolveAriaLabelledBy-CD_ugzhJ.js → resolveAriaLabelledBy-l4SuqStl.js} +1 -1
  132. package/dist/client/assets/{rightPanelRouteSearch-DB5gQGHK.js → rightPanelRouteSearch-DmpObL1z.js} +1 -1
  133. package/dist/client/assets/runtime-DYzjhL5M.js +1 -0
  134. package/dist/client/assets/{scroll-area-Drsa8bNB.js → scroll-area-DMs8l4bb.js} +1 -1
  135. package/dist/client/assets/{scrollEdges-B-cqxY4l.js → scrollEdges-DWTOweRb.js} +1 -1
  136. package/dist/client/assets/{select-BYbVr-yg.js → select-Djwp8HDm.js} +1 -1
  137. package/dist/client/assets/{separator-CdS5bi4Z.js → separator-rjtf5Q3V.js} +1 -1
  138. package/dist/client/assets/{session-logic-GZix7S2I.js → session-logic-DLEAZb3K.js} +2 -2
  139. package/dist/client/assets/{settingsDialogStore-ygYoScKe.js → settingsDialogStore-Dbykwvfs.js} +1 -1
  140. package/dist/client/assets/{settingsLayout-D8glO7f1.js → settingsLayout-C7bl9Xi4.js} +1 -1
  141. package/dist/client/assets/{sheet-BO78gIKZ.js → sheet-CQIQYfOM.js} +1 -1
  142. package/dist/client/assets/{sidebar-Dm6l2GA6.js → sidebar-BdDOvXe8.js} +1 -1
  143. package/dist/client/assets/sidebarProjectFolders-D_Me0oJ8.js +4 -0
  144. package/dist/client/assets/{sidebarStatusText-D0HT0fek.js → sidebarStatusText-BF6odB03.js} +1 -1
  145. package/dist/client/assets/{skeleton-CvQSeJbw.js → skeleton-Mgh4Gx9x.js} +1 -1
  146. package/dist/client/assets/{spinner-ClF0jOcX.js → spinner-CzzUdFeE.js} +1 -1
  147. package/dist/client/assets/{src-Vf4LVnMX.js → src-Ca7Gag3m.js} +1 -1
  148. package/dist/client/assets/storeSelectors-D7HbqO4E.js +1 -0
  149. package/dist/client/assets/{switch-BTGo9Yip.js → switch-CntUxI1A.js} +1 -1
  150. package/dist/client/assets/{terminal-links-CZ3c9AbA.js → terminal-links-CUFISn8U.js} +1 -1
  151. package/dist/client/assets/{textarea-RFPODxWW.js → textarea-C8QxddDb.js} +1 -1
  152. package/dist/client/assets/threadPinning-BIV4KXZU.js +1 -0
  153. package/dist/client/assets/{threadPriorityRefreshRuntime-Ct5pnIbX.js → threadPriorityRefreshRuntime-B-pVYK_y.js} +1 -1
  154. package/dist/client/assets/{toast-CcSCAm4B.js → toast-Cw7bXJzg.js} +1 -1
  155. package/dist/client/assets/{toggle-I6h33Cu5.js → toggle-Bi9uP4Hb.js} +1 -1
  156. package/dist/client/assets/{toggle-group-mLIkiJtU.js → toggle-group-LcgyMgj5.js} +1 -1
  157. package/dist/client/assets/{tooltip-C8sAONBj.js → tooltip-t3Nrleyq.js} +1 -1
  158. package/dist/client/assets/types-D7HbqO4E.js +1 -0
  159. package/dist/client/assets/{uiStateStore-B6pjzSjj.js → uiStateStore-BW2WnK4k.js} +1 -1
  160. package/dist/client/assets/useAtlassian-a-MaAd0k.js +0 -0
  161. package/dist/client/assets/{useButton-D__1LqCF.js → useButton-DUuWgIMw.js} +1 -1
  162. package/dist/client/assets/{useCompositeListItem-Cmr_nuuG.js → useCompositeListItem-CL5mJqCb.js} +1 -1
  163. package/dist/client/assets/{useDebouncedValue-DHjoudTq.js → useDebouncedValue-jDDWNjgt.js} +1 -1
  164. package/dist/client/assets/{useFloatingRootContext-D5EZmrCa.js → useFloatingRootContext-C4I8IxtL.js} +1 -1
  165. package/dist/client/assets/{useHandleNewThread-DX2FtXcP.js → useHandleNewThread-820pBJCC.js} +1 -1
  166. package/dist/client/assets/{useLabelableId-DnQJ7amm.js → useLabelableId-KX33mhBC.js} +1 -1
  167. package/dist/client/assets/{useLocation-CDeYzWW6.js → useLocation-B4QlXdMt.js} +1 -1
  168. package/dist/client/assets/{useOpenInteractionType-CjtpACKR.js → useOpenInteractionType-DjM9MBY7.js} +1 -1
  169. package/dist/client/assets/{usePhoneThreadActions-BEa3VzGG.js → usePhoneThreadActions-DxxWMYgC.js} +1 -1
  170. package/dist/client/assets/{usePopupViewport-BuhsNdVy.js → usePopupViewport-CAMlnyaP.js} +1 -1
  171. package/dist/client/assets/{useScrollLock-D3tMGsRk.js → useScrollLock-CAPfesBT.js} +1 -1
  172. package/dist/client/assets/{useStatistics-CtunoTE-.js → useStatistics-CWasDzsV.js} +2 -2
  173. package/dist/client/assets/{useSwipeDismiss-CbgDJvw1.js → useSwipeDismiss-BZsYSBgq.js} +1 -1
  174. package/dist/client/assets/{useTheme-DiC-5xCb.js → useTheme-By1kfyiU.js} +1 -1
  175. package/dist/client/assets/{useThreadActions-fN-Al13y.js → useThreadActions-MOjDrEnS.js} +1 -1
  176. package/dist/client/assets/{useTriggerFocusGuards-CrugmkhX.js → useTriggerFocusGuards-D5z439rn.js} +1 -1
  177. package/dist/client/assets/{useValueChanged-MQtIzPIU.js → useValueChanged-D0CHQQwP.js} +1 -1
  178. package/dist/client/assets/{utils-BofFIn5Y.js → utils-B76_2Yk7.js} +1 -1
  179. package/dist/client/index.html +1 -1
  180. package/dist/{collectUint8StreamText-Bb52hlpd.cjs → collectUint8StreamText-B9B7bGv9.cjs} +46 -10
  181. package/dist/{collectUint8StreamText-EDg4F0TU.mjs → collectUint8StreamText-RzKEq2NY.mjs} +35 -11
  182. package/dist/{makeManagedServerProvider-itynW7xv.cjs → makeManagedServerProvider-BF1eBatf.cjs} +1 -1
  183. package/dist/{makeManagedServerProvider-Cf8bNWwc.mjs → makeManagedServerProvider-BuG2fLP8.mjs} +1 -1
  184. package/package.json +1 -1
  185. package/dist/client/assets/AppearanceSettings-CYbSApl4.js +0 -1
  186. package/dist/client/assets/ChatRightPanel-BIS1DPGa.js +0 -27
  187. package/dist/client/assets/CommandPaletteDialog-C5xAo65V.js +0 -1
  188. package/dist/client/assets/DialogRoot-BpIvUdm7.js +0 -1
  189. package/dist/client/assets/GlassSurface-C3IIWMu9.js +0 -1
  190. package/dist/client/assets/HostedHubRoot-Cc8GYcK6.js +0 -1
  191. package/dist/client/assets/KeybindingsSettings-D2bNQPI-.js +0 -7
  192. package/dist/client/assets/PhoneHome-BtPE7bQn.js +0 -1
  193. package/dist/client/assets/PhoneSettingsSurface-tcFCccEL.js +0 -1
  194. package/dist/client/assets/ProvidersSettingsPanel-B3aBKY--.js +0 -1
  195. package/dist/client/assets/RootAppShell-C-0ChFVJ.js +0 -6
  196. package/dist/client/assets/SettingsDialog-Bbuoh793.js +0 -1
  197. package/dist/client/assets/SourceControlSettings-CkiYR4lR.js +0 -1
  198. package/dist/client/assets/ThreadStatusIndicators-ZImeLExQ.js +0 -0
  199. package/dist/client/assets/appearancePreferences-COvj0WMT.js +0 -1
  200. package/dist/client/assets/authorization-mIJKV2yp.js +0 -1
  201. package/dist/client/assets/composerDraftStore-CdJJZe42.js +0 -11
  202. package/dist/client/assets/editorPreferences-DHIJntKF.js +0 -1
  203. package/dist/client/assets/main-BKS5Nf2_.js +0 -9
  204. package/dist/client/assets/main-DaYHZt-J.css +0 -2
  205. package/dist/client/assets/panel-right-BodNpkM9.js +0 -1
  206. package/dist/client/assets/primary-BzLEg2w1.js +0 -2
  207. package/dist/client/assets/projectPaths-BAd6NFcE.js +0 -1
  208. package/dist/client/assets/providerInstances-BJcfB_9E.js +0 -1
  209. package/dist/client/assets/providerModels-BJcfB_9E.js +0 -1
  210. package/dist/client/assets/runtime-CXut_g4p.js +0 -1
  211. package/dist/client/assets/sidebarProjectFolders-cnmz3B_-.js +0 -4
  212. package/dist/client/assets/storeSelectors-DYekgeHu.js +0 -1
  213. package/dist/client/assets/types-DYekgeHu.js +0 -1
  214. package/dist/client/assets/useAppearancePreference-BlLlxQl7.js +0 -1
  215. package/dist/client/assets/useAtlassian-9-hy2f8z.js +0 -0
package/dist/bin.cjs CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const require_rolldown_runtime = require("./rolldown-runtime-LGfotAqq.cjs");
5
- const require_collectUint8StreamText = require("./collectUint8StreamText-Bb52hlpd.cjs");
5
+ const require_collectUint8StreamText = require("./collectUint8StreamText-B9B7bGv9.cjs");
6
6
  const require_Metrics = require("./Metrics-DIjMQ5pa.cjs");
7
- const require_SourceControlProviderDiscoveryCatalog = require("./SourceControlProviderDiscoveryCatalog-DJWDCoup.cjs");
7
+ const require_SourceControlProviderDiscoveryCatalog = require("./SourceControlProviderDiscoveryCatalog-Bj_sZfmB.cjs");
8
8
  const require_sourceControl = require("./sourceControl-B0D1Op29.cjs");
9
9
  let _effect_platform_node_NodeRuntime = require("@effect/platform-node/NodeRuntime");
10
10
  _effect_platform_node_NodeRuntime = require_rolldown_runtime.__toESM(_effect_platform_node_NodeRuntime, 1);
@@ -75,7 +75,6 @@ let node_http = require("node:http");
75
75
  let effect_unstable_sql_SqlSchema = require("effect/unstable/sql/SqlSchema");
76
76
  effect_unstable_sql_SqlSchema = require_rolldown_runtime.__toESM(effect_unstable_sql_SqlSchema, 1);
77
77
  let effect_Number = require("effect/Number");
78
- let node_url = require("node:url");
79
78
  let _pierre_diffs = require("@pierre/diffs");
80
79
  let effect_unstable_http_HttpServerRequest = require("effect/unstable/http/HttpServerRequest");
81
80
  effect_unstable_http_HttpServerRequest = require_rolldown_runtime.__toESM(effect_unstable_http_HttpServerRequest, 1);
@@ -1539,6 +1538,7 @@ function attachmentRelativePath(attachment) {
1539
1538
  });
1540
1539
  return `${attachment.id}${extension}`;
1541
1540
  }
1541
+ case "file": return `${attachment.id}.bin`;
1542
1542
  }
1543
1543
  }
1544
1544
  function resolveAttachmentPath(input) {
@@ -1547,6 +1547,64 @@ function resolveAttachmentPath(input) {
1547
1547
  relativePath: attachmentRelativePath(input.attachment)
1548
1548
  });
1549
1549
  }
1550
+ function attachmentByteLimit(attachment) {
1551
+ return attachment.type === "image" ? require_collectUint8StreamText.PROVIDER_SEND_TURN_MAX_IMAGE_BYTES : require_collectUint8StreamText.PROVIDER_SEND_TURN_MAX_FILE_BYTES;
1552
+ }
1553
+ /**
1554
+ * Opens and reads a persisted attachment through one descriptor. Comparing
1555
+ * the path's lstat identity with the opened descriptor prevents a path or
1556
+ * symlink swap between validation and read, including on platforms without a
1557
+ * useful O_NOFOLLOW flag.
1558
+ */
1559
+ function readPersistedAttachment(input) {
1560
+ const attachmentPath = resolveAttachmentPath(input);
1561
+ if (!attachmentPath) return {
1562
+ ok: false,
1563
+ reason: `Invalid attachment id '${input.attachment.id}'.`
1564
+ };
1565
+ let descriptor;
1566
+ try {
1567
+ const pathInfo = (0, node_fs.lstatSync)(attachmentPath);
1568
+ if (!pathInfo.isFile()) return {
1569
+ ok: false,
1570
+ reason: `Attachment '${input.attachment.name}' is not a regular file.`
1571
+ };
1572
+ const noFollow = typeof node_fs.constants.O_NOFOLLOW === "number" ? node_fs.constants.O_NOFOLLOW : 0;
1573
+ descriptor = (0, node_fs.openSync)(attachmentPath, node_fs.constants.O_RDONLY | noFollow);
1574
+ const openedInfo = (0, node_fs.fstatSync)(descriptor);
1575
+ if (!openedInfo.isFile() || openedInfo.dev !== pathInfo.dev || openedInfo.ino !== pathInfo.ino) return {
1576
+ ok: false,
1577
+ reason: `Attachment '${input.attachment.name}' changed while it was being opened. Attach it again and retry.`
1578
+ };
1579
+ const limit = attachmentByteLimit(input.attachment);
1580
+ if (openedInfo.size <= 0 || openedInfo.size > limit) return {
1581
+ ok: false,
1582
+ reason: `Attachment '${input.attachment.name}' is ${openedInfo.size} bytes; limit is ${limit} bytes.`
1583
+ };
1584
+ if (openedInfo.size !== input.attachment.sizeBytes) return {
1585
+ ok: false,
1586
+ reason: `Attachment '${input.attachment.name}' changed after upload; expected ${input.attachment.sizeBytes} bytes but found ${openedInfo.size}.`
1587
+ };
1588
+ const bytes = (0, node_fs.readFileSync)(descriptor);
1589
+ const completedInfo = (0, node_fs.fstatSync)(descriptor);
1590
+ if (completedInfo.dev !== openedInfo.dev || completedInfo.ino !== openedInfo.ino || completedInfo.size !== openedInfo.size || bytes.byteLength !== openedInfo.size) return {
1591
+ ok: false,
1592
+ reason: `Attachment '${input.attachment.name}' changed while it was being read. Attach it again and retry.`
1593
+ };
1594
+ return {
1595
+ ok: true,
1596
+ bytes,
1597
+ sizeBytes: bytes.byteLength
1598
+ };
1599
+ } catch {
1600
+ return {
1601
+ ok: false,
1602
+ reason: `Attachment '${input.attachment.name}' is missing, unreadable, or not a safe regular file.`
1603
+ };
1604
+ } finally {
1605
+ if (descriptor !== void 0) (0, node_fs.closeSync)(descriptor);
1606
+ }
1607
+ }
1550
1608
  function resolveAttachmentPathById(input) {
1551
1609
  const normalizedId = normalizeAttachmentRelativePath(input.attachmentId);
1552
1610
  if (!normalizedId || normalizedId.includes("/") || normalizedId.includes(".")) return null;
@@ -5893,6 +5951,7 @@ const makeRuntimeSqliteLayer = effect.Effect.fn("makeRuntimeSqliteLayer")(functi
5893
5951
  const setup = effect.Layer.effectDiscard(effect.Effect.gen(function* () {
5894
5952
  const startedAt = Date.now();
5895
5953
  const sql = yield* effect_unstable_sql_SqlClient.SqlClient;
5954
+ yield* sql`PRAGMA busy_timeout = 5000;`;
5896
5955
  yield* sql`PRAGMA journal_mode = WAL;`;
5897
5956
  yield* sql`PRAGMA foreign_keys = ON;`;
5898
5957
  yield* runMigrations();
@@ -7901,6 +7960,31 @@ const makeGitVcsDriverCore = effect.Effect.fn("makeGitVcsDriverCore")(function*
7901
7960
  }
7902
7961
  const currentUpstream = yield* resolveCurrentUpstream(cwd).pipe(effect.Effect.catch(() => effect.Effect.succeed(null)));
7903
7962
  if (currentUpstream) {
7963
+ if (!(branch === currentUpstream.branchName || branch.endsWith(`/${currentUpstream.branchName}`) && currentUpstream.upstreamRef.endsWith(`/${branch}`))) {
7964
+ const remoteName = (yield* resolvePushRemoteName(cwd, branch).pipe(effect.Effect.catch(() => effect.Effect.succeed(null)))) ?? currentUpstream.remoteName;
7965
+ const publishBranch = yield* resolvePublishBranchName(cwd, branch);
7966
+ if ((yield* runGitStdout("GitVcsDriver.pushCurrentBranch.readMergeBase", cwd, [
7967
+ "config",
7968
+ "--get",
7969
+ `branch.${branch}.gh-merge-base`
7970
+ ], true).pipe(effect.Effect.map((stdout) => stdout.trim()))).length === 0) yield* runGit("GitVcsDriver.pushCurrentBranch.recordMergeBase", cwd, [
7971
+ "config",
7972
+ `branch.${branch}.gh-merge-base`,
7973
+ currentUpstream.branchName
7974
+ ]);
7975
+ yield* runGit("GitVcsDriver.pushCurrentBranch.pushOwnBranch", cwd, [
7976
+ "push",
7977
+ "-u",
7978
+ remoteName,
7979
+ `HEAD:refs/heads/${publishBranch}`
7980
+ ]);
7981
+ return {
7982
+ status: "pushed",
7983
+ branch,
7984
+ upstreamBranch: `${remoteName}/${publishBranch}`,
7985
+ setUpstream: true
7986
+ };
7987
+ }
7904
7988
  yield* runGit("GitVcsDriver.pushCurrentBranch.pushUpstream", cwd, [
7905
7989
  "push",
7906
7990
  currentUpstream.remoteName,
@@ -8129,6 +8213,25 @@ const makeGitVcsDriverCore = effect.Effect.fn("makeGitVcsDriverCore")(function*
8129
8213
  input.refName
8130
8214
  ];
8131
8215
  yield* executeGit("GitVcsDriver.createWorktree", input.cwd, args, { fallbackErrorMessage: "git worktree add failed" });
8216
+ const gitmodulesPath = path.join(worktreePath, ".gitmodules");
8217
+ if (yield* fileSystem.exists(gitmodulesPath).pipe(effect.Effect.mapError((cause) => new require_collectUint8StreamText.GitCommandError({
8218
+ operation: "GitVcsDriver.createWorktree.inspectSubmodules",
8219
+ command: "inspect .gitmodules",
8220
+ cwd: worktreePath,
8221
+ detail: `Failed to inspect ${gitmodulesPath} after creating the worktree.`,
8222
+ cause
8223
+ })))) {
8224
+ const submoduleArgs = [
8225
+ "submodule",
8226
+ "update",
8227
+ "--init",
8228
+ "--recursive"
8229
+ ];
8230
+ yield* executeGit("GitVcsDriver.createWorktree.initializeSubmodules", worktreePath, submoduleArgs, {
8231
+ timeoutMs: 12e4,
8232
+ fallbackErrorMessage: "git submodule initialization failed"
8233
+ }).pipe(effect.Effect.mapError((error) => createGitCommandError("GitVcsDriver.createWorktree.initializeSubmodules", worktreePath, submoduleArgs, `The worktree was created, but its submodules could not be initialized: ${error.detail}`, error)));
8234
+ }
8132
8235
  if (input.dependencyHydration === "copyInstallDirs") yield* copyWorktreeDependencyInstallDirs({
8133
8236
  cwd: input.cwd,
8134
8237
  worktreePath
@@ -8193,6 +8296,15 @@ const makeGitVcsDriverCore = effect.Effect.fn("makeGitVcsDriverCore")(function*
8193
8296
  fallbackErrorMessage: "git worktree remove failed"
8194
8297
  }).pipe(effect.Effect.mapError((error) => createGitCommandError("GitVcsDriver.removeWorktree", input.cwd, args, `${commandLabel$1(args)} failed (cwd: ${input.cwd}): ${error.message}`, error)));
8195
8298
  });
8299
+ const pruneWorktrees = (cwd) => executeGit("GitVcsDriver.pruneWorktrees", cwd, [
8300
+ "worktree",
8301
+ "prune",
8302
+ "--expire",
8303
+ "now"
8304
+ ], {
8305
+ timeoutMs: 1e4,
8306
+ fallbackErrorMessage: "git worktree prune failed"
8307
+ }).pipe(effect.Effect.asVoid);
8196
8308
  const renameBranch = effect.Effect.fn("renameBranch")(function* (input) {
8197
8309
  if (input.oldBranch === input.newBranch) return { branch: input.newBranch };
8198
8310
  const targetBranch = yield* resolveAvailableBranchName(input.cwd, input.newBranch);
@@ -8319,6 +8431,7 @@ const makeGitVcsDriverCore = effect.Effect.fn("makeGitVcsDriverCore")(function*
8319
8431
  fetchRemoteTrackingBranch,
8320
8432
  setBranchUpstream,
8321
8433
  removeWorktree,
8434
+ pruneWorktrees,
8322
8435
  renameBranch,
8323
8436
  createRef,
8324
8437
  deleteBranch,
@@ -12697,26 +12810,26 @@ const make$12 = effect.Effect.fn("makeSourceControlProviderRegistry")(function*
12697
12810
  const azureDevOpsCli = yield* AzureDevOpsCli;
12698
12811
  const fileSystem = yield* effect.FileSystem.FileSystem;
12699
12812
  const github = yield* makeLazyProvider("github", effect.Effect.tryPromise({
12700
- try: () => Promise.resolve().then(() => require("./GitHubSourceControlProvider-DfFR9O2o.cjs")),
12813
+ try: () => Promise.resolve().then(() => require("./GitHubSourceControlProvider-3ofb6HsF.cjs")),
12701
12814
  catch: (cause) => providerLoadError("github", cause)
12702
12815
  }).pipe(effect.Effect.flatMap((module) => module.make()), effect.Effect.provideService(GitHubCli, githubCli), effect.Effect.provideService(effect.FileSystem.FileSystem, fileSystem)));
12703
12816
  const gitlab = yield* makeLazyProvider("gitlab", effect.Effect.tryPromise({
12704
- try: () => Promise.resolve().then(() => require("./GitLabSourceControlProvider-DGoelNmL.cjs")),
12817
+ try: () => Promise.resolve().then(() => require("./GitLabSourceControlProvider-DkupZH5G.cjs")),
12705
12818
  catch: (cause) => providerLoadError("gitlab", cause)
12706
12819
  }).pipe(effect.Effect.flatMap((module) => module.make()), effect.Effect.provideService(GitLabCli, gitlabCli)));
12707
12820
  const bitbucket = yield* makeLazyProvider("bitbucket", effect.Effect.tryPromise({
12708
- try: () => Promise.resolve().then(() => require("./BitbucketSourceControlProvider-CEZEd4PX.cjs")),
12821
+ try: () => Promise.resolve().then(() => require("./BitbucketSourceControlProvider-BWzNM0jW.cjs")),
12709
12822
  catch: (cause) => providerLoadError("bitbucket", cause)
12710
12823
  }).pipe(effect.Effect.flatMap((module) => module.make()), effect.Effect.provideService(BitbucketApi, bitbucketApi)), {
12711
12824
  searchRepositories: true,
12712
12825
  cloneAuthentication: true
12713
12826
  });
12714
12827
  const forgejo = yield* makeLazyProvider("forgejo", effect.Effect.tryPromise({
12715
- try: () => Promise.resolve().then(() => require("./ForgejoSourceControlProvider-CzmmcAZO.cjs")),
12828
+ try: () => Promise.resolve().then(() => require("./ForgejoSourceControlProvider-szJ-dvsD.cjs")),
12716
12829
  catch: (cause) => providerLoadError("forgejo", cause)
12717
12830
  }).pipe(effect.Effect.flatMap((module) => module.make()), effect.Effect.provideService(ForgejoApi, forgejoApi)));
12718
12831
  const azureDevOps = yield* makeLazyProvider("azure-devops", effect.Effect.tryPromise({
12719
- try: () => Promise.resolve().then(() => require("./AzureDevOpsSourceControlProvider-CVj-F-pW.cjs")),
12832
+ try: () => Promise.resolve().then(() => require("./AzureDevOpsSourceControlProvider-BtezW57t.cjs")),
12720
12833
  catch: (cause) => providerLoadError("azure-devops", cause)
12721
12834
  }).pipe(effect.Effect.flatMap((module) => module.make()), effect.Effect.provideService(AzureDevOpsCli, azureDevOpsCli)));
12722
12835
  const bitbucketDiscovery = require_SourceControlProviderDiscoveryCatalog.makeBitbucketDiscovery(bitbucketApi);
@@ -12955,6 +13068,11 @@ const DEFAULT_KEYBINDINGS = [
12955
13068
  command: "thread.find",
12956
13069
  when: "!terminalFocus"
12957
13070
  },
13071
+ {
13072
+ key: "mod+alt+p",
13073
+ command: "thread.pinToggle",
13074
+ when: "!terminalFocus"
13075
+ },
12958
13076
  {
12959
13077
  key: "mod+shift+[",
12960
13078
  command: "thread.previous"
@@ -14541,7 +14659,8 @@ const ServerNotification__SpendControlLimitSnapshot = effect_Schema.Struct({
14541
14659
  const ServerNotification__SubAgentActivityKind = effect_Schema.Literals([
14542
14660
  "started",
14543
14661
  "interacted",
14544
- "interrupted"
14662
+ "interrupted",
14663
+ "completed"
14545
14664
  ]);
14546
14665
  const ServerNotification__TerminalInteractionNotification = effect_Schema.Struct({
14547
14666
  itemId: effect_Schema.String,
@@ -15428,7 +15547,8 @@ const V2ItemCompletedNotification__ReasoningEffort = effect_Schema.String.annota
15428
15547
  const V2ItemCompletedNotification__SubAgentActivityKind = effect_Schema.Literals([
15429
15548
  "started",
15430
15549
  "interacted",
15431
- "interrupted"
15550
+ "interrupted",
15551
+ "completed"
15432
15552
  ]);
15433
15553
  const V2ItemCompletedNotification__TextElement = effect_Schema.Struct({
15434
15554
  byteRange: effect_Schema.Struct({
@@ -15612,7 +15732,8 @@ const V2ItemStartedNotification__ReasoningEffort = effect_Schema.String.annotate
15612
15732
  const V2ItemStartedNotification__SubAgentActivityKind = effect_Schema.Literals([
15613
15733
  "started",
15614
15734
  "interacted",
15615
- "interrupted"
15735
+ "interrupted",
15736
+ "completed"
15616
15737
  ]);
15617
15738
  const V2ItemStartedNotification__TextElement = effect_Schema.Struct({
15618
15739
  byteRange: effect_Schema.Struct({
@@ -16107,7 +16228,8 @@ const V2ReviewStartResponse__ReasoningEffort = effect_Schema.String.annotate({ d
16107
16228
  const V2ReviewStartResponse__SubAgentActivityKind = effect_Schema.Literals([
16108
16229
  "started",
16109
16230
  "interacted",
16110
- "interrupted"
16231
+ "interrupted",
16232
+ "completed"
16111
16233
  ]);
16112
16234
  const V2ReviewStartResponse__TextElement = effect_Schema.Struct({
16113
16235
  byteRange: effect_Schema.Struct({
@@ -16292,7 +16414,8 @@ const V2ThreadForkResponse__ReasoningEffort = effect_Schema.String.annotate({ de
16292
16414
  const V2ThreadForkResponse__SubAgentActivityKind = effect_Schema.Literals([
16293
16415
  "started",
16294
16416
  "interacted",
16295
- "interrupted"
16417
+ "interrupted",
16418
+ "completed"
16296
16419
  ]);
16297
16420
  const V2ThreadForkResponse__TextElement = effect_Schema.Struct({
16298
16421
  byteRange: effect_Schema.Struct({
@@ -16474,7 +16597,8 @@ const V2ThreadListResponse__ReasoningEffort = effect_Schema.String.annotate({ de
16474
16597
  const V2ThreadListResponse__SubAgentActivityKind = effect_Schema.Literals([
16475
16598
  "started",
16476
16599
  "interacted",
16477
- "interrupted"
16600
+ "interrupted",
16601
+ "completed"
16478
16602
  ]);
16479
16603
  const V2ThreadListResponse__TextElement = effect_Schema.Struct({
16480
16604
  byteRange: effect_Schema.Struct({
@@ -16610,7 +16734,8 @@ const V2ThreadMetadataUpdateResponse__ReasoningEffort = effect_Schema.String.ann
16610
16734
  const V2ThreadMetadataUpdateResponse__SubAgentActivityKind = effect_Schema.Literals([
16611
16735
  "started",
16612
16736
  "interacted",
16613
- "interrupted"
16737
+ "interrupted",
16738
+ "completed"
16614
16739
  ]);
16615
16740
  const V2ThreadMetadataUpdateResponse__TextElement = effect_Schema.Struct({
16616
16741
  byteRange: effect_Schema.Struct({
@@ -16741,7 +16866,8 @@ const V2ThreadReadResponse__ReasoningEffort = effect_Schema.String.annotate({ de
16741
16866
  const V2ThreadReadResponse__SubAgentActivityKind = effect_Schema.Literals([
16742
16867
  "started",
16743
16868
  "interacted",
16744
- "interrupted"
16869
+ "interrupted",
16870
+ "completed"
16745
16871
  ]);
16746
16872
  const V2ThreadReadResponse__TextElement = effect_Schema.Struct({
16747
16873
  byteRange: effect_Schema.Struct({
@@ -16983,7 +17109,8 @@ const V2ThreadResumeResponse__ReasoningEffort = effect_Schema.String.annotate({
16983
17109
  const V2ThreadResumeResponse__SubAgentActivityKind = effect_Schema.Literals([
16984
17110
  "started",
16985
17111
  "interacted",
16986
- "interrupted"
17112
+ "interrupted",
17113
+ "completed"
16987
17114
  ]);
16988
17115
  const V2ThreadResumeResponse__TextElement = effect_Schema.Struct({
16989
17116
  byteRange: effect_Schema.Struct({
@@ -17114,7 +17241,8 @@ const V2ThreadRollbackResponse__ReasoningEffort = effect_Schema.String.annotate(
17114
17241
  const V2ThreadRollbackResponse__SubAgentActivityKind = effect_Schema.Literals([
17115
17242
  "started",
17116
17243
  "interacted",
17117
- "interrupted"
17244
+ "interrupted",
17245
+ "completed"
17118
17246
  ]);
17119
17247
  const V2ThreadRollbackResponse__TextElement = effect_Schema.Struct({
17120
17248
  byteRange: effect_Schema.Struct({
@@ -17278,7 +17406,8 @@ const V2ThreadStartedNotification__ReasoningEffort = effect_Schema.String.annota
17278
17406
  const V2ThreadStartedNotification__SubAgentActivityKind = effect_Schema.Literals([
17279
17407
  "started",
17280
17408
  "interacted",
17281
- "interrupted"
17409
+ "interrupted",
17410
+ "completed"
17282
17411
  ]);
17283
17412
  const V2ThreadStartedNotification__TextElement = effect_Schema.Struct({
17284
17413
  byteRange: effect_Schema.Struct({
@@ -17456,7 +17585,8 @@ const V2ThreadStartResponse__ReasoningEffort = effect_Schema.String.annotate({ d
17456
17585
  const V2ThreadStartResponse__SubAgentActivityKind = effect_Schema.Literals([
17457
17586
  "started",
17458
17587
  "interacted",
17459
- "interrupted"
17588
+ "interrupted",
17589
+ "completed"
17460
17590
  ]);
17461
17591
  const V2ThreadStartResponse__TextElement = effect_Schema.Struct({
17462
17592
  byteRange: effect_Schema.Struct({
@@ -17599,7 +17729,8 @@ const V2ThreadUnarchiveResponse__ReasoningEffort = effect_Schema.String.annotate
17599
17729
  const V2ThreadUnarchiveResponse__SubAgentActivityKind = effect_Schema.Literals([
17600
17730
  "started",
17601
17731
  "interacted",
17602
- "interrupted"
17732
+ "interrupted",
17733
+ "completed"
17603
17734
  ]);
17604
17735
  const V2ThreadUnarchiveResponse__TextElement = effect_Schema.Struct({
17605
17736
  byteRange: effect_Schema.Struct({
@@ -17729,7 +17860,8 @@ const V2TurnCompletedNotification__ReasoningEffort = effect_Schema.String.annota
17729
17860
  const V2TurnCompletedNotification__SubAgentActivityKind = effect_Schema.Literals([
17730
17861
  "started",
17731
17862
  "interacted",
17732
- "interrupted"
17863
+ "interrupted",
17864
+ "completed"
17733
17865
  ]);
17734
17866
  const V2TurnCompletedNotification__TextElement = effect_Schema.Struct({
17735
17867
  byteRange: effect_Schema.Struct({
@@ -17856,7 +17988,8 @@ const V2TurnStartedNotification__ReasoningEffort = effect_Schema.String.annotate
17856
17988
  const V2TurnStartedNotification__SubAgentActivityKind = effect_Schema.Literals([
17857
17989
  "started",
17858
17990
  "interacted",
17859
- "interrupted"
17991
+ "interrupted",
17992
+ "completed"
17860
17993
  ]);
17861
17994
  const V2TurnStartedNotification__TextElement = effect_Schema.Struct({
17862
17995
  byteRange: effect_Schema.Struct({
@@ -18022,7 +18155,8 @@ const V2TurnStartResponse__ReasoningEffort = effect_Schema.String.annotate({ des
18022
18155
  const V2TurnStartResponse__SubAgentActivityKind = effect_Schema.Literals([
18023
18156
  "started",
18024
18157
  "interacted",
18025
- "interrupted"
18158
+ "interrupted",
18159
+ "completed"
18026
18160
  ]);
18027
18161
  const V2TurnStartResponse__TextElement = effect_Schema.Struct({
18028
18162
  byteRange: effect_Schema.Struct({
@@ -21933,14 +22067,19 @@ const ServerNotification__ThreadItem = effect_Schema.Union([
21933
22067
  status: effect_Schema.Literals([
21934
22068
  "inProgress",
21935
22069
  "completed",
21936
- "failed"
22070
+ "failed",
22071
+ "interrupted"
21937
22072
  ]).annotate({ description: "Current status of the collab tool call." }),
21938
22073
  tool: effect_Schema.Literals([
21939
22074
  "spawnAgent",
21940
22075
  "sendInput",
21941
22076
  "resumeAgent",
21942
22077
  "wait",
21943
- "closeAgent"
22078
+ "closeAgent",
22079
+ "sendMessage",
22080
+ "followupTask",
22081
+ "interruptAgent",
22082
+ "listAgents"
21944
22083
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
21945
22084
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
21946
22085
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22338,14 +22477,19 @@ const V2ItemCompletedNotification__ThreadItem = effect_Schema.Union([
22338
22477
  status: effect_Schema.Literals([
22339
22478
  "inProgress",
22340
22479
  "completed",
22341
- "failed"
22480
+ "failed",
22481
+ "interrupted"
22342
22482
  ]).annotate({ description: "Current status of the collab tool call." }),
22343
22483
  tool: effect_Schema.Literals([
22344
22484
  "spawnAgent",
22345
22485
  "sendInput",
22346
22486
  "resumeAgent",
22347
22487
  "wait",
22348
- "closeAgent"
22488
+ "closeAgent",
22489
+ "sendMessage",
22490
+ "followupTask",
22491
+ "interruptAgent",
22492
+ "listAgents"
22349
22493
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22350
22494
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22351
22495
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22532,14 +22676,19 @@ const V2ItemStartedNotification__ThreadItem = effect_Schema.Union([
22532
22676
  status: effect_Schema.Literals([
22533
22677
  "inProgress",
22534
22678
  "completed",
22535
- "failed"
22679
+ "failed",
22680
+ "interrupted"
22536
22681
  ]).annotate({ description: "Current status of the collab tool call." }),
22537
22682
  tool: effect_Schema.Literals([
22538
22683
  "spawnAgent",
22539
22684
  "sendInput",
22540
22685
  "resumeAgent",
22541
22686
  "wait",
22542
- "closeAgent"
22687
+ "closeAgent",
22688
+ "sendMessage",
22689
+ "followupTask",
22690
+ "interruptAgent",
22691
+ "listAgents"
22543
22692
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22544
22693
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22545
22694
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22775,14 +22924,19 @@ const V2ReviewStartResponse__ThreadItem = effect_Schema.Union([
22775
22924
  status: effect_Schema.Literals([
22776
22925
  "inProgress",
22777
22926
  "completed",
22778
- "failed"
22927
+ "failed",
22928
+ "interrupted"
22779
22929
  ]).annotate({ description: "Current status of the collab tool call." }),
22780
22930
  tool: effect_Schema.Literals([
22781
22931
  "spawnAgent",
22782
22932
  "sendInput",
22783
22933
  "resumeAgent",
22784
22934
  "wait",
22785
- "closeAgent"
22935
+ "closeAgent",
22936
+ "sendMessage",
22937
+ "followupTask",
22938
+ "interruptAgent",
22939
+ "listAgents"
22786
22940
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22787
22941
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22788
22942
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22956,14 +23110,19 @@ const V2ThreadForkResponse__ThreadItem = effect_Schema.Union([
22956
23110
  status: effect_Schema.Literals([
22957
23111
  "inProgress",
22958
23112
  "completed",
22959
- "failed"
23113
+ "failed",
23114
+ "interrupted"
22960
23115
  ]).annotate({ description: "Current status of the collab tool call." }),
22961
23116
  tool: effect_Schema.Literals([
22962
23117
  "spawnAgent",
22963
23118
  "sendInput",
22964
23119
  "resumeAgent",
22965
23120
  "wait",
22966
- "closeAgent"
23121
+ "closeAgent",
23122
+ "sendMessage",
23123
+ "followupTask",
23124
+ "interruptAgent",
23125
+ "listAgents"
22967
23126
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22968
23127
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22969
23128
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23127,14 +23286,19 @@ const V2ThreadListResponse__ThreadItem = effect_Schema.Union([
23127
23286
  status: effect_Schema.Literals([
23128
23287
  "inProgress",
23129
23288
  "completed",
23130
- "failed"
23289
+ "failed",
23290
+ "interrupted"
23131
23291
  ]).annotate({ description: "Current status of the collab tool call." }),
23132
23292
  tool: effect_Schema.Literals([
23133
23293
  "spawnAgent",
23134
23294
  "sendInput",
23135
23295
  "resumeAgent",
23136
23296
  "wait",
23137
- "closeAgent"
23297
+ "closeAgent",
23298
+ "sendMessage",
23299
+ "followupTask",
23300
+ "interruptAgent",
23301
+ "listAgents"
23138
23302
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23139
23303
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23140
23304
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23298,14 +23462,19 @@ const V2ThreadMetadataUpdateResponse__ThreadItem = effect_Schema.Union([
23298
23462
  status: effect_Schema.Literals([
23299
23463
  "inProgress",
23300
23464
  "completed",
23301
- "failed"
23465
+ "failed",
23466
+ "interrupted"
23302
23467
  ]).annotate({ description: "Current status of the collab tool call." }),
23303
23468
  tool: effect_Schema.Literals([
23304
23469
  "spawnAgent",
23305
23470
  "sendInput",
23306
23471
  "resumeAgent",
23307
23472
  "wait",
23308
- "closeAgent"
23473
+ "closeAgent",
23474
+ "sendMessage",
23475
+ "followupTask",
23476
+ "interruptAgent",
23477
+ "listAgents"
23309
23478
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23310
23479
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23311
23480
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23469,14 +23638,19 @@ const V2ThreadReadResponse__ThreadItem = effect_Schema.Union([
23469
23638
  status: effect_Schema.Literals([
23470
23639
  "inProgress",
23471
23640
  "completed",
23472
- "failed"
23641
+ "failed",
23642
+ "interrupted"
23473
23643
  ]).annotate({ description: "Current status of the collab tool call." }),
23474
23644
  tool: effect_Schema.Literals([
23475
23645
  "spawnAgent",
23476
23646
  "sendInput",
23477
23647
  "resumeAgent",
23478
23648
  "wait",
23479
- "closeAgent"
23649
+ "closeAgent",
23650
+ "sendMessage",
23651
+ "followupTask",
23652
+ "interruptAgent",
23653
+ "listAgents"
23480
23654
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23481
23655
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23482
23656
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23641,14 +23815,19 @@ const V2ThreadResumeResponse__ThreadItem = effect_Schema.Union([
23641
23815
  status: effect_Schema.Literals([
23642
23816
  "inProgress",
23643
23817
  "completed",
23644
- "failed"
23818
+ "failed",
23819
+ "interrupted"
23645
23820
  ]).annotate({ description: "Current status of the collab tool call." }),
23646
23821
  tool: effect_Schema.Literals([
23647
23822
  "spawnAgent",
23648
23823
  "sendInput",
23649
23824
  "resumeAgent",
23650
23825
  "wait",
23651
- "closeAgent"
23826
+ "closeAgent",
23827
+ "sendMessage",
23828
+ "followupTask",
23829
+ "interruptAgent",
23830
+ "listAgents"
23652
23831
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23653
23832
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23654
23833
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23812,14 +23991,19 @@ const V2ThreadRollbackResponse__ThreadItem = effect_Schema.Union([
23812
23991
  status: effect_Schema.Literals([
23813
23992
  "inProgress",
23814
23993
  "completed",
23815
- "failed"
23994
+ "failed",
23995
+ "interrupted"
23816
23996
  ]).annotate({ description: "Current status of the collab tool call." }),
23817
23997
  tool: effect_Schema.Literals([
23818
23998
  "spawnAgent",
23819
23999
  "sendInput",
23820
24000
  "resumeAgent",
23821
24001
  "wait",
23822
- "closeAgent"
24002
+ "closeAgent",
24003
+ "sendMessage",
24004
+ "followupTask",
24005
+ "interruptAgent",
24006
+ "listAgents"
23823
24007
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23824
24008
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23825
24009
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23987,14 +24171,19 @@ const V2ThreadStartedNotification__ThreadItem = effect_Schema.Union([
23987
24171
  status: effect_Schema.Literals([
23988
24172
  "inProgress",
23989
24173
  "completed",
23990
- "failed"
24174
+ "failed",
24175
+ "interrupted"
23991
24176
  ]).annotate({ description: "Current status of the collab tool call." }),
23992
24177
  tool: effect_Schema.Literals([
23993
24178
  "spawnAgent",
23994
24179
  "sendInput",
23995
24180
  "resumeAgent",
23996
24181
  "wait",
23997
- "closeAgent"
24182
+ "closeAgent",
24183
+ "sendMessage",
24184
+ "followupTask",
24185
+ "interruptAgent",
24186
+ "listAgents"
23998
24187
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23999
24188
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24000
24189
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24158,14 +24347,19 @@ const V2ThreadStartResponse__ThreadItem = effect_Schema.Union([
24158
24347
  status: effect_Schema.Literals([
24159
24348
  "inProgress",
24160
24349
  "completed",
24161
- "failed"
24350
+ "failed",
24351
+ "interrupted"
24162
24352
  ]).annotate({ description: "Current status of the collab tool call." }),
24163
24353
  tool: effect_Schema.Literals([
24164
24354
  "spawnAgent",
24165
24355
  "sendInput",
24166
24356
  "resumeAgent",
24167
24357
  "wait",
24168
- "closeAgent"
24358
+ "closeAgent",
24359
+ "sendMessage",
24360
+ "followupTask",
24361
+ "interruptAgent",
24362
+ "listAgents"
24169
24363
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24170
24364
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24171
24365
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24329,14 +24523,19 @@ const V2ThreadUnarchiveResponse__ThreadItem = effect_Schema.Union([
24329
24523
  status: effect_Schema.Literals([
24330
24524
  "inProgress",
24331
24525
  "completed",
24332
- "failed"
24526
+ "failed",
24527
+ "interrupted"
24333
24528
  ]).annotate({ description: "Current status of the collab tool call." }),
24334
24529
  tool: effect_Schema.Literals([
24335
24530
  "spawnAgent",
24336
24531
  "sendInput",
24337
24532
  "resumeAgent",
24338
24533
  "wait",
24339
- "closeAgent"
24534
+ "closeAgent",
24535
+ "sendMessage",
24536
+ "followupTask",
24537
+ "interruptAgent",
24538
+ "listAgents"
24340
24539
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24341
24540
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24342
24541
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24500,14 +24699,19 @@ const V2TurnCompletedNotification__ThreadItem = effect_Schema.Union([
24500
24699
  status: effect_Schema.Literals([
24501
24700
  "inProgress",
24502
24701
  "completed",
24503
- "failed"
24702
+ "failed",
24703
+ "interrupted"
24504
24704
  ]).annotate({ description: "Current status of the collab tool call." }),
24505
24705
  tool: effect_Schema.Literals([
24506
24706
  "spawnAgent",
24507
24707
  "sendInput",
24508
24708
  "resumeAgent",
24509
24709
  "wait",
24510
- "closeAgent"
24710
+ "closeAgent",
24711
+ "sendMessage",
24712
+ "followupTask",
24713
+ "interruptAgent",
24714
+ "listAgents"
24511
24715
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24512
24716
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24513
24717
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24671,14 +24875,19 @@ const V2TurnStartedNotification__ThreadItem = effect_Schema.Union([
24671
24875
  status: effect_Schema.Literals([
24672
24876
  "inProgress",
24673
24877
  "completed",
24674
- "failed"
24878
+ "failed",
24879
+ "interrupted"
24675
24880
  ]).annotate({ description: "Current status of the collab tool call." }),
24676
24881
  tool: effect_Schema.Literals([
24677
24882
  "spawnAgent",
24678
24883
  "sendInput",
24679
24884
  "resumeAgent",
24680
24885
  "wait",
24681
- "closeAgent"
24886
+ "closeAgent",
24887
+ "sendMessage",
24888
+ "followupTask",
24889
+ "interruptAgent",
24890
+ "listAgents"
24682
24891
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24683
24892
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24684
24893
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24842,14 +25051,19 @@ const V2TurnStartResponse__ThreadItem = effect_Schema.Union([
24842
25051
  status: effect_Schema.Literals([
24843
25052
  "inProgress",
24844
25053
  "completed",
24845
- "failed"
25054
+ "failed",
25055
+ "interrupted"
24846
25056
  ]).annotate({ description: "Current status of the collab tool call." }),
24847
25057
  tool: effect_Schema.Literals([
24848
25058
  "spawnAgent",
24849
25059
  "sendInput",
24850
25060
  "resumeAgent",
24851
25061
  "wait",
24852
- "closeAgent"
25062
+ "closeAgent",
25063
+ "sendMessage",
25064
+ "followupTask",
25065
+ "interruptAgent",
25066
+ "listAgents"
24853
25067
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24854
25068
  type: effect_Schema.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24855
25069
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -28107,12 +28321,17 @@ effect_Schema.Literals([
28107
28321
  "sendInput",
28108
28322
  "resumeAgent",
28109
28323
  "wait",
28110
- "closeAgent"
28324
+ "closeAgent",
28325
+ "sendMessage",
28326
+ "followupTask",
28327
+ "interruptAgent",
28328
+ "listAgents"
28111
28329
  ]);
28112
28330
  effect_Schema.Literals([
28113
28331
  "inProgress",
28114
28332
  "completed",
28115
- "failed"
28333
+ "failed",
28334
+ "interrupted"
28116
28335
  ]);
28117
28336
  effect_Schema.Literals(["stdout", "stderr"]).annotate({ description: "Stream label for `command/exec/outputDelta` notifications." });
28118
28337
  effect_Schema.Literals([
@@ -28836,12 +29055,17 @@ effect_Schema.Literals([
28836
29055
  "sendInput",
28837
29056
  "resumeAgent",
28838
29057
  "wait",
28839
- "closeAgent"
29058
+ "closeAgent",
29059
+ "sendMessage",
29060
+ "followupTask",
29061
+ "interruptAgent",
29062
+ "listAgents"
28840
29063
  ]);
28841
29064
  effect_Schema.Literals([
28842
29065
  "inProgress",
28843
29066
  "completed",
28844
- "failed"
29067
+ "failed",
29068
+ "interrupted"
28845
29069
  ]);
28846
29070
  effect_Schema.Literals([
28847
29071
  "agent",
@@ -28902,12 +29126,17 @@ effect_Schema.Literals([
28902
29126
  "sendInput",
28903
29127
  "resumeAgent",
28904
29128
  "wait",
28905
- "closeAgent"
29129
+ "closeAgent",
29130
+ "sendMessage",
29131
+ "followupTask",
29132
+ "interruptAgent",
29133
+ "listAgents"
28906
29134
  ]);
28907
29135
  effect_Schema.Literals([
28908
29136
  "inProgress",
28909
29137
  "completed",
28910
- "failed"
29138
+ "failed",
29139
+ "interrupted"
28911
29140
  ]);
28912
29141
  effect_Schema.Literals([
28913
29142
  "agent",
@@ -29264,12 +29493,17 @@ effect_Schema.Literals([
29264
29493
  "sendInput",
29265
29494
  "resumeAgent",
29266
29495
  "wait",
29267
- "closeAgent"
29496
+ "closeAgent",
29497
+ "sendMessage",
29498
+ "followupTask",
29499
+ "interruptAgent",
29500
+ "listAgents"
29268
29501
  ]);
29269
29502
  effect_Schema.Literals([
29270
29503
  "inProgress",
29271
29504
  "completed",
29272
- "failed"
29505
+ "failed",
29506
+ "interrupted"
29273
29507
  ]);
29274
29508
  effect_Schema.Literals([
29275
29509
  "agent",
@@ -29400,12 +29634,17 @@ effect_Schema.Literals([
29400
29634
  "sendInput",
29401
29635
  "resumeAgent",
29402
29636
  "wait",
29403
- "closeAgent"
29637
+ "closeAgent",
29638
+ "sendMessage",
29639
+ "followupTask",
29640
+ "interruptAgent",
29641
+ "listAgents"
29404
29642
  ]);
29405
29643
  effect_Schema.Literals([
29406
29644
  "inProgress",
29407
29645
  "completed",
29408
- "failed"
29646
+ "failed",
29647
+ "interrupted"
29409
29648
  ]);
29410
29649
  effect_Schema.Literals([
29411
29650
  "agent",
@@ -29511,12 +29750,17 @@ effect_Schema.Literals([
29511
29750
  "sendInput",
29512
29751
  "resumeAgent",
29513
29752
  "wait",
29514
- "closeAgent"
29753
+ "closeAgent",
29754
+ "sendMessage",
29755
+ "followupTask",
29756
+ "interruptAgent",
29757
+ "listAgents"
29515
29758
  ]);
29516
29759
  effect_Schema.Literals([
29517
29760
  "inProgress",
29518
29761
  "completed",
29519
- "failed"
29762
+ "failed",
29763
+ "interrupted"
29520
29764
  ]);
29521
29765
  effect_Schema.Literals([
29522
29766
  "agent",
@@ -29576,12 +29820,17 @@ effect_Schema.Literals([
29576
29820
  "sendInput",
29577
29821
  "resumeAgent",
29578
29822
  "wait",
29579
- "closeAgent"
29823
+ "closeAgent",
29824
+ "sendMessage",
29825
+ "followupTask",
29826
+ "interruptAgent",
29827
+ "listAgents"
29580
29828
  ]);
29581
29829
  effect_Schema.Literals([
29582
29830
  "inProgress",
29583
29831
  "completed",
29584
- "failed"
29832
+ "failed",
29833
+ "interrupted"
29585
29834
  ]);
29586
29835
  effect_Schema.Literals([
29587
29836
  "agent",
@@ -29634,12 +29883,17 @@ effect_Schema.Literals([
29634
29883
  "sendInput",
29635
29884
  "resumeAgent",
29636
29885
  "wait",
29637
- "closeAgent"
29886
+ "closeAgent",
29887
+ "sendMessage",
29888
+ "followupTask",
29889
+ "interruptAgent",
29890
+ "listAgents"
29638
29891
  ]);
29639
29892
  effect_Schema.Literals([
29640
29893
  "inProgress",
29641
29894
  "completed",
29642
- "failed"
29895
+ "failed",
29896
+ "interrupted"
29643
29897
  ]);
29644
29898
  effect_Schema.Literals([
29645
29899
  "agent",
@@ -29928,12 +30182,17 @@ effect_Schema.Literals([
29928
30182
  "sendInput",
29929
30183
  "resumeAgent",
29930
30184
  "wait",
29931
- "closeAgent"
30185
+ "closeAgent",
30186
+ "sendMessage",
30187
+ "followupTask",
30188
+ "interruptAgent",
30189
+ "listAgents"
29932
30190
  ]);
29933
30191
  effect_Schema.Literals([
29934
30192
  "inProgress",
29935
30193
  "completed",
29936
- "failed"
30194
+ "failed",
30195
+ "interrupted"
29937
30196
  ]);
29938
30197
  effect_Schema.Literals([
29939
30198
  "agent",
@@ -30062,12 +30321,17 @@ effect_Schema.Literals([
30062
30321
  "sendInput",
30063
30322
  "resumeAgent",
30064
30323
  "wait",
30065
- "closeAgent"
30324
+ "closeAgent",
30325
+ "sendMessage",
30326
+ "followupTask",
30327
+ "interruptAgent",
30328
+ "listAgents"
30066
30329
  ]);
30067
30330
  effect_Schema.Literals([
30068
30331
  "inProgress",
30069
30332
  "completed",
30070
- "failed"
30333
+ "failed",
30334
+ "interrupted"
30071
30335
  ]);
30072
30336
  effect_Schema.Literals([
30073
30337
  "agent",
@@ -30178,12 +30442,17 @@ effect_Schema.Literals([
30178
30442
  "sendInput",
30179
30443
  "resumeAgent",
30180
30444
  "wait",
30181
- "closeAgent"
30445
+ "closeAgent",
30446
+ "sendMessage",
30447
+ "followupTask",
30448
+ "interruptAgent",
30449
+ "listAgents"
30182
30450
  ]);
30183
30451
  effect_Schema.Literals([
30184
30452
  "inProgress",
30185
30453
  "completed",
30186
- "failed"
30454
+ "failed",
30455
+ "interrupted"
30187
30456
  ]);
30188
30457
  effect_Schema.Literals([
30189
30458
  "agent",
@@ -30328,12 +30597,17 @@ effect_Schema.Literals([
30328
30597
  "sendInput",
30329
30598
  "resumeAgent",
30330
30599
  "wait",
30331
- "closeAgent"
30600
+ "closeAgent",
30601
+ "sendMessage",
30602
+ "followupTask",
30603
+ "interruptAgent",
30604
+ "listAgents"
30332
30605
  ]);
30333
30606
  effect_Schema.Literals([
30334
30607
  "inProgress",
30335
30608
  "completed",
30336
- "failed"
30609
+ "failed",
30610
+ "interrupted"
30337
30611
  ]);
30338
30612
  effect_Schema.Literals([
30339
30613
  "agent",
@@ -30409,12 +30683,17 @@ effect_Schema.Literals([
30409
30683
  "sendInput",
30410
30684
  "resumeAgent",
30411
30685
  "wait",
30412
- "closeAgent"
30686
+ "closeAgent",
30687
+ "sendMessage",
30688
+ "followupTask",
30689
+ "interruptAgent",
30690
+ "listAgents"
30413
30691
  ]);
30414
30692
  effect_Schema.Literals([
30415
30693
  "inProgress",
30416
30694
  "completed",
30417
- "failed"
30695
+ "failed",
30696
+ "interrupted"
30418
30697
  ]);
30419
30698
  effect_Schema.Literals([
30420
30699
  "agent",
@@ -30464,12 +30743,17 @@ effect_Schema.Literals([
30464
30743
  "sendInput",
30465
30744
  "resumeAgent",
30466
30745
  "wait",
30467
- "closeAgent"
30746
+ "closeAgent",
30747
+ "sendMessage",
30748
+ "followupTask",
30749
+ "interruptAgent",
30750
+ "listAgents"
30468
30751
  ]);
30469
30752
  effect_Schema.Literals([
30470
30753
  "inProgress",
30471
30754
  "completed",
30472
- "failed"
30755
+ "failed",
30756
+ "interrupted"
30473
30757
  ]);
30474
30758
  effect_Schema.Literals([
30475
30759
  "agent",
@@ -30519,12 +30803,17 @@ effect_Schema.Literals([
30519
30803
  "sendInput",
30520
30804
  "resumeAgent",
30521
30805
  "wait",
30522
- "closeAgent"
30806
+ "closeAgent",
30807
+ "sendMessage",
30808
+ "followupTask",
30809
+ "interruptAgent",
30810
+ "listAgents"
30523
30811
  ]);
30524
30812
  effect_Schema.Literals([
30525
30813
  "inProgress",
30526
30814
  "completed",
30527
- "failed"
30815
+ "failed",
30816
+ "interrupted"
30528
30817
  ]);
30529
30818
  effect_Schema.Literals([
30530
30819
  "agent",
@@ -30581,12 +30870,17 @@ effect_Schema.Literals([
30581
30870
  "sendInput",
30582
30871
  "resumeAgent",
30583
30872
  "wait",
30584
- "closeAgent"
30873
+ "closeAgent",
30874
+ "sendMessage",
30875
+ "followupTask",
30876
+ "interruptAgent",
30877
+ "listAgents"
30585
30878
  ]);
30586
30879
  effect_Schema.Literals([
30587
30880
  "inProgress",
30588
30881
  "completed",
30589
- "failed"
30882
+ "failed",
30883
+ "interrupted"
30590
30884
  ]);
30591
30885
  effect_Schema.Literals([
30592
30886
  "agent",
@@ -32409,7 +32703,7 @@ const DEVICE_TOOL_DEFINITIONS = [
32409
32703
  }
32410
32704
  }
32411
32705
  ];
32412
- function asRecord$5(value) {
32706
+ function asRecord$6(value) {
32413
32707
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Tool arguments must be a JSON object.");
32414
32708
  return value;
32415
32709
  }
@@ -32632,7 +32926,7 @@ async function startDeviceToolGateway(manager) {
32632
32926
  if (typeof method !== "string") return json(response, 400, mcpError$1(id, -32600, "Missing method."));
32633
32927
  if (method === "notifications/initialized" || method === "notifications/cancelled") return empty(response, 202);
32634
32928
  if (method === "initialize") {
32635
- const requested = asRecord$5(message.params ?? {}).protocolVersion;
32929
+ const requested = asRecord$6(message.params ?? {}).protocolVersion;
32636
32930
  return json(response, 200, mcpSuccess(id, {
32637
32931
  protocolVersion: typeof requested === "string" ? requested : "2025-06-18",
32638
32932
  capabilities: { tools: { listChanged: false } },
@@ -32652,7 +32946,7 @@ async function startDeviceToolGateway(manager) {
32652
32946
  text: "Device tools are only available during an active Ryco turn."
32653
32947
  }]
32654
32948
  }));
32655
- const params = asRecord$5(message.params ?? {});
32949
+ const params = asRecord$6(message.params ?? {});
32656
32950
  const name = params.name;
32657
32951
  if (typeof name !== "string" || !DEVICE_TOOL_NAMES.includes(name)) return json(response, 200, mcpError$1(id, -32602, "Unknown device tool."));
32658
32952
  if (agentControlBlocksLegacyTool(binding.threadId, name)) return json(response, 200, mcpSuccess(id, {
@@ -32667,7 +32961,7 @@ async function startDeviceToolGateway(manager) {
32667
32961
  manager,
32668
32962
  threadId: binding.threadId,
32669
32963
  name,
32670
- args: asRecord$5(params.arguments ?? {})
32964
+ args: asRecord$6(params.arguments ?? {})
32671
32965
  });
32672
32966
  return json(response, 200, mcpSuccess(id, { content: value && typeof value === "object" && "_mcpContent" in value ? value._mcpContent : [{
32673
32967
  type: "text",
@@ -32966,7 +33260,7 @@ const BUILT_IN_DRIVERS = [
32966
33260
  configSchema: require_collectUint8StreamText.CodexSettings,
32967
33261
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.CodexSettings)({}),
32968
33262
  create: (input) => effect.Effect.tryPromise({
32969
- try: () => Promise.resolve().then(() => require("./CodexDriver-CZCIJSLV.cjs")),
33263
+ try: () => Promise.resolve().then(() => require("./CodexDriver-CFxwJNXx.cjs")),
32970
33264
  catch: (cause) => driverImportError(codexDriverKind, input, cause)
32971
33265
  }).pipe(effect.Effect.flatMap(({ CodexDriver }) => CodexDriver.create(input)))
32972
33266
  },
@@ -32980,7 +33274,7 @@ const BUILT_IN_DRIVERS = [
32980
33274
  configSchema: require_collectUint8StreamText.ClaudeSettings,
32981
33275
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.ClaudeSettings)({}),
32982
33276
  create: (input) => effect.Effect.tryPromise({
32983
- try: () => Promise.resolve().then(() => require("./ClaudeDriver-lBU7EyUX.cjs")),
33277
+ try: () => Promise.resolve().then(() => require("./ClaudeDriver-BTvdJvam.cjs")),
32984
33278
  catch: (cause) => driverImportError(claudeDriverKind, input, cause)
32985
33279
  }).pipe(effect.Effect.flatMap(({ ClaudeDriver }) => ClaudeDriver.create(input)))
32986
33280
  },
@@ -32994,7 +33288,7 @@ const BUILT_IN_DRIVERS = [
32994
33288
  configSchema: require_collectUint8StreamText.CopilotSettings,
32995
33289
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.CopilotSettings)({}),
32996
33290
  create: (input) => effect.Effect.tryPromise({
32997
- try: () => Promise.resolve().then(() => require("./CopilotDriver-CX5zhEdZ.cjs")),
33291
+ try: () => Promise.resolve().then(() => require("./CopilotDriver-B8J_ovCX.cjs")),
32998
33292
  catch: (cause) => driverImportError(copilotDriverKind, input, cause)
32999
33293
  }).pipe(effect.Effect.flatMap(({ CopilotDriver }) => CopilotDriver.create(input)))
33000
33294
  },
@@ -33008,7 +33302,7 @@ const BUILT_IN_DRIVERS = [
33008
33302
  configSchema: require_collectUint8StreamText.CursorSettings,
33009
33303
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.CursorSettings)({}),
33010
33304
  create: (input) => effect.Effect.tryPromise({
33011
- try: () => Promise.resolve().then(() => require("./CursorDriver-CPBVeesr.cjs")),
33305
+ try: () => Promise.resolve().then(() => require("./CursorDriver-zlKHPy1_.cjs")),
33012
33306
  catch: (cause) => driverImportError(cursorDriverKind, input, cause)
33013
33307
  }).pipe(effect.Effect.flatMap(({ CursorDriver }) => CursorDriver.create(input)))
33014
33308
  },
@@ -33022,7 +33316,7 @@ const BUILT_IN_DRIVERS = [
33022
33316
  configSchema: require_collectUint8StreamText.GrokSettings,
33023
33317
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.GrokSettings)({}),
33024
33318
  create: (input) => effect.Effect.tryPromise({
33025
- try: () => Promise.resolve().then(() => require("./GrokDriver-CIXj_4ry.cjs")),
33319
+ try: () => Promise.resolve().then(() => require("./GrokDriver-CTUNclwp.cjs")),
33026
33320
  catch: (cause) => driverImportError(grokDriverKind, input, cause)
33027
33321
  }).pipe(effect.Effect.flatMap(({ GrokDriver }) => GrokDriver.create(input)))
33028
33322
  },
@@ -33036,7 +33330,7 @@ const BUILT_IN_DRIVERS = [
33036
33330
  configSchema: require_collectUint8StreamText.OpenCodeSettings,
33037
33331
  defaultConfig: () => effect.Schema.decodeSync(require_collectUint8StreamText.OpenCodeSettings)({}),
33038
33332
  create: (input) => effect.Effect.tryPromise({
33039
- try: () => Promise.resolve().then(() => require("./OpenCodeDriver-DDEuwtXl.cjs")),
33333
+ try: () => Promise.resolve().then(() => require("./OpenCodeDriver-pXM8bSct.cjs")),
33040
33334
  catch: (cause) => driverImportError(openCodeDriverKind, input, cause)
33041
33335
  }).pipe(effect.Effect.flatMap(({ OpenCodeDriver }) => OpenCodeDriver.create(input)))
33042
33336
  }
@@ -33751,7 +34045,7 @@ const scopedSafeTeardown = (label) => (effect$28) => effect.Effect.gen(function*
33751
34045
  });
33752
34046
  //#endregion
33753
34047
  //#region package.json
33754
- var version$1 = "0.1.13";
34048
+ var version$1 = "0.1.14";
33755
34049
  //#endregion
33756
34050
  //#region src/provider/Layers/CodexProvider.ts
33757
34051
  const PROVIDER_PROBE_TIMEOUT_MS = 8e3;
@@ -34236,7 +34530,7 @@ function sortProviderSupport(left, right) {
34236
34530
  };
34237
34531
  return statusRank[left.status] - statusRank[right.status] || Number(right.enabled) - Number(left.enabled) || left.driver.localeCompare(right.driver) || left.instanceId.localeCompare(right.instanceId);
34238
34532
  }
34239
- function asRecord$4(value) {
34533
+ function asRecord$5(value) {
34240
34534
  if (value === null || typeof value !== "object" || Array.isArray(value)) return;
34241
34535
  return value;
34242
34536
  }
@@ -34244,7 +34538,7 @@ function asStringArray(value) {
34244
34538
  return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
34245
34539
  }
34246
34540
  function asStringRecord(value) {
34247
- const record = asRecord$4(value);
34541
+ const record = asRecord$5(value);
34248
34542
  if (!record) return {};
34249
34543
  const entries = Object.entries(record).filter((entry) => {
34250
34544
  const [, entryValue] = entry;
@@ -34269,7 +34563,7 @@ function asOptionalNumber(value) {
34269
34563
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
34270
34564
  }
34271
34565
  function sourceFromOrigin(origin) {
34272
- const type = asRecord$4(asRecord$4(origin)?.name)?.type;
34566
+ const type = asRecord$5(asRecord$5(origin)?.name)?.type;
34273
34567
  if (type === "user" || type === "project" || type === "system") return type;
34274
34568
  if (type === "mdm") return "managed";
34275
34569
  return "unknown";
@@ -34289,13 +34583,13 @@ function collectLayerServers(layers) {
34289
34583
  if (!layers) return [];
34290
34584
  const layerServers = [];
34291
34585
  for (const layer of layers) {
34292
- const servers = asRecord$4(asRecord$4(layer.config)?.mcp_servers);
34586
+ const servers = asRecord$5(asRecord$5(layer.config)?.mcp_servers);
34293
34587
  if (servers) layerServers.push(servers);
34294
34588
  }
34295
34589
  return layerServers;
34296
34590
  }
34297
34591
  function decodeServerConfig(raw) {
34298
- const record = asRecord$4(raw);
34592
+ const record = asRecord$5(raw);
34299
34593
  if (!record) return effect.Schema.decodeSync(require_collectUint8StreamText.McpServerConfig)({ transport: "unknown" });
34300
34594
  const input = {
34301
34595
  transport: typeof record.url === "string" ? "http" : typeof record.command === "string" ? "stdio" : "unknown",
@@ -34412,15 +34706,15 @@ function toStartupStatus(config, status) {
34412
34706
  }
34413
34707
  function extractConfigPath(layers) {
34414
34708
  const userLayer = layers?.find((layer) => {
34415
- const name = asRecord$4(layer.name);
34709
+ const name = asRecord$5(layer.name);
34416
34710
  return name?.type === "user" && typeof name.file === "string";
34417
34711
  });
34418
- const file = asRecord$4(userLayer?.name)?.file;
34712
+ const file = asRecord$5(userLayer?.name)?.file;
34419
34713
  return typeof file === "string" ? file : void 0;
34420
34714
  }
34421
34715
  function buildServers(input) {
34422
34716
  const configRecord = input.configResponse.config;
34423
- const configuredServers = asRecord$4(configRecord.mcp_servers) ?? {};
34717
+ const configuredServers = asRecord$5(configRecord.mcp_servers) ?? {};
34424
34718
  const statusByName = new Map(input.statuses.map((status) => [status.name, status]));
34425
34719
  const names = [.../* @__PURE__ */ new Set([...Object.keys(configuredServers), ...statusByName.keys()])].toSorted((left, right) => left.localeCompare(right));
34426
34720
  const layerServers = collectLayerServers(input.configResponse.layers);
@@ -34645,7 +34939,7 @@ const makeCodexMcpService = effect.Effect.gen(function* () {
34645
34939
  cwd: serverConfig.cwd,
34646
34940
  includeLayers: false
34647
34941
  })).config;
34648
- const config = mergeServerSecrets((asRecord$4(configRecord.mcp_servers) ?? {})[input.name], input);
34942
+ const config = mergeServerSecrets((asRecord$5(configRecord.mcp_servers) ?? {})[input.name], input);
34649
34943
  return yield* client.request("config/batchWrite", {
34650
34944
  edits: [{
34651
34945
  keyPath: `mcp_servers.${input.name}`,
@@ -37158,6 +37452,20 @@ const OpenLive = effect.Layer.effect(Open, make$10);
37158
37452
  */
37159
37453
  var OrchestrationEngineService = class extends effect.Context.Service()("ryco/orchestration/Services/OrchestrationEngine/OrchestrationEngineService") {};
37160
37454
  //#endregion
37455
+ //#region src/orchestration/Services/ThreadDeletionReactor.ts
37456
+ /**
37457
+ * ThreadDeletionReactor - Thread deletion cleanup reactor service interface.
37458
+ *
37459
+ * Owns background workers that react to thread deletion domain events and
37460
+ * perform best-effort runtime cleanup for provider sessions and terminals.
37461
+ *
37462
+ * @module ThreadDeletionReactor
37463
+ */
37464
+ /**
37465
+ * ThreadDeletionReactor - Service tag for thread deletion cleanup workers.
37466
+ */
37467
+ var ThreadDeletionReactor = class extends effect.Context.Service()("ryco/orchestration/Services/ThreadDeletionReactor") {};
37468
+ //#endregion
37161
37469
  //#region src/orchestration/Services/ContextHandoffInspection.ts
37162
37470
  var ContextHandoffInspection = class extends effect.Context.Service()("ryco/orchestration/Services/ContextHandoffInspection") {};
37163
37471
  //#endregion
@@ -38703,6 +39011,9 @@ var WorkspaceAccessPolicy = class extends effect.Context.Service()("ryco/workspa
38703
39011
  //#region src/provider/Services/ProviderSessionReaper.ts
38704
39012
  var ProviderSessionReaper = class extends effect.Context.Service()("ryco/provider/Services/ProviderSessionReaper") {};
38705
39013
  //#endregion
39014
+ //#region src/provider/Services/ProviderSessionDirectory.ts
39015
+ var ProviderSessionDirectory = class extends effect.Context.Service()("ryco/provider/Services/ProviderSessionDirectory") {};
39016
+ //#endregion
38706
39017
  //#region ../../packages/shared/src/qrCode.ts
38707
39018
  var QrCode = class QrCode {
38708
39019
  static Ecc;
@@ -39917,6 +40228,86 @@ const validateRestrictedWorkspaceSnapshot = (snapshot) => effect.Effect.gen(func
39917
40228
  operation: "persisted worktree startup validation"
39918
40229
  }), { discard: true });
39919
40230
  }).pipe(effect.Effect.mapError(incompatibleWorkspaceStateError));
40231
+ const ORPHANED_PROVIDER_SESSION_ERROR = "Provider session did not survive a server restart. Send a new message to continue.";
40232
+ function clearRuntimePayloadActiveTurn(runtimePayload) {
40233
+ if (typeof runtimePayload === "object" && runtimePayload !== null && !Array.isArray(runtimePayload)) return {
40234
+ ...runtimePayload,
40235
+ activeTurnId: null
40236
+ };
40237
+ return { activeTurnId: null };
40238
+ }
40239
+ /**
40240
+ * Settle projected provider sessions whose native process did not survive this
40241
+ * server process. This runs after the provider/orchestration roots subscribe,
40242
+ * but before the startup command gate opens, so repaired state is authoritative
40243
+ * before clients can mutate it.
40244
+ */
40245
+ const reconcileOrphanedProviderSessions = effect.Effect.gen(function* () {
40246
+ const directory = yield* ProviderSessionDirectory;
40247
+ const orchestrationEngine = yield* OrchestrationEngineService;
40248
+ const providerService = yield* ProviderService;
40249
+ const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
40250
+ const liveSessionsExit = yield* effect.Effect.exit(providerService.listSessions());
40251
+ if (effect.Exit.isFailure(liveSessionsExit)) {
40252
+ if (effect.Cause.hasInterrupts(liveSessionsExit.cause)) return yield* effect.Effect.failCause(liveSessionsExit.cause);
40253
+ yield* effect.Effect.logWarning("provider session startup inventory failed", { cause: effect.Cause.pretty(liveSessionsExit.cause) });
40254
+ return;
40255
+ }
40256
+ const liveThreadIds = new Set(liveSessionsExit.value.map((session) => session.threadId));
40257
+ const orphanedThreads = (yield* projectionSnapshotQuery.getCommandReadModel()).threads.filter((thread) => thread.session !== null && (thread.session.status === "starting" || thread.session.status === "running" || thread.session.activeTurnId !== null) && !liveThreadIds.has(thread.id));
40258
+ for (const thread of orphanedThreads) {
40259
+ const session = thread.session;
40260
+ if (session === null) continue;
40261
+ yield* effect.Effect.gen(function* () {
40262
+ const binding = yield* directory.getBinding(thread.id);
40263
+ if (effect.Option.isNone(binding)) return;
40264
+ yield* providerService.stopSessionBinding(binding.value).pipe(effect.Effect.catchCause((cause) => effect.Cause.hasInterrupts(cause) ? effect.Effect.failCause(cause) : effect.Effect.logWarning("failed to stop orphaned provider runtime binding", {
40265
+ threadId: thread.id,
40266
+ cause: effect.Cause.pretty(cause)
40267
+ })));
40268
+ yield* directory.upsert({
40269
+ ...binding.value,
40270
+ status: "stopped",
40271
+ runtimePayload: clearRuntimePayloadActiveTurn(binding.value.runtimePayload)
40272
+ });
40273
+ }).pipe(effect.Effect.catchCause((cause) => effect.Cause.hasInterrupts(cause) ? effect.Effect.failCause(cause) : effect.Effect.logWarning("failed to reconcile orphaned provider session binding", {
40274
+ threadId: thread.id,
40275
+ cause: effect.Cause.pretty(cause)
40276
+ })));
40277
+ const reconciledAt = (/* @__PURE__ */ new Date()).toISOString();
40278
+ if (session.activeTurnId !== null) {
40279
+ const interruptCommand = {
40280
+ type: "thread.turn.interrupt",
40281
+ commandId: require_collectUint8StreamText.CommandId.make(`provider:startup-reconciliation:turn-interrupt:${crypto.randomUUID()}`),
40282
+ threadId: thread.id,
40283
+ turnId: session.activeTurnId,
40284
+ createdAt: reconciledAt
40285
+ };
40286
+ yield* effect.Effect.suspend(() => orchestrationEngine.dispatch(interruptCommand)).pipe(effect.Effect.retry(effect.Schedule.recurs(1)), effect.Effect.catchCause((cause) => effect.Cause.hasInterrupts(cause) ? effect.Effect.failCause(cause) : effect.Effect.logWarning("failed to settle orphaned provider turn projection", {
40287
+ threadId: thread.id,
40288
+ turnId: session.activeTurnId,
40289
+ cause: effect.Cause.pretty(cause)
40290
+ })));
40291
+ }
40292
+ const sessionCommand = {
40293
+ type: "thread.session.set",
40294
+ commandId: require_collectUint8StreamText.CommandId.make(`server:startup-reconciliation:${crypto.randomUUID()}`),
40295
+ threadId: thread.id,
40296
+ session: {
40297
+ ...session,
40298
+ status: "error",
40299
+ activeTurnId: null,
40300
+ lastError: ORPHANED_PROVIDER_SESSION_ERROR,
40301
+ updatedAt: reconciledAt
40302
+ },
40303
+ createdAt: reconciledAt
40304
+ };
40305
+ yield* effect.Effect.suspend(() => orchestrationEngine.dispatch(sessionCommand)).pipe(effect.Effect.retry(effect.Schedule.recurs(1)), effect.Effect.catchCause((cause) => effect.Cause.hasInterrupts(cause) ? effect.Effect.failCause(cause) : effect.Effect.logWarning("failed to settle orphaned provider session projection", {
40306
+ threadId: thread.id,
40307
+ cause: effect.Cause.pretty(cause)
40308
+ })));
40309
+ }
40310
+ }).pipe(effect.Effect.catchCause((cause) => effect.Cause.hasInterrupts(cause) ? effect.Effect.failCause(cause) : effect.Effect.logWarning("provider session startup reconciliation failed", { cause: effect.Cause.pretty(cause) })));
39920
40311
  const makeServerRuntimeStartup = effect.Effect.gen(function* () {
39921
40312
  const runtimeStartedAt = Date.now();
39922
40313
  const serverConfig = yield* require_Metrics.ServerConfig;
@@ -39951,6 +40342,8 @@ const makeServerRuntimeStartup = effect.Effect.gen(function* () {
39951
40342
  concurrency: "unbounded",
39952
40343
  discard: true
39953
40344
  }));
40345
+ yield* effect.Effect.logDebug("startup phase: reconciling orphaned provider sessions");
40346
+ yield* runStartupPhase("provider-sessions.reconcile", reconcileOrphanedProviderSessions);
39954
40347
  const welcomeBase = yield* resolveWelcomeBase;
39955
40348
  const environment = yield* serverEnvironment.getDescriptor;
39956
40349
  yield* effect.Effect.logDebug("startup phase: preparing welcome payload");
@@ -41707,6 +42100,7 @@ const make$9 = effect.Effect.fn("makeGitWorkflowService")(function* () {
41707
42100
  listRefs: (input) => detectGitRepositoryForCommand("GitWorkflowService.listRefs", input.cwd).pipe(effect.Effect.flatMap((isGitRepository) => isGitRepository ? git.listRefs(input).pipe(effect.Effect.catch(recoverMissingCwd(input.cwd, nonRepositoryListRefs()))) : effect.Effect.succeed(nonRepositoryListRefs()))),
41708
42101
  createWorktree: (input) => ensureGitCommand("GitWorkflowService.createWorktree", input.cwd).pipe(effect.Effect.andThen(git.createWorktree(input))),
41709
42102
  removeWorktree: (input) => ensureGitCommand("GitWorkflowService.removeWorktree", input.cwd).pipe(effect.Effect.andThen(git.removeWorktree(input))),
42103
+ pruneWorktrees: (cwd) => ensureGitCommand("GitWorkflowService.pruneWorktrees", cwd).pipe(effect.Effect.andThen(git.pruneWorktrees(cwd))),
41710
42104
  listWorktreePaths: (cwd) => {
41711
42105
  const empty = [];
41712
42106
  return detectGitRepositoryForCommand("GitWorkflowService.listWorktreePaths", cwd).pipe(effect.Effect.flatMap((isGitRepository) => isGitRepository ? git.listWorktreePaths(cwd).pipe(effect.Effect.catch(recoverMissingCwd(cwd, empty))) : effect.Effect.succeed(empty)));
@@ -44882,6 +45276,7 @@ const makeWsRpcContext = (principal) => effect.Effect.gen(function* () {
44882
45276
  const usageServiceOption = yield* effect.Effect.serviceOption(UsageService);
44883
45277
  const usageService = effect.Option.getOrElse(usageServiceOption, () => UsageServiceTest);
44884
45278
  const orchestrationEngine = yield* OrchestrationEngineService;
45279
+ const threadDeletionReactor = yield* ThreadDeletionReactor;
44885
45280
  const contextHandoffInspection = yield* effect.Effect.serviceOption(ContextHandoffInspection);
44886
45281
  const threadPriorityCoordinator = yield* effect.Effect.serviceOption(ThreadPriorityCoordinator);
44887
45282
  const agentControlProposals = yield* effect.Effect.serviceOption(AgentControlProposalService);
@@ -45099,7 +45494,7 @@ const makeWsRpcContext = (principal) => effect.Effect.gen(function* () {
45099
45494
  })() : effect.Effect.void;
45100
45495
  return yield* effect.Effect.gen(function* () {
45101
45496
  if (bootstrap?.createThread) {
45102
- yield* orchestrationEngine.dispatch({
45497
+ const created = yield* orchestrationEngine.dispatch({
45103
45498
  type: "thread.create",
45104
45499
  commandId: serverCommandId("bootstrap-thread-create"),
45105
45500
  threadId: command.threadId,
@@ -45112,6 +45507,7 @@ const makeWsRpcContext = (principal) => effect.Effect.gen(function* () {
45112
45507
  worktreePath: bootstrap.createThread.worktreePath,
45113
45508
  createdAt: bootstrap.createThread.createdAt
45114
45509
  });
45510
+ yield* threadDeletionReactor.drainThrough(created.sequence);
45115
45511
  createdThread = true;
45116
45512
  }
45117
45513
  if (bootstrap?.prepareWorktree) {
@@ -45148,7 +45544,7 @@ const makeWsRpcContext = (principal) => effect.Effect.gen(function* () {
45148
45544
  }));
45149
45545
  });
45150
45546
  const dispatchNormalizedCommand = (normalizedCommand) => {
45151
- const dispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap ? dispatchBootstrapTurnStart(normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand).pipe(effect.Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45547
+ const dispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap ? dispatchBootstrapTurnStart(normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand).pipe(effect.Effect.tap(({ sequence }) => normalizedCommand.type === "thread.create" ? threadDeletionReactor.drainThrough(sequence) : effect.Effect.void), effect.Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45152
45548
  return startup.enqueueCommand(dispatchEffect).pipe(effect.Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45153
45549
  };
45154
45550
  const loadDiagnosticsMetrics = localDiagnosticsMetrics.snapshot;
@@ -45536,18 +45932,24 @@ const normalizeDispatchCommand = (command) => effect.Effect.gen(function* () {
45536
45932
  ...command.projectMetadataDir !== void 0 ? { projectMetadataDir: yield* normalizeProjectMetadataDir(command.projectMetadataDir) } : {}
45537
45933
  };
45538
45934
  if (command.type !== "thread.turn.start" && command.type !== "thread.turn.steer") return command;
45539
- const normalizedAttachments = yield* effect.Effect.forEach(command.message.attachments, (attachment) => effect.Effect.gen(function* () {
45935
+ const preparedAttachments = yield* effect.Effect.forEach(command.message.attachments, (attachment) => effect.Effect.gen(function* () {
45540
45936
  const parsed = parseBase64DataUrl(attachment.dataUrl);
45541
- if (!parsed || !parsed.mimeType.startsWith("image/")) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Invalid image attachment payload for '${attachment.name}'.` });
45542
- const bytes = Buffer.from(parsed.base64, "base64");
45543
- if (bytes.byteLength === 0 || bytes.byteLength > 10485760) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Image attachment '${attachment.name}' is empty or too large.` });
45937
+ if (!parsed) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' must use a valid base64 data URL.` });
45938
+ const normalizedMimeType = parsed.mimeType.toLowerCase();
45939
+ if (normalizedMimeType !== attachment.mimeType.toLowerCase()) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' declares '${attachment.mimeType}' but its payload is '${parsed.mimeType}'.` });
45940
+ if (attachment.type === "image" && !normalizedMimeType.startsWith("image/")) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Image attachment '${attachment.name}' must use an image MIME type.` });
45941
+ const normalizedBase64 = parsed.base64.replace(/\s+/g, "");
45942
+ const bytes = Buffer.from(normalizedBase64, "base64");
45943
+ if (bytes.byteLength === 0 || bytes.toString("base64") !== normalizedBase64 || bytes.byteLength !== attachment.sizeBytes) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' has invalid base64 data or mismatched size metadata.` });
45944
+ const attachmentLimit = attachment.type === "image" ? require_collectUint8StreamText.PROVIDER_SEND_TURN_MAX_IMAGE_BYTES : require_collectUint8StreamText.PROVIDER_SEND_TURN_MAX_FILE_BYTES;
45945
+ if (bytes.byteLength > attachmentLimit) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' is ${bytes.byteLength} bytes; limit is ${attachmentLimit} bytes.` });
45544
45946
  const attachmentId = createAttachmentId(command.threadId);
45545
45947
  if (!attachmentId) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: "Failed to create a safe attachment id." });
45546
45948
  const persistedAttachment = {
45547
- type: "image",
45949
+ type: attachment.type,
45548
45950
  id: attachmentId,
45549
45951
  name: attachment.name,
45550
- mimeType: parsed.mimeType.toLowerCase(),
45952
+ mimeType: normalizedMimeType,
45551
45953
  sizeBytes: bytes.byteLength
45552
45954
  };
45553
45955
  const attachmentPath = resolveAttachmentPath({
@@ -45555,10 +45957,22 @@ const normalizeDispatchCommand = (command) => effect.Effect.gen(function* () {
45555
45957
  attachment: persistedAttachment
45556
45958
  });
45557
45959
  if (!attachmentPath) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Failed to resolve persisted path for '${attachment.name}'.` });
45558
- yield* fileSystem.makeDirectory(path.dirname(attachmentPath), { recursive: true }).pipe(effect.Effect.mapError(() => new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Failed to create attachment directory for '${attachment.name}'.` })));
45559
- yield* fileSystem.writeFile(attachmentPath, bytes).pipe(effect.Effect.mapError(() => new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Failed to persist attachment '${attachment.name}'.` })));
45560
- return persistedAttachment;
45960
+ return {
45961
+ attachment: persistedAttachment,
45962
+ attachmentPath,
45963
+ bytes
45964
+ };
45561
45965
  }), { concurrency: 1 });
45966
+ const totalAttachmentBytes = preparedAttachments.reduce((total, prepared) => total + prepared.bytes.byteLength, 0);
45967
+ if (totalAttachmentBytes > 52428800) return yield* new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Attachments total ${totalAttachmentBytes} bytes; limit is ${require_collectUint8StreamText.PROVIDER_SEND_TURN_MAX_ATTACHMENT_TOTAL_BYTES} bytes.` });
45968
+ yield* effect.Effect.forEach(preparedAttachments, ({ attachment, attachmentPath, bytes }) => fileSystem.makeDirectory(path.dirname(attachmentPath), { recursive: true }).pipe(effect.Effect.mapError(() => new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Failed to create attachment directory for '${attachment.name}'.` })), effect.Effect.andThen(fileSystem.writeFile(attachmentPath, bytes).pipe(effect.Effect.mapError(() => new require_collectUint8StreamText.OrchestrationDispatchCommandError({ message: `Failed to persist attachment '${attachment.name}'.` }))))), {
45969
+ concurrency: 1,
45970
+ discard: true
45971
+ }).pipe(effect.Effect.onError(() => effect.Effect.forEach(preparedAttachments, ({ attachmentPath }) => fileSystem.remove(attachmentPath).pipe(effect.Effect.ignore), {
45972
+ concurrency: 1,
45973
+ discard: true
45974
+ })));
45975
+ const normalizedAttachments = preparedAttachments.map(({ attachment }) => attachment);
45562
45976
  return {
45563
45977
  ...command,
45564
45978
  message: {
@@ -47776,10 +48190,10 @@ const ContextHandoffDocument = effect.Schema.Struct({
47776
48190
  subagents: effect.Schema.Array(ContextHandoffSubagentEntry),
47777
48191
  priorHandoffs: effect.Schema.Array(ContextHandoffBoundaryEntry)
47778
48192
  });
47779
- function asRecord$3(value) {
48193
+ function asRecord$4(value) {
47780
48194
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
47781
48195
  }
47782
- function asTrimmedString$1(value) {
48196
+ function asTrimmedString$2(value) {
47783
48197
  if (typeof value !== "string") return;
47784
48198
  const trimmed = value.trim();
47785
48199
  return trimmed.length > 0 ? trimmed : void 0;
@@ -47798,7 +48212,7 @@ function truncateUnicodeSafe(value, maxChars) {
47798
48212
  return value.slice(0, end);
47799
48213
  }
47800
48214
  function boundedString(value, maxChars) {
47801
- const normalized = asTrimmedString$1(value);
48215
+ const normalized = asTrimmedString$2(value);
47802
48216
  if (!normalized) return { truncated: false };
47803
48217
  const bounded = truncateUnicodeSafe(normalized, maxChars);
47804
48218
  return {
@@ -47850,7 +48264,7 @@ function boundedEndpoint(endpoint) {
47850
48264
  };
47851
48265
  }
47852
48266
  function activityPayload(activity) {
47853
- return asRecord$3(activity.payload);
48267
+ return asRecord$4(activity.payload);
47854
48268
  }
47855
48269
  function decodeHandoffPayload(activity) {
47856
48270
  if (activity.kind !== "context-handoff") return;
@@ -47937,7 +48351,7 @@ function collectRuntimePlan(activities) {
47937
48351
  if (!Array.isArray(payload?.plan)) continue;
47938
48352
  let truncated = payload.plan.length > MAX_PLAN_STEPS;
47939
48353
  const steps = payload.plan.slice(0, MAX_PLAN_STEPS).flatMap((entry) => {
47940
- const record = asRecord$3(entry);
48354
+ const record = asRecord$4(entry);
47941
48355
  const step = boundedString(record?.step, DETAIL_MAX_CHARS);
47942
48356
  if (!step.value) return [];
47943
48357
  truncated ||= step.truncated;
@@ -47964,21 +48378,21 @@ function collectRuntimePlan(activities) {
47964
48378
  return latest ? [latest] : [];
47965
48379
  }
47966
48380
  function normalizeCommand(value) {
47967
- const direct = asTrimmedString$1(value);
48381
+ const direct = asTrimmedString$2(value);
47968
48382
  if (direct) return direct;
47969
48383
  if (!Array.isArray(value)) return;
47970
48384
  const parts = value.flatMap((entry) => {
47971
- const part = asTrimmedString$1(entry);
48385
+ const part = asTrimmedString$2(entry);
47972
48386
  return part ? [part] : [];
47973
48387
  });
47974
48388
  return parts.length > 0 ? parts.join(" ") : void 0;
47975
48389
  }
47976
48390
  function extractCommand(payload) {
47977
- const data = asRecord$3(payload.data);
47978
- const item = asRecord$3(data?.item);
47979
- const input = asRecord$3(item?.input);
47980
- const result = asRecord$3(item?.result);
47981
- const rawInput = asRecord$3(data?.rawInput);
48391
+ const data = asRecord$4(payload.data);
48392
+ const item = asRecord$4(data?.item);
48393
+ const input = asRecord$4(item?.input);
48394
+ const result = asRecord$4(item?.result);
48395
+ const rawInput = asRecord$4(data?.rawInput);
47982
48396
  for (const candidate of [
47983
48397
  item?.command,
47984
48398
  input?.command,
@@ -47989,7 +48403,7 @@ function extractCommand(payload) {
47989
48403
  const command = normalizeCommand(candidate);
47990
48404
  if (command) return command;
47991
48405
  }
47992
- const executable = asTrimmedString$1(rawInput?.executable);
48406
+ const executable = asTrimmedString$2(rawInput?.executable);
47993
48407
  const args = normalizeCommand(rawInput?.args);
47994
48408
  return executable ? args ? `${executable} ${args}` : executable : void 0;
47995
48409
  }
@@ -47997,36 +48411,36 @@ function textFromContentArray(value) {
47997
48411
  if (!Array.isArray(value)) return;
47998
48412
  const chunks = [];
47999
48413
  for (const entry of value) {
48000
- const record = asRecord$3(entry);
48001
- const direct = asTrimmedString$1(record?.text);
48002
- const nested = asTrimmedString$1(asRecord$3(record?.content)?.text);
48414
+ const record = asRecord$4(entry);
48415
+ const direct = asTrimmedString$2(record?.text);
48416
+ const nested = asTrimmedString$2(asRecord$4(record?.content)?.text);
48003
48417
  if (direct) chunks.push(direct);
48004
48418
  else if (nested) chunks.push(nested);
48005
48419
  }
48006
48420
  return chunks.length > 0 ? chunks.join("\n") : void 0;
48007
48421
  }
48008
48422
  function extractOutput(payload) {
48009
- const data = asRecord$3(payload.data);
48010
- const item = asRecord$3(data?.item);
48011
- if (item?.type === "commandExecution") return asTrimmedString$1(item.aggregatedOutput);
48423
+ const data = asRecord$4(payload.data);
48424
+ const item = asRecord$4(data?.item);
48425
+ if (item?.type === "commandExecution") return asTrimmedString$2(item.aggregatedOutput);
48012
48426
  if (item?.type === "mcpToolCall") {
48013
- const error = asTrimmedString$1(asRecord$3(item.error)?.message);
48427
+ const error = asTrimmedString$2(asRecord$4(item.error)?.message);
48014
48428
  if (error) return error;
48015
- const content = textFromContentArray(asRecord$3(item.result)?.content);
48429
+ const content = textFromContentArray(asRecord$4(item.result)?.content);
48016
48430
  if (content) return content;
48017
48431
  }
48018
48432
  if (item?.type === "dynamicToolCall") {
48019
48433
  const content = textFromContentArray(item.contentItems);
48020
48434
  if (content) return content;
48021
48435
  }
48022
- const rawOutput = asRecord$3(data?.rawOutput);
48023
- return asTrimmedString$1(rawOutput?.stdout) ?? asTrimmedString$1(rawOutput?.stderr) ?? asTrimmedString$1(rawOutput?.content) ?? textFromContentArray(data?.content);
48436
+ const rawOutput = asRecord$4(data?.rawOutput);
48437
+ return asTrimmedString$2(rawOutput?.stdout) ?? asTrimmedString$2(rawOutput?.stderr) ?? asTrimmedString$2(rawOutput?.content) ?? textFromContentArray(data?.content);
48024
48438
  }
48025
48439
  function extractExitCode(payload) {
48026
- const data = asRecord$3(payload.data);
48027
- const item = asRecord$3(data?.item);
48028
- const itemResult = asRecord$3(item?.result);
48029
- const rawOutput = asRecord$3(data?.rawOutput);
48440
+ const data = asRecord$4(payload.data);
48441
+ const item = asRecord$4(data?.item);
48442
+ const itemResult = asRecord$4(item?.result);
48443
+ const rawOutput = asRecord$4(data?.rawOutput);
48030
48444
  for (const candidate of [
48031
48445
  item?.exitCode,
48032
48446
  itemResult?.exitCode,
@@ -48035,7 +48449,7 @@ function extractExitCode(payload) {
48035
48449
  const exitCode = asInteger(candidate);
48036
48450
  if (exitCode !== void 0) return exitCode;
48037
48451
  }
48038
- const detail = asTrimmedString$1(payload.detail);
48452
+ const detail = asTrimmedString$2(payload.detail);
48039
48453
  const match = detail ? /<exited with exit code (?<code>-?\d+)>\s*$/iu.exec(detail) : null;
48040
48454
  const parsed = Number.parseInt(match?.groups?.code ?? "", 10);
48041
48455
  return Number.isInteger(parsed) ? parsed : void 0;
@@ -48049,7 +48463,7 @@ function pathFromRecord(record) {
48049
48463
  "newPath",
48050
48464
  "oldPath"
48051
48465
  ]) {
48052
- const path = asTrimmedString$1(record[key]);
48466
+ const path = asTrimmedString$2(record[key]);
48053
48467
  if (path) return truncateUnicodeSafe(path, PATH_MAX_CHARS);
48054
48468
  }
48055
48469
  }
@@ -48070,7 +48484,7 @@ function collectPathsAndChanges(value) {
48070
48484
  for (const entry of current) visit(entry, depth + 1);
48071
48485
  return;
48072
48486
  }
48073
- const record = asRecord$3(current);
48487
+ const record = asRecord$4(current);
48074
48488
  if (!record || seenObjects.has(record)) return;
48075
48489
  seenObjects.add(record);
48076
48490
  const path = pathFromRecord(record);
@@ -48124,10 +48538,10 @@ function extractTool(activity) {
48124
48538
  const lifecycle = toolLifecycle(activity.kind);
48125
48539
  const payload = activityPayload(activity);
48126
48540
  if (!lifecycle || !payload || !effect.Schema.is(require_collectUint8StreamText.ToolLifecycleItemType)(payload.itemType)) return;
48127
- const data = asRecord$3(payload.data);
48128
- const providerRefs = asRecord$3(payload.providerRefs);
48129
- const providerItemId = asTrimmedString$1(payload.providerItemId) ?? asTrimmedString$1(providerRefs?.providerItemId);
48130
- const toolCallId = asTrimmedString$1(data?.toolCallId);
48541
+ const data = asRecord$4(payload.data);
48542
+ const providerRefs = asRecord$4(payload.providerRefs);
48543
+ const providerItemId = asTrimmedString$2(payload.providerItemId) ?? asTrimmedString$2(providerRefs?.providerItemId);
48544
+ const toolCallId = asTrimmedString$2(data?.toolCallId);
48131
48545
  const command = boundedString(extractCommand(payload), TOOL_COMMAND_MAX_CHARS);
48132
48546
  const output = boundedString(extractOutput(payload), TOOL_OUTPUT_MAX_CHARS);
48133
48547
  const detail = boundedString(payload.detail, DETAIL_MAX_CHARS);
@@ -48219,7 +48633,7 @@ function parseQuestions(payload) {
48219
48633
  let truncated = payload.questions.length > MAX_QUESTIONS_PER_REQUEST;
48220
48634
  return {
48221
48635
  questions: payload.questions.slice(0, MAX_QUESTIONS_PER_REQUEST).flatMap((value) => {
48222
- const record = asRecord$3(value);
48636
+ const record = asRecord$4(value);
48223
48637
  const id = boundedString(record?.id, LABEL_MAX_CHARS);
48224
48638
  const header = boundedString(record?.header, LABEL_MAX_CHARS);
48225
48639
  const question = boundedString(record?.question, QUESTION_MAX_CHARS);
@@ -48228,7 +48642,7 @@ function parseQuestions(payload) {
48228
48642
  const rawOptions = Array.isArray(record?.options) ? record.options : [];
48229
48643
  truncated ||= rawOptions.length > MAX_OPTIONS_PER_QUESTION;
48230
48644
  const options = rawOptions.slice(0, MAX_OPTIONS_PER_QUESTION).flatMap((option) => {
48231
- const label = boundedString(asRecord$3(option)?.label, LABEL_MAX_CHARS);
48645
+ const label = boundedString(asRecord$4(option)?.label, LABEL_MAX_CHARS);
48232
48646
  truncated ||= label.truncated;
48233
48647
  return label.value ? [label.value] : [];
48234
48648
  });
@@ -48269,7 +48683,7 @@ function collectNotices(activities) {
48269
48683
  const failure = failureFromActivity(activity);
48270
48684
  if (failure) failures.push(failure);
48271
48685
  const payload = activityPayload(activity);
48272
- const requestId = asTrimmedString$1(payload?.requestId);
48686
+ const requestId = asTrimmedString$2(payload?.requestId);
48273
48687
  if (!requestId) continue;
48274
48688
  if (activity.kind === "user-input.resolved") {
48275
48689
  pendingQuestions.delete(requestId);
@@ -48296,7 +48710,7 @@ function collectSubagents(activities) {
48296
48710
  for (const activity of activities.toSorted(compareOrdered)) {
48297
48711
  if (activity.kind !== "subagent.completed") continue;
48298
48712
  const payload = activityPayload(activity);
48299
- const subagent = asRecord$3(payload?.subagent);
48713
+ const subagent = asRecord$4(payload?.subagent);
48300
48714
  const subagentId = boundedString(subagent?.subagentId, LABEL_MAX_CHARS);
48301
48715
  const status = payload?.status;
48302
48716
  if (!subagentId.value || !effect.Schema.is(require_collectUint8StreamText.RuntimeSubagentStatus)(status)) continue;
@@ -50315,10 +50729,10 @@ const DEVICE_CAPABILITY_IDS = [
50315
50729
  "accessibility",
50316
50730
  "encoder"
50317
50731
  ];
50318
- const asRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
50732
+ const asRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
50319
50733
  const asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
50320
50734
  const parseToolchain = (value) => {
50321
- const record = asRecord$2(value);
50735
+ const record = asRecord$3(value);
50322
50736
  if (!record) return void 0;
50323
50737
  const toolchain = {
50324
50738
  xcodeVersion: asNonEmptyString(record["xcodeVersion"]),
@@ -50340,7 +50754,7 @@ const parseCapability = (id, raw) => {
50340
50754
  id,
50341
50755
  ok: true
50342
50756
  };
50343
- const record = asRecord$2(raw);
50757
+ const record = asRecord$3(raw);
50344
50758
  if (!record) return {
50345
50759
  id,
50346
50760
  ok: false,
@@ -50373,7 +50787,7 @@ const parseHelperProbe = (stdout) => {
50373
50787
  error: "The device helper preflight returned unreadable output."
50374
50788
  };
50375
50789
  }
50376
- const record = asRecord$2(parsed);
50790
+ const record = asRecord$3(parsed);
50377
50791
  if (!record) return {
50378
50792
  ok: false,
50379
50793
  capabilities: DEVICE_CAPABILITY_IDS.map((id) => ({
@@ -50384,7 +50798,7 @@ const parseHelperProbe = (stdout) => {
50384
50798
  toolchain: void 0,
50385
50799
  error: "The device helper preflight returned unreadable output."
50386
50800
  };
50387
- const capabilitiesRecord = asRecord$2(record["capabilities"]);
50801
+ const capabilitiesRecord = asRecord$3(record["capabilities"]);
50388
50802
  const error = asNonEmptyString(record["error"]);
50389
50803
  if (!capabilitiesRecord) {
50390
50804
  const ok = record["ok"] === true;
@@ -50637,7 +51051,7 @@ var DeviceHelperError = class extends Error {
50637
51051
  this.code = code;
50638
51052
  }
50639
51053
  };
50640
- function asRecord$1(value) {
51054
+ function asRecord$2(value) {
50641
51055
  return typeof value === "object" && value !== null ? value : {};
50642
51056
  }
50643
51057
  /**
@@ -50773,8 +51187,8 @@ var HelperClient = class {
50773
51187
  async attach(udid, options = {}) {
50774
51188
  if (!options.force && this.attachment?.udid === udid) return this.attachment;
50775
51189
  this.attachment = null;
50776
- const result = asRecord$1(await this.request(HELPER_METHODS.attach, { udid }));
50777
- const capabilities = asRecord$1(result.capabilities);
51190
+ const result = asRecord$2(await this.request(HELPER_METHODS.attach, { udid }));
51191
+ const capabilities = asRecord$2(result.capabilities);
50778
51192
  const pixelWidth = readNumber(result, "pixelWidth", 0);
50779
51193
  const pixelHeight = readNumber(result, "pixelHeight", 0);
50780
51194
  const scale = readNumber(result, "scale", 3);
@@ -50928,14 +51342,14 @@ var HelperClient = class {
50928
51342
  } catch {
50929
51343
  return;
50930
51344
  }
50931
- const record = asRecord$1(message);
51345
+ const record = asRecord$2(message);
50932
51346
  if (typeof record.id !== "number") return;
50933
51347
  const request = this.pending.get(record.id);
50934
51348
  if (!request) return;
50935
51349
  this.pending.delete(record.id);
50936
51350
  clearTimeout(request.timer);
50937
51351
  if (record.error !== void 0 && record.error !== null) {
50938
- const error = asRecord$1(record.error);
51352
+ const error = asRecord$2(record.error);
50939
51353
  request.reject(new DeviceHelperError(typeof error.code === "number" ? `helper_${error.code}` : "helper_error", typeof error.message === "string" ? error.message : "Device helper reported an error"));
50940
51354
  return;
50941
51355
  }
@@ -75007,9 +75421,6 @@ effect.Schema.Struct({ threadId: require_collectUint8StreamText.ThreadId });
75007
75421
  */
75008
75422
  var ProviderSessionRuntimeRepository = class extends effect.Context.Service()("ryco/persistence/Services/ProviderSessionRuntime/ProviderSessionRuntimeRepository") {};
75009
75423
  //#endregion
75010
- //#region src/provider/Services/ProviderSessionDirectory.ts
75011
- var ProviderSessionDirectory = class extends effect.Context.Service()("ryco/provider/Services/ProviderSessionDirectory") {};
75012
- //#endregion
75013
75424
  //#region src/provider/Layers/ProviderSessionDirectory.ts
75014
75425
  function toPersistenceError(operation) {
75015
75426
  return (cause) => new ProviderSessionDirectoryPersistenceError({
@@ -75694,6 +76105,12 @@ const ProviderEventLoggersLive = effect.Layer.effect(ProviderEventLoggers, effec
75694
76105
  };
75695
76106
  }));
75696
76107
  //#endregion
76108
+ //#region ../../packages/shared/src/providerCapabilities.ts
76109
+ /** Drivers whose native turn API accepts arbitrary file bytes, not only images. */
76110
+ function providerSupportsGeneralFileAttachments(provider) {
76111
+ return provider === "copilot" || provider === "opencode";
76112
+ }
76113
+ //#endregion
75697
76114
  //#region src/provider/Layers/ProviderService.ts
75698
76115
  /**
75699
76116
  * ProviderServiceLive - Cross-provider orchestration layer.
@@ -76240,6 +76657,8 @@ const makeProviderService = effect.Effect.fn("makeProviderService")(function* (o
76240
76657
  });
76241
76658
  metricProvider = routed.adapter.provider;
76242
76659
  metricModel = input.modelSelection?.model;
76660
+ const unsupportedFile = input.attachments.find((attachment) => attachment.type === "file");
76661
+ if (unsupportedFile && !providerSupportsGeneralFileAttachments(routed.adapter.provider)) return yield* toValidationError("ProviderService.sendTurn", `Provider '${routed.adapter.provider}' does not accept general file attachments. Add '${unsupportedFile.name}' to the workspace and reference its path instead.`);
76243
76662
  yield* effect.Effect.annotateCurrentSpan({
76244
76663
  "provider.kind": routed.adapter.provider,
76245
76664
  ...input.modelSelection?.model ? { "provider.model": input.modelSelection.model } : {}
@@ -76314,6 +76733,8 @@ const makeProviderService = effect.Effect.fn("makeProviderService")(function* (o
76314
76733
  allowRecovery: false
76315
76734
  });
76316
76735
  if (!routed.isActive || routed.session === void 0) return yield* new ProviderSessionNotFoundError({ threadId: input.threadId });
76736
+ const unsupportedFile = input.attachments.find((attachment) => attachment.type === "file");
76737
+ if (unsupportedFile && !providerSupportsGeneralFileAttachments(routed.adapter.provider)) return yield* toValidationError("ProviderService.steerTurn", `Provider '${routed.adapter.provider}' does not accept general file attachments. Add '${unsupportedFile.name}' to the workspace and reference its path instead.`);
76317
76738
  if (routed.session.activeTurnId !== input.expectedTurnId) return yield* toValidationError("ProviderService.steerTurn", `Expected active turn '${input.expectedTurnId}', found '${routed.session.activeTurnId ?? "none"}'.`);
76318
76739
  const steer = routed.adapter.steerTurn;
76319
76740
  if (routed.adapter.capabilities.turnSteering !== "native" || steer === void 0) return yield* toValidationError("ProviderService.steerTurn", `Provider '${routed.adapter.provider}' does not support active-turn steering.`);
@@ -76758,13 +77179,13 @@ function openCodeQuestionId(index, question) {
76758
77179
  function toOpenCodeFileParts(input) {
76759
77180
  const parts = [];
76760
77181
  for (const attachment of input.attachments ?? []) {
76761
- const attachmentPath = input.resolveAttachmentPath(attachment);
76762
- if (!attachmentPath) continue;
77182
+ const attachmentUrl = input.resolveAttachmentUrl(attachment);
77183
+ if (!attachmentUrl) continue;
76763
77184
  parts.push({
76764
77185
  type: "file",
76765
77186
  mime: attachment.mimeType,
76766
77187
  filename: attachment.name,
76767
- url: (0, node_url.pathToFileURL)(attachmentPath).href
77188
+ url: attachmentUrl
76768
77189
  });
76769
77190
  }
76770
77191
  return parts;
@@ -77571,12 +77992,10 @@ const TERMINAL_ENV_BLOCKLIST = /* @__PURE__ */ new Set([
77571
77992
  var TerminalSubprocessCheckError = class extends effect.Schema.TaggedError()("TerminalSubprocessCheckError", {
77572
77993
  message: effect.Schema.String,
77573
77994
  cause: effect.Schema.optional(effect.Schema.Defect()),
77574
- terminalPid: effect.Schema.Number,
77575
- command: effect.Schema.Literals([
77576
- "powershell",
77577
- "pgrep",
77578
- "ps"
77579
- ])
77995
+ command: effect.Schema.Literals(["powershell", "ps"]),
77996
+ exitCode: effect.Schema.optional(effect.Schema.NullOr(effect.Schema.Number)),
77997
+ timedOut: effect.Schema.optional(effect.Schema.Boolean),
77998
+ stdoutTruncated: effect.Schema.optional(effect.Schema.Boolean)
77580
77999
  }) {};
77581
78000
  var TerminalProcessSignalError = class extends effect.Schema.TaggedError()("TerminalProcessSignalError", {
77582
78001
  message: effect.Schema.String,
@@ -77796,81 +78215,90 @@ function isRetryableShellSpawnError(error) {
77796
78215
  const message = messages.join(" ").toLowerCase();
77797
78216
  return message.includes("posix_spawnp failed") || message.includes("enoent") || message.includes("not found") || message.includes("file not found") || message.includes("no such file");
77798
78217
  }
77799
- function checkWindowsSubprocessActivity(terminalPid) {
77800
- const command = [
77801
- `$children = Get-CimInstance Win32_Process -Filter "ParentProcessId = ${terminalPid}" -ErrorAction SilentlyContinue`,
77802
- "if ($children) { exit 0 }",
77803
- "exit 1"
77804
- ].join("; ");
77805
- return effect.Effect.tryPromise({
77806
- try: () => runProcess("powershell.exe", [
77807
- "-NoProfile",
77808
- "-NonInteractive",
77809
- "-Command",
77810
- command
77811
- ], {
77812
- timeoutMs: 1500,
77813
- allowNonZeroExit: true,
77814
- maxBufferBytes: 32768,
77815
- outputMode: "truncate"
77816
- }),
77817
- catch: (cause) => new TerminalSubprocessCheckError({
77818
- message: "Failed to check Windows terminal subprocess activity.",
77819
- cause,
77820
- terminalPid,
77821
- command: "powershell"
77822
- })
77823
- }).pipe(effect.Effect.map((result) => result.code === 0));
78218
+ function parsePosixProcessTable(stdout) {
78219
+ const childrenByParent = /* @__PURE__ */ new Map();
78220
+ for (const line of stdout.split(/\r?\n/g)) {
78221
+ const match = /^\s*(\d+)\s+(\d+)(?:\s|$)/.exec(line);
78222
+ if (!match) continue;
78223
+ const pid = Number(match[1]);
78224
+ const parentPid = Number(match[2]);
78225
+ if (!Number.isInteger(pid) || !Number.isInteger(parentPid)) continue;
78226
+ const children = childrenByParent.get(parentPid) ?? [];
78227
+ children.push(pid);
78228
+ childrenByParent.set(parentPid, children);
78229
+ }
78230
+ return { childrenByParent };
78231
+ }
78232
+ function parseWindowsProcessTable(stdout) {
78233
+ const childrenByParent = /* @__PURE__ */ new Map();
78234
+ for (const line of stdout.split(/\r?\n/g)) {
78235
+ const [pidRaw, parentPidRaw] = line.trim().split("|", 2);
78236
+ const pid = Number(pidRaw);
78237
+ const parentPid = Number(parentPidRaw);
78238
+ if (!Number.isInteger(pid) || !Number.isInteger(parentPid)) continue;
78239
+ const children = childrenByParent.get(parentPid) ?? [];
78240
+ children.push(pid);
78241
+ childrenByParent.set(parentPid, children);
78242
+ }
78243
+ return { childrenByParent };
77824
78244
  }
77825
- const checkPosixSubprocessActivity = effect.Effect.fn("terminal.checkPosixSubprocessActivity")(function* (terminalPid) {
77826
- const runPgrep = effect.Effect.tryPromise({
77827
- try: () => runProcess("pgrep", ["-P", String(terminalPid)], {
78245
+ const POSIX_PS_ABSOLUTE_PATHS = ["/bin/ps", "/usr/bin/ps"];
78246
+ const resolvePosixPsCommand = effect.Effect.fn("terminal.resolvePosixPsCommand")(function* () {
78247
+ const fileSystem = yield* effect.FileSystem.FileSystem;
78248
+ for (const candidate of POSIX_PS_ABSOLUTE_PATHS) if (yield* fileSystem.exists(candidate).pipe(effect.Effect.orElseSucceed(() => false))) return candidate;
78249
+ return "ps";
78250
+ });
78251
+ const snapshotPosixProcessTable = effect.Effect.fn("terminal.snapshotPosixProcessTable")(function* (psCommand) {
78252
+ const result = yield* effect.Effect.tryPromise({
78253
+ try: () => runProcess(psCommand, ["-eo", "pid=,ppid="], {
77828
78254
  timeoutMs: 1e3,
77829
78255
  allowNonZeroExit: true,
77830
- maxBufferBytes: 32768,
78256
+ maxBufferBytes: 524288,
77831
78257
  outputMode: "truncate"
77832
78258
  }),
77833
78259
  catch: (cause) => new TerminalSubprocessCheckError({
77834
- message: "Failed to inspect terminal subprocesses with pgrep.",
78260
+ message: "Failed to snapshot POSIX processes.",
77835
78261
  cause,
77836
- terminalPid,
77837
- command: "pgrep"
78262
+ command: "ps"
77838
78263
  })
77839
78264
  });
77840
- const runPs = effect.Effect.tryPromise({
77841
- try: () => runProcess("ps", ["-eo", "pid=,ppid="], {
77842
- timeoutMs: 1e3,
78265
+ if (result.code !== 0 || result.timedOut || result.stdoutTruncated) return yield* new TerminalSubprocessCheckError({
78266
+ message: "POSIX process snapshot was incomplete.",
78267
+ command: "ps",
78268
+ exitCode: result.code,
78269
+ timedOut: result.timedOut,
78270
+ stdoutTruncated: result.stdoutTruncated
78271
+ });
78272
+ return parsePosixProcessTable(result.stdout);
78273
+ });
78274
+ const snapshotWindowsProcessTable = effect.Effect.fn("terminal.snapshotWindowsProcessTable")(function* () {
78275
+ const command = ["$processes = Get-CimInstance Win32_Process -ErrorAction Stop", "foreach ($process in $processes) { Write-Output \"$($process.ProcessId)|$($process.ParentProcessId)\" }"].join("; ");
78276
+ const result = yield* effect.Effect.tryPromise({
78277
+ try: () => runProcess("powershell.exe", [
78278
+ "-NoProfile",
78279
+ "-NonInteractive",
78280
+ "-Command",
78281
+ command
78282
+ ], {
78283
+ timeoutMs: 1500,
77843
78284
  allowNonZeroExit: true,
77844
- maxBufferBytes: 262144,
78285
+ maxBufferBytes: 524288,
77845
78286
  outputMode: "truncate"
77846
78287
  }),
77847
78288
  catch: (cause) => new TerminalSubprocessCheckError({
77848
- message: "Failed to inspect terminal subprocesses with ps.",
78289
+ message: "Failed to snapshot Windows processes.",
77849
78290
  cause,
77850
- terminalPid,
77851
- command: "ps"
78291
+ command: "powershell"
77852
78292
  })
77853
78293
  });
77854
- const pgrepResult = yield* effect.Effect.exit(runPgrep);
77855
- if (pgrepResult._tag === "Success") {
77856
- if (pgrepResult.value.code === 0) return pgrepResult.value.stdout.trim().length > 0;
77857
- if (pgrepResult.value.code === 1) return false;
77858
- }
77859
- const psResult = yield* effect.Effect.exit(runPs);
77860
- if (psResult._tag === "Failure" || psResult.value.code !== 0) return false;
77861
- for (const line of psResult.value.stdout.split(/\r?\n/g)) {
77862
- const [pidRaw, ppidRaw] = line.trim().split(/\s+/g);
77863
- const pid = Number(pidRaw);
77864
- const ppid = Number(ppidRaw);
77865
- if (!Number.isInteger(pid) || !Number.isInteger(ppid)) continue;
77866
- if (ppid === terminalPid) return true;
77867
- }
77868
- return false;
77869
- });
77870
- const defaultSubprocessChecker = effect.Effect.fn("terminal.defaultSubprocessChecker")(function* (terminalPid) {
77871
- if (!Number.isInteger(terminalPid) || terminalPid <= 0) return false;
77872
- if (process.platform === "win32") return yield* checkWindowsSubprocessActivity(terminalPid);
77873
- return yield* checkPosixSubprocessActivity(terminalPid);
78294
+ if (result.code !== 0 || result.timedOut || result.stdoutTruncated) return yield* new TerminalSubprocessCheckError({
78295
+ message: "Windows process snapshot was incomplete.",
78296
+ command: "powershell",
78297
+ exitCode: result.code,
78298
+ timedOut: result.timedOut,
78299
+ stdoutTruncated: result.stdoutTruncated
78300
+ });
78301
+ return parseWindowsProcessTable(result.stdout);
77874
78302
  });
77875
78303
  function capHistory(history, maxLines) {
77876
78304
  if (history.length === 0) return history;
@@ -78062,7 +78490,8 @@ const makeTerminalManagerWithOptions = effect.Effect.fn("makeTerminalManagerWith
78062
78490
  const platform = options.platform ?? process.platform;
78063
78491
  const baseEnv = options.env ?? process.env;
78064
78492
  const shellResolver = options.shellResolver ?? (() => defaultShellResolver(platform, baseEnv));
78065
- const subprocessChecker = options.subprocessChecker ?? defaultSubprocessChecker;
78493
+ const posixPsCommand = options.processTableSnapshotter === void 0 && platform !== "win32" ? yield* resolvePosixPsCommand() : null;
78494
+ const processTableSnapshotter = options.processTableSnapshotter ?? (platform === "win32" ? snapshotWindowsProcessTable : () => snapshotPosixProcessTable(posixPsCommand ?? "ps"));
78066
78495
  const subprocessPollIntervalMs = options.subprocessPollIntervalMs ?? DEFAULT_SUBPROCESS_POLL_INTERVAL_MS;
78067
78496
  const processKillGraceMs = options.processKillGraceMs ?? DEFAULT_PROCESS_KILL_GRACE_MS;
78068
78497
  const maxRetainedInactiveSessions = options.maxRetainedInactiveSessions ?? DEFAULT_MAX_RETAINED_INACTIVE_SESSIONS;
@@ -78553,26 +78982,22 @@ const makeTerminalManagerWithOptions = effect.Effect.fn("makeTerminalManagerWith
78553
78982
  const pollSubprocessActivity = effect.Effect.fn("terminal.pollSubprocessActivity")(function* () {
78554
78983
  const runningSessions = [...(yield* readManagerState).sessions.values()].filter((session) => session.status === "running" && Number.isInteger(session.pid));
78555
78984
  if (runningSessions.length === 0) return;
78985
+ const processTable = yield* processTableSnapshotter().pipe(effect.Effect.map(effect.Option.some), effect.Effect.catch((reason) => effect.Effect.logWarning("failed to snapshot processes for terminal subprocess polling", { reason }).pipe(effect.Effect.as(effect.Option.none()))));
78986
+ if (effect.Option.isNone(processTable)) return;
78556
78987
  const checkSubprocessActivity = effect.Effect.fn("terminal.checkSubprocessActivity")(function* (session) {
78557
78988
  const terminalPid = session.pid;
78558
- const hasRunningSubprocess = yield* subprocessChecker(terminalPid).pipe(effect.Effect.map(effect.Option.some), effect.Effect.catch((reason) => effect.Effect.logWarning("failed to check terminal subprocess activity", {
78559
- threadId: session.threadId,
78560
- terminalId: session.terminalId,
78561
- terminalPid,
78562
- reason
78563
- }).pipe(effect.Effect.as(effect.Option.none()))));
78564
- if (effect.Option.isNone(hasRunningSubprocess)) return;
78989
+ const hasRunningSubprocess = (processTable.value.childrenByParent.get(terminalPid)?.length ?? 0) > 0;
78565
78990
  const event = yield* modifyManagerState((state) => {
78566
78991
  const liveSession = effect.Option.fromNullishOr(state.sessions.get(toSessionKey(session.threadId, session.terminalId)));
78567
- if (effect.Option.isNone(liveSession) || liveSession.value.status !== "running" || liveSession.value.pid !== terminalPid || liveSession.value.hasRunningSubprocess === hasRunningSubprocess.value) return [effect.Option.none(), state];
78568
- liveSession.value.hasRunningSubprocess = hasRunningSubprocess.value;
78992
+ if (effect.Option.isNone(liveSession) || liveSession.value.status !== "running" || liveSession.value.pid !== terminalPid || liveSession.value.hasRunningSubprocess === hasRunningSubprocess) return [effect.Option.none(), state];
78993
+ liveSession.value.hasRunningSubprocess = hasRunningSubprocess;
78569
78994
  liveSession.value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
78570
78995
  return [effect.Option.some({
78571
78996
  type: "activity",
78572
78997
  threadId: liveSession.value.threadId,
78573
78998
  terminalId: liveSession.value.terminalId,
78574
78999
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
78575
- hasRunningSubprocess: hasRunningSubprocess.value
79000
+ hasRunningSubprocess
78576
79001
  }), state];
78577
79002
  });
78578
79003
  if (effect.Option.isSome(event)) yield* publishEvent(event.value);
@@ -78880,20 +79305,6 @@ var ProviderCommandReactor = class extends effect.Context.Service()("ryco/orches
78880
79305
  */
78881
79306
  var ProviderRuntimeIngestionService = class extends effect.Context.Service()("ryco/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {};
78882
79307
  //#endregion
78883
- //#region src/orchestration/Services/ThreadDeletionReactor.ts
78884
- /**
78885
- * ThreadDeletionReactor - Thread deletion cleanup reactor service interface.
78886
- *
78887
- * Owns background workers that react to thread deletion domain events and
78888
- * perform best-effort runtime cleanup for provider sessions and terminals.
78889
- *
78890
- * @module ThreadDeletionReactor
78891
- */
78892
- /**
78893
- * ThreadDeletionReactor - Service tag for thread deletion cleanup workers.
78894
- */
78895
- var ThreadDeletionReactor = class extends effect.Context.Service()("ryco/orchestration/Services/ThreadDeletionReactor") {};
78896
- //#endregion
78897
79308
  //#region src/orchestration/Layers/OrchestrationReactor.ts
78898
79309
  const makeOrchestrationReactor = effect.Effect.gen(function* () {
78899
79310
  const providerRuntimeIngestion = yield* ProviderRuntimeIngestionService;
@@ -79469,6 +79880,227 @@ function make$4() {
79469
79880
  }
79470
79881
  const layer = effect.Layer.effect(ThreadBackgroundLivenessService, effect.Effect.sync(make$4));
79471
79882
  //#endregion
79883
+ //#region src/orchestration/ActivityPayloadProjection.ts
79884
+ function asRecord$1(value) {
79885
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
79886
+ }
79887
+ function asTrimmedString$1(value) {
79888
+ if (typeof value !== "string") return null;
79889
+ const trimmed = value.trim();
79890
+ return trimmed.length > 0 ? trimmed : null;
79891
+ }
79892
+ function summarizeToolTextOutput(value) {
79893
+ const lines = [];
79894
+ for (const rawLine of value.split(/\r?\n/u)) {
79895
+ const line = rawLine.replace(/\s+/g, " ").trim();
79896
+ if (line.length > 0) lines.push(line);
79897
+ }
79898
+ const firstLine = lines.find((line) => line !== "```");
79899
+ if (firstLine) return firstLine.length <= 84 ? firstLine : `${firstLine.slice(0, 83).trimEnd()}…`;
79900
+ if (lines.length > 1) return `${lines.length.toLocaleString()} lines`;
79901
+ return null;
79902
+ }
79903
+ function pushChangedFile(target, seen, value) {
79904
+ const normalized = asTrimmedString$1(value);
79905
+ if (!normalized || seen.has(normalized)) return;
79906
+ seen.add(normalized);
79907
+ target.push(normalized);
79908
+ }
79909
+ function collectChangedFiles(value, target, seen, depth) {
79910
+ if (depth > 4 || target.length >= 12) return;
79911
+ if (Array.isArray(value)) {
79912
+ for (const entry of value) {
79913
+ collectChangedFiles(entry, target, seen, depth + 1);
79914
+ if (target.length >= 12) return;
79915
+ }
79916
+ return;
79917
+ }
79918
+ const record = asRecord$1(value);
79919
+ if (!record) return;
79920
+ pushChangedFile(target, seen, record.path);
79921
+ pushChangedFile(target, seen, record.filePath);
79922
+ pushChangedFile(target, seen, record.relativePath);
79923
+ pushChangedFile(target, seen, record.filename);
79924
+ pushChangedFile(target, seen, record.newPath);
79925
+ pushChangedFile(target, seen, record.oldPath);
79926
+ for (const nestedKey of [
79927
+ "item",
79928
+ "result",
79929
+ "input",
79930
+ "data",
79931
+ "changes",
79932
+ "files",
79933
+ "edits",
79934
+ "patch",
79935
+ "patches",
79936
+ "operations"
79937
+ ]) {
79938
+ if (!(nestedKey in record)) continue;
79939
+ collectChangedFiles(record[nestedKey], target, seen, depth + 1);
79940
+ if (target.length >= 12) return;
79941
+ }
79942
+ }
79943
+ function projectCommandData(data) {
79944
+ const item = asRecord$1(data.item);
79945
+ if (!item) return;
79946
+ const projectedItem = {};
79947
+ if ("command" in item) projectedItem.command = item.command;
79948
+ const aggregatedOutput = asTrimmedString$1(item.aggregatedOutput);
79949
+ if (aggregatedOutput) {
79950
+ const summary = summarizeToolTextOutput(aggregatedOutput);
79951
+ if (summary) projectedItem.aggregatedOutput = summary;
79952
+ }
79953
+ const input = asRecord$1(item.input);
79954
+ if (input && "command" in input) projectedItem.input = { command: input.command };
79955
+ const result = asRecord$1(item.result);
79956
+ if (result) {
79957
+ const projectedResult = {};
79958
+ if ("command" in result) projectedResult.command = result.command;
79959
+ const content = asTrimmedString$1(result.content);
79960
+ if (content) {
79961
+ const summary = summarizeToolTextOutput(content);
79962
+ if (summary) projectedResult.content = summary;
79963
+ }
79964
+ if (Object.keys(projectedResult).length > 0) projectedItem.result = projectedResult;
79965
+ }
79966
+ return Object.keys(projectedItem).length > 0 ? projectedItem : void 0;
79967
+ }
79968
+ function projectCommandValue(data) {
79969
+ if (data.command !== void 0) return data.command;
79970
+ const input = asRecord$1(data.input);
79971
+ if (input?.command !== void 0) return input.command;
79972
+ const stateInput = asRecord$1(asRecord$1(data.state)?.input);
79973
+ if (stateInput?.command !== void 0) return stateInput.command;
79974
+ }
79975
+ const MCP_ITEM_KEPT_FIELDS = [
79976
+ "type",
79977
+ "id",
79978
+ "tool",
79979
+ "server",
79980
+ "status",
79981
+ "arguments",
79982
+ "appContext",
79983
+ "error",
79984
+ "durationMs"
79985
+ ];
79986
+ function extractMcpResultText(result) {
79987
+ const record = asRecord$1(result);
79988
+ if (!record) return typeof result === "string" ? result : null;
79989
+ if (typeof record.content === "string") return record.content;
79990
+ if (Array.isArray(record.content)) {
79991
+ const texts = [];
79992
+ for (const entry of record.content) {
79993
+ const text = asRecord$1(entry)?.text;
79994
+ if (typeof text === "string" && text.trim().length > 0) texts.push(text);
79995
+ }
79996
+ if (texts.length > 0) return texts.join("\n");
79997
+ }
79998
+ return null;
79999
+ }
80000
+ function summarizeMcpResult(result) {
80001
+ if (result === void 0 || result === null) return;
80002
+ const text = extractMcpResultText(result);
80003
+ const summary = text ? summarizeToolTextOutput(text) : null;
80004
+ return summary ? { content: summary } : void 0;
80005
+ }
80006
+ function projectMcpToolCallData(data) {
80007
+ const projectedData = {};
80008
+ const item = asRecord$1(data.item);
80009
+ if (item) {
80010
+ const projectedItem = {};
80011
+ for (const key of MCP_ITEM_KEPT_FIELDS) if (key in item) projectedItem[key] = item[key];
80012
+ const result = summarizeMcpResult(item.result);
80013
+ if (result) projectedItem.result = result;
80014
+ projectedData.item = projectedItem;
80015
+ }
80016
+ if ("toolName" in data) projectedData.toolName = data.toolName;
80017
+ if ("input" in data) projectedData.input = data.input;
80018
+ if (!item) {
80019
+ const result = summarizeMcpResult(data.result);
80020
+ if (result) projectedData.result = result;
80021
+ }
80022
+ if ("toolCallId" in data) projectedData.toolCallId = data.toolCallId;
80023
+ if ("kind" in data) projectedData.kind = data.kind;
80024
+ const changedFiles = [];
80025
+ collectChangedFiles(data, changedFiles, /* @__PURE__ */ new Set(), 0);
80026
+ if (changedFiles.length > 0) projectedData.files = changedFiles.map((path) => ({ path }));
80027
+ return projectedData;
80028
+ }
80029
+ function projectRawOutput(value) {
80030
+ const direct = asTrimmedString$1(value);
80031
+ if (direct) {
80032
+ const summary = summarizeToolTextOutput(direct);
80033
+ return summary ? { content: summary } : void 0;
80034
+ }
80035
+ const rawOutput = asRecord$1(value);
80036
+ if (!rawOutput) return;
80037
+ if (typeof rawOutput.totalFiles === "number" && Number.isFinite(rawOutput.totalFiles)) return {
80038
+ totalFiles: rawOutput.totalFiles,
80039
+ ...rawOutput.truncated === true ? { truncated: true } : {}
80040
+ };
80041
+ for (const key of [
80042
+ "content",
80043
+ "stdout",
80044
+ "stderr"
80045
+ ]) {
80046
+ const output = asTrimmedString$1(rawOutput[key]);
80047
+ if (!output) continue;
80048
+ const summary = summarizeToolTextOutput(output);
80049
+ return summary ? { content: summary } : void 0;
80050
+ }
80051
+ }
80052
+ function projectAcpContent(value) {
80053
+ if (!Array.isArray(value)) return;
80054
+ const summary = summarizeToolTextOutput(value.map((entryValue) => {
80055
+ const entry = asRecord$1(entryValue);
80056
+ const content = asRecord$1(entry?.content);
80057
+ return entry?.type === "content" && content?.type === "text" ? asTrimmedString$1(content.text) : null;
80058
+ }).filter((entry) => entry !== null).join("\n"));
80059
+ return summary ? { content: summary } : void 0;
80060
+ }
80061
+ /**
80062
+ * Projects provider-specific tool data to the fields shared clients consume.
80063
+ * The result is safe to persist for cumulative streaming updates: unbounded
80064
+ * tool output is reduced to a one-line summary while identity, command, and
80065
+ * changed-file metadata remain available to every client.
80066
+ */
80067
+ function projectActivityPayload(activity) {
80068
+ const payload = asRecord$1(activity.payload);
80069
+ const data = asRecord$1(payload?.data);
80070
+ if (!payload || !data) return activity;
80071
+ const itemStatus = asRecord$1(data.item)?.status;
80072
+ const projectedPayload = payload.status === "completed" && (itemStatus === "failed" || itemStatus === "declined") ? {
80073
+ ...payload,
80074
+ status: itemStatus
80075
+ } : payload;
80076
+ if (payload.itemType === "mcp_tool_call") return {
80077
+ ...activity,
80078
+ payload: {
80079
+ ...projectedPayload,
80080
+ data: projectMcpToolCallData(data)
80081
+ }
80082
+ };
80083
+ const projectedData = {};
80084
+ const item = projectCommandData(data);
80085
+ if (item) projectedData.item = item;
80086
+ const command = projectCommandValue(data);
80087
+ if (command !== void 0) projectedData.command = command;
80088
+ const changedFiles = [];
80089
+ collectChangedFiles(data, changedFiles, /* @__PURE__ */ new Set(), 0);
80090
+ if (changedFiles.length > 0) projectedData.files = changedFiles.map((path) => ({ path }));
80091
+ if ("toolCallId" in data) projectedData.toolCallId = data.toolCallId;
80092
+ if ("kind" in data) projectedData.kind = data.kind;
80093
+ const rawOutput = projectRawOutput(data.rawOutput) ?? projectAcpContent(data.content);
80094
+ if (rawOutput) projectedData.rawOutput = rawOutput;
80095
+ return {
80096
+ ...activity,
80097
+ payload: {
80098
+ ...projectedPayload,
80099
+ data: projectedData
80100
+ }
80101
+ };
80102
+ }
80103
+ //#endregion
79472
80104
  //#region src/orchestration/Layers/ProviderRuntimeIngestion.ts
79473
80105
  const providerTurnKey = (threadId, turnId) => `${threadId}:${turnId}`;
79474
80106
  const providerTaskKey = (threadId, taskId) => `${threadId}:${taskId}`;
@@ -79986,7 +80618,7 @@ function runtimeEventToActivities(event, taskTitle) {
79986
80618
  }
79987
80619
  case "item.updated":
79988
80620
  if (!require_collectUint8StreamText.isToolLifecycleItemType(event.payload.itemType)) return [];
79989
- return [{
80621
+ return [projectActivityPayload({
79990
80622
  id: event.eventId,
79991
80623
  createdAt: event.createdAt,
79992
80624
  tone: "tool",
@@ -80004,7 +80636,7 @@ function runtimeEventToActivities(event, taskTitle) {
80004
80636
  },
80005
80637
  turnId: toTurnId$1(event.turnId) ?? null,
80006
80638
  ...maybeSequence
80007
- }];
80639
+ })];
80008
80640
  case "item.completed":
80009
80641
  if (!require_collectUint8StreamText.isToolLifecycleItemType(event.payload.itemType)) return [];
80010
80642
  return [{
@@ -80980,6 +81612,15 @@ const HANDLED_TURN_START_KEY_TTL = effect.Duration.minutes(30);
80980
81612
  const DEFAULT_RUNTIME_MODE = "full-access";
80981
81613
  const DEFAULT_TOKEN_MODE = require_collectUint8StreamText.DEFAULT_AGENT_TOKEN_MODE;
80982
81614
  const DEFAULT_THREAD_TITLE = "New thread";
81615
+ function pathEntryExists(targetPath) {
81616
+ try {
81617
+ (0, node_fs.lstatSync)(targetPath);
81618
+ return true;
81619
+ } catch (error) {
81620
+ if (error.code === "ENOENT") return false;
81621
+ throw error;
81622
+ }
81623
+ }
80983
81624
  function providerErrorLabel(value) {
80984
81625
  const normalized = value?.trim();
80985
81626
  return normalized && normalized.length > 0 ? normalized : "unknown";
@@ -81001,10 +81642,10 @@ function isUnknownPendingApprovalRequestError(cause) {
81001
81642
  const error = findProviderAdapterRequestError(cause);
81002
81643
  if (error) {
81003
81644
  const detail = error.detail.toLowerCase();
81004
- return detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request");
81645
+ return detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request") || detail.includes("unknown pending codex approval request");
81005
81646
  }
81006
- const message = effect.Cause.pretty(cause);
81007
- return message.includes("unknown pending approval request") || message.includes("unknown pending permission request");
81647
+ const message = effect.Cause.pretty(cause).toLowerCase();
81648
+ return message.includes("unknown pending approval request") || message.includes("unknown pending permission request") || message.includes("unknown pending codex approval request");
81008
81649
  }
81009
81650
  function isUnknownPendingUserInputRequestError(cause) {
81010
81651
  const error = findProviderAdapterRequestError(cause);
@@ -81088,9 +81729,64 @@ const make$2 = effect.Effect.gen(function* () {
81088
81729
  const resolveThread = effect.Effect.fnUntraced(function* (threadId) {
81089
81730
  return yield* projectionSnapshotQuery.getThreadDetailById(threadId).pipe(effect.Effect.map(effect.Option.getOrUndefined));
81090
81731
  });
81732
+ const ensureRecordedWorktreeAvailable = effect.Effect.fn("ensureRecordedWorktreeAvailable")(function* (thread, project) {
81733
+ if (thread.worktreePath === null) return;
81734
+ if (!project) return yield* new ProviderAdapterRequestError({
81735
+ provider: providerErrorLabel(String(thread.modelSelection.instanceId)),
81736
+ method: "thread.turn.start",
81737
+ detail: `Cannot verify worktree '${thread.worktreePath}' because project '${thread.projectId}' is unavailable.`
81738
+ });
81739
+ const repositoryRoot = node_path.default.resolve(project.workspaceRoot);
81740
+ const worktreePath = node_path.default.resolve(thread.worktreePath);
81741
+ if (worktreePath === repositoryRoot) return;
81742
+ const registeredWorktreePaths = () => gitWorkflow.listWorktreePaths(repositoryRoot).pipe(effect.Effect.map((paths) => paths.map((entry) => node_path.default.resolve(entry))));
81743
+ const failRecovery = (detail) => new ProviderAdapterRequestError({
81744
+ provider: providerErrorLabel(String(thread.modelSelection.instanceId)),
81745
+ method: "thread.turn.start",
81746
+ detail
81747
+ });
81748
+ if (pathEntryExists(worktreePath)) {
81749
+ if (!(yield* registeredWorktreePaths()).includes(worktreePath)) return yield* failRecovery(`Refusing to use '${worktreePath}' because it exists but is not a registered worktree for '${repositoryRoot}'.`);
81750
+ return;
81751
+ }
81752
+ const branch = thread.branch;
81753
+ if (branch === null) return yield* failRecovery(`Cannot recreate missing worktree '${worktreePath}' because the thread has no recorded branch.`);
81754
+ if (!(yield* gitWorkflow.listLocalBranchNames(repositoryRoot)).includes(branch)) return yield* failRecovery(`Cannot recreate missing worktree '${worktreePath}' because branch '${branch}' no longer exists.`);
81755
+ yield* gitWorkflow.pruneWorktrees(repositoryRoot);
81756
+ if (pathEntryExists(worktreePath)) {
81757
+ if ((yield* registeredWorktreePaths()).includes(worktreePath)) return;
81758
+ return yield* failRecovery(`Refusing to recreate worktree '${worktreePath}' because another filesystem entry now occupies that path.`);
81759
+ }
81760
+ const recreated = yield* gitWorkflow.createWorktree({
81761
+ cwd: repositoryRoot,
81762
+ path: worktreePath,
81763
+ refName: branch,
81764
+ dependencyHydration: "none"
81765
+ });
81766
+ if (node_path.default.resolve(recreated.worktree.path) !== worktreePath || recreated.worktree.refName !== branch) return yield* failRecovery(`Worktree recovery returned unexpected metadata for '${worktreePath}' and branch '${branch}'.`);
81767
+ const changedAt = (/* @__PURE__ */ new Date()).toISOString();
81768
+ yield* orchestrationEngine.dispatch({
81769
+ type: "thread.meta.update",
81770
+ commandId: serverCommandId$2("worktree-recovered"),
81771
+ threadId: thread.id,
81772
+ branch,
81773
+ worktreePath
81774
+ });
81775
+ if (thread.worktreeId !== void 0 && thread.worktreeId !== null) yield* orchestrationEngine.dispatch({
81776
+ type: "worktree.meta.update",
81777
+ commandId: serverCommandId$2("worktree-recovered-meta"),
81778
+ worktreeId: thread.worktreeId,
81779
+ branch,
81780
+ changedAt
81781
+ });
81782
+ yield* gitWorkflow.invalidateStatus(worktreePath);
81783
+ yield* vcsStatusBroadcaster.refreshStatus(worktreePath).pipe(effect.Effect.ignoreCause({ log: true }));
81784
+ });
81091
81785
  const ensureSessionForThread = effect.Effect.fn("ensureSessionForThread")(function* (threadId, createdAt, options) {
81092
81786
  const thread = yield* resolveThread(threadId);
81093
81787
  if (!thread) return yield* effect.Effect.die(/* @__PURE__ */ new Error(`Thread '${threadId}' was not found in read model.`));
81788
+ const project = yield* resolveProject(thread.projectId);
81789
+ yield* ensureRecordedWorktreeAvailable(thread, project);
81094
81790
  const desiredRuntimeMode = thread.runtimeMode;
81095
81791
  const desiredTokenMode = thread.tokenMode ?? DEFAULT_TOKEN_MODE;
81096
81792
  const requestedModelSelection = options?.modelSelection;
@@ -81138,7 +81834,6 @@ const make$2 = effect.Effect.gen(function* () {
81138
81834
  detail: `Thread '${threadId}' cannot switch from instance '${currentInstanceId}' to '${desiredInstanceId}' because their provider resume state is incompatible.`
81139
81835
  });
81140
81836
  }
81141
- const project = yield* resolveProject(thread.projectId);
81142
81837
  const effectiveCwd = resolveThreadWorkspaceCwd({
81143
81838
  thread,
81144
81839
  projects: project ? [project] : []
@@ -81371,34 +82066,7 @@ const make$2 = effect.Effect.gen(function* () {
81371
82066
  });
81372
82067
  return;
81373
82068
  }
81374
- if (event.payload.contextHandoff !== void 0) {
81375
- yield* contextHandoffCoordinator.processTurnStart(event);
81376
- return;
81377
- }
81378
- if (thread.messages.filter((entry) => entry.role === "user").length === 1) {
81379
- const project = yield* resolveProject(thread.projectId);
81380
- const generationCwd = resolveThreadWorkspaceCwd({
81381
- thread,
81382
- projects: project ? [project] : []
81383
- }) ?? process.cwd();
81384
- const generationInput = {
81385
- messageText: message.text,
81386
- ...message.attachments !== void 0 ? { attachments: message.attachments } : {},
81387
- ...event.payload.titleSeed !== void 0 ? { titleSeed: event.payload.titleSeed } : {}
81388
- };
81389
- yield* maybeGenerateAndRenameWorktreeBranchForFirstTurn({
81390
- threadId: event.payload.threadId,
81391
- branch: thread.branch,
81392
- worktreePath: thread.worktreePath,
81393
- worktreeId: thread.worktreeId ?? null,
81394
- ...generationInput
81395
- }).pipe(effect.Effect.forkScoped);
81396
- if (canReplaceThreadTitle(thread.title, event.payload.titleSeed)) yield* maybeGenerateThreadTitleForFirstTurn({
81397
- threadId: event.payload.threadId,
81398
- cwd: generationCwd,
81399
- ...generationInput
81400
- }).pipe(effect.Effect.forkScoped);
81401
- }
82069
+ const isFirstUserMessageTurn = thread.messages.filter((entry) => entry.role === "user").length === 1;
81402
82070
  const handleTurnStartFailure = (cause) => {
81403
82071
  if (effect.Cause.hasInterruptsOnly(cause)) return effect.Effect.void;
81404
82072
  const detail = formatFailureDetail(cause);
@@ -81421,6 +82089,12 @@ const make$2 = effect.Effect.gen(function* () {
81421
82089
  cause: effect.Cause.pretty(recoveryCause),
81422
82090
  originalCause: effect.Cause.pretty(cause)
81423
82091
  })));
82092
+ if (event.payload.contextHandoff !== void 0) {
82093
+ const project = yield* resolveProject(thread.projectId);
82094
+ if (!(yield* ensureRecordedWorktreeAvailable(thread, project).pipe(effect.Effect.as(true), effect.Effect.catchCause((cause) => handleTurnStartFailure(cause).pipe(effect.Effect.as(false)))))) return;
82095
+ yield* contextHandoffCoordinator.processTurnStart(event);
82096
+ return;
82097
+ }
81424
82098
  const sendTurnRequest = yield* buildSendTurnRequestForThread({
81425
82099
  threadId: event.payload.threadId,
81426
82100
  messageText: message.text,
@@ -81431,6 +82105,30 @@ const make$2 = effect.Effect.gen(function* () {
81431
82105
  createdAt: event.payload.createdAt
81432
82106
  }).pipe(effect.Effect.map(effect.Option.some), effect.Effect.catchCause((cause) => handleTurnStartFailure(cause).pipe(effect.Effect.as(effect.Option.none()))));
81433
82107
  if (effect.Option.isNone(sendTurnRequest)) return;
82108
+ if (isFirstUserMessageTurn) {
82109
+ const project = yield* resolveProject(thread.projectId);
82110
+ const generationCwd = resolveThreadWorkspaceCwd({
82111
+ thread,
82112
+ projects: project ? [project] : []
82113
+ }) ?? process.cwd();
82114
+ const generationInput = {
82115
+ messageText: message.text,
82116
+ ...message.attachments !== void 0 ? { attachments: message.attachments } : {},
82117
+ ...event.payload.titleSeed !== void 0 ? { titleSeed: event.payload.titleSeed } : {}
82118
+ };
82119
+ yield* maybeGenerateAndRenameWorktreeBranchForFirstTurn({
82120
+ threadId: event.payload.threadId,
82121
+ branch: thread.branch,
82122
+ worktreePath: thread.worktreePath,
82123
+ worktreeId: thread.worktreeId ?? null,
82124
+ ...generationInput
82125
+ }).pipe(effect.Effect.forkScoped);
82126
+ if (canReplaceThreadTitle(thread.title, event.payload.titleSeed)) yield* maybeGenerateThreadTitleForFirstTurn({
82127
+ threadId: event.payload.threadId,
82128
+ cwd: generationCwd,
82129
+ ...generationInput
82130
+ }).pipe(effect.Effect.forkScoped);
82131
+ }
81434
82132
  const commitAcceptedModelSelection = event.payload.modelSelection !== void 0 && !effect.Equal.equals(thread.modelSelection, event.payload.modelSelection) ? orchestrationEngine.dispatch({
81435
82133
  type: "thread.meta.update",
81436
82134
  commandId: serverCommandId$2("accepted-model-selection"),
@@ -81443,7 +82141,8 @@ const make$2 = effect.Effect.gen(function* () {
81443
82141
  if (isProviderOriginatedCommandId(event.commandId)) return;
81444
82142
  const thread = yield* resolveThread(event.payload.threadId);
81445
82143
  if (!thread) return;
81446
- if (!(thread.session && thread.session.status !== "stopped")) return yield* appendProviderFailureActivity({
82144
+ const session = thread.session;
82145
+ if (!session || session.status === "stopped") return yield* appendProviderFailureActivity({
81447
82146
  threadId: event.payload.threadId,
81448
82147
  kind: "provider.turn.interrupt.failed",
81449
82148
  summary: "Provider turn interrupt failed",
@@ -81451,7 +82150,41 @@ const make$2 = effect.Effect.gen(function* () {
81451
82150
  turnId: event.payload.turnId ?? null,
81452
82151
  createdAt: event.payload.createdAt
81453
82152
  });
81454
- yield* providerService.interruptTurn({ threadId: event.payload.threadId });
82153
+ const recoverInterruptFailure = (cause) => {
82154
+ if (effect.Cause.hasInterruptsOnly(cause)) return effect.Effect.interrupt;
82155
+ const detail = formatFailureDetail(cause);
82156
+ return effect.Effect.gen(function* () {
82157
+ const latestSession = (yield* resolveThread(event.payload.threadId))?.session;
82158
+ if (!latestSession || latestSession.status === "stopped" || latestSession.status === "ready" || latestSession.activeTurnId === null || event.payload.turnId !== void 0 && latestSession.activeTurnId !== event.payload.turnId) return;
82159
+ yield* providerService.stopSession({ threadId: event.payload.threadId }).pipe(effect.Effect.catchCause((stopCause) => effect.Cause.hasInterruptsOnly(stopCause) ? effect.Effect.interrupt : effect.Effect.logWarning("provider command reactor failed to stop session after interrupt failure", {
82160
+ threadId: event.payload.threadId,
82161
+ cause: effect.Cause.pretty(stopCause),
82162
+ originalCause: effect.Cause.pretty(cause)
82163
+ })));
82164
+ const stoppedSession = (yield* resolveThread(event.payload.threadId))?.session;
82165
+ if (!stoppedSession || stoppedSession.status === "stopped" || stoppedSession.status === "ready" || stoppedSession.activeTurnId === null || event.payload.turnId !== void 0 && stoppedSession.activeTurnId !== event.payload.turnId) return;
82166
+ yield* setThreadSession({
82167
+ threadId: event.payload.threadId,
82168
+ session: {
82169
+ ...stoppedSession,
82170
+ status: "stopped",
82171
+ activeTurnId: null,
82172
+ lastError: detail,
82173
+ updatedAt: event.payload.createdAt
82174
+ },
82175
+ createdAt: event.payload.createdAt
82176
+ });
82177
+ yield* appendProviderFailureActivity({
82178
+ threadId: event.payload.threadId,
82179
+ kind: "provider.turn.interrupt.failed",
82180
+ summary: "Provider turn interrupt failed",
82181
+ detail,
82182
+ turnId: event.payload.turnId ?? null,
82183
+ createdAt: event.payload.createdAt
82184
+ });
82185
+ });
82186
+ };
82187
+ yield* providerService.interruptTurn({ threadId: event.payload.threadId }).pipe(effect.Effect.catchCause(recoverInterruptFailure));
81455
82188
  });
81456
82189
  const processGoalUpdated = effect.Effect.fn("processGoalUpdated")(function* (event) {
81457
82190
  if (event.payload.origin !== "client") return;
@@ -83243,14 +83976,17 @@ const make = effect.Effect.gen(function* () {
83243
83976
  }),
83244
83977
  process: processThreadDeletedSafely
83245
83978
  });
83979
+ const seenSequence = yield* effect.SubscriptionRef.make(0);
83980
+ const noteSeen = (sequence) => effect.SubscriptionRef.update(seenSequence, (seen) => Math.max(seen, sequence));
83246
83981
  return {
83247
83982
  start: effect.Effect.fn("start")(function* () {
83248
- yield* effect.Effect.forkScoped(effect.Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) => {
83249
- if (event.type !== "thread.deleted") return effect.Effect.void;
83250
- return worker.enqueue(event);
83251
- }));
83983
+ const subscription = yield* orchestrationEngine.subscribeDomainEvents;
83984
+ yield* effect.Effect.forkScoped(effect.Stream.runForEach(effect.Stream.fromSubscription(subscription), (event) => (event.type === "thread.deleted" ? worker.enqueue(event) : effect.Effect.void).pipe(effect.Effect.andThen(noteSeen(event.sequence)))));
83252
83985
  }),
83253
- drain: worker.drain
83986
+ drainThrough: effect.Effect.fn("ThreadDeletionReactor.drainThrough")(function* (targetSequence) {
83987
+ yield* effect.SubscriptionRef.changes(seenSequence).pipe(effect.Stream.filter((seen) => seen >= targetSequence), effect.Stream.runHead);
83988
+ yield* worker.drain;
83989
+ })
83254
83990
  };
83255
83991
  });
83256
83992
  const ThreadDeletionReactorLive = effect.Layer.effect(ThreadDeletionReactor, make);
@@ -97568,6 +98304,12 @@ const OrchestrationEventPersistedRowSchema = effect.Schema.Struct({
97568
98304
  payload: UnknownFromJsonString,
97569
98305
  metadata: EventMetadataFromJsonString
97570
98306
  });
98307
+ const HasEventAfterRequestSchema = effect.Schema.Struct({
98308
+ aggregateKind: require_collectUint8StreamText.OrchestrationAggregateKind,
98309
+ aggregateId: effect.Schema.String,
98310
+ type: require_collectUint8StreamText.OrchestrationEventType,
98311
+ sequenceExclusive: require_collectUint8StreamText.NonNegativeInt
98312
+ });
97571
98313
  const ReadFromSequenceRequestSchema = effect.Schema.Struct({
97572
98314
  sequenceExclusive: require_collectUint8StreamText.NonNegativeInt,
97573
98315
  limit: effect.Schema.Number
@@ -97681,6 +98423,20 @@ const makeEventStore = effect.Effect.gen(function* () {
97681
98423
  ORDER BY sequence DESC
97682
98424
  LIMIT ${limit}
97683
98425
  `
98426
+ });
98427
+ const findEventAfter = effect_unstable_sql_SqlSchema.findOneOption({
98428
+ Request: HasEventAfterRequestSchema,
98429
+ Result: effect.Schema.Struct({ sequence: require_collectUint8StreamText.NonNegativeInt }),
98430
+ execute: (request) => sql`
98431
+ SELECT sequence
98432
+ FROM orchestration_events
98433
+ WHERE aggregate_kind = ${request.aggregateKind}
98434
+ AND stream_id = ${request.aggregateId}
98435
+ AND event_type = ${request.type}
98436
+ AND sequence > ${request.sequenceExclusive}
98437
+ ORDER BY sequence ASC
98438
+ LIMIT 1
98439
+ `
97684
98440
  });
97685
98441
  const append = (event) => appendEventRow({
97686
98442
  eventId: event.eventId,
@@ -97730,12 +98486,14 @@ const makeEventStore = effect.Effect.gen(function* () {
97730
98486
  since: input.since,
97731
98487
  limit: Math.min(Math.max(1, Math.floor(input.limit)), 500)
97732
98488
  }).pipe(effect.Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.readRecent:query", "OrchestrationEventStore.readRecent:decodeRows")), effect.Effect.flatMap((rows) => effect.Effect.forEach(rows, (row) => decodeEvent(row).pipe(effect.Effect.mapError(toPersistenceDecodeError("OrchestrationEventStore.readRecent:rowToEvent"))))));
98489
+ const hasEventAfter = (input) => findEventAfter(input).pipe(effect.Effect.map(effect.Option.isSome), effect.Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.hasEventAfter:query", "OrchestrationEventStore.hasEventAfter:decodeRow")));
97733
98490
  return {
97734
98491
  append,
97735
98492
  readPage,
97736
98493
  readRecent,
97737
98494
  readFromSequence,
97738
- readAll: () => readFromSequence(0, Number.MAX_SAFE_INTEGER)
98495
+ readAll: () => readFromSequence(0, Number.MAX_SAFE_INTEGER),
98496
+ hasEventAfter
97739
98497
  };
97740
98498
  });
97741
98499
  const OrchestrationEventStoreLive = effect.Layer.effect(OrchestrationEventStore, makeEventStore);
@@ -98053,7 +98811,8 @@ function requireThreadHasUserMessage(input) {
98053
98811
  return requireThread(input).pipe(effect.Effect.flatMap((thread) => thread.messages.some((message) => message.role === "user") ? effect.Effect.succeed(thread) : effect.Effect.fail(invariantError(input.command.type, `Thread '${input.threadId}' cannot be archived before a message has been sent.`))));
98054
98812
  }
98055
98813
  function requireThreadAbsent(input) {
98056
- if (!findThreadById(input.readModel, input.threadId)) return effect.Effect.void;
98814
+ const existing = findThreadById(input.readModel, input.threadId);
98815
+ if (existing === void 0 || existing.deletedAt !== null) return effect.Effect.void;
98057
98816
  return effect.Effect.fail(invariantError(input.command.type, `Thread '${input.threadId}' already exists and cannot be created twice.`));
98058
98817
  }
98059
98818
  //#endregion
@@ -100466,17 +101225,26 @@ const makeProjectionPendingApprovalRepository = effect.Effect.gen(function* () {
100466
101225
  execute: ({ requestId }) => sql`
100467
101226
  DELETE FROM projection_pending_approvals
100468
101227
  WHERE request_id = ${requestId}
101228
+ `
101229
+ });
101230
+ const deleteProjectionPendingApprovalRowsByThread = effect_unstable_sql_SqlSchema.void({
101231
+ Request: ListProjectionPendingApprovalsInput,
101232
+ execute: ({ threadId }) => sql`
101233
+ DELETE FROM projection_pending_approvals
101234
+ WHERE thread_id = ${threadId}
100469
101235
  `
100470
101236
  });
100471
101237
  const upsert = (row) => upsertProjectionPendingApprovalRow(row).pipe(effect.Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.upsert:query")));
100472
101238
  const listByThreadId = (input) => listProjectionPendingApprovalRows(input).pipe(effect.Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.listByThreadId:query")));
100473
101239
  const getByRequestId = (input) => getProjectionPendingApprovalRow(input).pipe(effect.Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.getByRequestId:query")));
100474
101240
  const deleteByRequestId = (input) => deleteProjectionPendingApprovalRow(input).pipe(effect.Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.deleteByRequestId:query")));
101241
+ const deleteByThreadId = (input) => deleteProjectionPendingApprovalRowsByThread(input).pipe(effect.Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.deleteByThreadId:query")));
100475
101242
  return {
100476
101243
  upsert,
100477
101244
  listByThreadId,
100478
101245
  getByRequestId,
100479
- deleteByRequestId
101246
+ deleteByRequestId,
101247
+ deleteByThreadId
100480
101248
  };
100481
101249
  });
100482
101250
  const ProjectionPendingApprovalRepositoryLive = effect.Layer.effect(ProjectionPendingApprovalRepository, makeProjectionPendingApprovalRepository);
@@ -101424,7 +102192,15 @@ const ORCHESTRATION_EVENT_PROJECTORS = {
101424
102192
  "project.meta-updated": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101425
102193
  "project.avatar-set": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101426
102194
  "project.deleted": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101427
- "thread.created": [ORCHESTRATION_PROJECTOR_NAMES.threads],
102195
+ "thread.created": [
102196
+ ORCHESTRATION_PROJECTOR_NAMES.threadMessages,
102197
+ ORCHESTRATION_PROJECTOR_NAMES.threadProposedPlans,
102198
+ ORCHESTRATION_PROJECTOR_NAMES.threadActivities,
102199
+ ORCHESTRATION_PROJECTOR_NAMES.threadSessions,
102200
+ ORCHESTRATION_PROJECTOR_NAMES.threadTurns,
102201
+ ORCHESTRATION_PROJECTOR_NAMES.pendingApprovals,
102202
+ ORCHESTRATION_PROJECTOR_NAMES.threads
102203
+ ],
101428
102204
  "thread.deleted": [ORCHESTRATION_PROJECTOR_NAMES.threads],
101429
102205
  "thread.archived": [ORCHESTRATION_PROJECTOR_NAMES.threads],
101430
102206
  "thread.unarchived": [ORCHESTRATION_PROJECTOR_NAMES.threads],
@@ -101489,7 +102265,7 @@ function extractActivityRequestId(payload) {
101489
102265
  }
101490
102266
  function isStalePendingApprovalFailureDetail(detail) {
101491
102267
  if (detail === null) return false;
101492
- return detail.includes("stale pending approval request") || detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request");
102268
+ return detail.includes("stale pending approval request") || detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request") || detail.includes("unknown pending codex approval request");
101493
102269
  }
101494
102270
  function derivePendingUserInputStatesFromActivities(activities) {
101495
102271
  const states = /* @__PURE__ */ new Map();
@@ -101574,7 +102350,6 @@ function collectThreadAttachmentRelativePaths(threadId, messages) {
101574
102350
  if (!threadSegment) return /* @__PURE__ */ new Set();
101575
102351
  const relativePaths = /* @__PURE__ */ new Set();
101576
102352
  for (const message of messages) for (const attachment of message.attachments ?? []) {
101577
- if (attachment.type !== "image") continue;
101578
102353
  const attachmentThreadSegment = parseThreadSegmentFromAttachmentId(attachment.id);
101579
102354
  if (!attachmentThreadSegment || attachmentThreadSegment !== threadSegment) continue;
101580
102355
  relativePaths.add(attachmentRelativePath(attachment));
@@ -101876,7 +102651,12 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
101876
102651
  return;
101877
102652
  }
101878
102653
  case "thread.deleted": {
101879
- attachmentSideEffects.deletedThreadIds.add(event.payload.threadId);
102654
+ if (!(yield* eventStore.hasEventAfter({
102655
+ aggregateKind: "thread",
102656
+ aggregateId: event.payload.threadId,
102657
+ type: "thread.created",
102658
+ sequenceExclusive: event.sequence
102659
+ }))) attachmentSideEffects.deletedThreadIds.add(event.payload.threadId);
101880
102660
  const existingRow = yield* projectionThreadRepository.getById({ threadId: event.payload.threadId });
101881
102661
  if (effect.Option.isNone(existingRow)) return;
101882
102662
  yield* projectionThreadRepository.upsert({
@@ -102111,6 +102891,9 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102111
102891
  });
102112
102892
  const applyThreadMessagesProjection = effect.Effect.fn("applyThreadMessagesProjection")(function* (event, attachmentSideEffects) {
102113
102893
  switch (event.type) {
102894
+ case "thread.created":
102895
+ yield* projectionThreadMessageRepository.deleteByThreadId({ threadId: event.payload.threadId });
102896
+ return;
102114
102897
  case "thread.message-sent": {
102115
102898
  const existingMessage = yield* projectionThreadMessageRepository.getByMessageId({ messageId: event.payload.messageId });
102116
102899
  const previousMessage = effect.Option.getOrUndefined(existingMessage);
@@ -102152,6 +102935,9 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102152
102935
  });
102153
102936
  const applyThreadProposedPlansProjection = effect.Effect.fn("applyThreadProposedPlansProjection")(function* (event, _attachmentSideEffects) {
102154
102937
  switch (event.type) {
102938
+ case "thread.created":
102939
+ yield* projectionThreadProposedPlanRepository.deleteByThreadId({ threadId: event.payload.threadId });
102940
+ return;
102155
102941
  case "thread.proposed-plan-upserted":
102156
102942
  yield* projectionThreadProposedPlanRepository.upsert({
102157
102943
  planId: event.payload.proposedPlan.id,
@@ -102178,6 +102964,10 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102178
102964
  });
102179
102965
  const applyThreadActivitiesProjection = effect.Effect.fn("applyThreadActivitiesProjection")(function* (event, attachmentSideEffects) {
102180
102966
  switch (event.type) {
102967
+ case "thread.created":
102968
+ yield* projectionThreadActivityRepository.deleteByThreadId({ threadId: event.payload.threadId });
102969
+ yield* projectionThreadUserInputRequestRepository.deleteByThreadId({ threadId: event.payload.threadId });
102970
+ return;
102181
102971
  case "thread.activity-appended": {
102182
102972
  const requestId = extractActivityRequestId(event.payload.activity.payload);
102183
102973
  const activityPayload = typeof event.payload.activity.payload === "object" && event.payload.activity.payload !== null ? event.payload.activity.payload : null;
@@ -102233,6 +103023,10 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102233
103023
  }
102234
103024
  });
102235
103025
  const applyThreadSessionsProjection = effect.Effect.fn("applyThreadSessionsProjection")(function* (event, _attachmentSideEffects) {
103026
+ if (event.type === "thread.created") {
103027
+ yield* projectionThreadSessionRepository.deleteByThreadId({ threadId: event.payload.threadId });
103028
+ return;
103029
+ }
102236
103030
  if (event.type !== "thread.session-set") return;
102237
103031
  yield* projectionThreadSessionRepository.upsert({
102238
103032
  threadId: event.payload.threadId,
@@ -102249,6 +103043,9 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102249
103043
  });
102250
103044
  const applyThreadTurnsProjection = effect.Effect.fn("applyThreadTurnsProjection")(function* (event, _attachmentSideEffects) {
102251
103045
  switch (event.type) {
103046
+ case "thread.created":
103047
+ yield* projectionTurnRepository.deleteByThreadId({ threadId: event.payload.threadId });
103048
+ return;
102252
103049
  case "thread.turn-start-requested":
102253
103050
  yield* projectionTurnRepository.replacePendingTurnStart({
102254
103051
  threadId: event.payload.threadId,
@@ -102424,6 +103221,9 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102424
103221
  const applyCheckpointsProjection = () => effect.Effect.void;
102425
103222
  const applyPendingApprovalsProjection = effect.Effect.fn("applyPendingApprovalsProjection")(function* (event, attachmentSideEffects) {
102426
103223
  switch (event.type) {
103224
+ case "thread.created":
103225
+ yield* projectionPendingApprovalRepository.deleteByThreadId({ threadId: event.payload.threadId });
103226
+ return;
102427
103227
  case "thread.activity-appended": {
102428
103228
  const requestId = extractActivityRequestId(event.payload.activity.payload) ?? event.metadata.requestId ?? null;
102429
103229
  if (requestId === null) return;
@@ -102581,7 +103381,7 @@ const makeOrchestrationProjectionPipeline = effect.Effect.fn("makeOrchestrationP
102581
103381
  const lastAppliedByProjector = new Map(projectors.map((projector) => [projector.name, 0]));
102582
103382
  for (const row of stateRows) if (lastAppliedByProjector.has(row.projector)) lastAppliedByProjector.set(row.projector, row.lastAppliedSequence);
102583
103383
  const replayFromSequence = Math.min(...lastAppliedByProjector.values());
102584
- yield* effect.Stream.runForEach(eventStore.readFromSequence(replayFromSequence), (event) => effect.Effect.gen(function* () {
103384
+ yield* effect.Stream.runForEach(eventStore.readFromSequence(replayFromSequence, Number.MAX_SAFE_INTEGER), (event) => effect.Effect.gen(function* () {
102585
103385
  const projectorsToAdvance = projectors.filter((projector) => event.sequence > (lastAppliedByProjector.get(projector.name) ?? 0));
102586
103386
  if (projectorsToAdvance.length === 0) return;
102587
103387
  const postCommit = yield* sql.withTransaction(applyProjectorsForEvent(event, projectorsToAdvance));
@@ -106637,6 +107437,7 @@ exports.openCodeRuntimeErrorDetail = openCodeRuntimeErrorDetail;
106637
107437
  exports.parseGenericCliVersion = parseGenericCliVersion;
106638
107438
  exports.parseOpenCodeModelSlug = parseOpenCodeModelSlug;
106639
107439
  exports.providerModelsFromSettings = providerModelsFromSettings;
107440
+ exports.readPersistedAttachment = readPersistedAttachment;
106640
107441
  exports.redactAgentControlSecrets = redactAgentControlSecrets;
106641
107442
  exports.resolveAttachmentPath = resolveAttachmentPath;
106642
107443
  exports.resolveClaudeHomePath = resolveClaudeHomePath$1;