ryco-cli 0.1.13 → 0.1.15

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 (217) hide show
  1. package/dist/{AcpNativeLogging-Be1KGJfF.cjs → AcpNativeLogging-OhEq3XNp.cjs} +1 -1
  2. package/dist/{AcpNativeLogging-Ba9Nn9Re.mjs → AcpNativeLogging-qZgtIa5K.mjs} +2 -2
  3. package/dist/{AzureDevOpsSourceControlProvider-CGlK6M0b.mjs → AzureDevOpsSourceControlProvider-B0YsaJyI.mjs} +3 -3
  4. package/dist/{AzureDevOpsSourceControlProvider-CVj-F-pW.cjs → AzureDevOpsSourceControlProvider-Dyu8KQ_S.cjs} +2 -2
  5. package/dist/{BitbucketSourceControlProvider-CEZEd4PX.cjs → BitbucketSourceControlProvider-3VHGKSl1.cjs} +2 -2
  6. package/dist/{BitbucketSourceControlProvider-BV6iRDi7.mjs → BitbucketSourceControlProvider-B8IPx2Ad.mjs} +3 -3
  7. package/dist/{ClaudeDriver-lBU7EyUX.cjs → ClaudeDriver-CBCy0_WX.cjs} +176 -11
  8. package/dist/{ClaudeDriver-rooMNrJz.mjs → ClaudeDriver-DsW8yDj9.mjs} +177 -12
  9. package/dist/{CodexDriver-CZCIJSLV.cjs → CodexDriver-3TZPgrGk.cjs} +3 -3
  10. package/dist/{CodexDriver-DBz2rPXb.mjs → CodexDriver-DLwPz5sk.mjs} +4 -4
  11. package/dist/{CodexTextGeneration-BeG7ymPC.mjs → CodexTextGeneration-D1vV8grr.mjs} +2 -2
  12. package/dist/{CodexTextGeneration-BvIcyD1P.cjs → CodexTextGeneration-DLHSW4Mz.cjs} +1 -1
  13. package/dist/{CopilotDriver-CX5zhEdZ.cjs → CopilotDriver-C7a8IhyK.cjs} +20 -16
  14. package/dist/{CopilotDriver-D36vbGbn.mjs → CopilotDriver-DXvGBv-s.mjs} +21 -17
  15. package/dist/{CursorDriver-DWuuOSkJ.mjs → CursorDriver-CeB_vMKJ.mjs} +4 -4
  16. package/dist/{CursorDriver-CPBVeesr.cjs → CursorDriver-uNsDetA3.cjs} +3 -3
  17. package/dist/{ForgejoSourceControlProvider-CzmmcAZO.cjs → ForgejoSourceControlProvider-CJLksvL_.cjs} +2 -2
  18. package/dist/{ForgejoSourceControlProvider-CeN7Snfr.mjs → ForgejoSourceControlProvider-Ds0rU_PN.mjs} +3 -3
  19. package/dist/{GitHubSourceControlProvider-Dmz1LJct.mjs → GitHubSourceControlProvider-C7CJAslU.mjs} +3 -3
  20. package/dist/{GitHubSourceControlProvider-DfFR9O2o.cjs → GitHubSourceControlProvider-CrYNFu8S.cjs} +2 -2
  21. package/dist/{GitLabSourceControlProvider-DGoelNmL.cjs → GitLabSourceControlProvider-jbX5M34A.cjs} +2 -2
  22. package/dist/{GitLabSourceControlProvider-C21lwphV.mjs → GitLabSourceControlProvider-u-Y-e8PV.mjs} +3 -3
  23. package/dist/{GrokDriver-CIXj_4ry.cjs → GrokDriver-BJ00ZiYg.cjs} +3 -3
  24. package/dist/{GrokDriver-qKX1a63G.mjs → GrokDriver-CFgjwnvE.mjs} +4 -4
  25. package/dist/{OpenCodeDriver-DDEuwtXl.cjs → OpenCodeDriver-BTxd2Q3Q.cjs} +487 -207
  26. package/dist/{OpenCodeDriver-CbdswhqU.mjs → OpenCodeDriver-DNApoGdu.mjs} +487 -207
  27. package/dist/{SourceControlProviderDiscoveryCatalog-DJWDCoup.cjs → SourceControlProviderDiscoveryCatalog-CPO3a9_U.cjs} +1 -1
  28. package/dist/{SourceControlProviderDiscoveryCatalog-4_4yahsa.mjs → SourceControlProviderDiscoveryCatalog-hXWNwRMn.mjs} +1 -1
  29. package/dist/bin.cjs +1324 -340
  30. package/dist/bin.mjs +1324 -343
  31. package/dist/client/assets/{AccountSettings-Be5_48k0.js → AccountSettings-Cey-16wq.js} +1 -1
  32. package/dist/client/assets/{AiFocusSettings-DIpQXLW2.js → AiFocusSettings-CaHQXDaQ.js} +1 -1
  33. package/dist/client/assets/{AnimatedHeight-BIsV_Z3J.js → AnimatedHeight-BC-qaTJY.js} +1 -1
  34. package/dist/client/assets/AppearanceSettings-B6UaU-_a.js +1 -0
  35. package/dist/client/assets/{BranchToolbar.logic-D7slG_zJ.js → BranchToolbar.logic-DILAA3Cz.js} +1 -1
  36. package/dist/client/assets/ChatRightPanel-D-AL07IU.js +27 -0
  37. package/dist/client/assets/{ChatThreadRouteView-CocRstME.js → ChatThreadRouteView-tEo-zoCf.js} +1 -1
  38. package/dist/client/assets/CommandPaletteDialog-s7yf5Y2S.js +1 -0
  39. package/dist/client/assets/{CompositeItem-F3NGn6aG.js → CompositeItem-97y1QiiT.js} +1 -1
  40. package/dist/client/assets/{CompositeRoot-CmJGfRtc.js → CompositeRoot-C7Mz4Y_2.js} +1 -1
  41. package/dist/client/assets/{ConnectionsSettings-CXabxSaH.js → ConnectionsSettings-B0-Hkwof.js} +2 -2
  42. package/dist/client/assets/{DiagnosticsSettings-CZ3vY43G.js → DiagnosticsSettings-DX5LH9Bt.js} +1 -1
  43. package/dist/client/assets/{DialogHandle-C4uSr9wX.js → DialogHandle-Cl9dQBJp.js} +1 -1
  44. package/dist/client/assets/{DialogPopup-Dck8r8Hn.js → DialogPopup-a1M74u16.js} +1 -1
  45. package/dist/client/assets/DialogRoot-C_DO1gtO.js +1 -0
  46. package/dist/client/assets/{DialogTitle-CCedPAjV.js → DialogTitle-Bk-w3xLJ.js} +1 -1
  47. package/dist/client/assets/{DialogTrigger-CYJ7_YcV.js → DialogTrigger-D9nkMFu2.js} +1 -1
  48. package/dist/client/assets/{DialogViewport-D-CrTM-P.js → DialogViewport-tgJz2Lwn.js} +1 -1
  49. package/dist/client/assets/{DraftChatThreadRouteView-D8Bt3Qnq.js → DraftChatThreadRouteView-BU2IGTR6.js} +1 -1
  50. package/dist/client/assets/{ExternalIdentityWeb.logic-D64j70NH.js → ExternalIdentityWeb.logic-Bn1HigS9.js} +1 -1
  51. package/dist/client/assets/GlassSurface-CDok2tTN.js +1 -0
  52. package/dist/client/assets/{HostedConnectionControls-DxAXv0Hd.js → HostedConnectionControls-Cux_sRCM.js} +1 -1
  53. package/dist/client/assets/HostedHubRoot-CyySCdJV.js +1 -0
  54. package/dist/client/assets/{HostedNativeAuthorizationRoute-CTQe7Vjt.js → HostedNativeAuthorizationRoute-490iDXmk.js} +1 -1
  55. package/dist/client/assets/{HostedRelayTrustNotice-BldMySVi.js → HostedRelayTrustNotice-CcDOAwgS.js} +1 -1
  56. package/dist/client/assets/{Icons-CT3nd2MA.js → Icons-BEtED8P8.js} +1 -1
  57. package/dist/client/assets/{IntegrationsSettingsPanel-D6f3KoqM.js → IntegrationsSettingsPanel-BFTAvxtn.js} +1 -1
  58. package/dist/client/assets/KeybindingsSettings-VYgbhiZF.js +7 -0
  59. package/dist/client/assets/{McpServersSettings-B7YqVvV4.js → McpServersSettings-DSDCjoTn.js} +1 -1
  60. package/dist/client/assets/{MobileSheet-CkeG6_SP.js → MobileSheet-BDvnUC5W.js} +1 -1
  61. package/dist/client/assets/{NewWorktreeDialog-CKr2ioue.js → NewWorktreeDialog-C65Aifeb.js} +1 -1
  62. package/dist/client/assets/{NoActiveThreadState-BD-eNmfn.js → NoActiveThreadState-DehHNgAp.js} +1 -1
  63. package/dist/client/assets/{NodeSecuritySettings-FWM_SeDi.js → NodeSecuritySettings-DW9GJ-kU.js} +1 -1
  64. package/dist/client/assets/{OpinionatedPluginsSettings-BtZQF4Ze.js → OpinionatedPluginsSettings-DbxPOokL.js} +1 -1
  65. package/dist/client/assets/{PhoneGetAppInterstitial-CooQgpSw.js → PhoneGetAppInterstitial-CbyVrtDn.js} +1 -1
  66. package/dist/client/assets/{PhoneGetAppInterstitialBackdrop-B8vfJdZd.js → PhoneGetAppInterstitialBackdrop-BA4R225F.js} +1 -1
  67. package/dist/client/assets/PhoneHome-c0j_TBEC.js +1 -0
  68. package/dist/client/assets/PhoneSettingsSurface-5LFRIx_5.js +1 -0
  69. package/dist/client/assets/{ProjectFavicon-qZGdjYCM.js → ProjectFavicon-CeVJCQCy.js} +1 -1
  70. package/dist/client/assets/{ProviderModelPicker-D0w23uWo.js → ProviderModelPicker-MFRYAv_3.js} +1 -1
  71. package/dist/client/assets/{ProviderUpdateLaunchNotification.logic-BkoRegCn.js → ProviderUpdateLaunchNotification.logic-CywRitn3.js} +1 -1
  72. package/dist/client/assets/ProvidersSettingsPanel-FYBEqSr_.js +1 -0
  73. package/dist/client/assets/{RedactedSensitiveText-CxtaUiKH.js → RedactedSensitiveText-BuWSWty8.js} +1 -1
  74. package/dist/client/assets/RootAppShell-5HrP6N8H.js +6 -0
  75. package/dist/client/assets/{RycoLetterMark-Bk0kvGJ_.js → RycoLetterMark-CZYntY8t.js} +1 -1
  76. package/dist/client/assets/SettingsDialog-CpwoqGS8.js +1 -0
  77. package/dist/client/assets/{SettingsPanels-Dr4f2y9l.js → SettingsPanels-COWRB29-.js} +3 -3
  78. package/dist/client/assets/{SettingsPanels.editor-B2x4U4rW.js → SettingsPanels.editor-lbLEbllb.js} +1 -1
  79. package/dist/client/assets/SourceControlSettings-DvBNelcO.js +1 -0
  80. package/dist/client/assets/{StatisticsPage-Bjouapmf.js → StatisticsPage-DxAKqvVX.js} +1 -1
  81. package/dist/client/assets/{StatisticsPanel-D_khPph6.js → StatisticsPanel-C0xGLlMA.js} +1 -1
  82. package/dist/client/assets/{StatisticsSettingsLink-Cx43bOeo.js → StatisticsSettingsLink-B7SZerf3.js} +1 -1
  83. package/dist/client/assets/ThreadStatusIndicators-CIOM98q2.js +0 -0
  84. package/dist/client/assets/{ThreadTerminalDrawer-DDHEuRGB.js → ThreadTerminalDrawer-DRelLlEP.js} +1 -1
  85. package/dist/client/assets/{ThreadWorkspacePanel-QF3KwbGm.js → ThreadWorkspacePanel-CktVSliZ.js} +3 -3
  86. package/dist/client/assets/{ToolbarRootContext-BgqqXVly.js → ToolbarRootContext-B1g8IP6k.js} +1 -1
  87. package/dist/client/assets/{WorkItemsTab-AOVwVvb7.js → WorkItemsTab-CahU_t_S.js} +12 -12
  88. package/dist/client/assets/{alert-LqMhbdE9.js → alert-DomE7dAt.js} +1 -1
  89. package/dist/client/assets/{alert-dialog-DxoA6ky8.js → alert-dialog-9Jyh0e8u.js} +1 -1
  90. package/dist/client/assets/appearancePreferences-BhNRCg6W.js +1 -0
  91. package/dist/client/assets/authorization-D8lJzXTE.js +1 -0
  92. package/dist/client/assets/{badge-CXw6fWrB.js → badge-w43sx8eF.js} +1 -1
  93. package/dist/client/assets/{branding-BDfN6Spd.js → branding-B7DcCXjn.js} +1 -1
  94. package/dist/client/assets/{button-BAbJxRzt.js → button-DG8WqjNn.js} +1 -1
  95. package/dist/client/assets/{capabilities-3zgirmmI.js → capabilities-B1FHGoov.js} +1 -1
  96. package/dist/client/assets/{chatThreadActions-DQ8aOQ1g.js → chatThreadActions-BZvyhfKr.js} +1 -1
  97. package/dist/client/assets/{collapsible-dxy6kc2k.js → collapsible-EhAEe5S9.js} +1 -1
  98. package/dist/client/assets/{command-CGNKG_Oe.js → command-Cyn6yIEa.js} +1 -1
  99. package/dist/client/assets/composerDraftStore-TYv9j3vY.js +11 -0
  100. package/dist/client/assets/{data-list-CYKBxN62.js → data-list-DTdqWMGN.js} +1 -1
  101. package/dist/client/assets/{desktopUpdateAtoms-CyfPW2jg.js → desktopUpdateAtoms-CPlZiFRm.js} +1 -1
  102. package/dist/client/assets/{desktopWorkspace-DHUZEpfy.js → desktopWorkspace-DEZ30LlY.js} +1 -1
  103. package/dist/client/assets/device-CHdXzvhB.js +168 -0
  104. package/dist/client/assets/{dialog-DQsYchqu.js → dialog-BNmFD6Nh.js} +1 -1
  105. package/dist/client/assets/{draft-input-CkzOk8BY.js → draft-input-dP7F8odz.js} +1 -1
  106. package/dist/client/assets/editorPreferences-B4GvqMiF.js +1 -0
  107. package/dist/client/assets/{empty-DwzqNgCP.js → empty-Ccxhyvdf.js} +1 -1
  108. package/dist/client/assets/{env-B4arEvJg.js → env-Bcq9YR3B.js} +1 -1
  109. package/dist/client/assets/{getPseudoElementBounds-X62ElHN8.js → getPseudoElementBounds-CO5HJT7x.js} +1 -1
  110. package/dist/client/assets/{group-D9ER9giz.js → group-CzdKmc45.js} +1 -1
  111. package/dist/client/assets/{index-CQmEMMQH.js → index-Gre6bNC8.js} +2 -2
  112. package/dist/client/assets/{input-CHEwW3oH.js → input-BZz4eLRl.js} +1 -1
  113. package/dist/client/assets/{kbd-DCGQZk18.js → kbd-DbvN3zTb.js} +1 -1
  114. package/dist/client/assets/{keybindings-CWJ7E9ZI.js → keybindings-BPE3eEAM.js} +1 -1
  115. package/dist/client/assets/{label-CVFHsLFO.js → label-DZf4lbNF.js} +1 -1
  116. package/dist/client/assets/{lib-qiiNMGgU.js → lib-DgOYoged.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-81iP6Hps.js} +1 -1
  119. package/dist/client/assets/main-DlGNPwsH.css +2 -0
  120. package/dist/client/assets/main-Dz0zookE.js +9 -0
  121. package/dist/client/assets/{menu-Dvxh8sD5.js → menu-B6UEFcn0.js} +1 -1
  122. package/dist/client/assets/{popover-CuH9Yrj3.js → popover-BuYzXGwl.js} +1 -1
  123. package/dist/client/assets/primary-CiDY2oUi.js +2 -0
  124. package/dist/client/assets/projectPaths-D6fHIU1b.js +1 -0
  125. package/dist/client/assets/{providerDriverMeta-I0TSo-QI.js → providerDriverMeta-sBwZhQoN.js} +1 -1
  126. package/dist/client/assets/{providerIconUtils-X0Z3EK-Q.js → providerIconUtils-DiDJeNtT.js} +1 -1
  127. package/dist/client/assets/providerInstances-vd2eZtHx.js +1 -0
  128. package/dist/client/assets/providerModels-vd2eZtHx.js +1 -0
  129. package/dist/client/assets/{qr-code-Bddq6K7S.js → qr-code-Ie92aZvE.js} +1 -1
  130. package/dist/client/assets/{radio-group-CBZFr4C8.js → radio-group-BuuTEtdC.js} +1 -1
  131. package/dist/client/assets/{resolveAriaLabelledBy-CD_ugzhJ.js → resolveAriaLabelledBy-0FA0k4xp.js} +1 -1
  132. package/dist/client/assets/{rightPanelRouteSearch-DB5gQGHK.js → rightPanelRouteSearch-BS8CkNS6.js} +1 -1
  133. package/dist/client/assets/runtime-CPM0EUhb.js +1 -0
  134. package/dist/client/assets/{scroll-area-Drsa8bNB.js → scroll-area-C0yF015F.js} +1 -1
  135. package/dist/client/assets/{scrollEdges-B-cqxY4l.js → scrollEdges-DI5Y3mtR.js} +1 -1
  136. package/dist/client/assets/{select-BYbVr-yg.js → select-CZukJlTn.js} +1 -1
  137. package/dist/client/assets/{separator-CdS5bi4Z.js → separator-D4ckGtPe.js} +1 -1
  138. package/dist/client/assets/session-logic-BalPN1Sc.js +4 -0
  139. package/dist/client/assets/{settingsDialogStore-ygYoScKe.js → settingsDialogStore-LxRFC5hh.js} +1 -1
  140. package/dist/client/assets/{settingsLayout-D8glO7f1.js → settingsLayout-CHJT5wtl.js} +1 -1
  141. package/dist/client/assets/{sheet-BO78gIKZ.js → sheet-BNfImQ-7.js} +1 -1
  142. package/dist/client/assets/{sidebar-Dm6l2GA6.js → sidebar-CFGg5Tkr.js} +1 -1
  143. package/dist/client/assets/sidebarProjectFolders-bhNsO9Z_.js +4 -0
  144. package/dist/client/assets/{sidebarStatusText-D0HT0fek.js → sidebarStatusText-C8QBhZhZ.js} +1 -1
  145. package/dist/client/assets/{skeleton-CvQSeJbw.js → skeleton-DOgQaVXv.js} +1 -1
  146. package/dist/client/assets/{spinner-ClF0jOcX.js → spinner-ClQu8SdC.js} +1 -1
  147. package/dist/client/assets/{src-Vf4LVnMX.js → src-DmPIm3ie.js} +1 -1
  148. package/dist/client/assets/storeSelectors-Cf2WDMfx.js +1 -0
  149. package/dist/client/assets/{switch-BTGo9Yip.js → switch-BZjA7VT9.js} +1 -1
  150. package/dist/client/assets/{terminal-links-CZ3c9AbA.js → terminal-links-CzJomeox.js} +1 -1
  151. package/dist/client/assets/{textarea-RFPODxWW.js → textarea-DHdmRD1r.js} +1 -1
  152. package/dist/client/assets/threadPinning-BLqwZebi.js +1 -0
  153. package/dist/client/assets/{threadPriorityRefreshRuntime-Ct5pnIbX.js → threadPriorityRefreshRuntime-BoNAlBXK.js} +1 -1
  154. package/dist/client/assets/{toast-CcSCAm4B.js → toast-C-0Ft2jD.js} +1 -1
  155. package/dist/client/assets/{toggle-I6h33Cu5.js → toggle-DsnOFDbJ.js} +1 -1
  156. package/dist/client/assets/{toggle-group-mLIkiJtU.js → toggle-group-Chxh9G6t.js} +1 -1
  157. package/dist/client/assets/{tooltip-C8sAONBj.js → tooltip-C_-9XEfA.js} +1 -1
  158. package/dist/client/assets/types-Cf2WDMfx.js +1 -0
  159. package/dist/client/assets/{uiStateStore-B6pjzSjj.js → uiStateStore-DzUrk2GS.js} +1 -1
  160. package/dist/client/assets/useAtlassian-CoHKzu-e.js +0 -0
  161. package/dist/client/assets/{useButton-D__1LqCF.js → useButton-BmvYhoMC.js} +1 -1
  162. package/dist/client/assets/{useCompositeListItem-Cmr_nuuG.js → useCompositeListItem-D0PvH4nv.js} +1 -1
  163. package/dist/client/assets/{useDebouncedValue-DHjoudTq.js → useDebouncedValue-s0BC8Yyp.js} +1 -1
  164. package/dist/client/assets/{useFloatingRootContext-D5EZmrCa.js → useFloatingRootContext-CLCaQEJk.js} +1 -1
  165. package/dist/client/assets/{useHandleNewThread-DX2FtXcP.js → useHandleNewThread-Bw460iXT.js} +1 -1
  166. package/dist/client/assets/{useLabelableId-DnQJ7amm.js → useLabelableId-CB_9OReR.js} +1 -1
  167. package/dist/client/assets/{useLocation-CDeYzWW6.js → useLocation-DGJMt6gP.js} +1 -1
  168. package/dist/client/assets/{useOpenInteractionType-CjtpACKR.js → useOpenInteractionType-BSSI2GzS.js} +1 -1
  169. package/dist/client/assets/{usePhoneThreadActions-BEa3VzGG.js → usePhoneThreadActions-BIDUSWSI.js} +1 -1
  170. package/dist/client/assets/{usePopupViewport-BuhsNdVy.js → usePopupViewport-8F-J1h5f.js} +1 -1
  171. package/dist/client/assets/{useScrollLock-D3tMGsRk.js → useScrollLock-CBz-5_MX.js} +1 -1
  172. package/dist/client/assets/{useStatistics-CtunoTE-.js → useStatistics-B91973jb.js} +2 -2
  173. package/dist/client/assets/{useSwipeDismiss-CbgDJvw1.js → useSwipeDismiss-D22_vuiH.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-BCH01d6u.js} +1 -1
  176. package/dist/client/assets/{useTriggerFocusGuards-CrugmkhX.js → useTriggerFocusGuards-f7afwACm.js} +1 -1
  177. package/dist/client/assets/{useValueChanged-MQtIzPIU.js → useValueChanged-EkWF0C3k.js} +1 -1
  178. package/dist/client/assets/{utils-BofFIn5Y.js → utils-CV2fJJxC.js} +1 -1
  179. package/dist/client/index.html +1 -1
  180. package/dist/{collectUint8StreamText-Bb52hlpd.cjs → collectUint8StreamText-Dsbmrw73.cjs} +48 -10
  181. package/dist/{collectUint8StreamText-EDg4F0TU.mjs → collectUint8StreamText-oFvWyN3_.mjs} +37 -11
  182. package/dist/{makeManagedServerProvider-itynW7xv.cjs → makeManagedServerProvider-CANTNAsz.cjs} +9 -2
  183. package/dist/{makeManagedServerProvider-Cf8bNWwc.mjs → makeManagedServerProvider-PLtJj7EV.mjs} +10 -3
  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/device-B_qvyvtW.js +0 -168
  203. package/dist/client/assets/editorPreferences-DHIJntKF.js +0 -1
  204. package/dist/client/assets/main-BKS5Nf2_.js +0 -9
  205. package/dist/client/assets/main-DaYHZt-J.css +0 -2
  206. package/dist/client/assets/panel-right-BodNpkM9.js +0 -1
  207. package/dist/client/assets/primary-BzLEg2w1.js +0 -2
  208. package/dist/client/assets/projectPaths-BAd6NFcE.js +0 -1
  209. package/dist/client/assets/providerInstances-BJcfB_9E.js +0 -1
  210. package/dist/client/assets/providerModels-BJcfB_9E.js +0 -1
  211. package/dist/client/assets/runtime-CXut_g4p.js +0 -1
  212. package/dist/client/assets/session-logic-GZix7S2I.js +0 -4
  213. package/dist/client/assets/sidebarProjectFolders-cnmz3B_-.js +0 -4
  214. package/dist/client/assets/storeSelectors-DYekgeHu.js +0 -1
  215. package/dist/client/assets/types-DYekgeHu.js +0 -1
  216. package/dist/client/assets/useAppearancePreference-BlLlxQl7.js +0 -1
  217. package/dist/client/assets/useAtlassian-9-hy2f8z.js +0 -0
package/dist/bin.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as AgentControlExternalOverviewResult, $a as DESKTOP_NATIVE_NODE_CLAIM_SIGN_PATH, $i as ThreadTurnDiffCompletedPayload$1, $n as ClaudeSettings, $r as OrchestrationEventType, $t as AgentControlMcpRecentActivityResult, A as AGENT_CONTROL_MCP_AUTOMATION_LIST_PROMPT_MAX_CHARS, Aa as ThreadPriorityBatchId, An as AtlassianConnectionStatus, Ao as ApprovalRequestId, At as AgentControlMcpProposeAutomationUpdateInput, B as AGENT_CONTROL_TERMINAL_PROPOSAL_STATUSES, Ba as defaultInstanceIdForDriver, Bi as ThreadGoalUpdatedPayload$1, Bn as McpProviderCapabilities, Bo as MessageId, Br as DEFAULT_PROJECT_METADATA_DIR, Bt as AgentControlMcpProposeProjectCreateInput, C as AGENT_CONTROL_DEVICE_ACTION_KINDS, Ci as ProjectCreatedPayload$1, Cn as DeviceUdid, Co as RelayProtocolVersion, Cr as ProviderSteerTurnInput, Ct as AgentControlMcpListThreadsInput, D as AGENT_CONTROL_EXTERNAL_MCP_TOOL_NAMES, Di as ProjectScript, Dn as AtlassianCapability, Do as AuthRevokeClientSessionInput, Dr as CONTEXT_HANDOFF_ACTIVITY_KIND, Dt as AgentControlMcpOrchestrationEventsResult, E as AGENT_CONTROL_EXTERNAL_MCP_TOOLS, Ea as VcsProcessExitError, Ei as ProjectMetadataDir, En as ThreadPriorityRpcError, Eo as AuthCreatePairingCredentialInput, Er as AgentTokenMode, Et as AgentControlMcpOperationalReadInput, F as AGENT_CONTROL_MCP_TOOLS, Fa as DEFAULT_GIT_TEXT_GENERATION_OPTIONS_BY_PROVIDER, Fi as ThreadArchivedPayload$1, Fn as McpInventoryResource, Fo as CommandId, Fr as ContextHandoffDigest, Ft as AgentControlMcpProposeDeviceInstallInput, G as AgentControlAutomationDefinition, Ga as TerminalNotRunningError, Gi as ThreadProposedPlanUpsertedPayload$1, Gn as McpServerWritableConfig, Gr as OrchestrationAggregateKind, Gt as AgentControlMcpReadAutomationInput, H as AgentControlActionKind, Hi as ThreadMessageSentPayload, Hn as McpServer, Ho as PositiveInt, Hr as ModelSelection, Ht as AgentControlMcpProposeProjectUpdateInput, I as AGENT_CONTROL_MCP_TOOL_NAMES, Ia as DEFAULT_MODEL, Ii as ThreadAttachedToWorktreePayload$1, In as McpInventoryResourceTemplate, Io as ContextHandoffId, Ir as ContextHandoffEndpointSnapshot, It as AgentControlMcpProposeDeviceLaunchInput, J as AgentControlAutomationRunId, Ja as EDITORS, Ji as ThreadSessionSetPayload$1, Jn as McpWorkspaceId, Jr as OrchestrationCheckpointSummary, Jt as AgentControlMcpReadDeviceContentInput, K as AgentControlAutomationId, Ka as TerminalSessionLookupError, Ki as ThreadRevertedPayload$1, Kn as McpSettingsError, Kr as OrchestrationCheckpointFile, Kt as AgentControlMcpReadAutomationResult, L as AGENT_CONTROL_MCP_WAIT_TIMEOUT_MS_DEFAULT, La as MODEL_SLUG_ALIASES_BY_PROVIDER, Li as ThreadCreatedPayload$1, Ln as McpInventoryTool, Lo as EnvironmentId, Lr as ContextHandoffInspectionError, Lt as AgentControlMcpProposeDeviceOpenUrlInput, M as AGENT_CONTROL_MCP_OPERATIONAL_RANGE_MAX_MS, Ma as ThreadPriorityFingerprint, Mi as ProviderSessionRuntimeStatus, Mn as GitCommandError, Mo as AtlassianResourceId, Mr as ChatAttachment, Mt as AgentControlMcpProposeDeviceBootInput, N as AGENT_CONTROL_MCP_OPERATIONAL_RETENTION_MS, Ni as RuntimeMode, Nn as GitManagerError, No as AuthSessionId, Nr as ClientOrchestrationCommand, Nt as AgentControlMcpProposeDeviceDetachInput, O as AGENT_CONTROL_EXTERNAL_PAIRING_CODE_TTL_MS, Oi as ProjectionPendingApprovalDecision, On as AtlassianConnectionError, Oo as AuthRevokePairingLinkInput, Or as CONTEXT_HANDOFF_ERROR_MAX_CHARS, Ot as AgentControlMcpProposeAutomationCancelInput, P as AGENT_CONTROL_MCP_READ_THREAD_TEXT_BUDGET_CHARS, Pa as DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER, Pi as ThreadActivityAppendedPayload$1, Pn as TextGenerationError, Po as CheckpointRef, Pr as ContextHandoffActivityPayload, Pt as AgentControlMcpProposeDeviceInputInput, Q as AgentControlExternalIntegration, Qa as DESKTOP_NATIVE_NODE_CLAIM_MAX_BODY_BYTES, Qi as ThreadTokenModeSetPayload$1, Qn as ServerProviderUpdateError, Qo as TurnId, Qr as OrchestrationEventMetadata, Qt as AgentControlMcpReadThreadResult, R as AGENT_CONTROL_MCP_WAIT_TIMEOUT_MS_MAX, Ra as ProviderDriverKind, Ri as ThreadDeletedPayload$1, Rn as McpListServersResult, Ro as EventId, Rr as ContextHandoffMode, Rt as AgentControlMcpProposeDeviceRecordingInput, S as AGENT_CONTROL_CAPABILITIES, Sa as SourceControlRepositoryError, Si as ProjectAvatarSetPayload$1, Sn as DeviceRpcError, So as RelayFrame, Sr as ProviderSessionStartInput, St as AgentControlMcpListProjectsResult, T as AGENT_CONTROL_EXTERNAL_CREDENTIAL_AUDIENCE, Ti as ProjectMetaUpdatedPayload$1, Tn as ThreadPriorityCandidateRanking, To as AuthClientMetadataDeviceType, Tr as ProviderStopSessionInput, Tt as AgentControlMcpMutationResult, U as AgentControlActionPlan, Ua as TerminalCwdError, Ui as ThreadMetaUpdatedPayload$1, Un as McpServerConfig, Uo as ProjectId, Ur as ORCHESTRATION_WS_METHODS, Ut as AgentControlMcpProposeSettingsChangeInput, V as AGENT_CONTROL_WS_METHODS, Va as isProviderDriverKind, Vi as ThreadInteractionModeSetPayload$1, Vn as McpProviderSupport, Vo as NonNegativeInt, Vr as DEFAULT_PROVIDER_INTERACTION_MODE, Vt as AgentControlMcpProposeProjectRemoveInput, W as AgentControlAutomation, Wa as TerminalHistoryError, Wi as ThreadPriorityProjectedRanking, Wn as McpServerName, Wr as OrchestrationActorKind, Wt as AgentControlMcpProviderRuntimeEventsResult, X as AgentControlExternalCapabilitiesResult, Xa as DESKTOP_NATIVE_NODE_CLAIM_COMMIT_PATH, Xi as ThreadSettlementOverride, Xn as UsageReadError, Xo as ThreadId, Xr as OrchestrationDispatchCommandError, Xt as AgentControlMcpReadDeviceStateResult, Y as AgentControlCapability, Ya as OpenError, Yi as ThreadSettledPayload$1, Yn as OpinionatedPluginError, Yr as OrchestrationCommandReceiptStatus, Yt as AgentControlMcpReadDeviceStateInput, Z as AgentControlExternalCreateTaskInput, Za as DESKTOP_NATIVE_NODE_CLAIM_DESCRIPTOR_PATH, Zi as ThreadStatusBucketOverriddenPayload$1, Zn as ServerProvider, Zo as TrimmedNonEmptyString, Zr as OrchestrationEvent, Zt as AgentControlMcpReadThreadInput, _ as ProjectWriteFileError, _a as WORK_ITEM_DETAIL_COMMENT_BODY_MAX_BYTES, _i as OrchestrationThreadHistoryCursor, _n as AgentControlRpcError, _o as RELAY_MAX_RPC_MESSAGE_BYTES, _r as isToolLifecycleItemType, _t as AgentControlMcpListAutomationsInput, a as WS_METHODS, aa as WorktreeCreatedPayload$1, ai as OrchestrationGetWorkflowScriptError, an as AgentControlOperationId, ao as LOCAL_INTRODUCTION_MAX_BODY_BYTES, ar as OpenCodeSettings, at as AgentControlIntegrationId, b as AGENT_CONTROL_AUTOMATION_MIN_INTERVAL_MS, bn as DEVICE_SWIPE_DURATION_MAX_MS, bo as RelayChannelId, br as ProviderRespondToUserInputInput, bt as AgentControlMcpListDevicesResult, c as WsRpcGroup, ca as WorktreeMetaUpdatedPayload$1, ci as OrchestrationProposedPlanId, cn as AgentControlPlanDigest, co as HubEnrollmentCeremonyDetail, cr as ThreadEnvMode, ct as AgentControlMcpControlRequestResult, da as PullRequestState, di as OrchestrationSession, dn as AgentControlProposal, do as RELAY_AUTHENTICATION_DEADLINE_MS, dr as KeybindingsConfigError, dt as AgentControlMcpDiagnosticsSummaryResult, ea as ThreadTurnInterruptRequestedPayload$1, ei as OrchestrationGetFullThreadDiffError, en as AgentControlMcpSendMessageInput, eo as DesktopNativeNodeClaimCommitRequest, er as CodexSettings, et as AgentControlExternalProjectScope, f as ProjectListEntriesError, fa as StatusBucket, fi as OrchestrationSessionStatus, fn as AgentControlProposalId, fo as RELAY_FRAME_TYPES, fr as MODEL_PICKER_JUMP_KEYBINDING_COMMANDS, ft as AgentControlMcpInstallation, g as ProjectStageFileReferenceError, ga as WORK_ITEM_DETAIL_BODY_MAX_BYTES, gi as OrchestrationThreadActivityTone, gn as AgentControlRiskTag, go as RELAY_MAX_RETRY_AFTER_MS, gr as ToolLifecycleItemType, gt as AgentControlMcpListAutomationRunsResult, h as ProjectSearchEntriesError, ha as ThreadGoal, hi as OrchestrationThread, hn as AgentControlResultEnvelope, ho as RELAY_MAX_DATA_FRAME_BYTES, hr as RuntimeSubagentStatus, ht as AgentControlMcpListAutomationRunsInput, i as fromLenientJson, ia as WorktreeArchivedPayload$1, ii as OrchestrationGetTurnDiffResult, in as AgentControlOperation, io as LOCAL_INTRODUCTION_DESCRIPTOR_PATH, ir as GrokSettings, it as AgentControlExternalWaitForTaskInput, j as AGENT_CONTROL_MCP_MESSAGE_TEXT_MAX_CHARS, ja as ThreadPriorityCandidateId, ji as ProviderInteractionMode, jn as AtlassianProduct, jo as AtlassianConnectionId, jr as CONTEXT_HANDOFF_WS_METHODS, jt as AgentControlMcpProposeDeviceAttachInput, k as AGENT_CONTROL_EXTERNAL_PROPOSAL_TTL_MS, ka as VcsUnsupportedOperationError, ki as ProjectionPendingApprovalStatus, kn as AtlassianConnectionKind, ko as AuthRpcError, kr as CONTEXT_HANDOFF_INSPECTION_CHUNK_MAX_BYTES, kt as AgentControlMcpProposeAutomationCreateInput, l as FilesystemBrowseError, la as WorktreeRestoredPayload$1, li as OrchestrationReadModel, ln as AgentControlPrincipal, lo as HubEnrollmentStartResult, lr as KeybindingRule, lt as AgentControlMcpCreateThreadsInput, m as ProjectReadFileError, ma as WorktreeId, mi as OrchestrationStopBackgroundTaskError, mn as AgentControlRequestId, mr as THREAD_JUMP_KEYBINDING_COMMANDS, mt as AgentControlMcpInterruptThreadInput, n as decodeJsonResult, na as ThreadUnsettledPayload$1, ni as OrchestrationGetTaskOutputError, nn as AgentControlMcpUpdateThreadInput, no as LOCAL_INTRODUCTION_COMPLETE_PATH, nr as CursorSettings, nt as AgentControlExternalTaskId, o as WsDeviceRpcGroup, oa as WorktreeDeletedPayload$1, oi as OrchestrationMessage, on as AgentControlOperationState, oo as LocalIntroductionCompleteRequest, or as ServerSettings, ot as AgentControlMcpCapabilitiesResult, p as ProjectReadFileBinaryError, pa as Worktree, pi as OrchestrationShellSnapshot, pn as AgentControlProposalStatus, po as RELAY_MAX_CONTROL_FRAME_BYTES, pr as ResolvedKeybindingRule, pt as AgentControlMcpInstallationId, q as AgentControlAutomationRun, qa as TerminalSubscriptionResyncError, qi as ThreadRuntimeModeSetPayload$1, qn as McpWorkspace, qo as RuntimeSessionId, qr as OrchestrationCheckpointStatus, qt as AgentControlMcpReadControlRequestInput, r as formatSchemaError, ra as TurnDispatchMode, ri as OrchestrationGetTurnDiffError, rn as AgentControlMcpWaitForControlRequestInput, rr as DEFAULT_SERVER_SETTINGS, rt as AgentControlExternalTaskIdInput, s as WsHostedRpcGroup, sa as WorktreeManualPositionSetPayload$1, si as OrchestrationMessageRole, sn as AgentControlOperationStatus, so as HubConnectorStatus, sr as ServerSettingsError, st as AgentControlMcpContextResult, t as collectUint8StreamText, ta as ThreadUnarchivedPayload$1, ti as OrchestrationGetSnapshotError, tn as AgentControlMcpSettingsSummaryResult, to as DesktopNativeNodeClaimSignRequest, tr as CopilotSettings, tt as AgentControlExternalRpcError, u as PROJECT_READ_FILE_BINARY_MAX_BYTES, ua as WorktreeSourceControlStateUpdatedPayload$1, ui as OrchestrationReplayEventsError, un as AgentControlPromptSummary, uo as HubIdentitySummary, ur as KeybindingsConfig, ut as AgentControlMcpDiagnosticsSummaryInput, v as AGENT_CONTROL_ACTION_CAPABILITIES, va as WorkItemProviderError, vi as OrchestrationThreadHistoryError, vn as DEVICE_CAPABILITY_LABELS, vo as RELAY_SUPPORTED_VERSION_RANGE, vr as ProviderInterruptTurnInput, vt as AgentControlMcpListAutomationsResult, w as AGENT_CONTROL_ERROR_CODES, wa as VcsDriverKind, wi as ProjectDeletedPayload$1, wn as ThreadPriorityBatchSnapshot, wo as AuthBootstrapInput, wr as ProviderStopBackgroundTaskInput, wt as AgentControlMcpListThreadsResult, x as AGENT_CONTROL_AUTOMATION_PROPOSAL_TTL_MS, xa as SourceControlProviderError, xn as DEVICE_WS_METHODS, xo as RelayEffectiveRole, xr as ProviderSendTurnInput, xt as AgentControlMcpListProjectsInput, y as AGENT_CONTROL_AUTOMATION_MAX_HORIZON_MS, ya as WorkItemProviderKind, yi as OrchestrationWorktreeShell, yn as DEVICE_FRAME_MAGIC, yo as RelayCapability, yr as ProviderRespondToRequestInput, yt as AgentControlMcpListDevicesInput, z as AGENT_CONTROL_RISK_TAGS, za as ProviderInstanceId, zi as ThreadGoalClearedPayload$1, zn as McpOauthLoginResult, zo as IsoDateTime, zr as DEFAULT_AGENT_TOKEN_MODE, zt as AgentControlMcpProposeDeviceShutdownInput } from "./collectUint8StreamText-EDg4F0TU.mjs";
3
+ import { $ as AgentControlExternalOverviewResult, $a as DESKTOP_NATIVE_NODE_CLAIM_DESCRIPTOR_PATH, $i as ThreadStatusBucketOverriddenPayload$1, $n as ClaudeSettings, $o as TrimmedNonEmptyString, $r as OrchestrationEventType, $t as AgentControlMcpRecentActivityResult, A as AGENT_CONTROL_MCP_AUTOMATION_LIST_PROMPT_MAX_CHARS, Ai as ProjectionPendingApprovalDecision, An as AtlassianConnectionStatus, Ao as AuthRevokePairingLinkInput, At as AgentControlMcpProposeAutomationUpdateInput, B as AGENT_CONTROL_TERMINAL_PROPOSAL_STATUSES, Ba as ProviderDriverKind, Bi as ThreadDeletedPayload$1, Bn as McpProviderCapabilities, Bo as EventId, Br as DEFAULT_PROJECT_METADATA_DIR, Bt as AgentControlMcpProposeProjectCreateInput, C as AGENT_CONTROL_DEVICE_ACTION_KINDS, Ca as SourceControlProviderError, Cn as DeviceUdid, Co as RelayEffectiveRole, Cr as ProviderSteerTurnInput, Ct as AgentControlMcpListThreadsInput, D as AGENT_CONTROL_EXTERNAL_MCP_TOOL_NAMES, Di as ProjectMetaUpdatedPayload$1, Dn as AtlassianCapability, Do as AuthClientMetadataDeviceType, Dr as CONTEXT_HANDOFF_ACTIVITY_KIND, Dt as AgentControlMcpOrchestrationEventsResult, E as AGENT_CONTROL_EXTERNAL_MCP_TOOLS, Ea as VcsDriverKind, Ei as ProjectDeletedPayload$1, En as ThreadPriorityRpcError, Eo as AuthBootstrapInput, Er as AgentTokenMode, Et as AgentControlMcpOperationalReadInput, F as AGENT_CONTROL_MCP_TOOLS, Fi as RuntimeMode, Fn as McpInventoryResource, Fo as AuthSessionId, Fr as ContextHandoffDigest, Ft as AgentControlMcpProposeDeviceInstallInput, G as AgentControlAutomationDefinition, Ga as TerminalCwdError, Gi as ThreadMetaUpdatedPayload$1, Gn as McpServerWritableConfig, Go as ProjectId, Gr as OrchestrationAggregateKind, Gt as AgentControlMcpReadAutomationInput, H as AgentControlActionKind, Ha as defaultInstanceIdForDriver, Hi as ThreadGoalUpdatedPayload$1, Hn as McpServer, Ho as MessageId, Hr as ModelSelection, Ht as AgentControlMcpProposeProjectUpdateInput, I as AGENT_CONTROL_MCP_TOOL_NAMES, Ia as DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER, Ii as ThreadActivityAppendedPayload$1, In as McpInventoryResourceTemplate, Io as CheckpointRef, Ir as ContextHandoffEndpointSnapshot, It as AgentControlMcpProposeDeviceLaunchInput, J as AgentControlAutomationRunId, Ja as TerminalSessionLookupError, Ji as ThreadRevertedPayload$1, Jn as McpWorkspaceId, Jr as OrchestrationCheckpointSummary, Jt as AgentControlMcpReadDeviceContentInput, K as AgentControlAutomationId, Ka as TerminalHistoryError, Ki as ThreadPriorityProjectedRanking, Kn as McpSettingsError, Kr as OrchestrationCheckpointFile, Kt as AgentControlMcpReadAutomationResult, L as AGENT_CONTROL_MCP_WAIT_TIMEOUT_MS_DEFAULT, La as DEFAULT_GIT_TEXT_GENERATION_OPTIONS_BY_PROVIDER, Li as ThreadArchivedPayload$1, Ln as McpInventoryTool, Lo as CommandId, Lr as ContextHandoffInspectionError, Lt as AgentControlMcpProposeDeviceOpenUrlInput, M as AGENT_CONTROL_MCP_OPERATIONAL_RANGE_MAX_MS, Ma as ThreadPriorityBatchId, Mn as GitCommandError, Mo as ApprovalRequestId, Mr as ChatAttachment, Mt as AgentControlMcpProposeDeviceBootInput, N as AGENT_CONTROL_MCP_OPERATIONAL_RETENTION_MS, Na as ThreadPriorityCandidateId, Ni as ProviderInteractionMode, Nn as GitManagerError, No as AtlassianConnectionId, Nr as ClientOrchestrationCommand, Nt as AgentControlMcpProposeDeviceDetachInput, O as AGENT_CONTROL_EXTERNAL_PAIRING_CODE_TTL_MS, Oa as VcsProcessExitError, Oi as ProjectMetadataDir, On as AtlassianConnectionError, Oo as AuthCreatePairingCredentialInput, Or as CONTEXT_HANDOFF_ERROR_MAX_CHARS, Ot as AgentControlMcpProposeAutomationCancelInput, P as AGENT_CONTROL_MCP_READ_THREAD_TEXT_BUDGET_CHARS, Pa as ThreadPriorityFingerprint, Pi as ProviderSessionRuntimeStatus, Pn as TextGenerationError, Po as AtlassianResourceId, Pr as ContextHandoffActivityPayload, Pt as AgentControlMcpProposeDeviceInputInput, Q as AgentControlExternalIntegration, Qa as DESKTOP_NATIVE_NODE_CLAIM_COMMIT_PATH, Qi as ThreadSettlementOverride, Qn as ServerProviderUpdateError, Qo as ThreadId, Qr as OrchestrationEventMetadata, Qt as AgentControlMcpReadThreadResult, R as AGENT_CONTROL_MCP_WAIT_TIMEOUT_MS_MAX, Ra as DEFAULT_MODEL, Ri as ThreadAttachedToWorktreePayload$1, Rn as McpListServersResult, Ro as ContextHandoffId, Rr as ContextHandoffMode, Rt as AgentControlMcpProposeDeviceRecordingInput, S as AGENT_CONTROL_CAPABILITIES, Si as PROVIDER_SEND_TURN_MAX_IMAGE_BYTES, Sn as DeviceRpcError, So as RelayChannelId, Sr as ProviderSessionStartInput, St as AgentControlMcpListProjectsResult, T as AGENT_CONTROL_EXTERNAL_CREDENTIAL_AUDIENCE, Ti as ProjectCreatedPayload$1, Tn as ThreadPriorityCandidateRanking, To as RelayProtocolVersion, Tr as ProviderStopSessionInput, Tt as AgentControlMcpMutationResult, U as AgentControlActionPlan, Ua as isProviderDriverKind, Ui as ThreadInteractionModeSetPayload$1, Un as McpServerConfig, Uo as NonNegativeInt, Ur as ORCHESTRATION_WS_METHODS, Ut as AgentControlMcpProposeSettingsChangeInput, V as AGENT_CONTROL_WS_METHODS, Va as ProviderInstanceId, Vi as ThreadGoalClearedPayload$1, Vn as McpProviderSupport, Vo as IsoDateTime, Vr as DEFAULT_PROVIDER_INTERACTION_MODE, Vt as AgentControlMcpProposeProjectRemoveInput, W as AgentControlAutomation, Wi as ThreadMessageSentPayload, Wn as McpServerName, Wo as PositiveInt, Wr as OrchestrationActorKind, Wt as AgentControlMcpProviderRuntimeEventsResult, X as AgentControlExternalCapabilitiesResult, Xa as EDITORS, Xi as ThreadSessionSetPayload$1, Xn as UsageReadError, Xr as OrchestrationDispatchCommandError, Xt as AgentControlMcpReadDeviceStateResult, Y as AgentControlCapability, Ya as TerminalSubscriptionResyncError, Yi as ThreadRuntimeModeSetPayload$1, Yn as OpinionatedPluginError, Yo as RuntimeSessionId, Yr as OrchestrationCommandReceiptStatus, Yt as AgentControlMcpReadDeviceStateInput, Z as AgentControlExternalCreateTaskInput, Za as OpenError, Zi as ThreadSettledPayload$1, Zn as ServerProvider, Zr as OrchestrationEvent, Zt as AgentControlMcpReadThreadInput, _ as ProjectWriteFileError, _a as ThreadGoal, _i as OrchestrationThreadHistoryCursor, _n as AgentControlRpcError, _o as RELAY_MAX_DATA_FRAME_BYTES, _r as isToolLifecycleItemType, _t as AgentControlMcpListAutomationsInput, a as WS_METHODS, aa as TurnDispatchMode, ai as OrchestrationGetWorkflowScriptError, an as AgentControlOperationId, ar as OpenCodeSettings, at as AgentControlIntegrationId, b as AGENT_CONTROL_AUTOMATION_MIN_INTERVAL_MS, ba as WorkItemProviderError, bi as PROVIDER_SEND_TURN_MAX_ATTACHMENT_TOTAL_BYTES, bn as DEVICE_SWIPE_DURATION_MAX_MS, bo as RELAY_SUPPORTED_VERSION_RANGE, br as ProviderRespondToUserInputInput, bt as AgentControlMcpListDevicesResult, c as WsRpcGroup, ca as WorktreeDeletedPayload$1, ci as OrchestrationProposedPlanId, cn as AgentControlPlanDigest, co as LocalIntroductionCompleteRequest, cr as ThreadEnvMode, ct as AgentControlMcpControlRequestResult, da as WorktreeRestoredPayload$1, di as OrchestrationSession, dn as AgentControlProposal, do as HubEnrollmentStartResult, dr as KeybindingsConfigError, dt as AgentControlMcpDiagnosticsSummaryResult, ea as ThreadTokenModeSetPayload$1, ei as OrchestrationGetFullThreadDiffError, en as AgentControlMcpSendMessageInput, eo as DESKTOP_NATIVE_NODE_CLAIM_MAX_BODY_BYTES, er as CodexSettings, es as TurnId, et as AgentControlExternalProjectScope, f as ProjectListEntriesError, fa as WorktreeSourceControlStateUpdatedPayload$1, fi as OrchestrationSessionStatus, fn as AgentControlProposalId, fo as HubIdentitySummary, fr as MODEL_PICKER_JUMP_KEYBINDING_COMMANDS, ft as AgentControlMcpInstallation, g as ProjectStageFileReferenceError, ga as WorktreeId, gi as OrchestrationThreadActivityTone, gn as AgentControlRiskTag, gr as ToolLifecycleItemType, gt as AgentControlMcpListAutomationRunsResult, h as ProjectSearchEntriesError, ha as Worktree, hi as OrchestrationThread, hn as AgentControlResultEnvelope, ho as RELAY_MAX_CONTROL_FRAME_BYTES, hr as RuntimeSubagentStatus, ht as AgentControlMcpListAutomationRunsInput, i as fromLenientJson, ia as ThreadUnsettledPayload$1, ii as OrchestrationGetTurnDiffResult, in as AgentControlOperation, io as LOCAL_INTRODUCTION_COMPLETE_PATH, ir as GrokSettings, it as AgentControlExternalWaitForTaskInput, j as AGENT_CONTROL_MCP_MESSAGE_TEXT_MAX_CHARS, ja as VcsUnsupportedOperationError, ji as ProjectionPendingApprovalStatus, jn as AtlassianProduct, jo as AuthRpcError, jr as CONTEXT_HANDOFF_WS_METHODS, jt as AgentControlMcpProposeDeviceAttachInput, k as AGENT_CONTROL_EXTERNAL_PROPOSAL_TTL_MS, ki as ProjectScript, kn as AtlassianConnectionKind, ko as AuthRevokeClientSessionInput, kr as CONTEXT_HANDOFF_INSPECTION_CHUNK_MAX_BYTES, kt as AgentControlMcpProposeAutomationCreateInput, l as FilesystemBrowseError, la as WorktreeManualPositionSetPayload$1, li as OrchestrationReadModel, ln as AgentControlPrincipal, lo as HubConnectorStatus, lr as KeybindingRule, lt as AgentControlMcpCreateThreadsInput, m as ProjectReadFileError, ma as StatusBucket, mi as OrchestrationStopBackgroundTaskError, mn as AgentControlRequestId, mo as RELAY_FRAME_TYPES, mr as THREAD_JUMP_KEYBINDING_COMMANDS, mt as AgentControlMcpInterruptThreadInput, n as decodeJsonResult, na as ThreadTurnInterruptRequestedPayload$1, ni as OrchestrationGetTaskOutputError, nn as AgentControlMcpUpdateThreadInput, no as DesktopNativeNodeClaimCommitRequest, nr as CursorSettings, nt as AgentControlExternalTaskId, o as WsDeviceRpcGroup, oa as WorktreeArchivedPayload$1, oi as OrchestrationMessage, on as AgentControlOperationState, oo as LOCAL_INTRODUCTION_DESCRIPTOR_PATH, or as ServerSettings, ot as AgentControlMcpCapabilitiesResult, p as ProjectReadFileBinaryError, pa as PullRequestState, pi as OrchestrationShellSnapshot, pn as AgentControlProposalStatus, po as RELAY_AUTHENTICATION_DEADLINE_MS, pr as ResolvedKeybindingRule, pt as AgentControlMcpInstallationId, q as AgentControlAutomationRun, qa as TerminalNotRunningError, qi as ThreadProposedPlanUpsertedPayload$1, qn as McpWorkspace, qr as OrchestrationCheckpointStatus, qt as AgentControlMcpReadControlRequestInput, r as formatSchemaError, ra as ThreadUnarchivedPayload$1, ri as OrchestrationGetTurnDiffError, rn as AgentControlMcpWaitForControlRequestInput, ro as DesktopNativeNodeClaimSignRequest, rr as DEFAULT_SERVER_SETTINGS, rt as AgentControlExternalTaskIdInput, s as WsHostedRpcGroup, sa as WorktreeCreatedPayload$1, si as OrchestrationMessageRole, sn as AgentControlOperationStatus, so as LOCAL_INTRODUCTION_MAX_BODY_BYTES, sr as ServerSettingsError, st as AgentControlMcpContextResult, t as collectUint8StreamText, ta as ThreadTurnDiffCompletedPayload$1, ti as OrchestrationGetSnapshotError, tn as AgentControlMcpSettingsSummaryResult, to as DESKTOP_NATIVE_NODE_CLAIM_SIGN_PATH, tr as CopilotSettings, tt as AgentControlExternalRpcError, u as PROJECT_READ_FILE_BINARY_MAX_BYTES, ua as WorktreeMetaUpdatedPayload$1, ui as OrchestrationReplayEventsError, un as AgentControlPromptSummary, uo as HubEnrollmentCeremonyDetail, ur as KeybindingsConfig, ut as AgentControlMcpDiagnosticsSummaryInput, v as AGENT_CONTROL_ACTION_CAPABILITIES, va as WORK_ITEM_DETAIL_BODY_MAX_BYTES, vi as OrchestrationThreadHistoryError, vn as DEVICE_CAPABILITY_LABELS, vo as RELAY_MAX_RETRY_AFTER_MS, vr as ProviderInterruptTurnInput, vt as AgentControlMcpListAutomationsResult, w as AGENT_CONTROL_ERROR_CODES, wa as SourceControlRepositoryError, wi as ProjectAvatarSetPayload$1, wn as ThreadPriorityBatchSnapshot, wo as RelayFrame, wr as ProviderStopBackgroundTaskInput, wt as AgentControlMcpListThreadsResult, x as AGENT_CONTROL_AUTOMATION_PROPOSAL_TTL_MS, xa as WorkItemProviderKind, xi as PROVIDER_SEND_TURN_MAX_FILE_BYTES, xn as DEVICE_WS_METHODS, xo as RelayCapability, xr as ProviderSendTurnInput, xt as AgentControlMcpListProjectsInput, y as AGENT_CONTROL_AUTOMATION_MAX_HORIZON_MS, ya as WORK_ITEM_DETAIL_COMMENT_BODY_MAX_BYTES, yi as OrchestrationWorktreeShell, yn as DEVICE_FRAME_MAGIC, yo as RELAY_MAX_RPC_MESSAGE_BYTES, yr as ProviderRespondToRequestInput, yt as AgentControlMcpListDevicesInput, z as AGENT_CONTROL_RISK_TAGS, za as MODEL_SLUG_ALIASES_BY_PROVIDER, zi as ThreadCreatedPayload$1, zn as McpOauthLoginResult, zo as EnvironmentId, zr as DEFAULT_AGENT_TOKEN_MODE, zt as AgentControlMcpProposeDeviceShutdownInput } from "./collectUint8StreamText-oFvWyN3_.mjs";
4
4
  import { $ as normalizeGitRemoteUrl, A as runtimeQueueBlockedDuration, B as startupCommandGateQueueHighWater, C as providerStartupQueueHighWater, Ct as decode, D as providerTurnsTotal, E as providerTurnMetricAttributes, Et as Type, F as runtimeQueueHighWater, G as LocalDiagnosticsMetrics, H as terminalRestartsTotal, I as runtimeQueueOverflowsTotal, J as buildTemporaryWorktreeBranchName, K as LocalDiagnosticsMetricsLive, L as runtimeQueueRecoveriesTotal, M as runtimeQueueDepth, N as runtimeQueueDequeuesTotal, O as rpcRequestDuration, P as runtimeQueueEnqueuesTotal, Q as mergeGitStatusParts, R as startupCommandGateEnqueuesTotal, S as providerStartupQueueDepth, St as Tokeniser, T as providerTurnDuration, Tt as rfc8949EncodeOptions, U as terminalSessionsTotal, V as startupCommandGateQueueWaitDuration, W as withMetrics, X as detectSourceControlProviderFromGitRemoteUrl, Y as dedupeRemoteBranchesWithLocalMatches, Z as isTemporaryWorktreeBranch, _ as providerRuntimeEventsTotal, _t as encodeNodeKeyRotationTranscript, a as contextHandoffsTotal, at as DEFAULT_PORT, b as providerStaleStopTimeoutsTotal, bt as formatNodePublicKeyFingerprint, c as increment, ct as deriveServerPaths, d as orchestrationCommandAckDuration, dt as resolveManagedWorktreesRoot, et as resolveAutoFeatureBranchName, f as orchestrationCommandDuration, ft as resolveNodeE2eePolicyConfig, g as providerMetricAttributes, gt as encodeNodeAuthenticationTranscript, h as providerEventLogRecordsDroppedTotal, ht as encodeNativeNodeClaimTranscript, i as contextHandoffPreparationDuration, it as outcomeFromExit, j as runtimeQueueCoalescedTotal, k as rpcRequestsTotal, l as metricAttributes, lt as ensureServerDirectories, m as orchestrationEventsProcessedTotal, mt as canonicalizeHubOrigin, n as contextHandoffContextEntriesTotal, nt as sanitizeFeatureBranchName, o as gitCommandDuration, ot as RuntimeMode$1, p as orchestrationCommandsTotal, pt as resolveStaticDir, q as WORKTREE_BRANCH_PREFIX, r as contextHandoffDispatchDuration, rt as compactTraceAttributes, s as gitCommandsTotal, st as ServerConfig, t as contextHandoffContextBytesTotal, tt as sanitizeBranchFragment, u as metricNames, ut as resolveHubConnectorConfig, v as providerRuntimeStaleEventsTotal, vt as equalNodeIdentityBytes, w as providerStartupQueueWaitDuration, wt as encode, x as providerStartupAdmissionTotal, xt as normalizeHubNodeName, y as providerSessionsTotal, yt as fingerprintNodePublicKey, z as startupCommandGateQueueDepth } from "./Metrics-BP9YjxZB.mjs";
5
- import { a as makeForgejoDiscovery, c as sourceBranch, d as firstNonEmptyLine, f as probeSourceControlProvider, h as layer$20, i as makeBitbucketDiscovery, m as VcsProcess, n as githubDiscovery, o as SourceControlProvider, p as refineUnknownRemoteProvider, r as gitlabDiscovery, s as parseSourceControlOwnerRef, t as azureDevOpsDiscovery, u as detailFromCause } from "./SourceControlProviderDiscoveryCatalog-4_4yahsa.mjs";
5
+ import { a as makeForgejoDiscovery, c as sourceBranch, d as firstNonEmptyLine, f as probeSourceControlProvider, h as layer$20, i as makeBitbucketDiscovery, m as VcsProcess, n as githubDiscovery, o as SourceControlProvider, p as refineUnknownRemoteProvider, r as gitlabDiscovery, s as parseSourceControlOwnerRef, t as azureDevOpsDiscovery, u as detailFromCause } from "./SourceControlProviderDiscoveryCatalog-hXWNwRMn.mjs";
6
6
  import { n as detectSourceControlProviderFromRemoteUrl, r as getChangeRequestTerminologyForKind } from "./sourceControl-BiEBxN01.mjs";
7
7
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
8
8
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -11,7 +11,7 @@ import * as Layer$1 from "effect/Layer";
11
11
  import { Argument, Command, Flag, GlobalFlag } from "effect/unstable/cli";
12
12
  import * as Net from "node:net";
13
13
  import { createServer } from "node:net";
14
- import { Array as Array$1, Cache, Cause, Clock, Config, Console, Context, Data, DateTime, Deferred, Duration, Effect, Encoding, Equal, Exit, Fiber, FileSystem, Layer, Logger, Metric, Option, Order, Path, Predicate, PubSub, Queue, Redacted, Ref, References, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaTransformation, Scope, Semaphore, Stream, Struct, SynchronizedRef, Tracer, TxQueue, TxRef } from "effect";
14
+ import { Array as Array$1, Cache, Cause, Clock, Config, Console, Context, Data, DateTime, Deferred, Duration, Effect, Encoding, Equal, Exit, Fiber, FileSystem, Layer, Logger, Metric, Option, Order, Path, Predicate, PubSub, Queue, Redacted, Ref, References, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaTransformation, Scope, Semaphore, Stream, Struct, SubscriptionRef, SynchronizedRef, Tracer, TxQueue, TxRef } from "effect";
15
15
  import * as Schema$1 from "effect/Schema";
16
16
  import * as P from "effect/Predicate";
17
17
  import { FetchHttpClient, HttpBody, HttpClient, HttpClientRequest, HttpClientResponse, HttpRouter, HttpServer, HttpServerRequest, HttpServerResponse, Multipart } from "effect/unstable/http";
@@ -20,7 +20,7 @@ import path, { basename, dirname, extname, join } from "node:path";
20
20
  import * as Crypto from "node:crypto";
21
21
  import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign } from "node:crypto";
22
22
  import * as NFS from "node:fs";
23
- import fs, { accessSync, constants, existsSync, realpathSync, statSync } from "node:fs";
23
+ import fs, { accessSync, closeSync, constants, existsSync, fstatSync, lstatSync, openSync, readFileSync, realpathSync, statSync } from "node:fs";
24
24
  import * as readline from "node:readline";
25
25
  import { createInterface } from "node:readline";
26
26
  import * as OS from "node:os";
@@ -51,7 +51,6 @@ import * as Sink$1 from "effect/Sink";
51
51
  import { createServer as createServer$1 } from "node:http";
52
52
  import * as SqlSchema from "effect/unstable/sql/SqlSchema";
53
53
  import { clamp } from "effect/Number";
54
- import { pathToFileURL } from "node:url";
55
54
  import { parsePatchFiles } from "@pierre/diffs";
56
55
  import * as HttpServerRequest$1 from "effect/unstable/http/HttpServerRequest";
57
56
  import { createInterface as createInterface$1 } from "node:readline/promises";
@@ -1514,6 +1513,7 @@ function attachmentRelativePath(attachment) {
1514
1513
  });
1515
1514
  return `${attachment.id}${extension}`;
1516
1515
  }
1516
+ case "file": return `${attachment.id}.bin`;
1517
1517
  }
1518
1518
  }
1519
1519
  function resolveAttachmentPath(input) {
@@ -1522,6 +1522,64 @@ function resolveAttachmentPath(input) {
1522
1522
  relativePath: attachmentRelativePath(input.attachment)
1523
1523
  });
1524
1524
  }
1525
+ function attachmentByteLimit(attachment) {
1526
+ return attachment.type === "image" ? PROVIDER_SEND_TURN_MAX_IMAGE_BYTES : PROVIDER_SEND_TURN_MAX_FILE_BYTES;
1527
+ }
1528
+ /**
1529
+ * Opens and reads a persisted attachment through one descriptor. Comparing
1530
+ * the path's lstat identity with the opened descriptor prevents a path or
1531
+ * symlink swap between validation and read, including on platforms without a
1532
+ * useful O_NOFOLLOW flag.
1533
+ */
1534
+ function readPersistedAttachment(input) {
1535
+ const attachmentPath = resolveAttachmentPath(input);
1536
+ if (!attachmentPath) return {
1537
+ ok: false,
1538
+ reason: `Invalid attachment id '${input.attachment.id}'.`
1539
+ };
1540
+ let descriptor;
1541
+ try {
1542
+ const pathInfo = lstatSync(attachmentPath);
1543
+ if (!pathInfo.isFile()) return {
1544
+ ok: false,
1545
+ reason: `Attachment '${input.attachment.name}' is not a regular file.`
1546
+ };
1547
+ const noFollow = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
1548
+ descriptor = openSync(attachmentPath, constants.O_RDONLY | noFollow);
1549
+ const openedInfo = fstatSync(descriptor);
1550
+ if (!openedInfo.isFile() || openedInfo.dev !== pathInfo.dev || openedInfo.ino !== pathInfo.ino) return {
1551
+ ok: false,
1552
+ reason: `Attachment '${input.attachment.name}' changed while it was being opened. Attach it again and retry.`
1553
+ };
1554
+ const limit = attachmentByteLimit(input.attachment);
1555
+ if (openedInfo.size <= 0 || openedInfo.size > limit) return {
1556
+ ok: false,
1557
+ reason: `Attachment '${input.attachment.name}' is ${openedInfo.size} bytes; limit is ${limit} bytes.`
1558
+ };
1559
+ if (openedInfo.size !== input.attachment.sizeBytes) return {
1560
+ ok: false,
1561
+ reason: `Attachment '${input.attachment.name}' changed after upload; expected ${input.attachment.sizeBytes} bytes but found ${openedInfo.size}.`
1562
+ };
1563
+ const bytes = readFileSync(descriptor);
1564
+ const completedInfo = fstatSync(descriptor);
1565
+ if (completedInfo.dev !== openedInfo.dev || completedInfo.ino !== openedInfo.ino || completedInfo.size !== openedInfo.size || bytes.byteLength !== openedInfo.size) return {
1566
+ ok: false,
1567
+ reason: `Attachment '${input.attachment.name}' changed while it was being read. Attach it again and retry.`
1568
+ };
1569
+ return {
1570
+ ok: true,
1571
+ bytes,
1572
+ sizeBytes: bytes.byteLength
1573
+ };
1574
+ } catch {
1575
+ return {
1576
+ ok: false,
1577
+ reason: `Attachment '${input.attachment.name}' is missing, unreadable, or not a safe regular file.`
1578
+ };
1579
+ } finally {
1580
+ if (descriptor !== void 0) closeSync(descriptor);
1581
+ }
1582
+ }
1525
1583
  function resolveAttachmentPathById(input) {
1526
1584
  const normalizedId = normalizeAttachmentRelativePath(input.attachmentId);
1527
1585
  if (!normalizedId || normalizedId.includes("/") || normalizedId.includes(".")) return null;
@@ -1971,7 +2029,7 @@ const authClientsRevokeOthersRouteLayer = HttpRouter.add("POST", "/api/auth/clie
1971
2029
  var ServerEnvironment = class extends Context.Service()("ryco/environment/Services/ServerEnvironment") {};
1972
2030
  //#endregion
1973
2031
  //#region src/http.ts
1974
- const PROJECT_FAVICON_CACHE_CONTROL = "public, max-age=3600";
2032
+ const PROJECT_FAVICON_CACHE_CONTROL = "private, max-age=3600";
1975
2033
  const PROJECT_AVATAR_MAX_BYTES = 2097152;
1976
2034
  const PROJECT_AVATAR_CACHE_CONTROL = "private, max-age=0, must-revalidate";
1977
2035
  const STATIC_INDEX_CACHE_CONTROL = "no-cache";
@@ -1985,6 +2043,19 @@ const LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set([
1985
2043
  "::1",
1986
2044
  "localhost"
1987
2045
  ]);
2046
+ const SVG_CONTENT_SECURITY_POLICY = "default-src 'none'; style-src 'unsafe-inline'; sandbox";
2047
+ const DOWNLOAD_CONTENT_SECURITY_POLICY = "default-src 'none'; sandbox";
2048
+ const INLINE_ATTACHMENT_EXTENSIONS = /* @__PURE__ */ new Set([
2049
+ ".avif",
2050
+ ".bmp",
2051
+ ".gif",
2052
+ ".ico",
2053
+ ".jpeg",
2054
+ ".jpg",
2055
+ ".png",
2056
+ ".svg",
2057
+ ".webp"
2058
+ ]);
1988
2059
  const STATIC_CONTENT_TYPES = {
1989
2060
  ".css": "text/css; charset=utf-8",
1990
2061
  ".html": "text/html; charset=utf-8",
@@ -2029,6 +2100,33 @@ function resolveStaticCacheControl(staticRelativePath) {
2029
2100
  const basename = normalized.split("/").at(-1) ?? normalized;
2030
2101
  return /(?:^|[-.])[a-zA-Z0-9_-]{8,}\.[a-zA-Z0-9]+$/u.test(basename) ? STATIC_IMMUTABLE_CACHE_CONTROL : STATIC_INDEX_CACHE_CONTROL;
2031
2102
  }
2103
+ /** Build a download disposition with a safe ASCII fallback and UTF-8 filename. */
2104
+ function downloadContentDisposition(fileName) {
2105
+ if (fileName === void 0) return "attachment";
2106
+ const sanitized = fileName.toWellFormed().replace(/[\u0000-\u001f"\\]/g, "_");
2107
+ const asciiFallback = sanitized.replace(/[^\u0020-\u007e]/g, "_");
2108
+ const extendedName = encodeURIComponent(sanitized).replace(/['()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
2109
+ return `attachment; filename="${asciiFallback}"${asciiFallback === sanitized ? "" : `; filename*=UTF-8''${extendedName}`}`;
2110
+ }
2111
+ function userAssetResponseHeaders(filePath, path) {
2112
+ const extension = path.extname(filePath).toLowerCase();
2113
+ return {
2114
+ "Cache-Control": "private, max-age=3600",
2115
+ "X-Content-Type-Options": "nosniff",
2116
+ ...!INLINE_ATTACHMENT_EXTENSIONS.has(extension) ? {
2117
+ "Content-Disposition": downloadContentDisposition(path.basename(filePath)),
2118
+ "Content-Security-Policy": DOWNLOAD_CONTENT_SECURITY_POLICY,
2119
+ "Content-Type": "application/octet-stream"
2120
+ } : extension === ".svg" ? { "Content-Security-Policy": SVG_CONTENT_SECURITY_POLICY } : {}
2121
+ };
2122
+ }
2123
+ function inlineImageResponseHeaders(filePath) {
2124
+ return {
2125
+ "Cache-Control": PROJECT_FAVICON_CACHE_CONTROL,
2126
+ "X-Content-Type-Options": "nosniff",
2127
+ ...filePath.toLowerCase().endsWith(".svg") ? { "Content-Security-Policy": SVG_CONTENT_SECURITY_POLICY } : {}
2128
+ };
2129
+ }
2032
2130
  function resolveStaticContentType(filePath, path) {
2033
2131
  return STATIC_CONTENT_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream";
2034
2132
  }
@@ -2091,11 +2189,13 @@ const attachmentsRouteLayer = HttpRouter.add("GET", `${ATTACHMENTS_ROUTE_PREFIX}
2091
2189
  relativePath: normalizedRelativePath
2092
2190
  });
2093
2191
  if (!filePath) return HttpServerResponse.text(isIdLookup ? "Not Found" : "Invalid attachment path", { status: isIdLookup ? 404 : 400 });
2094
- const fileInfo = yield* (yield* FileSystem.FileSystem).stat(filePath).pipe(Effect.catch(() => Effect.succeed(null)));
2192
+ const fileSystem = yield* FileSystem.FileSystem;
2193
+ const path = yield* Path.Path;
2194
+ const fileInfo = yield* fileSystem.stat(filePath).pipe(Effect.catch(() => Effect.succeed(null)));
2095
2195
  if (!fileInfo || fileInfo.type !== "File") return HttpServerResponse.text("Not Found", { status: 404 });
2096
2196
  return yield* HttpServerResponse.file(filePath, {
2097
2197
  status: 200,
2098
- headers: { "Cache-Control": "public, max-age=31536000, immutable" }
2198
+ headers: userAssetResponseHeaders(filePath, path)
2099
2199
  }).pipe(Effect.catch(() => Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 }))));
2100
2200
  }).pipe(Effect.catchTag("AuthError", respondToAuthError)));
2101
2201
  const projectFaviconRouteLayer = HttpRouter.add("GET", "/api/project-favicon", Effect.gen(function* () {
@@ -2109,11 +2209,11 @@ const projectFaviconRouteLayer = HttpRouter.add("GET", "/api/project-favicon", E
2109
2209
  if (!faviconFilePath) return HttpServerResponse.text(FALLBACK_PROJECT_FAVICON_SVG, {
2110
2210
  status: 200,
2111
2211
  contentType: "image/svg+xml",
2112
- headers: { "Cache-Control": PROJECT_FAVICON_CACHE_CONTROL }
2212
+ headers: inlineImageResponseHeaders("fallback.svg")
2113
2213
  });
2114
2214
  return yield* HttpServerResponse.file(faviconFilePath, {
2115
2215
  status: 200,
2116
- headers: { "Cache-Control": PROJECT_FAVICON_CACHE_CONTROL }
2216
+ headers: inlineImageResponseHeaders(faviconFilePath)
2117
2217
  }).pipe(Effect.catch(() => Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 }))));
2118
2218
  }).pipe(Effect.catchTag("AuthError", respondToAuthError)));
2119
2219
  const AvatarFormSchema = Schema$1.Struct({ avatar: Multipart.SingleFileSchema });
@@ -5868,6 +5968,7 @@ const makeRuntimeSqliteLayer = Effect.fn("makeRuntimeSqliteLayer")(function* (co
5868
5968
  const setup = Layer.effectDiscard(Effect.gen(function* () {
5869
5969
  const startedAt = Date.now();
5870
5970
  const sql = yield* SqlClient.SqlClient;
5971
+ yield* sql`PRAGMA busy_timeout = 5000;`;
5871
5972
  yield* sql`PRAGMA journal_mode = WAL;`;
5872
5973
  yield* sql`PRAGMA foreign_keys = ON;`;
5873
5974
  yield* runMigrations();
@@ -7876,6 +7977,31 @@ const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* (option
7876
7977
  }
7877
7978
  const currentUpstream = yield* resolveCurrentUpstream(cwd).pipe(Effect.catch(() => Effect.succeed(null)));
7878
7979
  if (currentUpstream) {
7980
+ if (!(branch === currentUpstream.branchName || branch.endsWith(`/${currentUpstream.branchName}`) && currentUpstream.upstreamRef.endsWith(`/${branch}`))) {
7981
+ const remoteName = (yield* resolvePushRemoteName(cwd, branch).pipe(Effect.catch(() => Effect.succeed(null)))) ?? currentUpstream.remoteName;
7982
+ const publishBranch = yield* resolvePublishBranchName(cwd, branch);
7983
+ if ((yield* runGitStdout("GitVcsDriver.pushCurrentBranch.readMergeBase", cwd, [
7984
+ "config",
7985
+ "--get",
7986
+ `branch.${branch}.gh-merge-base`
7987
+ ], true).pipe(Effect.map((stdout) => stdout.trim()))).length === 0) yield* runGit("GitVcsDriver.pushCurrentBranch.recordMergeBase", cwd, [
7988
+ "config",
7989
+ `branch.${branch}.gh-merge-base`,
7990
+ currentUpstream.branchName
7991
+ ]);
7992
+ yield* runGit("GitVcsDriver.pushCurrentBranch.pushOwnBranch", cwd, [
7993
+ "push",
7994
+ "-u",
7995
+ remoteName,
7996
+ `HEAD:refs/heads/${publishBranch}`
7997
+ ]);
7998
+ return {
7999
+ status: "pushed",
8000
+ branch,
8001
+ upstreamBranch: `${remoteName}/${publishBranch}`,
8002
+ setUpstream: true
8003
+ };
8004
+ }
7879
8005
  yield* runGit("GitVcsDriver.pushCurrentBranch.pushUpstream", cwd, [
7880
8006
  "push",
7881
8007
  currentUpstream.remoteName,
@@ -8104,6 +8230,25 @@ const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* (option
8104
8230
  input.refName
8105
8231
  ];
8106
8232
  yield* executeGit("GitVcsDriver.createWorktree", input.cwd, args, { fallbackErrorMessage: "git worktree add failed" });
8233
+ const gitmodulesPath = path.join(worktreePath, ".gitmodules");
8234
+ if (yield* fileSystem.exists(gitmodulesPath).pipe(Effect.mapError((cause) => new GitCommandError({
8235
+ operation: "GitVcsDriver.createWorktree.inspectSubmodules",
8236
+ command: "inspect .gitmodules",
8237
+ cwd: worktreePath,
8238
+ detail: `Failed to inspect ${gitmodulesPath} after creating the worktree.`,
8239
+ cause
8240
+ })))) {
8241
+ const submoduleArgs = [
8242
+ "submodule",
8243
+ "update",
8244
+ "--init",
8245
+ "--recursive"
8246
+ ];
8247
+ yield* executeGit("GitVcsDriver.createWorktree.initializeSubmodules", worktreePath, submoduleArgs, {
8248
+ timeoutMs: 12e4,
8249
+ fallbackErrorMessage: "git submodule initialization failed"
8250
+ }).pipe(Effect.mapError((error) => createGitCommandError("GitVcsDriver.createWorktree.initializeSubmodules", worktreePath, submoduleArgs, `The worktree was created, but its submodules could not be initialized: ${error.detail}`, error)));
8251
+ }
8107
8252
  if (input.dependencyHydration === "copyInstallDirs") yield* copyWorktreeDependencyInstallDirs({
8108
8253
  cwd: input.cwd,
8109
8254
  worktreePath
@@ -8168,6 +8313,15 @@ const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* (option
8168
8313
  fallbackErrorMessage: "git worktree remove failed"
8169
8314
  }).pipe(Effect.mapError((error) => createGitCommandError("GitVcsDriver.removeWorktree", input.cwd, args, `${commandLabel$1(args)} failed (cwd: ${input.cwd}): ${error.message}`, error)));
8170
8315
  });
8316
+ const pruneWorktrees = (cwd) => executeGit("GitVcsDriver.pruneWorktrees", cwd, [
8317
+ "worktree",
8318
+ "prune",
8319
+ "--expire",
8320
+ "now"
8321
+ ], {
8322
+ timeoutMs: 1e4,
8323
+ fallbackErrorMessage: "git worktree prune failed"
8324
+ }).pipe(Effect.asVoid);
8171
8325
  const renameBranch = Effect.fn("renameBranch")(function* (input) {
8172
8326
  if (input.oldBranch === input.newBranch) return { branch: input.newBranch };
8173
8327
  const targetBranch = yield* resolveAvailableBranchName(input.cwd, input.newBranch);
@@ -8294,6 +8448,7 @@ const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* (option
8294
8448
  fetchRemoteTrackingBranch,
8295
8449
  setBranchUpstream,
8296
8450
  removeWorktree,
8451
+ pruneWorktrees,
8297
8452
  renameBranch,
8298
8453
  createRef,
8299
8454
  deleteBranch,
@@ -12672,26 +12827,26 @@ const make$12 = Effect.fn("makeSourceControlProviderRegistry")(function* () {
12672
12827
  const azureDevOpsCli = yield* AzureDevOpsCli;
12673
12828
  const fileSystem = yield* FileSystem.FileSystem;
12674
12829
  const github = yield* makeLazyProvider("github", Effect.tryPromise({
12675
- try: () => import("./GitHubSourceControlProvider-Dmz1LJct.mjs"),
12830
+ try: () => import("./GitHubSourceControlProvider-C7CJAslU.mjs"),
12676
12831
  catch: (cause) => providerLoadError("github", cause)
12677
12832
  }).pipe(Effect.flatMap((module) => module.make()), Effect.provideService(GitHubCli, githubCli), Effect.provideService(FileSystem.FileSystem, fileSystem)));
12678
12833
  const gitlab = yield* makeLazyProvider("gitlab", Effect.tryPromise({
12679
- try: () => import("./GitLabSourceControlProvider-C21lwphV.mjs"),
12834
+ try: () => import("./GitLabSourceControlProvider-u-Y-e8PV.mjs"),
12680
12835
  catch: (cause) => providerLoadError("gitlab", cause)
12681
12836
  }).pipe(Effect.flatMap((module) => module.make()), Effect.provideService(GitLabCli, gitlabCli)));
12682
12837
  const bitbucket = yield* makeLazyProvider("bitbucket", Effect.tryPromise({
12683
- try: () => import("./BitbucketSourceControlProvider-BV6iRDi7.mjs"),
12838
+ try: () => import("./BitbucketSourceControlProvider-B8IPx2Ad.mjs"),
12684
12839
  catch: (cause) => providerLoadError("bitbucket", cause)
12685
12840
  }).pipe(Effect.flatMap((module) => module.make()), Effect.provideService(BitbucketApi, bitbucketApi)), {
12686
12841
  searchRepositories: true,
12687
12842
  cloneAuthentication: true
12688
12843
  });
12689
12844
  const forgejo = yield* makeLazyProvider("forgejo", Effect.tryPromise({
12690
- try: () => import("./ForgejoSourceControlProvider-CeN7Snfr.mjs"),
12845
+ try: () => import("./ForgejoSourceControlProvider-Ds0rU_PN.mjs"),
12691
12846
  catch: (cause) => providerLoadError("forgejo", cause)
12692
12847
  }).pipe(Effect.flatMap((module) => module.make()), Effect.provideService(ForgejoApi, forgejoApi)));
12693
12848
  const azureDevOps = yield* makeLazyProvider("azure-devops", Effect.tryPromise({
12694
- try: () => import("./AzureDevOpsSourceControlProvider-CGlK6M0b.mjs"),
12849
+ try: () => import("./AzureDevOpsSourceControlProvider-B0YsaJyI.mjs"),
12695
12850
  catch: (cause) => providerLoadError("azure-devops", cause)
12696
12851
  }).pipe(Effect.flatMap((module) => module.make()), Effect.provideService(AzureDevOpsCli, azureDevOpsCli)));
12697
12852
  const bitbucketDiscovery = makeBitbucketDiscovery(bitbucketApi);
@@ -12930,6 +13085,11 @@ const DEFAULT_KEYBINDINGS = [
12930
13085
  command: "thread.find",
12931
13086
  when: "!terminalFocus"
12932
13087
  },
13088
+ {
13089
+ key: "mod+alt+p",
13090
+ command: "thread.pinToggle",
13091
+ when: "!terminalFocus"
13092
+ },
12933
13093
  {
12934
13094
  key: "mod+shift+[",
12935
13095
  command: "thread.previous"
@@ -14516,7 +14676,8 @@ const ServerNotification__SpendControlLimitSnapshot = Schema$1.Struct({
14516
14676
  const ServerNotification__SubAgentActivityKind = Schema$1.Literals([
14517
14677
  "started",
14518
14678
  "interacted",
14519
- "interrupted"
14679
+ "interrupted",
14680
+ "completed"
14520
14681
  ]);
14521
14682
  const ServerNotification__TerminalInteractionNotification = Schema$1.Struct({
14522
14683
  itemId: Schema$1.String,
@@ -15403,7 +15564,8 @@ const V2ItemCompletedNotification__ReasoningEffort = Schema$1.String.annotate({
15403
15564
  const V2ItemCompletedNotification__SubAgentActivityKind = Schema$1.Literals([
15404
15565
  "started",
15405
15566
  "interacted",
15406
- "interrupted"
15567
+ "interrupted",
15568
+ "completed"
15407
15569
  ]);
15408
15570
  const V2ItemCompletedNotification__TextElement = Schema$1.Struct({
15409
15571
  byteRange: Schema$1.Struct({
@@ -15587,7 +15749,8 @@ const V2ItemStartedNotification__ReasoningEffort = Schema$1.String.annotate({ de
15587
15749
  const V2ItemStartedNotification__SubAgentActivityKind = Schema$1.Literals([
15588
15750
  "started",
15589
15751
  "interacted",
15590
- "interrupted"
15752
+ "interrupted",
15753
+ "completed"
15591
15754
  ]);
15592
15755
  const V2ItemStartedNotification__TextElement = Schema$1.Struct({
15593
15756
  byteRange: Schema$1.Struct({
@@ -16082,7 +16245,8 @@ const V2ReviewStartResponse__ReasoningEffort = Schema$1.String.annotate({ descri
16082
16245
  const V2ReviewStartResponse__SubAgentActivityKind = Schema$1.Literals([
16083
16246
  "started",
16084
16247
  "interacted",
16085
- "interrupted"
16248
+ "interrupted",
16249
+ "completed"
16086
16250
  ]);
16087
16251
  const V2ReviewStartResponse__TextElement = Schema$1.Struct({
16088
16252
  byteRange: Schema$1.Struct({
@@ -16267,7 +16431,8 @@ const V2ThreadForkResponse__ReasoningEffort = Schema$1.String.annotate({ descrip
16267
16431
  const V2ThreadForkResponse__SubAgentActivityKind = Schema$1.Literals([
16268
16432
  "started",
16269
16433
  "interacted",
16270
- "interrupted"
16434
+ "interrupted",
16435
+ "completed"
16271
16436
  ]);
16272
16437
  const V2ThreadForkResponse__TextElement = Schema$1.Struct({
16273
16438
  byteRange: Schema$1.Struct({
@@ -16449,7 +16614,8 @@ const V2ThreadListResponse__ReasoningEffort = Schema$1.String.annotate({ descrip
16449
16614
  const V2ThreadListResponse__SubAgentActivityKind = Schema$1.Literals([
16450
16615
  "started",
16451
16616
  "interacted",
16452
- "interrupted"
16617
+ "interrupted",
16618
+ "completed"
16453
16619
  ]);
16454
16620
  const V2ThreadListResponse__TextElement = Schema$1.Struct({
16455
16621
  byteRange: Schema$1.Struct({
@@ -16585,7 +16751,8 @@ const V2ThreadMetadataUpdateResponse__ReasoningEffort = Schema$1.String.annotate
16585
16751
  const V2ThreadMetadataUpdateResponse__SubAgentActivityKind = Schema$1.Literals([
16586
16752
  "started",
16587
16753
  "interacted",
16588
- "interrupted"
16754
+ "interrupted",
16755
+ "completed"
16589
16756
  ]);
16590
16757
  const V2ThreadMetadataUpdateResponse__TextElement = Schema$1.Struct({
16591
16758
  byteRange: Schema$1.Struct({
@@ -16716,7 +16883,8 @@ const V2ThreadReadResponse__ReasoningEffort = Schema$1.String.annotate({ descrip
16716
16883
  const V2ThreadReadResponse__SubAgentActivityKind = Schema$1.Literals([
16717
16884
  "started",
16718
16885
  "interacted",
16719
- "interrupted"
16886
+ "interrupted",
16887
+ "completed"
16720
16888
  ]);
16721
16889
  const V2ThreadReadResponse__TextElement = Schema$1.Struct({
16722
16890
  byteRange: Schema$1.Struct({
@@ -16958,7 +17126,8 @@ const V2ThreadResumeResponse__ReasoningEffort = Schema$1.String.annotate({ descr
16958
17126
  const V2ThreadResumeResponse__SubAgentActivityKind = Schema$1.Literals([
16959
17127
  "started",
16960
17128
  "interacted",
16961
- "interrupted"
17129
+ "interrupted",
17130
+ "completed"
16962
17131
  ]);
16963
17132
  const V2ThreadResumeResponse__TextElement = Schema$1.Struct({
16964
17133
  byteRange: Schema$1.Struct({
@@ -17089,7 +17258,8 @@ const V2ThreadRollbackResponse__ReasoningEffort = Schema$1.String.annotate({ des
17089
17258
  const V2ThreadRollbackResponse__SubAgentActivityKind = Schema$1.Literals([
17090
17259
  "started",
17091
17260
  "interacted",
17092
- "interrupted"
17261
+ "interrupted",
17262
+ "completed"
17093
17263
  ]);
17094
17264
  const V2ThreadRollbackResponse__TextElement = Schema$1.Struct({
17095
17265
  byteRange: Schema$1.Struct({
@@ -17253,7 +17423,8 @@ const V2ThreadStartedNotification__ReasoningEffort = Schema$1.String.annotate({
17253
17423
  const V2ThreadStartedNotification__SubAgentActivityKind = Schema$1.Literals([
17254
17424
  "started",
17255
17425
  "interacted",
17256
- "interrupted"
17426
+ "interrupted",
17427
+ "completed"
17257
17428
  ]);
17258
17429
  const V2ThreadStartedNotification__TextElement = Schema$1.Struct({
17259
17430
  byteRange: Schema$1.Struct({
@@ -17431,7 +17602,8 @@ const V2ThreadStartResponse__ReasoningEffort = Schema$1.String.annotate({ descri
17431
17602
  const V2ThreadStartResponse__SubAgentActivityKind = Schema$1.Literals([
17432
17603
  "started",
17433
17604
  "interacted",
17434
- "interrupted"
17605
+ "interrupted",
17606
+ "completed"
17435
17607
  ]);
17436
17608
  const V2ThreadStartResponse__TextElement = Schema$1.Struct({
17437
17609
  byteRange: Schema$1.Struct({
@@ -17574,7 +17746,8 @@ const V2ThreadUnarchiveResponse__ReasoningEffort = Schema$1.String.annotate({ de
17574
17746
  const V2ThreadUnarchiveResponse__SubAgentActivityKind = Schema$1.Literals([
17575
17747
  "started",
17576
17748
  "interacted",
17577
- "interrupted"
17749
+ "interrupted",
17750
+ "completed"
17578
17751
  ]);
17579
17752
  const V2ThreadUnarchiveResponse__TextElement = Schema$1.Struct({
17580
17753
  byteRange: Schema$1.Struct({
@@ -17704,7 +17877,8 @@ const V2TurnCompletedNotification__ReasoningEffort = Schema$1.String.annotate({
17704
17877
  const V2TurnCompletedNotification__SubAgentActivityKind = Schema$1.Literals([
17705
17878
  "started",
17706
17879
  "interacted",
17707
- "interrupted"
17880
+ "interrupted",
17881
+ "completed"
17708
17882
  ]);
17709
17883
  const V2TurnCompletedNotification__TextElement = Schema$1.Struct({
17710
17884
  byteRange: Schema$1.Struct({
@@ -17831,7 +18005,8 @@ const V2TurnStartedNotification__ReasoningEffort = Schema$1.String.annotate({ de
17831
18005
  const V2TurnStartedNotification__SubAgentActivityKind = Schema$1.Literals([
17832
18006
  "started",
17833
18007
  "interacted",
17834
- "interrupted"
18008
+ "interrupted",
18009
+ "completed"
17835
18010
  ]);
17836
18011
  const V2TurnStartedNotification__TextElement = Schema$1.Struct({
17837
18012
  byteRange: Schema$1.Struct({
@@ -17997,7 +18172,8 @@ const V2TurnStartResponse__ReasoningEffort = Schema$1.String.annotate({ descript
17997
18172
  const V2TurnStartResponse__SubAgentActivityKind = Schema$1.Literals([
17998
18173
  "started",
17999
18174
  "interacted",
18000
- "interrupted"
18175
+ "interrupted",
18176
+ "completed"
18001
18177
  ]);
18002
18178
  const V2TurnStartResponse__TextElement = Schema$1.Struct({
18003
18179
  byteRange: Schema$1.Struct({
@@ -21908,14 +22084,19 @@ const ServerNotification__ThreadItem = Schema$1.Union([
21908
22084
  status: Schema$1.Literals([
21909
22085
  "inProgress",
21910
22086
  "completed",
21911
- "failed"
22087
+ "failed",
22088
+ "interrupted"
21912
22089
  ]).annotate({ description: "Current status of the collab tool call." }),
21913
22090
  tool: Schema$1.Literals([
21914
22091
  "spawnAgent",
21915
22092
  "sendInput",
21916
22093
  "resumeAgent",
21917
22094
  "wait",
21918
- "closeAgent"
22095
+ "closeAgent",
22096
+ "sendMessage",
22097
+ "followupTask",
22098
+ "interruptAgent",
22099
+ "listAgents"
21919
22100
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
21920
22101
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
21921
22102
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22313,14 +22494,19 @@ const V2ItemCompletedNotification__ThreadItem = Schema$1.Union([
22313
22494
  status: Schema$1.Literals([
22314
22495
  "inProgress",
22315
22496
  "completed",
22316
- "failed"
22497
+ "failed",
22498
+ "interrupted"
22317
22499
  ]).annotate({ description: "Current status of the collab tool call." }),
22318
22500
  tool: Schema$1.Literals([
22319
22501
  "spawnAgent",
22320
22502
  "sendInput",
22321
22503
  "resumeAgent",
22322
22504
  "wait",
22323
- "closeAgent"
22505
+ "closeAgent",
22506
+ "sendMessage",
22507
+ "followupTask",
22508
+ "interruptAgent",
22509
+ "listAgents"
22324
22510
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22325
22511
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22326
22512
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22507,14 +22693,19 @@ const V2ItemStartedNotification__ThreadItem = Schema$1.Union([
22507
22693
  status: Schema$1.Literals([
22508
22694
  "inProgress",
22509
22695
  "completed",
22510
- "failed"
22696
+ "failed",
22697
+ "interrupted"
22511
22698
  ]).annotate({ description: "Current status of the collab tool call." }),
22512
22699
  tool: Schema$1.Literals([
22513
22700
  "spawnAgent",
22514
22701
  "sendInput",
22515
22702
  "resumeAgent",
22516
22703
  "wait",
22517
- "closeAgent"
22704
+ "closeAgent",
22705
+ "sendMessage",
22706
+ "followupTask",
22707
+ "interruptAgent",
22708
+ "listAgents"
22518
22709
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22519
22710
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22520
22711
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22750,14 +22941,19 @@ const V2ReviewStartResponse__ThreadItem = Schema$1.Union([
22750
22941
  status: Schema$1.Literals([
22751
22942
  "inProgress",
22752
22943
  "completed",
22753
- "failed"
22944
+ "failed",
22945
+ "interrupted"
22754
22946
  ]).annotate({ description: "Current status of the collab tool call." }),
22755
22947
  tool: Schema$1.Literals([
22756
22948
  "spawnAgent",
22757
22949
  "sendInput",
22758
22950
  "resumeAgent",
22759
22951
  "wait",
22760
- "closeAgent"
22952
+ "closeAgent",
22953
+ "sendMessage",
22954
+ "followupTask",
22955
+ "interruptAgent",
22956
+ "listAgents"
22761
22957
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22762
22958
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22763
22959
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -22931,14 +23127,19 @@ const V2ThreadForkResponse__ThreadItem = Schema$1.Union([
22931
23127
  status: Schema$1.Literals([
22932
23128
  "inProgress",
22933
23129
  "completed",
22934
- "failed"
23130
+ "failed",
23131
+ "interrupted"
22935
23132
  ]).annotate({ description: "Current status of the collab tool call." }),
22936
23133
  tool: Schema$1.Literals([
22937
23134
  "spawnAgent",
22938
23135
  "sendInput",
22939
23136
  "resumeAgent",
22940
23137
  "wait",
22941
- "closeAgent"
23138
+ "closeAgent",
23139
+ "sendMessage",
23140
+ "followupTask",
23141
+ "interruptAgent",
23142
+ "listAgents"
22942
23143
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
22943
23144
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
22944
23145
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23102,14 +23303,19 @@ const V2ThreadListResponse__ThreadItem = Schema$1.Union([
23102
23303
  status: Schema$1.Literals([
23103
23304
  "inProgress",
23104
23305
  "completed",
23105
- "failed"
23306
+ "failed",
23307
+ "interrupted"
23106
23308
  ]).annotate({ description: "Current status of the collab tool call." }),
23107
23309
  tool: Schema$1.Literals([
23108
23310
  "spawnAgent",
23109
23311
  "sendInput",
23110
23312
  "resumeAgent",
23111
23313
  "wait",
23112
- "closeAgent"
23314
+ "closeAgent",
23315
+ "sendMessage",
23316
+ "followupTask",
23317
+ "interruptAgent",
23318
+ "listAgents"
23113
23319
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23114
23320
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23115
23321
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23273,14 +23479,19 @@ const V2ThreadMetadataUpdateResponse__ThreadItem = Schema$1.Union([
23273
23479
  status: Schema$1.Literals([
23274
23480
  "inProgress",
23275
23481
  "completed",
23276
- "failed"
23482
+ "failed",
23483
+ "interrupted"
23277
23484
  ]).annotate({ description: "Current status of the collab tool call." }),
23278
23485
  tool: Schema$1.Literals([
23279
23486
  "spawnAgent",
23280
23487
  "sendInput",
23281
23488
  "resumeAgent",
23282
23489
  "wait",
23283
- "closeAgent"
23490
+ "closeAgent",
23491
+ "sendMessage",
23492
+ "followupTask",
23493
+ "interruptAgent",
23494
+ "listAgents"
23284
23495
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23285
23496
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23286
23497
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23444,14 +23655,19 @@ const V2ThreadReadResponse__ThreadItem = Schema$1.Union([
23444
23655
  status: Schema$1.Literals([
23445
23656
  "inProgress",
23446
23657
  "completed",
23447
- "failed"
23658
+ "failed",
23659
+ "interrupted"
23448
23660
  ]).annotate({ description: "Current status of the collab tool call." }),
23449
23661
  tool: Schema$1.Literals([
23450
23662
  "spawnAgent",
23451
23663
  "sendInput",
23452
23664
  "resumeAgent",
23453
23665
  "wait",
23454
- "closeAgent"
23666
+ "closeAgent",
23667
+ "sendMessage",
23668
+ "followupTask",
23669
+ "interruptAgent",
23670
+ "listAgents"
23455
23671
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23456
23672
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23457
23673
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23616,14 +23832,19 @@ const V2ThreadResumeResponse__ThreadItem = Schema$1.Union([
23616
23832
  status: Schema$1.Literals([
23617
23833
  "inProgress",
23618
23834
  "completed",
23619
- "failed"
23835
+ "failed",
23836
+ "interrupted"
23620
23837
  ]).annotate({ description: "Current status of the collab tool call." }),
23621
23838
  tool: Schema$1.Literals([
23622
23839
  "spawnAgent",
23623
23840
  "sendInput",
23624
23841
  "resumeAgent",
23625
23842
  "wait",
23626
- "closeAgent"
23843
+ "closeAgent",
23844
+ "sendMessage",
23845
+ "followupTask",
23846
+ "interruptAgent",
23847
+ "listAgents"
23627
23848
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23628
23849
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23629
23850
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23787,14 +24008,19 @@ const V2ThreadRollbackResponse__ThreadItem = Schema$1.Union([
23787
24008
  status: Schema$1.Literals([
23788
24009
  "inProgress",
23789
24010
  "completed",
23790
- "failed"
24011
+ "failed",
24012
+ "interrupted"
23791
24013
  ]).annotate({ description: "Current status of the collab tool call." }),
23792
24014
  tool: Schema$1.Literals([
23793
24015
  "spawnAgent",
23794
24016
  "sendInput",
23795
24017
  "resumeAgent",
23796
24018
  "wait",
23797
- "closeAgent"
24019
+ "closeAgent",
24020
+ "sendMessage",
24021
+ "followupTask",
24022
+ "interruptAgent",
24023
+ "listAgents"
23798
24024
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23799
24025
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23800
24026
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -23962,14 +24188,19 @@ const V2ThreadStartedNotification__ThreadItem = Schema$1.Union([
23962
24188
  status: Schema$1.Literals([
23963
24189
  "inProgress",
23964
24190
  "completed",
23965
- "failed"
24191
+ "failed",
24192
+ "interrupted"
23966
24193
  ]).annotate({ description: "Current status of the collab tool call." }),
23967
24194
  tool: Schema$1.Literals([
23968
24195
  "spawnAgent",
23969
24196
  "sendInput",
23970
24197
  "resumeAgent",
23971
24198
  "wait",
23972
- "closeAgent"
24199
+ "closeAgent",
24200
+ "sendMessage",
24201
+ "followupTask",
24202
+ "interruptAgent",
24203
+ "listAgents"
23973
24204
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
23974
24205
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
23975
24206
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24133,14 +24364,19 @@ const V2ThreadStartResponse__ThreadItem = Schema$1.Union([
24133
24364
  status: Schema$1.Literals([
24134
24365
  "inProgress",
24135
24366
  "completed",
24136
- "failed"
24367
+ "failed",
24368
+ "interrupted"
24137
24369
  ]).annotate({ description: "Current status of the collab tool call." }),
24138
24370
  tool: Schema$1.Literals([
24139
24371
  "spawnAgent",
24140
24372
  "sendInput",
24141
24373
  "resumeAgent",
24142
24374
  "wait",
24143
- "closeAgent"
24375
+ "closeAgent",
24376
+ "sendMessage",
24377
+ "followupTask",
24378
+ "interruptAgent",
24379
+ "listAgents"
24144
24380
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24145
24381
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24146
24382
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24304,14 +24540,19 @@ const V2ThreadUnarchiveResponse__ThreadItem = Schema$1.Union([
24304
24540
  status: Schema$1.Literals([
24305
24541
  "inProgress",
24306
24542
  "completed",
24307
- "failed"
24543
+ "failed",
24544
+ "interrupted"
24308
24545
  ]).annotate({ description: "Current status of the collab tool call." }),
24309
24546
  tool: Schema$1.Literals([
24310
24547
  "spawnAgent",
24311
24548
  "sendInput",
24312
24549
  "resumeAgent",
24313
24550
  "wait",
24314
- "closeAgent"
24551
+ "closeAgent",
24552
+ "sendMessage",
24553
+ "followupTask",
24554
+ "interruptAgent",
24555
+ "listAgents"
24315
24556
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24316
24557
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24317
24558
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24475,14 +24716,19 @@ const V2TurnCompletedNotification__ThreadItem = Schema$1.Union([
24475
24716
  status: Schema$1.Literals([
24476
24717
  "inProgress",
24477
24718
  "completed",
24478
- "failed"
24719
+ "failed",
24720
+ "interrupted"
24479
24721
  ]).annotate({ description: "Current status of the collab tool call." }),
24480
24722
  tool: Schema$1.Literals([
24481
24723
  "spawnAgent",
24482
24724
  "sendInput",
24483
24725
  "resumeAgent",
24484
24726
  "wait",
24485
- "closeAgent"
24727
+ "closeAgent",
24728
+ "sendMessage",
24729
+ "followupTask",
24730
+ "interruptAgent",
24731
+ "listAgents"
24486
24732
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24487
24733
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24488
24734
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24646,14 +24892,19 @@ const V2TurnStartedNotification__ThreadItem = Schema$1.Union([
24646
24892
  status: Schema$1.Literals([
24647
24893
  "inProgress",
24648
24894
  "completed",
24649
- "failed"
24895
+ "failed",
24896
+ "interrupted"
24650
24897
  ]).annotate({ description: "Current status of the collab tool call." }),
24651
24898
  tool: Schema$1.Literals([
24652
24899
  "spawnAgent",
24653
24900
  "sendInput",
24654
24901
  "resumeAgent",
24655
24902
  "wait",
24656
- "closeAgent"
24903
+ "closeAgent",
24904
+ "sendMessage",
24905
+ "followupTask",
24906
+ "interruptAgent",
24907
+ "listAgents"
24657
24908
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24658
24909
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24659
24910
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -24817,14 +25068,19 @@ const V2TurnStartResponse__ThreadItem = Schema$1.Union([
24817
25068
  status: Schema$1.Literals([
24818
25069
  "inProgress",
24819
25070
  "completed",
24820
- "failed"
25071
+ "failed",
25072
+ "interrupted"
24821
25073
  ]).annotate({ description: "Current status of the collab tool call." }),
24822
25074
  tool: Schema$1.Literals([
24823
25075
  "spawnAgent",
24824
25076
  "sendInput",
24825
25077
  "resumeAgent",
24826
25078
  "wait",
24827
- "closeAgent"
25079
+ "closeAgent",
25080
+ "sendMessage",
25081
+ "followupTask",
25082
+ "interruptAgent",
25083
+ "listAgents"
24828
25084
  ]).annotate({ description: "Name of the collab tool that was invoked." }),
24829
25085
  type: Schema$1.Literal("collabAgentToolCall").annotate({ title: "CollabAgentToolCallThreadItemType" })
24830
25086
  }).annotate({ title: "CollabAgentToolCallThreadItem" }),
@@ -28082,12 +28338,17 @@ Schema$1.Literals([
28082
28338
  "sendInput",
28083
28339
  "resumeAgent",
28084
28340
  "wait",
28085
- "closeAgent"
28341
+ "closeAgent",
28342
+ "sendMessage",
28343
+ "followupTask",
28344
+ "interruptAgent",
28345
+ "listAgents"
28086
28346
  ]);
28087
28347
  Schema$1.Literals([
28088
28348
  "inProgress",
28089
28349
  "completed",
28090
- "failed"
28350
+ "failed",
28351
+ "interrupted"
28091
28352
  ]);
28092
28353
  Schema$1.Literals(["stdout", "stderr"]).annotate({ description: "Stream label for `command/exec/outputDelta` notifications." });
28093
28354
  Schema$1.Literals([
@@ -28811,12 +29072,17 @@ Schema$1.Literals([
28811
29072
  "sendInput",
28812
29073
  "resumeAgent",
28813
29074
  "wait",
28814
- "closeAgent"
29075
+ "closeAgent",
29076
+ "sendMessage",
29077
+ "followupTask",
29078
+ "interruptAgent",
29079
+ "listAgents"
28815
29080
  ]);
28816
29081
  Schema$1.Literals([
28817
29082
  "inProgress",
28818
29083
  "completed",
28819
- "failed"
29084
+ "failed",
29085
+ "interrupted"
28820
29086
  ]);
28821
29087
  Schema$1.Literals([
28822
29088
  "agent",
@@ -28877,12 +29143,17 @@ Schema$1.Literals([
28877
29143
  "sendInput",
28878
29144
  "resumeAgent",
28879
29145
  "wait",
28880
- "closeAgent"
29146
+ "closeAgent",
29147
+ "sendMessage",
29148
+ "followupTask",
29149
+ "interruptAgent",
29150
+ "listAgents"
28881
29151
  ]);
28882
29152
  Schema$1.Literals([
28883
29153
  "inProgress",
28884
29154
  "completed",
28885
- "failed"
29155
+ "failed",
29156
+ "interrupted"
28886
29157
  ]);
28887
29158
  Schema$1.Literals([
28888
29159
  "agent",
@@ -29239,12 +29510,17 @@ Schema$1.Literals([
29239
29510
  "sendInput",
29240
29511
  "resumeAgent",
29241
29512
  "wait",
29242
- "closeAgent"
29513
+ "closeAgent",
29514
+ "sendMessage",
29515
+ "followupTask",
29516
+ "interruptAgent",
29517
+ "listAgents"
29243
29518
  ]);
29244
29519
  Schema$1.Literals([
29245
29520
  "inProgress",
29246
29521
  "completed",
29247
- "failed"
29522
+ "failed",
29523
+ "interrupted"
29248
29524
  ]);
29249
29525
  Schema$1.Literals([
29250
29526
  "agent",
@@ -29375,12 +29651,17 @@ Schema$1.Literals([
29375
29651
  "sendInput",
29376
29652
  "resumeAgent",
29377
29653
  "wait",
29378
- "closeAgent"
29654
+ "closeAgent",
29655
+ "sendMessage",
29656
+ "followupTask",
29657
+ "interruptAgent",
29658
+ "listAgents"
29379
29659
  ]);
29380
29660
  Schema$1.Literals([
29381
29661
  "inProgress",
29382
29662
  "completed",
29383
- "failed"
29663
+ "failed",
29664
+ "interrupted"
29384
29665
  ]);
29385
29666
  Schema$1.Literals([
29386
29667
  "agent",
@@ -29486,12 +29767,17 @@ Schema$1.Literals([
29486
29767
  "sendInput",
29487
29768
  "resumeAgent",
29488
29769
  "wait",
29489
- "closeAgent"
29770
+ "closeAgent",
29771
+ "sendMessage",
29772
+ "followupTask",
29773
+ "interruptAgent",
29774
+ "listAgents"
29490
29775
  ]);
29491
29776
  Schema$1.Literals([
29492
29777
  "inProgress",
29493
29778
  "completed",
29494
- "failed"
29779
+ "failed",
29780
+ "interrupted"
29495
29781
  ]);
29496
29782
  Schema$1.Literals([
29497
29783
  "agent",
@@ -29551,12 +29837,17 @@ Schema$1.Literals([
29551
29837
  "sendInput",
29552
29838
  "resumeAgent",
29553
29839
  "wait",
29554
- "closeAgent"
29840
+ "closeAgent",
29841
+ "sendMessage",
29842
+ "followupTask",
29843
+ "interruptAgent",
29844
+ "listAgents"
29555
29845
  ]);
29556
29846
  Schema$1.Literals([
29557
29847
  "inProgress",
29558
29848
  "completed",
29559
- "failed"
29849
+ "failed",
29850
+ "interrupted"
29560
29851
  ]);
29561
29852
  Schema$1.Literals([
29562
29853
  "agent",
@@ -29609,12 +29900,17 @@ Schema$1.Literals([
29609
29900
  "sendInput",
29610
29901
  "resumeAgent",
29611
29902
  "wait",
29612
- "closeAgent"
29903
+ "closeAgent",
29904
+ "sendMessage",
29905
+ "followupTask",
29906
+ "interruptAgent",
29907
+ "listAgents"
29613
29908
  ]);
29614
29909
  Schema$1.Literals([
29615
29910
  "inProgress",
29616
29911
  "completed",
29617
- "failed"
29912
+ "failed",
29913
+ "interrupted"
29618
29914
  ]);
29619
29915
  Schema$1.Literals([
29620
29916
  "agent",
@@ -29903,12 +30199,17 @@ Schema$1.Literals([
29903
30199
  "sendInput",
29904
30200
  "resumeAgent",
29905
30201
  "wait",
29906
- "closeAgent"
30202
+ "closeAgent",
30203
+ "sendMessage",
30204
+ "followupTask",
30205
+ "interruptAgent",
30206
+ "listAgents"
29907
30207
  ]);
29908
30208
  Schema$1.Literals([
29909
30209
  "inProgress",
29910
30210
  "completed",
29911
- "failed"
30211
+ "failed",
30212
+ "interrupted"
29912
30213
  ]);
29913
30214
  Schema$1.Literals([
29914
30215
  "agent",
@@ -30037,12 +30338,17 @@ Schema$1.Literals([
30037
30338
  "sendInput",
30038
30339
  "resumeAgent",
30039
30340
  "wait",
30040
- "closeAgent"
30341
+ "closeAgent",
30342
+ "sendMessage",
30343
+ "followupTask",
30344
+ "interruptAgent",
30345
+ "listAgents"
30041
30346
  ]);
30042
30347
  Schema$1.Literals([
30043
30348
  "inProgress",
30044
30349
  "completed",
30045
- "failed"
30350
+ "failed",
30351
+ "interrupted"
30046
30352
  ]);
30047
30353
  Schema$1.Literals([
30048
30354
  "agent",
@@ -30153,12 +30459,17 @@ Schema$1.Literals([
30153
30459
  "sendInput",
30154
30460
  "resumeAgent",
30155
30461
  "wait",
30156
- "closeAgent"
30462
+ "closeAgent",
30463
+ "sendMessage",
30464
+ "followupTask",
30465
+ "interruptAgent",
30466
+ "listAgents"
30157
30467
  ]);
30158
30468
  Schema$1.Literals([
30159
30469
  "inProgress",
30160
30470
  "completed",
30161
- "failed"
30471
+ "failed",
30472
+ "interrupted"
30162
30473
  ]);
30163
30474
  Schema$1.Literals([
30164
30475
  "agent",
@@ -30303,12 +30614,17 @@ Schema$1.Literals([
30303
30614
  "sendInput",
30304
30615
  "resumeAgent",
30305
30616
  "wait",
30306
- "closeAgent"
30617
+ "closeAgent",
30618
+ "sendMessage",
30619
+ "followupTask",
30620
+ "interruptAgent",
30621
+ "listAgents"
30307
30622
  ]);
30308
30623
  Schema$1.Literals([
30309
30624
  "inProgress",
30310
30625
  "completed",
30311
- "failed"
30626
+ "failed",
30627
+ "interrupted"
30312
30628
  ]);
30313
30629
  Schema$1.Literals([
30314
30630
  "agent",
@@ -30384,12 +30700,17 @@ Schema$1.Literals([
30384
30700
  "sendInput",
30385
30701
  "resumeAgent",
30386
30702
  "wait",
30387
- "closeAgent"
30703
+ "closeAgent",
30704
+ "sendMessage",
30705
+ "followupTask",
30706
+ "interruptAgent",
30707
+ "listAgents"
30388
30708
  ]);
30389
30709
  Schema$1.Literals([
30390
30710
  "inProgress",
30391
30711
  "completed",
30392
- "failed"
30712
+ "failed",
30713
+ "interrupted"
30393
30714
  ]);
30394
30715
  Schema$1.Literals([
30395
30716
  "agent",
@@ -30439,12 +30760,17 @@ Schema$1.Literals([
30439
30760
  "sendInput",
30440
30761
  "resumeAgent",
30441
30762
  "wait",
30442
- "closeAgent"
30763
+ "closeAgent",
30764
+ "sendMessage",
30765
+ "followupTask",
30766
+ "interruptAgent",
30767
+ "listAgents"
30443
30768
  ]);
30444
30769
  Schema$1.Literals([
30445
30770
  "inProgress",
30446
30771
  "completed",
30447
- "failed"
30772
+ "failed",
30773
+ "interrupted"
30448
30774
  ]);
30449
30775
  Schema$1.Literals([
30450
30776
  "agent",
@@ -30494,12 +30820,17 @@ Schema$1.Literals([
30494
30820
  "sendInput",
30495
30821
  "resumeAgent",
30496
30822
  "wait",
30497
- "closeAgent"
30823
+ "closeAgent",
30824
+ "sendMessage",
30825
+ "followupTask",
30826
+ "interruptAgent",
30827
+ "listAgents"
30498
30828
  ]);
30499
30829
  Schema$1.Literals([
30500
30830
  "inProgress",
30501
30831
  "completed",
30502
- "failed"
30832
+ "failed",
30833
+ "interrupted"
30503
30834
  ]);
30504
30835
  Schema$1.Literals([
30505
30836
  "agent",
@@ -30556,12 +30887,17 @@ Schema$1.Literals([
30556
30887
  "sendInput",
30557
30888
  "resumeAgent",
30558
30889
  "wait",
30559
- "closeAgent"
30890
+ "closeAgent",
30891
+ "sendMessage",
30892
+ "followupTask",
30893
+ "interruptAgent",
30894
+ "listAgents"
30560
30895
  ]);
30561
30896
  Schema$1.Literals([
30562
30897
  "inProgress",
30563
30898
  "completed",
30564
- "failed"
30899
+ "failed",
30900
+ "interrupted"
30565
30901
  ]);
30566
30902
  Schema$1.Literals([
30567
30903
  "agent",
@@ -31165,7 +31501,10 @@ const makeCodexAppServerPatchedProtocol = Effect$1.fn("makeCodexAppServerPatched
31165
31501
  const incomingRequests = yield* options.onRequest ? Queue$1.sliding(PROTOCOL_QUEUE_CAPACITY) : Queue$1.bounded(PROTOCOL_QUEUE_CAPACITY);
31166
31502
  const pending = yield* Ref$1.make(/* @__PURE__ */ new Map());
31167
31503
  const nextRequestId = yield* Ref$1.make(1);
31168
- const remainder = yield* Ref$1.make("");
31504
+ const remainder = {
31505
+ fragments: [],
31506
+ byteLength: 0
31507
+ };
31169
31508
  const terminationHandled = yield* Ref$1.make(false);
31170
31509
  const logProtocol = (event) => {
31171
31510
  if (event.direction === "incoming" && !options.logIncoming) return Effect$1.void;
@@ -31264,19 +31603,39 @@ const makeCodexAppServerPatchedProtocol = Effect$1.fn("makeCodexAppServerPatched
31264
31603
  }
31265
31604
  })), Effect$1.flatMap(routeMessage));
31266
31605
  };
31267
- yield* options.stdio.stdin.pipe(Stream$1.decodeText(), Stream$1.runForEach((chunk) => Ref$1.modify(remainder, (current) => {
31268
- const lines = (current + chunk).split("\n");
31269
- const nextRemainder = lines.pop() ?? "";
31270
- return [{
31271
- lines: lines.map((line) => line.replace(/\r$/, "")),
31272
- remainderBytes: new TextEncoder().encode(nextRemainder).byteLength
31273
- }, nextRemainder];
31274
- }).pipe(Effect$1.flatMap(({ lines, remainderBytes }) => remainderBytes > PROTOCOL_MAX_FRAME_BYTES ? Effect$1.fail(new CodexAppServerProtocolOverloadedError({
31275
- queue: "incoming-frame-bytes",
31276
- capacity: PROTOCOL_MAX_FRAME_BYTES
31277
- })) : Effect$1.forEach(lines, handleLine, { discard: true })))), Effect$1.matchEffect({
31606
+ yield* options.stdio.stdin.pipe(Stream$1.decodeText(), Stream$1.runForEach((chunk) => Effect$1.gen(function* () {
31607
+ const lines = [];
31608
+ let start = 0;
31609
+ for (let newline = chunk.indexOf("\n"); newline !== -1; newline = chunk.indexOf("\n", start)) {
31610
+ const fragment = chunk.slice(start, newline);
31611
+ if (remainder.byteLength + new TextEncoder().encode(fragment).byteLength > PROTOCOL_MAX_FRAME_BYTES) return yield* Effect$1.fail(new CodexAppServerProtocolOverloadedError({
31612
+ queue: "incoming-frame-bytes",
31613
+ capacity: PROTOCOL_MAX_FRAME_BYTES
31614
+ }));
31615
+ remainder.fragments.push(fragment);
31616
+ lines.push(remainder.fragments.join("").replace(/\r$/, ""));
31617
+ remainder.fragments.length = 0;
31618
+ remainder.byteLength = 0;
31619
+ start = newline + 1;
31620
+ }
31621
+ if (start < chunk.length) {
31622
+ const fragment = chunk.slice(start);
31623
+ remainder.byteLength += new TextEncoder().encode(fragment).byteLength;
31624
+ if (remainder.byteLength > PROTOCOL_MAX_FRAME_BYTES) return yield* Effect$1.fail(new CodexAppServerProtocolOverloadedError({
31625
+ queue: "incoming-frame-bytes",
31626
+ capacity: PROTOCOL_MAX_FRAME_BYTES
31627
+ }));
31628
+ remainder.fragments.push(fragment);
31629
+ }
31630
+ yield* Effect$1.forEach(lines, handleLine, { discard: true });
31631
+ })), Effect$1.matchEffect({
31278
31632
  onFailure: (error) => handleTermination(() => Effect$1.succeed(normalizeProtocolError(error, "Codex App Server input stream failed"))),
31279
- onSuccess: () => Ref$1.get(remainder).pipe(Effect$1.flatMap((line) => line.trim().length === 0 ? Effect$1.void : handleLine(line)), Effect$1.matchEffect({
31633
+ onSuccess: () => Effect$1.sync(() => {
31634
+ const line = remainder.fragments.join("");
31635
+ remainder.fragments.length = 0;
31636
+ remainder.byteLength = 0;
31637
+ return line;
31638
+ }).pipe(Effect$1.flatMap((line) => line.trim().length === 0 ? Effect$1.void : handleLine(line)), Effect$1.matchEffect({
31280
31639
  onFailure: (error) => handleTermination(() => Effect$1.succeed(error)),
31281
31640
  onSuccess: () => handleTermination(() => options.terminationError ?? Effect$1.succeed(new CodexAppServerTransportError({
31282
31641
  detail: "Codex App Server input stream ended",
@@ -32384,7 +32743,7 @@ const DEVICE_TOOL_DEFINITIONS = [
32384
32743
  }
32385
32744
  }
32386
32745
  ];
32387
- function asRecord$5(value) {
32746
+ function asRecord$6(value) {
32388
32747
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Tool arguments must be a JSON object.");
32389
32748
  return value;
32390
32749
  }
@@ -32607,7 +32966,7 @@ async function startDeviceToolGateway(manager) {
32607
32966
  if (typeof method !== "string") return json(response, 400, mcpError$1(id, -32600, "Missing method."));
32608
32967
  if (method === "notifications/initialized" || method === "notifications/cancelled") return empty(response, 202);
32609
32968
  if (method === "initialize") {
32610
- const requested = asRecord$5(message.params ?? {}).protocolVersion;
32969
+ const requested = asRecord$6(message.params ?? {}).protocolVersion;
32611
32970
  return json(response, 200, mcpSuccess(id, {
32612
32971
  protocolVersion: typeof requested === "string" ? requested : "2025-06-18",
32613
32972
  capabilities: { tools: { listChanged: false } },
@@ -32627,7 +32986,7 @@ async function startDeviceToolGateway(manager) {
32627
32986
  text: "Device tools are only available during an active Ryco turn."
32628
32987
  }]
32629
32988
  }));
32630
- const params = asRecord$5(message.params ?? {});
32989
+ const params = asRecord$6(message.params ?? {});
32631
32990
  const name = params.name;
32632
32991
  if (typeof name !== "string" || !DEVICE_TOOL_NAMES.includes(name)) return json(response, 200, mcpError$1(id, -32602, "Unknown device tool."));
32633
32992
  if (agentControlBlocksLegacyTool(binding.threadId, name)) return json(response, 200, mcpSuccess(id, {
@@ -32642,7 +33001,7 @@ async function startDeviceToolGateway(manager) {
32642
33001
  manager,
32643
33002
  threadId: binding.threadId,
32644
33003
  name,
32645
- args: asRecord$5(params.arguments ?? {})
33004
+ args: asRecord$6(params.arguments ?? {})
32646
33005
  });
32647
33006
  return json(response, 200, mcpSuccess(id, { content: value && typeof value === "object" && "_mcpContent" in value ? value._mcpContent : [{
32648
33007
  type: "text",
@@ -32941,7 +33300,7 @@ const BUILT_IN_DRIVERS = [
32941
33300
  configSchema: CodexSettings,
32942
33301
  defaultConfig: () => Schema.decodeSync(CodexSettings)({}),
32943
33302
  create: (input) => Effect.tryPromise({
32944
- try: () => import("./CodexDriver-DBz2rPXb.mjs"),
33303
+ try: () => import("./CodexDriver-DLwPz5sk.mjs"),
32945
33304
  catch: (cause) => driverImportError(codexDriverKind, input, cause)
32946
33305
  }).pipe(Effect.flatMap(({ CodexDriver }) => CodexDriver.create(input)))
32947
33306
  },
@@ -32955,7 +33314,7 @@ const BUILT_IN_DRIVERS = [
32955
33314
  configSchema: ClaudeSettings,
32956
33315
  defaultConfig: () => Schema.decodeSync(ClaudeSettings)({}),
32957
33316
  create: (input) => Effect.tryPromise({
32958
- try: () => import("./ClaudeDriver-rooMNrJz.mjs"),
33317
+ try: () => import("./ClaudeDriver-DsW8yDj9.mjs"),
32959
33318
  catch: (cause) => driverImportError(claudeDriverKind, input, cause)
32960
33319
  }).pipe(Effect.flatMap(({ ClaudeDriver }) => ClaudeDriver.create(input)))
32961
33320
  },
@@ -32969,7 +33328,7 @@ const BUILT_IN_DRIVERS = [
32969
33328
  configSchema: CopilotSettings,
32970
33329
  defaultConfig: () => Schema.decodeSync(CopilotSettings)({}),
32971
33330
  create: (input) => Effect.tryPromise({
32972
- try: () => import("./CopilotDriver-D36vbGbn.mjs"),
33331
+ try: () => import("./CopilotDriver-DXvGBv-s.mjs"),
32973
33332
  catch: (cause) => driverImportError(copilotDriverKind, input, cause)
32974
33333
  }).pipe(Effect.flatMap(({ CopilotDriver }) => CopilotDriver.create(input)))
32975
33334
  },
@@ -32983,7 +33342,7 @@ const BUILT_IN_DRIVERS = [
32983
33342
  configSchema: CursorSettings,
32984
33343
  defaultConfig: () => Schema.decodeSync(CursorSettings)({}),
32985
33344
  create: (input) => Effect.tryPromise({
32986
- try: () => import("./CursorDriver-DWuuOSkJ.mjs"),
33345
+ try: () => import("./CursorDriver-CeB_vMKJ.mjs"),
32987
33346
  catch: (cause) => driverImportError(cursorDriverKind, input, cause)
32988
33347
  }).pipe(Effect.flatMap(({ CursorDriver }) => CursorDriver.create(input)))
32989
33348
  },
@@ -32997,7 +33356,7 @@ const BUILT_IN_DRIVERS = [
32997
33356
  configSchema: GrokSettings,
32998
33357
  defaultConfig: () => Schema.decodeSync(GrokSettings)({}),
32999
33358
  create: (input) => Effect.tryPromise({
33000
- try: () => import("./GrokDriver-qKX1a63G.mjs"),
33359
+ try: () => import("./GrokDriver-CFgjwnvE.mjs"),
33001
33360
  catch: (cause) => driverImportError(grokDriverKind, input, cause)
33002
33361
  }).pipe(Effect.flatMap(({ GrokDriver }) => GrokDriver.create(input)))
33003
33362
  },
@@ -33011,7 +33370,7 @@ const BUILT_IN_DRIVERS = [
33011
33370
  configSchema: OpenCodeSettings,
33012
33371
  defaultConfig: () => Schema.decodeSync(OpenCodeSettings)({}),
33013
33372
  create: (input) => Effect.tryPromise({
33014
- try: () => import("./OpenCodeDriver-CbdswhqU.mjs"),
33373
+ try: () => import("./OpenCodeDriver-DNApoGdu.mjs"),
33015
33374
  catch: (cause) => driverImportError(openCodeDriverKind, input, cause)
33016
33375
  }).pipe(Effect.flatMap(({ OpenCodeDriver }) => OpenCodeDriver.create(input)))
33017
33376
  }
@@ -33726,7 +34085,7 @@ const scopedSafeTeardown = (label) => (effect) => Effect.gen(function* () {
33726
34085
  });
33727
34086
  //#endregion
33728
34087
  //#region package.json
33729
- var version$1 = "0.1.13";
34088
+ var version$1 = "0.1.15";
33730
34089
  //#endregion
33731
34090
  //#region src/provider/Layers/CodexProvider.ts
33732
34091
  const PROVIDER_PROBE_TIMEOUT_MS = 8e3;
@@ -34211,7 +34570,7 @@ function sortProviderSupport(left, right) {
34211
34570
  };
34212
34571
  return statusRank[left.status] - statusRank[right.status] || Number(right.enabled) - Number(left.enabled) || left.driver.localeCompare(right.driver) || left.instanceId.localeCompare(right.instanceId);
34213
34572
  }
34214
- function asRecord$4(value) {
34573
+ function asRecord$5(value) {
34215
34574
  if (value === null || typeof value !== "object" || Array.isArray(value)) return;
34216
34575
  return value;
34217
34576
  }
@@ -34219,7 +34578,7 @@ function asStringArray(value) {
34219
34578
  return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
34220
34579
  }
34221
34580
  function asStringRecord(value) {
34222
- const record = asRecord$4(value);
34581
+ const record = asRecord$5(value);
34223
34582
  if (!record) return {};
34224
34583
  const entries = Object.entries(record).filter((entry) => {
34225
34584
  const [, entryValue] = entry;
@@ -34244,7 +34603,7 @@ function asOptionalNumber(value) {
34244
34603
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
34245
34604
  }
34246
34605
  function sourceFromOrigin(origin) {
34247
- const type = asRecord$4(asRecord$4(origin)?.name)?.type;
34606
+ const type = asRecord$5(asRecord$5(origin)?.name)?.type;
34248
34607
  if (type === "user" || type === "project" || type === "system") return type;
34249
34608
  if (type === "mdm") return "managed";
34250
34609
  return "unknown";
@@ -34264,13 +34623,13 @@ function collectLayerServers(layers) {
34264
34623
  if (!layers) return [];
34265
34624
  const layerServers = [];
34266
34625
  for (const layer of layers) {
34267
- const servers = asRecord$4(asRecord$4(layer.config)?.mcp_servers);
34626
+ const servers = asRecord$5(asRecord$5(layer.config)?.mcp_servers);
34268
34627
  if (servers) layerServers.push(servers);
34269
34628
  }
34270
34629
  return layerServers;
34271
34630
  }
34272
34631
  function decodeServerConfig(raw) {
34273
- const record = asRecord$4(raw);
34632
+ const record = asRecord$5(raw);
34274
34633
  if (!record) return Schema.decodeSync(McpServerConfig)({ transport: "unknown" });
34275
34634
  const input = {
34276
34635
  transport: typeof record.url === "string" ? "http" : typeof record.command === "string" ? "stdio" : "unknown",
@@ -34387,15 +34746,15 @@ function toStartupStatus(config, status) {
34387
34746
  }
34388
34747
  function extractConfigPath(layers) {
34389
34748
  const userLayer = layers?.find((layer) => {
34390
- const name = asRecord$4(layer.name);
34749
+ const name = asRecord$5(layer.name);
34391
34750
  return name?.type === "user" && typeof name.file === "string";
34392
34751
  });
34393
- const file = asRecord$4(userLayer?.name)?.file;
34752
+ const file = asRecord$5(userLayer?.name)?.file;
34394
34753
  return typeof file === "string" ? file : void 0;
34395
34754
  }
34396
34755
  function buildServers(input) {
34397
34756
  const configRecord = input.configResponse.config;
34398
- const configuredServers = asRecord$4(configRecord.mcp_servers) ?? {};
34757
+ const configuredServers = asRecord$5(configRecord.mcp_servers) ?? {};
34399
34758
  const statusByName = new Map(input.statuses.map((status) => [status.name, status]));
34400
34759
  const names = [.../* @__PURE__ */ new Set([...Object.keys(configuredServers), ...statusByName.keys()])].toSorted((left, right) => left.localeCompare(right));
34401
34760
  const layerServers = collectLayerServers(input.configResponse.layers);
@@ -34620,7 +34979,7 @@ const makeCodexMcpService = Effect.gen(function* () {
34620
34979
  cwd: serverConfig.cwd,
34621
34980
  includeLayers: false
34622
34981
  })).config;
34623
- const config = mergeServerSecrets((asRecord$4(configRecord.mcp_servers) ?? {})[input.name], input);
34982
+ const config = mergeServerSecrets((asRecord$5(configRecord.mcp_servers) ?? {})[input.name], input);
34624
34983
  return yield* client.request("config/batchWrite", {
34625
34984
  edits: [{
34626
34985
  keyPath: `mcp_servers.${input.name}`,
@@ -37133,6 +37492,20 @@ const OpenLive = Layer.effect(Open, make$10);
37133
37492
  */
37134
37493
  var OrchestrationEngineService = class extends Context.Service()("ryco/orchestration/Services/OrchestrationEngine/OrchestrationEngineService") {};
37135
37494
  //#endregion
37495
+ //#region src/orchestration/Services/ThreadDeletionReactor.ts
37496
+ /**
37497
+ * ThreadDeletionReactor - Thread deletion cleanup reactor service interface.
37498
+ *
37499
+ * Owns background workers that react to thread deletion domain events and
37500
+ * perform best-effort runtime cleanup for provider sessions and terminals.
37501
+ *
37502
+ * @module ThreadDeletionReactor
37503
+ */
37504
+ /**
37505
+ * ThreadDeletionReactor - Service tag for thread deletion cleanup workers.
37506
+ */
37507
+ var ThreadDeletionReactor = class extends Context.Service()("ryco/orchestration/Services/ThreadDeletionReactor") {};
37508
+ //#endregion
37136
37509
  //#region src/orchestration/Services/ContextHandoffInspection.ts
37137
37510
  var ContextHandoffInspection = class extends Context.Service()("ryco/orchestration/Services/ContextHandoffInspection") {};
37138
37511
  //#endregion
@@ -38678,6 +39051,9 @@ var WorkspaceAccessPolicy = class extends Context.Service()("ryco/workspace/Serv
38678
39051
  //#region src/provider/Services/ProviderSessionReaper.ts
38679
39052
  var ProviderSessionReaper = class extends Context.Service()("ryco/provider/Services/ProviderSessionReaper") {};
38680
39053
  //#endregion
39054
+ //#region src/provider/Services/ProviderSessionDirectory.ts
39055
+ var ProviderSessionDirectory = class extends Context.Service()("ryco/provider/Services/ProviderSessionDirectory") {};
39056
+ //#endregion
38681
39057
  //#region ../../packages/shared/src/qrCode.ts
38682
39058
  var QrCode = class QrCode {
38683
39059
  static Ecc;
@@ -39892,6 +40268,86 @@ const validateRestrictedWorkspaceSnapshot = (snapshot) => Effect.gen(function* (
39892
40268
  operation: "persisted worktree startup validation"
39893
40269
  }), { discard: true });
39894
40270
  }).pipe(Effect.mapError(incompatibleWorkspaceStateError));
40271
+ const ORPHANED_PROVIDER_SESSION_ERROR = "Provider session did not survive a server restart. Send a new message to continue.";
40272
+ function clearRuntimePayloadActiveTurn(runtimePayload) {
40273
+ if (typeof runtimePayload === "object" && runtimePayload !== null && !Array.isArray(runtimePayload)) return {
40274
+ ...runtimePayload,
40275
+ activeTurnId: null
40276
+ };
40277
+ return { activeTurnId: null };
40278
+ }
40279
+ /**
40280
+ * Settle projected provider sessions whose native process did not survive this
40281
+ * server process. This runs after the provider/orchestration roots subscribe,
40282
+ * but before the startup command gate opens, so repaired state is authoritative
40283
+ * before clients can mutate it.
40284
+ */
40285
+ const reconcileOrphanedProviderSessions = Effect.gen(function* () {
40286
+ const directory = yield* ProviderSessionDirectory;
40287
+ const orchestrationEngine = yield* OrchestrationEngineService;
40288
+ const providerService = yield* ProviderService;
40289
+ const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
40290
+ const liveSessionsExit = yield* Effect.exit(providerService.listSessions());
40291
+ if (Exit.isFailure(liveSessionsExit)) {
40292
+ if (Cause.hasInterrupts(liveSessionsExit.cause)) return yield* Effect.failCause(liveSessionsExit.cause);
40293
+ yield* Effect.logWarning("provider session startup inventory failed", { cause: Cause.pretty(liveSessionsExit.cause) });
40294
+ return;
40295
+ }
40296
+ const liveThreadIds = new Set(liveSessionsExit.value.map((session) => session.threadId));
40297
+ 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));
40298
+ for (const thread of orphanedThreads) {
40299
+ const session = thread.session;
40300
+ if (session === null) continue;
40301
+ yield* Effect.gen(function* () {
40302
+ const binding = yield* directory.getBinding(thread.id);
40303
+ if (Option.isNone(binding)) return;
40304
+ yield* providerService.stopSessionBinding(binding.value).pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.logWarning("failed to stop orphaned provider runtime binding", {
40305
+ threadId: thread.id,
40306
+ cause: Cause.pretty(cause)
40307
+ })));
40308
+ yield* directory.upsert({
40309
+ ...binding.value,
40310
+ status: "stopped",
40311
+ runtimePayload: clearRuntimePayloadActiveTurn(binding.value.runtimePayload)
40312
+ });
40313
+ }).pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.logWarning("failed to reconcile orphaned provider session binding", {
40314
+ threadId: thread.id,
40315
+ cause: Cause.pretty(cause)
40316
+ })));
40317
+ const reconciledAt = (/* @__PURE__ */ new Date()).toISOString();
40318
+ if (session.activeTurnId !== null) {
40319
+ const interruptCommand = {
40320
+ type: "thread.turn.interrupt",
40321
+ commandId: CommandId.make(`provider:startup-reconciliation:turn-interrupt:${crypto.randomUUID()}`),
40322
+ threadId: thread.id,
40323
+ turnId: session.activeTurnId,
40324
+ createdAt: reconciledAt
40325
+ };
40326
+ yield* Effect.suspend(() => orchestrationEngine.dispatch(interruptCommand)).pipe(Effect.retry(Schedule.recurs(1)), Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.logWarning("failed to settle orphaned provider turn projection", {
40327
+ threadId: thread.id,
40328
+ turnId: session.activeTurnId,
40329
+ cause: Cause.pretty(cause)
40330
+ })));
40331
+ }
40332
+ const sessionCommand = {
40333
+ type: "thread.session.set",
40334
+ commandId: CommandId.make(`server:startup-reconciliation:${crypto.randomUUID()}`),
40335
+ threadId: thread.id,
40336
+ session: {
40337
+ ...session,
40338
+ status: "error",
40339
+ activeTurnId: null,
40340
+ lastError: ORPHANED_PROVIDER_SESSION_ERROR,
40341
+ updatedAt: reconciledAt
40342
+ },
40343
+ createdAt: reconciledAt
40344
+ };
40345
+ yield* Effect.suspend(() => orchestrationEngine.dispatch(sessionCommand)).pipe(Effect.retry(Schedule.recurs(1)), Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.logWarning("failed to settle orphaned provider session projection", {
40346
+ threadId: thread.id,
40347
+ cause: Cause.pretty(cause)
40348
+ })));
40349
+ }
40350
+ }).pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.logWarning("provider session startup reconciliation failed", { cause: Cause.pretty(cause) })));
39895
40351
  const makeServerRuntimeStartup = Effect.gen(function* () {
39896
40352
  const runtimeStartedAt = Date.now();
39897
40353
  const serverConfig = yield* ServerConfig;
@@ -39926,6 +40382,8 @@ const makeServerRuntimeStartup = Effect.gen(function* () {
39926
40382
  concurrency: "unbounded",
39927
40383
  discard: true
39928
40384
  }));
40385
+ yield* Effect.logDebug("startup phase: reconciling orphaned provider sessions");
40386
+ yield* runStartupPhase("provider-sessions.reconcile", reconcileOrphanedProviderSessions);
39929
40387
  const welcomeBase = yield* resolveWelcomeBase;
39930
40388
  const environment = yield* serverEnvironment.getDescriptor;
39931
40389
  yield* Effect.logDebug("startup phase: preparing welcome payload");
@@ -41010,17 +41468,40 @@ const makeGitManager = Effect.fn("makeGitManager")(function* () {
41010
41468
  timeToLive: (exit) => Exit.isSuccess(exit) ? STATUS_RESULT_CACHE_TTL : Duration.zero
41011
41469
  });
41012
41470
  const invalidateLocalStatusResultCache = (cwd) => normalizeStatusCacheKey(cwd).pipe(Effect.flatMap((cacheKey) => Cache.invalidate(localStatusResultCache, cacheKey)));
41471
+ const probeBranchPublished = Effect.fn("probeBranchPublished")(function* (cwd, branch, upstreamRef) {
41472
+ if (upstreamRef !== null) return true;
41473
+ return yield* Effect.gen(function* () {
41474
+ const remotes = (yield* gitCore.execute({
41475
+ operation: "GitManager.probeBranchPublished.remotes",
41476
+ cwd,
41477
+ args: ["remote"]
41478
+ })).stdout.split("\n").map((remote) => remote.trim()).filter((remote) => remote.length > 0);
41479
+ if (remotes.length === 0) return null;
41480
+ const refsResult = yield* gitCore.execute({
41481
+ operation: "GitManager.probeBranchPublished.remoteRefs",
41482
+ cwd,
41483
+ args: [
41484
+ "for-each-ref",
41485
+ "--format=%(refname:short)",
41486
+ "refs/remotes"
41487
+ ]
41488
+ });
41489
+ const remoteRefs = new Set(refsResult.stdout.split("\n").map((ref) => ref.trim()).filter((ref) => ref.length > 0));
41490
+ return remotes.some((remote) => remoteRefs.has(`${remote}/${branch}`));
41491
+ }).pipe(Effect.catch(() => Effect.succeed(null)));
41492
+ });
41013
41493
  const readRemoteStatus = Effect.fn("readRemoteStatus")(function* (cwd) {
41014
41494
  const details = yield* gitCore.statusDetails(cwd).pipe(Effect.catchIf(isNotGitRepositoryError, () => Effect.succeed(null)));
41015
41495
  if (details === null || !details.isRepo) return null;
41016
- const pr = details.branch !== null ? yield* findLatestPr(cwd, {
41496
+ const shouldQueryPullRequests = details.branch === null ? false : (yield* probeBranchPublished(cwd, details.branch, details.upstreamRef)) ?? true;
41497
+ const pr = details.branch !== null && shouldQueryPullRequests ? yield* findLatestPr(cwd, {
41017
41498
  branch: details.branch,
41018
41499
  upstreamRef: details.upstreamRef
41019
41500
  }).pipe(Effect.map((latest) => {
41020
41501
  if (!latest) return null;
41021
41502
  if (details.isDefaultBranch && latest.state !== "open") return null;
41022
41503
  return toStatusPr(latest);
41023
- }), Effect.catch(() => Effect.succeed(null))) : null;
41504
+ })) : null;
41024
41505
  return {
41025
41506
  hasUpstream: details.hasUpstream,
41026
41507
  aheadCount: details.aheadCount,
@@ -41682,6 +42163,7 @@ const make$9 = Effect.fn("makeGitWorkflowService")(function* () {
41682
42163
  listRefs: (input) => detectGitRepositoryForCommand("GitWorkflowService.listRefs", input.cwd).pipe(Effect.flatMap((isGitRepository) => isGitRepository ? git.listRefs(input).pipe(Effect.catch(recoverMissingCwd(input.cwd, nonRepositoryListRefs()))) : Effect.succeed(nonRepositoryListRefs()))),
41683
42164
  createWorktree: (input) => ensureGitCommand("GitWorkflowService.createWorktree", input.cwd).pipe(Effect.andThen(git.createWorktree(input))),
41684
42165
  removeWorktree: (input) => ensureGitCommand("GitWorkflowService.removeWorktree", input.cwd).pipe(Effect.andThen(git.removeWorktree(input))),
42166
+ pruneWorktrees: (cwd) => ensureGitCommand("GitWorkflowService.pruneWorktrees", cwd).pipe(Effect.andThen(git.pruneWorktrees(cwd))),
41685
42167
  listWorktreePaths: (cwd) => {
41686
42168
  const empty = [];
41687
42169
  return detectGitRepositoryForCommand("GitWorkflowService.listWorktreePaths", cwd).pipe(Effect.flatMap((isGitRepository) => isGitRepository ? git.listWorktreePaths(cwd).pipe(Effect.catch(recoverMissingCwd(cwd, empty))) : Effect.succeed(empty)));
@@ -44857,6 +45339,7 @@ const makeWsRpcContext = (principal) => Effect.gen(function* () {
44857
45339
  const usageServiceOption = yield* Effect.serviceOption(UsageService);
44858
45340
  const usageService = Option.getOrElse(usageServiceOption, () => UsageServiceTest);
44859
45341
  const orchestrationEngine = yield* OrchestrationEngineService;
45342
+ const threadDeletionReactor = yield* ThreadDeletionReactor;
44860
45343
  const contextHandoffInspection = yield* Effect.serviceOption(ContextHandoffInspection);
44861
45344
  const threadPriorityCoordinator = yield* Effect.serviceOption(ThreadPriorityCoordinator);
44862
45345
  const agentControlProposals = yield* Effect.serviceOption(AgentControlProposalService);
@@ -45074,7 +45557,7 @@ const makeWsRpcContext = (principal) => Effect.gen(function* () {
45074
45557
  })() : Effect.void;
45075
45558
  return yield* Effect.gen(function* () {
45076
45559
  if (bootstrap?.createThread) {
45077
- yield* orchestrationEngine.dispatch({
45560
+ const created = yield* orchestrationEngine.dispatch({
45078
45561
  type: "thread.create",
45079
45562
  commandId: serverCommandId("bootstrap-thread-create"),
45080
45563
  threadId: command.threadId,
@@ -45087,6 +45570,7 @@ const makeWsRpcContext = (principal) => Effect.gen(function* () {
45087
45570
  worktreePath: bootstrap.createThread.worktreePath,
45088
45571
  createdAt: bootstrap.createThread.createdAt
45089
45572
  });
45573
+ yield* threadDeletionReactor.drainThrough(created.sequence);
45090
45574
  createdThread = true;
45091
45575
  }
45092
45576
  if (bootstrap?.prepareWorktree) {
@@ -45123,7 +45607,7 @@ const makeWsRpcContext = (principal) => Effect.gen(function* () {
45123
45607
  }));
45124
45608
  });
45125
45609
  const dispatchNormalizedCommand = (normalizedCommand) => {
45126
- const dispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap ? dispatchBootstrapTurnStart(normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand).pipe(Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45610
+ const dispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap ? dispatchBootstrapTurnStart(normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand).pipe(Effect.tap(({ sequence }) => normalizedCommand.type === "thread.create" ? threadDeletionReactor.drainThrough(sequence) : Effect.void), Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45127
45611
  return startup.enqueueCommand(dispatchEffect).pipe(Effect.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
45128
45612
  };
45129
45613
  const loadDiagnosticsMetrics = localDiagnosticsMetrics.snapshot;
@@ -45511,18 +45995,24 @@ const normalizeDispatchCommand = (command) => Effect.gen(function* () {
45511
45995
  ...command.projectMetadataDir !== void 0 ? { projectMetadataDir: yield* normalizeProjectMetadataDir(command.projectMetadataDir) } : {}
45512
45996
  };
45513
45997
  if (command.type !== "thread.turn.start" && command.type !== "thread.turn.steer") return command;
45514
- const normalizedAttachments = yield* Effect.forEach(command.message.attachments, (attachment) => Effect.gen(function* () {
45998
+ const preparedAttachments = yield* Effect.forEach(command.message.attachments, (attachment) => Effect.gen(function* () {
45515
45999
  const parsed = parseBase64DataUrl(attachment.dataUrl);
45516
- if (!parsed || !parsed.mimeType.startsWith("image/")) return yield* new OrchestrationDispatchCommandError({ message: `Invalid image attachment payload for '${attachment.name}'.` });
45517
- const bytes = Buffer.from(parsed.base64, "base64");
45518
- if (bytes.byteLength === 0 || bytes.byteLength > 10485760) return yield* new OrchestrationDispatchCommandError({ message: `Image attachment '${attachment.name}' is empty or too large.` });
46000
+ if (!parsed) return yield* new OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' must use a valid base64 data URL.` });
46001
+ const normalizedMimeType = parsed.mimeType.toLowerCase();
46002
+ if (normalizedMimeType !== attachment.mimeType.toLowerCase()) return yield* new OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' declares '${attachment.mimeType}' but its payload is '${parsed.mimeType}'.` });
46003
+ if (attachment.type === "image" && !normalizedMimeType.startsWith("image/")) return yield* new OrchestrationDispatchCommandError({ message: `Image attachment '${attachment.name}' must use an image MIME type.` });
46004
+ const normalizedBase64 = parsed.base64.replace(/\s+/g, "");
46005
+ const bytes = Buffer.from(normalizedBase64, "base64");
46006
+ if (bytes.byteLength === 0 || bytes.toString("base64") !== normalizedBase64 || bytes.byteLength !== attachment.sizeBytes) return yield* new OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' has invalid base64 data or mismatched size metadata.` });
46007
+ const attachmentLimit = attachment.type === "image" ? PROVIDER_SEND_TURN_MAX_IMAGE_BYTES : PROVIDER_SEND_TURN_MAX_FILE_BYTES;
46008
+ if (bytes.byteLength > attachmentLimit) return yield* new OrchestrationDispatchCommandError({ message: `Attachment '${attachment.name}' is ${bytes.byteLength} bytes; limit is ${attachmentLimit} bytes.` });
45519
46009
  const attachmentId = createAttachmentId(command.threadId);
45520
46010
  if (!attachmentId) return yield* new OrchestrationDispatchCommandError({ message: "Failed to create a safe attachment id." });
45521
46011
  const persistedAttachment = {
45522
- type: "image",
46012
+ type: attachment.type,
45523
46013
  id: attachmentId,
45524
46014
  name: attachment.name,
45525
- mimeType: parsed.mimeType.toLowerCase(),
46015
+ mimeType: normalizedMimeType,
45526
46016
  sizeBytes: bytes.byteLength
45527
46017
  };
45528
46018
  const attachmentPath = resolveAttachmentPath({
@@ -45530,10 +46020,22 @@ const normalizeDispatchCommand = (command) => Effect.gen(function* () {
45530
46020
  attachment: persistedAttachment
45531
46021
  });
45532
46022
  if (!attachmentPath) return yield* new OrchestrationDispatchCommandError({ message: `Failed to resolve persisted path for '${attachment.name}'.` });
45533
- yield* fileSystem.makeDirectory(path.dirname(attachmentPath), { recursive: true }).pipe(Effect.mapError(() => new OrchestrationDispatchCommandError({ message: `Failed to create attachment directory for '${attachment.name}'.` })));
45534
- yield* fileSystem.writeFile(attachmentPath, bytes).pipe(Effect.mapError(() => new OrchestrationDispatchCommandError({ message: `Failed to persist attachment '${attachment.name}'.` })));
45535
- return persistedAttachment;
46023
+ return {
46024
+ attachment: persistedAttachment,
46025
+ attachmentPath,
46026
+ bytes
46027
+ };
45536
46028
  }), { concurrency: 1 });
46029
+ const totalAttachmentBytes = preparedAttachments.reduce((total, prepared) => total + prepared.bytes.byteLength, 0);
46030
+ if (totalAttachmentBytes > 52428800) return yield* new OrchestrationDispatchCommandError({ message: `Attachments total ${totalAttachmentBytes} bytes; limit is ${PROVIDER_SEND_TURN_MAX_ATTACHMENT_TOTAL_BYTES} bytes.` });
46031
+ yield* Effect.forEach(preparedAttachments, ({ attachment, attachmentPath, bytes }) => fileSystem.makeDirectory(path.dirname(attachmentPath), { recursive: true }).pipe(Effect.mapError(() => new OrchestrationDispatchCommandError({ message: `Failed to create attachment directory for '${attachment.name}'.` })), Effect.andThen(fileSystem.writeFile(attachmentPath, bytes).pipe(Effect.mapError(() => new OrchestrationDispatchCommandError({ message: `Failed to persist attachment '${attachment.name}'.` }))))), {
46032
+ concurrency: 1,
46033
+ discard: true
46034
+ }).pipe(Effect.onError(() => Effect.forEach(preparedAttachments, ({ attachmentPath }) => fileSystem.remove(attachmentPath).pipe(Effect.ignore), {
46035
+ concurrency: 1,
46036
+ discard: true
46037
+ })));
46038
+ const normalizedAttachments = preparedAttachments.map(({ attachment }) => attachment);
45537
46039
  return {
45538
46040
  ...command,
45539
46041
  message: {
@@ -47751,10 +48253,10 @@ const ContextHandoffDocument = Schema.Struct({
47751
48253
  subagents: Schema.Array(ContextHandoffSubagentEntry),
47752
48254
  priorHandoffs: Schema.Array(ContextHandoffBoundaryEntry)
47753
48255
  });
47754
- function asRecord$3(value) {
48256
+ function asRecord$4(value) {
47755
48257
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
47756
48258
  }
47757
- function asTrimmedString$1(value) {
48259
+ function asTrimmedString$2(value) {
47758
48260
  if (typeof value !== "string") return;
47759
48261
  const trimmed = value.trim();
47760
48262
  return trimmed.length > 0 ? trimmed : void 0;
@@ -47773,7 +48275,7 @@ function truncateUnicodeSafe(value, maxChars) {
47773
48275
  return value.slice(0, end);
47774
48276
  }
47775
48277
  function boundedString(value, maxChars) {
47776
- const normalized = asTrimmedString$1(value);
48278
+ const normalized = asTrimmedString$2(value);
47777
48279
  if (!normalized) return { truncated: false };
47778
48280
  const bounded = truncateUnicodeSafe(normalized, maxChars);
47779
48281
  return {
@@ -47825,7 +48327,7 @@ function boundedEndpoint(endpoint) {
47825
48327
  };
47826
48328
  }
47827
48329
  function activityPayload(activity) {
47828
- return asRecord$3(activity.payload);
48330
+ return asRecord$4(activity.payload);
47829
48331
  }
47830
48332
  function decodeHandoffPayload(activity) {
47831
48333
  if (activity.kind !== "context-handoff") return;
@@ -47912,7 +48414,7 @@ function collectRuntimePlan(activities) {
47912
48414
  if (!Array.isArray(payload?.plan)) continue;
47913
48415
  let truncated = payload.plan.length > MAX_PLAN_STEPS;
47914
48416
  const steps = payload.plan.slice(0, MAX_PLAN_STEPS).flatMap((entry) => {
47915
- const record = asRecord$3(entry);
48417
+ const record = asRecord$4(entry);
47916
48418
  const step = boundedString(record?.step, DETAIL_MAX_CHARS);
47917
48419
  if (!step.value) return [];
47918
48420
  truncated ||= step.truncated;
@@ -47939,21 +48441,21 @@ function collectRuntimePlan(activities) {
47939
48441
  return latest ? [latest] : [];
47940
48442
  }
47941
48443
  function normalizeCommand(value) {
47942
- const direct = asTrimmedString$1(value);
48444
+ const direct = asTrimmedString$2(value);
47943
48445
  if (direct) return direct;
47944
48446
  if (!Array.isArray(value)) return;
47945
48447
  const parts = value.flatMap((entry) => {
47946
- const part = asTrimmedString$1(entry);
48448
+ const part = asTrimmedString$2(entry);
47947
48449
  return part ? [part] : [];
47948
48450
  });
47949
48451
  return parts.length > 0 ? parts.join(" ") : void 0;
47950
48452
  }
47951
48453
  function extractCommand(payload) {
47952
- const data = asRecord$3(payload.data);
47953
- const item = asRecord$3(data?.item);
47954
- const input = asRecord$3(item?.input);
47955
- const result = asRecord$3(item?.result);
47956
- const rawInput = asRecord$3(data?.rawInput);
48454
+ const data = asRecord$4(payload.data);
48455
+ const item = asRecord$4(data?.item);
48456
+ const input = asRecord$4(item?.input);
48457
+ const result = asRecord$4(item?.result);
48458
+ const rawInput = asRecord$4(data?.rawInput);
47957
48459
  for (const candidate of [
47958
48460
  item?.command,
47959
48461
  input?.command,
@@ -47964,7 +48466,7 @@ function extractCommand(payload) {
47964
48466
  const command = normalizeCommand(candidate);
47965
48467
  if (command) return command;
47966
48468
  }
47967
- const executable = asTrimmedString$1(rawInput?.executable);
48469
+ const executable = asTrimmedString$2(rawInput?.executable);
47968
48470
  const args = normalizeCommand(rawInput?.args);
47969
48471
  return executable ? args ? `${executable} ${args}` : executable : void 0;
47970
48472
  }
@@ -47972,36 +48474,36 @@ function textFromContentArray(value) {
47972
48474
  if (!Array.isArray(value)) return;
47973
48475
  const chunks = [];
47974
48476
  for (const entry of value) {
47975
- const record = asRecord$3(entry);
47976
- const direct = asTrimmedString$1(record?.text);
47977
- const nested = asTrimmedString$1(asRecord$3(record?.content)?.text);
48477
+ const record = asRecord$4(entry);
48478
+ const direct = asTrimmedString$2(record?.text);
48479
+ const nested = asTrimmedString$2(asRecord$4(record?.content)?.text);
47978
48480
  if (direct) chunks.push(direct);
47979
48481
  else if (nested) chunks.push(nested);
47980
48482
  }
47981
48483
  return chunks.length > 0 ? chunks.join("\n") : void 0;
47982
48484
  }
47983
48485
  function extractOutput(payload) {
47984
- const data = asRecord$3(payload.data);
47985
- const item = asRecord$3(data?.item);
47986
- if (item?.type === "commandExecution") return asTrimmedString$1(item.aggregatedOutput);
48486
+ const data = asRecord$4(payload.data);
48487
+ const item = asRecord$4(data?.item);
48488
+ if (item?.type === "commandExecution") return asTrimmedString$2(item.aggregatedOutput);
47987
48489
  if (item?.type === "mcpToolCall") {
47988
- const error = asTrimmedString$1(asRecord$3(item.error)?.message);
48490
+ const error = asTrimmedString$2(asRecord$4(item.error)?.message);
47989
48491
  if (error) return error;
47990
- const content = textFromContentArray(asRecord$3(item.result)?.content);
48492
+ const content = textFromContentArray(asRecord$4(item.result)?.content);
47991
48493
  if (content) return content;
47992
48494
  }
47993
48495
  if (item?.type === "dynamicToolCall") {
47994
48496
  const content = textFromContentArray(item.contentItems);
47995
48497
  if (content) return content;
47996
48498
  }
47997
- const rawOutput = asRecord$3(data?.rawOutput);
47998
- return asTrimmedString$1(rawOutput?.stdout) ?? asTrimmedString$1(rawOutput?.stderr) ?? asTrimmedString$1(rawOutput?.content) ?? textFromContentArray(data?.content);
48499
+ const rawOutput = asRecord$4(data?.rawOutput);
48500
+ return asTrimmedString$2(rawOutput?.stdout) ?? asTrimmedString$2(rawOutput?.stderr) ?? asTrimmedString$2(rawOutput?.content) ?? textFromContentArray(data?.content);
47999
48501
  }
48000
48502
  function extractExitCode(payload) {
48001
- const data = asRecord$3(payload.data);
48002
- const item = asRecord$3(data?.item);
48003
- const itemResult = asRecord$3(item?.result);
48004
- const rawOutput = asRecord$3(data?.rawOutput);
48503
+ const data = asRecord$4(payload.data);
48504
+ const item = asRecord$4(data?.item);
48505
+ const itemResult = asRecord$4(item?.result);
48506
+ const rawOutput = asRecord$4(data?.rawOutput);
48005
48507
  for (const candidate of [
48006
48508
  item?.exitCode,
48007
48509
  itemResult?.exitCode,
@@ -48010,7 +48512,7 @@ function extractExitCode(payload) {
48010
48512
  const exitCode = asInteger(candidate);
48011
48513
  if (exitCode !== void 0) return exitCode;
48012
48514
  }
48013
- const detail = asTrimmedString$1(payload.detail);
48515
+ const detail = asTrimmedString$2(payload.detail);
48014
48516
  const match = detail ? /<exited with exit code (?<code>-?\d+)>\s*$/iu.exec(detail) : null;
48015
48517
  const parsed = Number.parseInt(match?.groups?.code ?? "", 10);
48016
48518
  return Number.isInteger(parsed) ? parsed : void 0;
@@ -48024,7 +48526,7 @@ function pathFromRecord(record) {
48024
48526
  "newPath",
48025
48527
  "oldPath"
48026
48528
  ]) {
48027
- const path = asTrimmedString$1(record[key]);
48529
+ const path = asTrimmedString$2(record[key]);
48028
48530
  if (path) return truncateUnicodeSafe(path, PATH_MAX_CHARS);
48029
48531
  }
48030
48532
  }
@@ -48045,7 +48547,7 @@ function collectPathsAndChanges(value) {
48045
48547
  for (const entry of current) visit(entry, depth + 1);
48046
48548
  return;
48047
48549
  }
48048
- const record = asRecord$3(current);
48550
+ const record = asRecord$4(current);
48049
48551
  if (!record || seenObjects.has(record)) return;
48050
48552
  seenObjects.add(record);
48051
48553
  const path = pathFromRecord(record);
@@ -48099,10 +48601,10 @@ function extractTool(activity) {
48099
48601
  const lifecycle = toolLifecycle(activity.kind);
48100
48602
  const payload = activityPayload(activity);
48101
48603
  if (!lifecycle || !payload || !Schema.is(ToolLifecycleItemType)(payload.itemType)) return;
48102
- const data = asRecord$3(payload.data);
48103
- const providerRefs = asRecord$3(payload.providerRefs);
48104
- const providerItemId = asTrimmedString$1(payload.providerItemId) ?? asTrimmedString$1(providerRefs?.providerItemId);
48105
- const toolCallId = asTrimmedString$1(data?.toolCallId);
48604
+ const data = asRecord$4(payload.data);
48605
+ const providerRefs = asRecord$4(payload.providerRefs);
48606
+ const providerItemId = asTrimmedString$2(payload.providerItemId) ?? asTrimmedString$2(providerRefs?.providerItemId);
48607
+ const toolCallId = asTrimmedString$2(data?.toolCallId);
48106
48608
  const command = boundedString(extractCommand(payload), TOOL_COMMAND_MAX_CHARS);
48107
48609
  const output = boundedString(extractOutput(payload), TOOL_OUTPUT_MAX_CHARS);
48108
48610
  const detail = boundedString(payload.detail, DETAIL_MAX_CHARS);
@@ -48194,7 +48696,7 @@ function parseQuestions(payload) {
48194
48696
  let truncated = payload.questions.length > MAX_QUESTIONS_PER_REQUEST;
48195
48697
  return {
48196
48698
  questions: payload.questions.slice(0, MAX_QUESTIONS_PER_REQUEST).flatMap((value) => {
48197
- const record = asRecord$3(value);
48699
+ const record = asRecord$4(value);
48198
48700
  const id = boundedString(record?.id, LABEL_MAX_CHARS);
48199
48701
  const header = boundedString(record?.header, LABEL_MAX_CHARS);
48200
48702
  const question = boundedString(record?.question, QUESTION_MAX_CHARS);
@@ -48203,7 +48705,7 @@ function parseQuestions(payload) {
48203
48705
  const rawOptions = Array.isArray(record?.options) ? record.options : [];
48204
48706
  truncated ||= rawOptions.length > MAX_OPTIONS_PER_QUESTION;
48205
48707
  const options = rawOptions.slice(0, MAX_OPTIONS_PER_QUESTION).flatMap((option) => {
48206
- const label = boundedString(asRecord$3(option)?.label, LABEL_MAX_CHARS);
48708
+ const label = boundedString(asRecord$4(option)?.label, LABEL_MAX_CHARS);
48207
48709
  truncated ||= label.truncated;
48208
48710
  return label.value ? [label.value] : [];
48209
48711
  });
@@ -48244,7 +48746,7 @@ function collectNotices(activities) {
48244
48746
  const failure = failureFromActivity(activity);
48245
48747
  if (failure) failures.push(failure);
48246
48748
  const payload = activityPayload(activity);
48247
- const requestId = asTrimmedString$1(payload?.requestId);
48749
+ const requestId = asTrimmedString$2(payload?.requestId);
48248
48750
  if (!requestId) continue;
48249
48751
  if (activity.kind === "user-input.resolved") {
48250
48752
  pendingQuestions.delete(requestId);
@@ -48271,7 +48773,7 @@ function collectSubagents(activities) {
48271
48773
  for (const activity of activities.toSorted(compareOrdered)) {
48272
48774
  if (activity.kind !== "subagent.completed") continue;
48273
48775
  const payload = activityPayload(activity);
48274
- const subagent = asRecord$3(payload?.subagent);
48776
+ const subagent = asRecord$4(payload?.subagent);
48275
48777
  const subagentId = boundedString(subagent?.subagentId, LABEL_MAX_CHARS);
48276
48778
  const status = payload?.status;
48277
48779
  if (!subagentId.value || !Schema.is(RuntimeSubagentStatus)(status)) continue;
@@ -50290,10 +50792,10 @@ const DEVICE_CAPABILITY_IDS = [
50290
50792
  "accessibility",
50291
50793
  "encoder"
50292
50794
  ];
50293
- const asRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
50795
+ const asRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
50294
50796
  const asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
50295
50797
  const parseToolchain = (value) => {
50296
- const record = asRecord$2(value);
50798
+ const record = asRecord$3(value);
50297
50799
  if (!record) return void 0;
50298
50800
  const toolchain = {
50299
50801
  xcodeVersion: asNonEmptyString(record["xcodeVersion"]),
@@ -50315,7 +50817,7 @@ const parseCapability = (id, raw) => {
50315
50817
  id,
50316
50818
  ok: true
50317
50819
  };
50318
- const record = asRecord$2(raw);
50820
+ const record = asRecord$3(raw);
50319
50821
  if (!record) return {
50320
50822
  id,
50321
50823
  ok: false,
@@ -50348,7 +50850,7 @@ const parseHelperProbe = (stdout) => {
50348
50850
  error: "The device helper preflight returned unreadable output."
50349
50851
  };
50350
50852
  }
50351
- const record = asRecord$2(parsed);
50853
+ const record = asRecord$3(parsed);
50352
50854
  if (!record) return {
50353
50855
  ok: false,
50354
50856
  capabilities: DEVICE_CAPABILITY_IDS.map((id) => ({
@@ -50359,7 +50861,7 @@ const parseHelperProbe = (stdout) => {
50359
50861
  toolchain: void 0,
50360
50862
  error: "The device helper preflight returned unreadable output."
50361
50863
  };
50362
- const capabilitiesRecord = asRecord$2(record["capabilities"]);
50864
+ const capabilitiesRecord = asRecord$3(record["capabilities"]);
50363
50865
  const error = asNonEmptyString(record["error"]);
50364
50866
  if (!capabilitiesRecord) {
50365
50867
  const ok = record["ok"] === true;
@@ -50612,7 +51114,7 @@ var DeviceHelperError = class extends Error {
50612
51114
  this.code = code;
50613
51115
  }
50614
51116
  };
50615
- function asRecord$1(value) {
51117
+ function asRecord$2(value) {
50616
51118
  return typeof value === "object" && value !== null ? value : {};
50617
51119
  }
50618
51120
  /**
@@ -50748,8 +51250,8 @@ var HelperClient = class {
50748
51250
  async attach(udid, options = {}) {
50749
51251
  if (!options.force && this.attachment?.udid === udid) return this.attachment;
50750
51252
  this.attachment = null;
50751
- const result = asRecord$1(await this.request(HELPER_METHODS.attach, { udid }));
50752
- const capabilities = asRecord$1(result.capabilities);
51253
+ const result = asRecord$2(await this.request(HELPER_METHODS.attach, { udid }));
51254
+ const capabilities = asRecord$2(result.capabilities);
50753
51255
  const pixelWidth = readNumber(result, "pixelWidth", 0);
50754
51256
  const pixelHeight = readNumber(result, "pixelHeight", 0);
50755
51257
  const scale = readNumber(result, "scale", 3);
@@ -50903,14 +51405,14 @@ var HelperClient = class {
50903
51405
  } catch {
50904
51406
  return;
50905
51407
  }
50906
- const record = asRecord$1(message);
51408
+ const record = asRecord$2(message);
50907
51409
  if (typeof record.id !== "number") return;
50908
51410
  const request = this.pending.get(record.id);
50909
51411
  if (!request) return;
50910
51412
  this.pending.delete(record.id);
50911
51413
  clearTimeout(request.timer);
50912
51414
  if (record.error !== void 0 && record.error !== null) {
50913
- const error = asRecord$1(record.error);
51415
+ const error = asRecord$2(record.error);
50914
51416
  request.reject(new DeviceHelperError(typeof error.code === "number" ? `helper_${error.code}` : "helper_error", typeof error.message === "string" ? error.message : "Device helper reported an error"));
50915
51417
  return;
50916
51418
  }
@@ -74982,9 +75484,6 @@ Schema.Struct({ threadId: ThreadId });
74982
75484
  */
74983
75485
  var ProviderSessionRuntimeRepository = class extends Context.Service()("ryco/persistence/Services/ProviderSessionRuntime/ProviderSessionRuntimeRepository") {};
74984
75486
  //#endregion
74985
- //#region src/provider/Services/ProviderSessionDirectory.ts
74986
- var ProviderSessionDirectory = class extends Context.Service()("ryco/provider/Services/ProviderSessionDirectory") {};
74987
- //#endregion
74988
75487
  //#region src/provider/Layers/ProviderSessionDirectory.ts
74989
75488
  function toPersistenceError(operation) {
74990
75489
  return (cause) => new ProviderSessionDirectoryPersistenceError({
@@ -75669,6 +76168,12 @@ const ProviderEventLoggersLive = Layer.effect(ProviderEventLoggers, Effect.gen(f
75669
76168
  };
75670
76169
  }));
75671
76170
  //#endregion
76171
+ //#region ../../packages/shared/src/providerCapabilities.ts
76172
+ /** Drivers whose native turn API accepts arbitrary file bytes, not only images. */
76173
+ function providerSupportsGeneralFileAttachments(provider) {
76174
+ return provider === "copilot" || provider === "opencode";
76175
+ }
76176
+ //#endregion
75672
76177
  //#region src/provider/Layers/ProviderService.ts
75673
76178
  /**
75674
76179
  * ProviderServiceLive - Cross-provider orchestration layer.
@@ -76215,6 +76720,8 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
76215
76720
  });
76216
76721
  metricProvider = routed.adapter.provider;
76217
76722
  metricModel = input.modelSelection?.model;
76723
+ const unsupportedFile = input.attachments.find((attachment) => attachment.type === "file");
76724
+ 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.`);
76218
76725
  yield* Effect.annotateCurrentSpan({
76219
76726
  "provider.kind": routed.adapter.provider,
76220
76727
  ...input.modelSelection?.model ? { "provider.model": input.modelSelection.model } : {}
@@ -76289,6 +76796,8 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
76289
76796
  allowRecovery: false
76290
76797
  });
76291
76798
  if (!routed.isActive || routed.session === void 0) return yield* new ProviderSessionNotFoundError({ threadId: input.threadId });
76799
+ const unsupportedFile = input.attachments.find((attachment) => attachment.type === "file");
76800
+ 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.`);
76292
76801
  if (routed.session.activeTurnId !== input.expectedTurnId) return yield* toValidationError("ProviderService.steerTurn", `Expected active turn '${input.expectedTurnId}', found '${routed.session.activeTurnId ?? "none"}'.`);
76293
76802
  const steer = routed.adapter.steerTurn;
76294
76803
  if (routed.adapter.capabilities.turnSteering !== "native" || steer === void 0) return yield* toValidationError("ProviderService.steerTurn", `Provider '${routed.adapter.provider}' does not support active-turn steering.`);
@@ -76667,6 +77176,7 @@ const ProviderSessionReaperLive = makeProviderSessionReaperLive();
76667
77176
  const OPENCODE_SERVER_READY_PREFIX = "opencode server listening";
76668
77177
  const DEFAULT_OPENCODE_SERVER_TIMEOUT_MS = 5e3;
76669
77178
  const DEFAULT_HOSTNAME = "127.0.0.1";
77179
+ const MINIMUM_OPENCODE_VERSION = "1.14.19";
76670
77180
  const OPENCODE_RUNTIME_ERROR_TAG = "OpenCodeRuntimeError";
76671
77181
  var OpenCodeRuntimeError = class extends Data.TaggedError(OPENCODE_RUNTIME_ERROR_TAG) {
76672
77182
  static is = (u) => Predicate.isTagged(u, OPENCODE_RUNTIME_ERROR_TAG);
@@ -76692,6 +77202,22 @@ const runOpenCodeSdk = (operation, fn) => Effect.tryPromise({
76692
77202
  cause
76693
77203
  })
76694
77204
  }).pipe(Effect.withSpan(`opencode.${operation}`));
77205
+ const verifyOpenCodeServerVersion = (client) => runOpenCodeSdk("global.health", (signal) => client.global.health({ signal })).pipe(Effect.timeoutOption("5 seconds"), Effect.flatMap((result) => {
77206
+ if (Option.isNone(result)) return Effect.fail(new OpenCodeRuntimeError({
77207
+ operation: "global.health",
77208
+ detail: "Timed out while checking the OpenCode server version."
77209
+ }));
77210
+ const health = result.value.data;
77211
+ if (!health?.healthy || typeof health.version !== "string" || health.version.length === 0) return Effect.fail(new OpenCodeRuntimeError({
77212
+ operation: "global.health",
77213
+ detail: "OpenCode server health check returned an invalid response."
77214
+ }));
77215
+ if (compareCliVersions(health.version, "1.14.19") < 0) return Effect.fail(new OpenCodeRuntimeError({
77216
+ operation: "global.health",
77217
+ detail: `OpenCode v${health.version} is too old. Upgrade to v${MINIMUM_OPENCODE_VERSION} or newer.`
77218
+ }));
77219
+ return Effect.succeed(health.version);
77220
+ }));
76695
77221
  let openCodeSdkModulePromise;
76696
77222
  const loadOpenCodeSdkModule = () => Effect.tryPromise({
76697
77223
  try: async () => {
@@ -76709,6 +77235,11 @@ const loadOpenCodeSdkModule = () => Effect.tryPromise({
76709
77235
  cause
76710
77236
  })
76711
77237
  }).pipe(Effect.withSpan("opencode.sdk.load"));
77238
+ function resolveOpenCodeServerPassword(input) {
77239
+ if (input.configuredPassword !== void 0) return input.configuredPassword;
77240
+ if (input.external) return;
77241
+ return input.environment === void 0 ? process.env.OPENCODE_SERVER_PASSWORD : input.environment.OPENCODE_SERVER_PASSWORD;
77242
+ }
76712
77243
  function parseServerUrlFromOutput(output) {
76713
77244
  for (const line of output.split("\n")) {
76714
77245
  if (!line.startsWith(OPENCODE_SERVER_READY_PREFIX)) continue;
@@ -76733,13 +77264,13 @@ function openCodeQuestionId(index, question) {
76733
77264
  function toOpenCodeFileParts(input) {
76734
77265
  const parts = [];
76735
77266
  for (const attachment of input.attachments ?? []) {
76736
- const attachmentPath = input.resolveAttachmentPath(attachment);
76737
- if (!attachmentPath) continue;
77267
+ const attachmentUrl = input.resolveAttachmentUrl(attachment);
77268
+ if (!attachmentUrl) continue;
76738
77269
  parts.push({
76739
77270
  type: "file",
76740
77271
  mime: attachment.mimeType,
76741
77272
  filename: attachment.name,
76742
- url: pathToFileURL(attachmentPath).href
77273
+ url: attachmentUrl
76743
77274
  });
76744
77275
  }
76745
77276
  return parts;
@@ -76858,11 +77389,17 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
76858
77389
  `--hostname=${hostname}`,
76859
77390
  `--port=${port}`
76860
77391
  ];
77392
+ const serverPassword = resolveOpenCodeServerPassword({
77393
+ external: false,
77394
+ ...input.serverPassword !== void 0 ? { configuredPassword: input.serverPassword } : {},
77395
+ ...input.environment !== void 0 ? { environment: input.environment } : {}
77396
+ });
76861
77397
  const child = yield* spawner.spawn(ChildProcess.make(input.binaryPath, args, {
76862
77398
  detached: process.platform !== "win32",
76863
77399
  shell: process.platform === "win32",
76864
77400
  env: {
76865
77401
  ...input.environment ?? process.env,
77402
+ ...serverPassword !== void 0 ? { OPENCODE_SERVER_PASSWORD: serverPassword } : {},
76866
77403
  OPENCODE_CONFIG_CONTENT: JSON.stringify({})
76867
77404
  }
76868
77405
  })).pipe(Effect.provideService(Scope.Scope, runtimeScope), Effect.mapError((cause) => new OpenCodeRuntimeError({
@@ -76925,24 +77462,34 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
76925
77462
  }
76926
77463
  return {
76927
77464
  url: readyOption.value,
77465
+ ...serverPassword !== void 0 ? { serverPassword } : {},
76928
77466
  exitCode: child.exitCode.pipe(Effect.map(Number), Effect.orElseSucceed(() => 0))
76929
77467
  };
76930
77468
  });
76931
77469
  const connectToOpenCodeServer = (input) => {
76932
77470
  const serverUrl = input.serverUrl?.trim();
76933
- if (serverUrl) return Effect.succeed({
76934
- url: serverUrl,
76935
- exitCode: null,
76936
- external: true
76937
- });
77471
+ if (serverUrl) {
77472
+ const serverPassword = resolveOpenCodeServerPassword({
77473
+ external: true,
77474
+ ...input.serverPassword !== void 0 ? { configuredPassword: input.serverPassword } : {}
77475
+ });
77476
+ return Effect.succeed({
77477
+ url: serverUrl,
77478
+ ...serverPassword !== void 0 ? { serverPassword } : {},
77479
+ exitCode: null,
77480
+ external: true
77481
+ });
77482
+ }
76938
77483
  return startOpenCodeServerProcess({
76939
77484
  binaryPath: input.binaryPath,
77485
+ ...input.serverPassword !== void 0 ? { serverPassword: input.serverPassword } : {},
76940
77486
  ...input.environment !== void 0 ? { environment: input.environment } : {},
76941
77487
  ...input.port !== void 0 ? { port: input.port } : {},
76942
77488
  ...input.hostname !== void 0 ? { hostname: input.hostname } : {},
76943
77489
  ...input.timeoutMs !== void 0 ? { timeoutMs: input.timeoutMs } : {}
76944
77490
  }).pipe(Effect.map((server) => ({
76945
77491
  url: server.url,
77492
+ ...server.serverPassword !== void 0 ? { serverPassword: server.serverPassword } : {},
76946
77493
  exitCode: server.exitCode,
76947
77494
  external: false
76948
77495
  })));
@@ -76953,11 +77500,11 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
76953
77500
  ...input.serverPassword ? { headers: { Authorization: `Basic ${Buffer.from(`opencode:${input.serverPassword}`, "utf8").toString("base64")}` } } : {},
76954
77501
  throwOnError: true
76955
77502
  })));
76956
- const loadProviders = (client) => runOpenCodeSdk("provider.list", () => client.provider.list()).pipe(Effect.filterMapOrFail((list) => list.data ? Result.succeed(list.data) : Result.fail(new OpenCodeRuntimeError({
77503
+ const loadProviders = (client) => runOpenCodeSdk("provider.list", (signal) => client.provider.list({}, { signal })).pipe(Effect.filterMapOrFail((list) => list.data ? Result.succeed(list.data) : Result.fail(new OpenCodeRuntimeError({
76957
77504
  operation: "provider.list",
76958
77505
  detail: "OpenCode provider list was empty."
76959
77506
  })), (result) => result));
76960
- const loadAgents = (client) => runOpenCodeSdk("app.agents", () => client.app.agents()).pipe(Effect.map((result) => result.data ?? []));
77507
+ const loadAgents = (client) => runOpenCodeSdk("app.agents", (signal) => client.app.agents({}, { signal })).pipe(Effect.map((result) => result.data ?? []));
76961
77508
  const loadOpenCodeInventory = (client) => Effect.all([loadProviders(client), loadAgents(client)], { concurrency: "unbounded" }).pipe(Effect.map(([providerList, agents]) => ({
76962
77509
  providerList,
76963
77510
  agents
@@ -77546,12 +78093,10 @@ const TERMINAL_ENV_BLOCKLIST = /* @__PURE__ */ new Set([
77546
78093
  var TerminalSubprocessCheckError = class extends Schema.TaggedError()("TerminalSubprocessCheckError", {
77547
78094
  message: Schema.String,
77548
78095
  cause: Schema.optional(Schema.Defect()),
77549
- terminalPid: Schema.Number,
77550
- command: Schema.Literals([
77551
- "powershell",
77552
- "pgrep",
77553
- "ps"
77554
- ])
78096
+ command: Schema.Literals(["powershell", "ps"]),
78097
+ exitCode: Schema.optional(Schema.NullOr(Schema.Number)),
78098
+ timedOut: Schema.optional(Schema.Boolean),
78099
+ stdoutTruncated: Schema.optional(Schema.Boolean)
77555
78100
  }) {};
77556
78101
  var TerminalProcessSignalError = class extends Schema.TaggedError()("TerminalProcessSignalError", {
77557
78102
  message: Schema.String,
@@ -77771,81 +78316,90 @@ function isRetryableShellSpawnError(error) {
77771
78316
  const message = messages.join(" ").toLowerCase();
77772
78317
  return message.includes("posix_spawnp failed") || message.includes("enoent") || message.includes("not found") || message.includes("file not found") || message.includes("no such file");
77773
78318
  }
77774
- function checkWindowsSubprocessActivity(terminalPid) {
77775
- const command = [
77776
- `$children = Get-CimInstance Win32_Process -Filter "ParentProcessId = ${terminalPid}" -ErrorAction SilentlyContinue`,
77777
- "if ($children) { exit 0 }",
77778
- "exit 1"
77779
- ].join("; ");
77780
- return Effect.tryPromise({
77781
- try: () => runProcess("powershell.exe", [
77782
- "-NoProfile",
77783
- "-NonInteractive",
77784
- "-Command",
77785
- command
77786
- ], {
77787
- timeoutMs: 1500,
77788
- allowNonZeroExit: true,
77789
- maxBufferBytes: 32768,
77790
- outputMode: "truncate"
77791
- }),
77792
- catch: (cause) => new TerminalSubprocessCheckError({
77793
- message: "Failed to check Windows terminal subprocess activity.",
77794
- cause,
77795
- terminalPid,
77796
- command: "powershell"
77797
- })
77798
- }).pipe(Effect.map((result) => result.code === 0));
78319
+ function parsePosixProcessTable(stdout) {
78320
+ const childrenByParent = /* @__PURE__ */ new Map();
78321
+ for (const line of stdout.split(/\r?\n/g)) {
78322
+ const match = /^\s*(\d+)\s+(\d+)(?:\s|$)/.exec(line);
78323
+ if (!match) continue;
78324
+ const pid = Number(match[1]);
78325
+ const parentPid = Number(match[2]);
78326
+ if (!Number.isInteger(pid) || !Number.isInteger(parentPid)) continue;
78327
+ const children = childrenByParent.get(parentPid) ?? [];
78328
+ children.push(pid);
78329
+ childrenByParent.set(parentPid, children);
78330
+ }
78331
+ return { childrenByParent };
78332
+ }
78333
+ function parseWindowsProcessTable(stdout) {
78334
+ const childrenByParent = /* @__PURE__ */ new Map();
78335
+ for (const line of stdout.split(/\r?\n/g)) {
78336
+ const [pidRaw, parentPidRaw] = line.trim().split("|", 2);
78337
+ const pid = Number(pidRaw);
78338
+ const parentPid = Number(parentPidRaw);
78339
+ if (!Number.isInteger(pid) || !Number.isInteger(parentPid)) continue;
78340
+ const children = childrenByParent.get(parentPid) ?? [];
78341
+ children.push(pid);
78342
+ childrenByParent.set(parentPid, children);
78343
+ }
78344
+ return { childrenByParent };
77799
78345
  }
77800
- const checkPosixSubprocessActivity = Effect.fn("terminal.checkPosixSubprocessActivity")(function* (terminalPid) {
77801
- const runPgrep = Effect.tryPromise({
77802
- try: () => runProcess("pgrep", ["-P", String(terminalPid)], {
78346
+ const POSIX_PS_ABSOLUTE_PATHS = ["/bin/ps", "/usr/bin/ps"];
78347
+ const resolvePosixPsCommand = Effect.fn("terminal.resolvePosixPsCommand")(function* () {
78348
+ const fileSystem = yield* FileSystem.FileSystem;
78349
+ for (const candidate of POSIX_PS_ABSOLUTE_PATHS) if (yield* fileSystem.exists(candidate).pipe(Effect.orElseSucceed(() => false))) return candidate;
78350
+ return "ps";
78351
+ });
78352
+ const snapshotPosixProcessTable = Effect.fn("terminal.snapshotPosixProcessTable")(function* (psCommand) {
78353
+ const result = yield* Effect.tryPromise({
78354
+ try: () => runProcess(psCommand, ["-eo", "pid=,ppid="], {
77803
78355
  timeoutMs: 1e3,
77804
78356
  allowNonZeroExit: true,
77805
- maxBufferBytes: 32768,
78357
+ maxBufferBytes: 524288,
77806
78358
  outputMode: "truncate"
77807
78359
  }),
77808
78360
  catch: (cause) => new TerminalSubprocessCheckError({
77809
- message: "Failed to inspect terminal subprocesses with pgrep.",
78361
+ message: "Failed to snapshot POSIX processes.",
77810
78362
  cause,
77811
- terminalPid,
77812
- command: "pgrep"
78363
+ command: "ps"
77813
78364
  })
77814
78365
  });
77815
- const runPs = Effect.tryPromise({
77816
- try: () => runProcess("ps", ["-eo", "pid=,ppid="], {
77817
- timeoutMs: 1e3,
78366
+ if (result.code !== 0 || result.timedOut || result.stdoutTruncated) return yield* new TerminalSubprocessCheckError({
78367
+ message: "POSIX process snapshot was incomplete.",
78368
+ command: "ps",
78369
+ exitCode: result.code,
78370
+ timedOut: result.timedOut,
78371
+ stdoutTruncated: result.stdoutTruncated
78372
+ });
78373
+ return parsePosixProcessTable(result.stdout);
78374
+ });
78375
+ const snapshotWindowsProcessTable = Effect.fn("terminal.snapshotWindowsProcessTable")(function* () {
78376
+ const command = ["$processes = Get-CimInstance Win32_Process -ErrorAction Stop", "foreach ($process in $processes) { Write-Output \"$($process.ProcessId)|$($process.ParentProcessId)\" }"].join("; ");
78377
+ const result = yield* Effect.tryPromise({
78378
+ try: () => runProcess("powershell.exe", [
78379
+ "-NoProfile",
78380
+ "-NonInteractive",
78381
+ "-Command",
78382
+ command
78383
+ ], {
78384
+ timeoutMs: 1500,
77818
78385
  allowNonZeroExit: true,
77819
- maxBufferBytes: 262144,
78386
+ maxBufferBytes: 524288,
77820
78387
  outputMode: "truncate"
77821
78388
  }),
77822
78389
  catch: (cause) => new TerminalSubprocessCheckError({
77823
- message: "Failed to inspect terminal subprocesses with ps.",
78390
+ message: "Failed to snapshot Windows processes.",
77824
78391
  cause,
77825
- terminalPid,
77826
- command: "ps"
78392
+ command: "powershell"
77827
78393
  })
77828
78394
  });
77829
- const pgrepResult = yield* Effect.exit(runPgrep);
77830
- if (pgrepResult._tag === "Success") {
77831
- if (pgrepResult.value.code === 0) return pgrepResult.value.stdout.trim().length > 0;
77832
- if (pgrepResult.value.code === 1) return false;
77833
- }
77834
- const psResult = yield* Effect.exit(runPs);
77835
- if (psResult._tag === "Failure" || psResult.value.code !== 0) return false;
77836
- for (const line of psResult.value.stdout.split(/\r?\n/g)) {
77837
- const [pidRaw, ppidRaw] = line.trim().split(/\s+/g);
77838
- const pid = Number(pidRaw);
77839
- const ppid = Number(ppidRaw);
77840
- if (!Number.isInteger(pid) || !Number.isInteger(ppid)) continue;
77841
- if (ppid === terminalPid) return true;
77842
- }
77843
- return false;
77844
- });
77845
- const defaultSubprocessChecker = Effect.fn("terminal.defaultSubprocessChecker")(function* (terminalPid) {
77846
- if (!Number.isInteger(terminalPid) || terminalPid <= 0) return false;
77847
- if (process.platform === "win32") return yield* checkWindowsSubprocessActivity(terminalPid);
77848
- return yield* checkPosixSubprocessActivity(terminalPid);
78395
+ if (result.code !== 0 || result.timedOut || result.stdoutTruncated) return yield* new TerminalSubprocessCheckError({
78396
+ message: "Windows process snapshot was incomplete.",
78397
+ command: "powershell",
78398
+ exitCode: result.code,
78399
+ timedOut: result.timedOut,
78400
+ stdoutTruncated: result.stdoutTruncated
78401
+ });
78402
+ return parseWindowsProcessTable(result.stdout);
77849
78403
  });
77850
78404
  function capHistory(history, maxLines) {
77851
78405
  if (history.length === 0) return history;
@@ -78037,7 +78591,8 @@ const makeTerminalManagerWithOptions = Effect.fn("makeTerminalManagerWithOptions
78037
78591
  const platform = options.platform ?? process.platform;
78038
78592
  const baseEnv = options.env ?? process.env;
78039
78593
  const shellResolver = options.shellResolver ?? (() => defaultShellResolver(platform, baseEnv));
78040
- const subprocessChecker = options.subprocessChecker ?? defaultSubprocessChecker;
78594
+ const posixPsCommand = options.processTableSnapshotter === void 0 && platform !== "win32" ? yield* resolvePosixPsCommand() : null;
78595
+ const processTableSnapshotter = options.processTableSnapshotter ?? (platform === "win32" ? snapshotWindowsProcessTable : () => snapshotPosixProcessTable(posixPsCommand ?? "ps"));
78041
78596
  const subprocessPollIntervalMs = options.subprocessPollIntervalMs ?? DEFAULT_SUBPROCESS_POLL_INTERVAL_MS;
78042
78597
  const processKillGraceMs = options.processKillGraceMs ?? DEFAULT_PROCESS_KILL_GRACE_MS;
78043
78598
  const maxRetainedInactiveSessions = options.maxRetainedInactiveSessions ?? DEFAULT_MAX_RETAINED_INACTIVE_SESSIONS;
@@ -78528,26 +79083,22 @@ const makeTerminalManagerWithOptions = Effect.fn("makeTerminalManagerWithOptions
78528
79083
  const pollSubprocessActivity = Effect.fn("terminal.pollSubprocessActivity")(function* () {
78529
79084
  const runningSessions = [...(yield* readManagerState).sessions.values()].filter((session) => session.status === "running" && Number.isInteger(session.pid));
78530
79085
  if (runningSessions.length === 0) return;
79086
+ const processTable = yield* processTableSnapshotter().pipe(Effect.map(Option.some), Effect.catch((reason) => Effect.logWarning("failed to snapshot processes for terminal subprocess polling", { reason }).pipe(Effect.as(Option.none()))));
79087
+ if (Option.isNone(processTable)) return;
78531
79088
  const checkSubprocessActivity = Effect.fn("terminal.checkSubprocessActivity")(function* (session) {
78532
79089
  const terminalPid = session.pid;
78533
- const hasRunningSubprocess = yield* subprocessChecker(terminalPid).pipe(Effect.map(Option.some), Effect.catch((reason) => Effect.logWarning("failed to check terminal subprocess activity", {
78534
- threadId: session.threadId,
78535
- terminalId: session.terminalId,
78536
- terminalPid,
78537
- reason
78538
- }).pipe(Effect.as(Option.none()))));
78539
- if (Option.isNone(hasRunningSubprocess)) return;
79090
+ const hasRunningSubprocess = (processTable.value.childrenByParent.get(terminalPid)?.length ?? 0) > 0;
78540
79091
  const event = yield* modifyManagerState((state) => {
78541
79092
  const liveSession = Option.fromNullishOr(state.sessions.get(toSessionKey(session.threadId, session.terminalId)));
78542
- if (Option.isNone(liveSession) || liveSession.value.status !== "running" || liveSession.value.pid !== terminalPid || liveSession.value.hasRunningSubprocess === hasRunningSubprocess.value) return [Option.none(), state];
78543
- liveSession.value.hasRunningSubprocess = hasRunningSubprocess.value;
79093
+ if (Option.isNone(liveSession) || liveSession.value.status !== "running" || liveSession.value.pid !== terminalPid || liveSession.value.hasRunningSubprocess === hasRunningSubprocess) return [Option.none(), state];
79094
+ liveSession.value.hasRunningSubprocess = hasRunningSubprocess;
78544
79095
  liveSession.value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
78545
79096
  return [Option.some({
78546
79097
  type: "activity",
78547
79098
  threadId: liveSession.value.threadId,
78548
79099
  terminalId: liveSession.value.terminalId,
78549
79100
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
78550
- hasRunningSubprocess: hasRunningSubprocess.value
79101
+ hasRunningSubprocess
78551
79102
  }), state];
78552
79103
  });
78553
79104
  if (Option.isSome(event)) yield* publishEvent(event.value);
@@ -78855,20 +79406,6 @@ var ProviderCommandReactor = class extends Context.Service()("ryco/orchestration
78855
79406
  */
78856
79407
  var ProviderRuntimeIngestionService = class extends Context.Service()("ryco/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {};
78857
79408
  //#endregion
78858
- //#region src/orchestration/Services/ThreadDeletionReactor.ts
78859
- /**
78860
- * ThreadDeletionReactor - Thread deletion cleanup reactor service interface.
78861
- *
78862
- * Owns background workers that react to thread deletion domain events and
78863
- * perform best-effort runtime cleanup for provider sessions and terminals.
78864
- *
78865
- * @module ThreadDeletionReactor
78866
- */
78867
- /**
78868
- * ThreadDeletionReactor - Service tag for thread deletion cleanup workers.
78869
- */
78870
- var ThreadDeletionReactor = class extends Context.Service()("ryco/orchestration/Services/ThreadDeletionReactor") {};
78871
- //#endregion
78872
79409
  //#region src/orchestration/Layers/OrchestrationReactor.ts
78873
79410
  const makeOrchestrationReactor = Effect.gen(function* () {
78874
79411
  const providerRuntimeIngestion = yield* ProviderRuntimeIngestionService;
@@ -79444,6 +79981,227 @@ function make$4() {
79444
79981
  }
79445
79982
  const layer = Layer.effect(ThreadBackgroundLivenessService, Effect.sync(make$4));
79446
79983
  //#endregion
79984
+ //#region src/orchestration/ActivityPayloadProjection.ts
79985
+ function asRecord$1(value) {
79986
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
79987
+ }
79988
+ function asTrimmedString$1(value) {
79989
+ if (typeof value !== "string") return null;
79990
+ const trimmed = value.trim();
79991
+ return trimmed.length > 0 ? trimmed : null;
79992
+ }
79993
+ function summarizeToolTextOutput(value) {
79994
+ const lines = [];
79995
+ for (const rawLine of value.split(/\r?\n/u)) {
79996
+ const line = rawLine.replace(/\s+/g, " ").trim();
79997
+ if (line.length > 0) lines.push(line);
79998
+ }
79999
+ const firstLine = lines.find((line) => line !== "```");
80000
+ if (firstLine) return firstLine.length <= 84 ? firstLine : `${firstLine.slice(0, 83).trimEnd()}…`;
80001
+ if (lines.length > 1) return `${lines.length.toLocaleString()} lines`;
80002
+ return null;
80003
+ }
80004
+ function pushChangedFile(target, seen, value) {
80005
+ const normalized = asTrimmedString$1(value);
80006
+ if (!normalized || seen.has(normalized)) return;
80007
+ seen.add(normalized);
80008
+ target.push(normalized);
80009
+ }
80010
+ function collectChangedFiles(value, target, seen, depth) {
80011
+ if (depth > 4 || target.length >= 12) return;
80012
+ if (Array.isArray(value)) {
80013
+ for (const entry of value) {
80014
+ collectChangedFiles(entry, target, seen, depth + 1);
80015
+ if (target.length >= 12) return;
80016
+ }
80017
+ return;
80018
+ }
80019
+ const record = asRecord$1(value);
80020
+ if (!record) return;
80021
+ pushChangedFile(target, seen, record.path);
80022
+ pushChangedFile(target, seen, record.filePath);
80023
+ pushChangedFile(target, seen, record.relativePath);
80024
+ pushChangedFile(target, seen, record.filename);
80025
+ pushChangedFile(target, seen, record.newPath);
80026
+ pushChangedFile(target, seen, record.oldPath);
80027
+ for (const nestedKey of [
80028
+ "item",
80029
+ "result",
80030
+ "input",
80031
+ "data",
80032
+ "changes",
80033
+ "files",
80034
+ "edits",
80035
+ "patch",
80036
+ "patches",
80037
+ "operations"
80038
+ ]) {
80039
+ if (!(nestedKey in record)) continue;
80040
+ collectChangedFiles(record[nestedKey], target, seen, depth + 1);
80041
+ if (target.length >= 12) return;
80042
+ }
80043
+ }
80044
+ function projectCommandData(data) {
80045
+ const item = asRecord$1(data.item);
80046
+ if (!item) return;
80047
+ const projectedItem = {};
80048
+ if ("command" in item) projectedItem.command = item.command;
80049
+ const aggregatedOutput = asTrimmedString$1(item.aggregatedOutput);
80050
+ if (aggregatedOutput) {
80051
+ const summary = summarizeToolTextOutput(aggregatedOutput);
80052
+ if (summary) projectedItem.aggregatedOutput = summary;
80053
+ }
80054
+ const input = asRecord$1(item.input);
80055
+ if (input && "command" in input) projectedItem.input = { command: input.command };
80056
+ const result = asRecord$1(item.result);
80057
+ if (result) {
80058
+ const projectedResult = {};
80059
+ if ("command" in result) projectedResult.command = result.command;
80060
+ const content = asTrimmedString$1(result.content);
80061
+ if (content) {
80062
+ const summary = summarizeToolTextOutput(content);
80063
+ if (summary) projectedResult.content = summary;
80064
+ }
80065
+ if (Object.keys(projectedResult).length > 0) projectedItem.result = projectedResult;
80066
+ }
80067
+ return Object.keys(projectedItem).length > 0 ? projectedItem : void 0;
80068
+ }
80069
+ function projectCommandValue(data) {
80070
+ if (data.command !== void 0) return data.command;
80071
+ const input = asRecord$1(data.input);
80072
+ if (input?.command !== void 0) return input.command;
80073
+ const stateInput = asRecord$1(asRecord$1(data.state)?.input);
80074
+ if (stateInput?.command !== void 0) return stateInput.command;
80075
+ }
80076
+ const MCP_ITEM_KEPT_FIELDS = [
80077
+ "type",
80078
+ "id",
80079
+ "tool",
80080
+ "server",
80081
+ "status",
80082
+ "arguments",
80083
+ "appContext",
80084
+ "error",
80085
+ "durationMs"
80086
+ ];
80087
+ function extractMcpResultText(result) {
80088
+ const record = asRecord$1(result);
80089
+ if (!record) return typeof result === "string" ? result : null;
80090
+ if (typeof record.content === "string") return record.content;
80091
+ if (Array.isArray(record.content)) {
80092
+ const texts = [];
80093
+ for (const entry of record.content) {
80094
+ const text = asRecord$1(entry)?.text;
80095
+ if (typeof text === "string" && text.trim().length > 0) texts.push(text);
80096
+ }
80097
+ if (texts.length > 0) return texts.join("\n");
80098
+ }
80099
+ return null;
80100
+ }
80101
+ function summarizeMcpResult(result) {
80102
+ if (result === void 0 || result === null) return;
80103
+ const text = extractMcpResultText(result);
80104
+ const summary = text ? summarizeToolTextOutput(text) : null;
80105
+ return summary ? { content: summary } : void 0;
80106
+ }
80107
+ function projectMcpToolCallData(data) {
80108
+ const projectedData = {};
80109
+ const item = asRecord$1(data.item);
80110
+ if (item) {
80111
+ const projectedItem = {};
80112
+ for (const key of MCP_ITEM_KEPT_FIELDS) if (key in item) projectedItem[key] = item[key];
80113
+ const result = summarizeMcpResult(item.result);
80114
+ if (result) projectedItem.result = result;
80115
+ projectedData.item = projectedItem;
80116
+ }
80117
+ if ("toolName" in data) projectedData.toolName = data.toolName;
80118
+ if ("input" in data) projectedData.input = data.input;
80119
+ if (!item) {
80120
+ const result = summarizeMcpResult(data.result);
80121
+ if (result) projectedData.result = result;
80122
+ }
80123
+ if ("toolCallId" in data) projectedData.toolCallId = data.toolCallId;
80124
+ if ("kind" in data) projectedData.kind = data.kind;
80125
+ const changedFiles = [];
80126
+ collectChangedFiles(data, changedFiles, /* @__PURE__ */ new Set(), 0);
80127
+ if (changedFiles.length > 0) projectedData.files = changedFiles.map((path) => ({ path }));
80128
+ return projectedData;
80129
+ }
80130
+ function projectRawOutput(value) {
80131
+ const direct = asTrimmedString$1(value);
80132
+ if (direct) {
80133
+ const summary = summarizeToolTextOutput(direct);
80134
+ return summary ? { content: summary } : void 0;
80135
+ }
80136
+ const rawOutput = asRecord$1(value);
80137
+ if (!rawOutput) return;
80138
+ if (typeof rawOutput.totalFiles === "number" && Number.isFinite(rawOutput.totalFiles)) return {
80139
+ totalFiles: rawOutput.totalFiles,
80140
+ ...rawOutput.truncated === true ? { truncated: true } : {}
80141
+ };
80142
+ for (const key of [
80143
+ "content",
80144
+ "stdout",
80145
+ "stderr"
80146
+ ]) {
80147
+ const output = asTrimmedString$1(rawOutput[key]);
80148
+ if (!output) continue;
80149
+ const summary = summarizeToolTextOutput(output);
80150
+ return summary ? { content: summary } : void 0;
80151
+ }
80152
+ }
80153
+ function projectAcpContent(value) {
80154
+ if (!Array.isArray(value)) return;
80155
+ const summary = summarizeToolTextOutput(value.map((entryValue) => {
80156
+ const entry = asRecord$1(entryValue);
80157
+ const content = asRecord$1(entry?.content);
80158
+ return entry?.type === "content" && content?.type === "text" ? asTrimmedString$1(content.text) : null;
80159
+ }).filter((entry) => entry !== null).join("\n"));
80160
+ return summary ? { content: summary } : void 0;
80161
+ }
80162
+ /**
80163
+ * Projects provider-specific tool data to the fields shared clients consume.
80164
+ * The result is safe to persist for cumulative streaming updates: unbounded
80165
+ * tool output is reduced to a one-line summary while identity, command, and
80166
+ * changed-file metadata remain available to every client.
80167
+ */
80168
+ function projectActivityPayload(activity) {
80169
+ const payload = asRecord$1(activity.payload);
80170
+ const data = asRecord$1(payload?.data);
80171
+ if (!payload || !data) return activity;
80172
+ const itemStatus = asRecord$1(data.item)?.status;
80173
+ const projectedPayload = payload.status === "completed" && (itemStatus === "failed" || itemStatus === "declined") ? {
80174
+ ...payload,
80175
+ status: itemStatus
80176
+ } : payload;
80177
+ if (payload.itemType === "mcp_tool_call") return {
80178
+ ...activity,
80179
+ payload: {
80180
+ ...projectedPayload,
80181
+ data: projectMcpToolCallData(data)
80182
+ }
80183
+ };
80184
+ const projectedData = {};
80185
+ const item = projectCommandData(data);
80186
+ if (item) projectedData.item = item;
80187
+ const command = projectCommandValue(data);
80188
+ if (command !== void 0) projectedData.command = command;
80189
+ const changedFiles = [];
80190
+ collectChangedFiles(data, changedFiles, /* @__PURE__ */ new Set(), 0);
80191
+ if (changedFiles.length > 0) projectedData.files = changedFiles.map((path) => ({ path }));
80192
+ if ("toolCallId" in data) projectedData.toolCallId = data.toolCallId;
80193
+ if ("kind" in data) projectedData.kind = data.kind;
80194
+ const rawOutput = projectRawOutput(data.rawOutput) ?? projectAcpContent(data.content);
80195
+ if (rawOutput) projectedData.rawOutput = rawOutput;
80196
+ return {
80197
+ ...activity,
80198
+ payload: {
80199
+ ...projectedPayload,
80200
+ data: projectedData
80201
+ }
80202
+ };
80203
+ }
80204
+ //#endregion
79447
80205
  //#region src/orchestration/Layers/ProviderRuntimeIngestion.ts
79448
80206
  const providerTurnKey = (threadId, turnId) => `${threadId}:${turnId}`;
79449
80207
  const providerTaskKey = (threadId, taskId) => `${threadId}:${taskId}`;
@@ -79961,7 +80719,7 @@ function runtimeEventToActivities(event, taskTitle) {
79961
80719
  }
79962
80720
  case "item.updated":
79963
80721
  if (!isToolLifecycleItemType(event.payload.itemType)) return [];
79964
- return [{
80722
+ return [projectActivityPayload({
79965
80723
  id: event.eventId,
79966
80724
  createdAt: event.createdAt,
79967
80725
  tone: "tool",
@@ -79979,7 +80737,7 @@ function runtimeEventToActivities(event, taskTitle) {
79979
80737
  },
79980
80738
  turnId: toTurnId$1(event.turnId) ?? null,
79981
80739
  ...maybeSequence
79982
- }];
80740
+ })];
79983
80741
  case "item.completed":
79984
80742
  if (!isToolLifecycleItemType(event.payload.itemType)) return [];
79985
80743
  return [{
@@ -80955,6 +81713,15 @@ const HANDLED_TURN_START_KEY_TTL = Duration.minutes(30);
80955
81713
  const DEFAULT_RUNTIME_MODE = "full-access";
80956
81714
  const DEFAULT_TOKEN_MODE = DEFAULT_AGENT_TOKEN_MODE;
80957
81715
  const DEFAULT_THREAD_TITLE = "New thread";
81716
+ function pathEntryExists(targetPath) {
81717
+ try {
81718
+ lstatSync(targetPath);
81719
+ return true;
81720
+ } catch (error) {
81721
+ if (error.code === "ENOENT") return false;
81722
+ throw error;
81723
+ }
81724
+ }
80958
81725
  function providerErrorLabel(value) {
80959
81726
  const normalized = value?.trim();
80960
81727
  return normalized && normalized.length > 0 ? normalized : "unknown";
@@ -80976,10 +81743,10 @@ function isUnknownPendingApprovalRequestError(cause) {
80976
81743
  const error = findProviderAdapterRequestError(cause);
80977
81744
  if (error) {
80978
81745
  const detail = error.detail.toLowerCase();
80979
- return detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request");
81746
+ return detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request") || detail.includes("unknown pending codex approval request");
80980
81747
  }
80981
- const message = Cause.pretty(cause);
80982
- return message.includes("unknown pending approval request") || message.includes("unknown pending permission request");
81748
+ const message = Cause.pretty(cause).toLowerCase();
81749
+ return message.includes("unknown pending approval request") || message.includes("unknown pending permission request") || message.includes("unknown pending codex approval request");
80983
81750
  }
80984
81751
  function isUnknownPendingUserInputRequestError(cause) {
80985
81752
  const error = findProviderAdapterRequestError(cause);
@@ -81063,9 +81830,64 @@ const make$2 = Effect.gen(function* () {
81063
81830
  const resolveThread = Effect.fnUntraced(function* (threadId) {
81064
81831
  return yield* projectionSnapshotQuery.getThreadDetailById(threadId).pipe(Effect.map(Option.getOrUndefined));
81065
81832
  });
81833
+ const ensureRecordedWorktreeAvailable = Effect.fn("ensureRecordedWorktreeAvailable")(function* (thread, project) {
81834
+ if (thread.worktreePath === null) return;
81835
+ if (!project) return yield* new ProviderAdapterRequestError({
81836
+ provider: providerErrorLabel(String(thread.modelSelection.instanceId)),
81837
+ method: "thread.turn.start",
81838
+ detail: `Cannot verify worktree '${thread.worktreePath}' because project '${thread.projectId}' is unavailable.`
81839
+ });
81840
+ const repositoryRoot = path.resolve(project.workspaceRoot);
81841
+ const worktreePath = path.resolve(thread.worktreePath);
81842
+ if (worktreePath === repositoryRoot) return;
81843
+ const registeredWorktreePaths = () => gitWorkflow.listWorktreePaths(repositoryRoot).pipe(Effect.map((paths) => paths.map((entry) => path.resolve(entry))));
81844
+ const failRecovery = (detail) => new ProviderAdapterRequestError({
81845
+ provider: providerErrorLabel(String(thread.modelSelection.instanceId)),
81846
+ method: "thread.turn.start",
81847
+ detail
81848
+ });
81849
+ if (pathEntryExists(worktreePath)) {
81850
+ if (!(yield* registeredWorktreePaths()).includes(worktreePath)) return yield* failRecovery(`Refusing to use '${worktreePath}' because it exists but is not a registered worktree for '${repositoryRoot}'.`);
81851
+ return;
81852
+ }
81853
+ const branch = thread.branch;
81854
+ if (branch === null) return yield* failRecovery(`Cannot recreate missing worktree '${worktreePath}' because the thread has no recorded branch.`);
81855
+ if (!(yield* gitWorkflow.listLocalBranchNames(repositoryRoot)).includes(branch)) return yield* failRecovery(`Cannot recreate missing worktree '${worktreePath}' because branch '${branch}' no longer exists.`);
81856
+ yield* gitWorkflow.pruneWorktrees(repositoryRoot);
81857
+ if (pathEntryExists(worktreePath)) {
81858
+ if ((yield* registeredWorktreePaths()).includes(worktreePath)) return;
81859
+ return yield* failRecovery(`Refusing to recreate worktree '${worktreePath}' because another filesystem entry now occupies that path.`);
81860
+ }
81861
+ const recreated = yield* gitWorkflow.createWorktree({
81862
+ cwd: repositoryRoot,
81863
+ path: worktreePath,
81864
+ refName: branch,
81865
+ dependencyHydration: "none"
81866
+ });
81867
+ if (path.resolve(recreated.worktree.path) !== worktreePath || recreated.worktree.refName !== branch) return yield* failRecovery(`Worktree recovery returned unexpected metadata for '${worktreePath}' and branch '${branch}'.`);
81868
+ const changedAt = (/* @__PURE__ */ new Date()).toISOString();
81869
+ yield* orchestrationEngine.dispatch({
81870
+ type: "thread.meta.update",
81871
+ commandId: serverCommandId$2("worktree-recovered"),
81872
+ threadId: thread.id,
81873
+ branch,
81874
+ worktreePath
81875
+ });
81876
+ if (thread.worktreeId !== void 0 && thread.worktreeId !== null) yield* orchestrationEngine.dispatch({
81877
+ type: "worktree.meta.update",
81878
+ commandId: serverCommandId$2("worktree-recovered-meta"),
81879
+ worktreeId: thread.worktreeId,
81880
+ branch,
81881
+ changedAt
81882
+ });
81883
+ yield* gitWorkflow.invalidateStatus(worktreePath);
81884
+ yield* vcsStatusBroadcaster.refreshStatus(worktreePath).pipe(Effect.ignoreCause({ log: true }));
81885
+ });
81066
81886
  const ensureSessionForThread = Effect.fn("ensureSessionForThread")(function* (threadId, createdAt, options) {
81067
81887
  const thread = yield* resolveThread(threadId);
81068
81888
  if (!thread) return yield* Effect.die(/* @__PURE__ */ new Error(`Thread '${threadId}' was not found in read model.`));
81889
+ const project = yield* resolveProject(thread.projectId);
81890
+ yield* ensureRecordedWorktreeAvailable(thread, project);
81069
81891
  const desiredRuntimeMode = thread.runtimeMode;
81070
81892
  const desiredTokenMode = thread.tokenMode ?? DEFAULT_TOKEN_MODE;
81071
81893
  const requestedModelSelection = options?.modelSelection;
@@ -81113,7 +81935,6 @@ const make$2 = Effect.gen(function* () {
81113
81935
  detail: `Thread '${threadId}' cannot switch from instance '${currentInstanceId}' to '${desiredInstanceId}' because their provider resume state is incompatible.`
81114
81936
  });
81115
81937
  }
81116
- const project = yield* resolveProject(thread.projectId);
81117
81938
  const effectiveCwd = resolveThreadWorkspaceCwd({
81118
81939
  thread,
81119
81940
  projects: project ? [project] : []
@@ -81301,7 +82122,10 @@ const make$2 = Effect.gen(function* () {
81301
82122
  message: input.messageText,
81302
82123
  ...attachments.length > 0 ? { attachments } : {},
81303
82124
  modelSelection
81304
- });
82125
+ }).pipe(Effect.retry({
82126
+ times: 2,
82127
+ schedule: Schedule.exponential("2 seconds")
82128
+ }));
81305
82129
  if (!generated) return;
81306
82130
  const thread = yield* resolveThread(input.threadId);
81307
82131
  if (!thread) return;
@@ -81346,34 +82170,7 @@ const make$2 = Effect.gen(function* () {
81346
82170
  });
81347
82171
  return;
81348
82172
  }
81349
- if (event.payload.contextHandoff !== void 0) {
81350
- yield* contextHandoffCoordinator.processTurnStart(event);
81351
- return;
81352
- }
81353
- if (thread.messages.filter((entry) => entry.role === "user").length === 1) {
81354
- const project = yield* resolveProject(thread.projectId);
81355
- const generationCwd = resolveThreadWorkspaceCwd({
81356
- thread,
81357
- projects: project ? [project] : []
81358
- }) ?? process.cwd();
81359
- const generationInput = {
81360
- messageText: message.text,
81361
- ...message.attachments !== void 0 ? { attachments: message.attachments } : {},
81362
- ...event.payload.titleSeed !== void 0 ? { titleSeed: event.payload.titleSeed } : {}
81363
- };
81364
- yield* maybeGenerateAndRenameWorktreeBranchForFirstTurn({
81365
- threadId: event.payload.threadId,
81366
- branch: thread.branch,
81367
- worktreePath: thread.worktreePath,
81368
- worktreeId: thread.worktreeId ?? null,
81369
- ...generationInput
81370
- }).pipe(Effect.forkScoped);
81371
- if (canReplaceThreadTitle(thread.title, event.payload.titleSeed)) yield* maybeGenerateThreadTitleForFirstTurn({
81372
- threadId: event.payload.threadId,
81373
- cwd: generationCwd,
81374
- ...generationInput
81375
- }).pipe(Effect.forkScoped);
81376
- }
82173
+ const isFirstUserMessageTurn = thread.messages.filter((entry) => entry.role === "user").length === 1;
81377
82174
  const handleTurnStartFailure = (cause) => {
81378
82175
  if (Cause.hasInterruptsOnly(cause)) return Effect.void;
81379
82176
  const detail = formatFailureDetail(cause);
@@ -81396,6 +82193,12 @@ const make$2 = Effect.gen(function* () {
81396
82193
  cause: Cause.pretty(recoveryCause),
81397
82194
  originalCause: Cause.pretty(cause)
81398
82195
  })));
82196
+ if (event.payload.contextHandoff !== void 0) {
82197
+ const project = yield* resolveProject(thread.projectId);
82198
+ if (!(yield* ensureRecordedWorktreeAvailable(thread, project).pipe(Effect.as(true), Effect.catchCause((cause) => handleTurnStartFailure(cause).pipe(Effect.as(false)))))) return;
82199
+ yield* contextHandoffCoordinator.processTurnStart(event);
82200
+ return;
82201
+ }
81399
82202
  const sendTurnRequest = yield* buildSendTurnRequestForThread({
81400
82203
  threadId: event.payload.threadId,
81401
82204
  messageText: message.text,
@@ -81406,6 +82209,30 @@ const make$2 = Effect.gen(function* () {
81406
82209
  createdAt: event.payload.createdAt
81407
82210
  }).pipe(Effect.map(Option.some), Effect.catchCause((cause) => handleTurnStartFailure(cause).pipe(Effect.as(Option.none()))));
81408
82211
  if (Option.isNone(sendTurnRequest)) return;
82212
+ if (isFirstUserMessageTurn) {
82213
+ const project = yield* resolveProject(thread.projectId);
82214
+ const generationCwd = resolveThreadWorkspaceCwd({
82215
+ thread,
82216
+ projects: project ? [project] : []
82217
+ }) ?? process.cwd();
82218
+ const generationInput = {
82219
+ messageText: message.text,
82220
+ ...message.attachments !== void 0 ? { attachments: message.attachments } : {},
82221
+ ...event.payload.titleSeed !== void 0 ? { titleSeed: event.payload.titleSeed } : {}
82222
+ };
82223
+ yield* maybeGenerateAndRenameWorktreeBranchForFirstTurn({
82224
+ threadId: event.payload.threadId,
82225
+ branch: thread.branch,
82226
+ worktreePath: thread.worktreePath,
82227
+ worktreeId: thread.worktreeId ?? null,
82228
+ ...generationInput
82229
+ }).pipe(Effect.forkScoped);
82230
+ if (canReplaceThreadTitle(thread.title, event.payload.titleSeed)) yield* maybeGenerateThreadTitleForFirstTurn({
82231
+ threadId: event.payload.threadId,
82232
+ cwd: generationCwd,
82233
+ ...generationInput
82234
+ }).pipe(Effect.forkScoped);
82235
+ }
81409
82236
  const commitAcceptedModelSelection = event.payload.modelSelection !== void 0 && !Equal.equals(thread.modelSelection, event.payload.modelSelection) ? orchestrationEngine.dispatch({
81410
82237
  type: "thread.meta.update",
81411
82238
  commandId: serverCommandId$2("accepted-model-selection"),
@@ -81418,7 +82245,8 @@ const make$2 = Effect.gen(function* () {
81418
82245
  if (isProviderOriginatedCommandId(event.commandId)) return;
81419
82246
  const thread = yield* resolveThread(event.payload.threadId);
81420
82247
  if (!thread) return;
81421
- if (!(thread.session && thread.session.status !== "stopped")) return yield* appendProviderFailureActivity({
82248
+ const session = thread.session;
82249
+ if (!session || session.status === "stopped") return yield* appendProviderFailureActivity({
81422
82250
  threadId: event.payload.threadId,
81423
82251
  kind: "provider.turn.interrupt.failed",
81424
82252
  summary: "Provider turn interrupt failed",
@@ -81426,7 +82254,41 @@ const make$2 = Effect.gen(function* () {
81426
82254
  turnId: event.payload.turnId ?? null,
81427
82255
  createdAt: event.payload.createdAt
81428
82256
  });
81429
- yield* providerService.interruptTurn({ threadId: event.payload.threadId });
82257
+ const recoverInterruptFailure = (cause) => {
82258
+ if (Cause.hasInterruptsOnly(cause)) return Effect.interrupt;
82259
+ const detail = formatFailureDetail(cause);
82260
+ return Effect.gen(function* () {
82261
+ const latestSession = (yield* resolveThread(event.payload.threadId))?.session;
82262
+ if (!latestSession || latestSession.status === "stopped" || latestSession.status === "ready" || latestSession.activeTurnId === null || event.payload.turnId !== void 0 && latestSession.activeTurnId !== event.payload.turnId) return;
82263
+ yield* providerService.stopSession({ threadId: event.payload.threadId }).pipe(Effect.catchCause((stopCause) => Cause.hasInterruptsOnly(stopCause) ? Effect.interrupt : Effect.logWarning("provider command reactor failed to stop session after interrupt failure", {
82264
+ threadId: event.payload.threadId,
82265
+ cause: Cause.pretty(stopCause),
82266
+ originalCause: Cause.pretty(cause)
82267
+ })));
82268
+ const stoppedSession = (yield* resolveThread(event.payload.threadId))?.session;
82269
+ if (!stoppedSession || stoppedSession.status === "stopped" || stoppedSession.status === "ready" || stoppedSession.activeTurnId === null || event.payload.turnId !== void 0 && stoppedSession.activeTurnId !== event.payload.turnId) return;
82270
+ yield* setThreadSession({
82271
+ threadId: event.payload.threadId,
82272
+ session: {
82273
+ ...stoppedSession,
82274
+ status: "stopped",
82275
+ activeTurnId: null,
82276
+ lastError: detail,
82277
+ updatedAt: event.payload.createdAt
82278
+ },
82279
+ createdAt: event.payload.createdAt
82280
+ });
82281
+ yield* appendProviderFailureActivity({
82282
+ threadId: event.payload.threadId,
82283
+ kind: "provider.turn.interrupt.failed",
82284
+ summary: "Provider turn interrupt failed",
82285
+ detail,
82286
+ turnId: event.payload.turnId ?? null,
82287
+ createdAt: event.payload.createdAt
82288
+ });
82289
+ });
82290
+ };
82291
+ yield* providerService.interruptTurn({ threadId: event.payload.threadId }).pipe(Effect.catchCause(recoverInterruptFailure));
81430
82292
  });
81431
82293
  const processGoalUpdated = Effect.fn("processGoalUpdated")(function* (event) {
81432
82294
  if (event.payload.origin !== "client") return;
@@ -83218,14 +84080,17 @@ const make = Effect.gen(function* () {
83218
84080
  }),
83219
84081
  process: processThreadDeletedSafely
83220
84082
  });
84083
+ const seenSequence = yield* SubscriptionRef.make(0);
84084
+ const noteSeen = (sequence) => SubscriptionRef.update(seenSequence, (seen) => Math.max(seen, sequence));
83221
84085
  return {
83222
84086
  start: Effect.fn("start")(function* () {
83223
- yield* Effect.forkScoped(Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) => {
83224
- if (event.type !== "thread.deleted") return Effect.void;
83225
- return worker.enqueue(event);
83226
- }));
84087
+ const subscription = yield* orchestrationEngine.subscribeDomainEvents;
84088
+ yield* Effect.forkScoped(Stream.runForEach(Stream.fromSubscription(subscription), (event) => (event.type === "thread.deleted" ? worker.enqueue(event) : Effect.void).pipe(Effect.andThen(noteSeen(event.sequence)))));
83227
84089
  }),
83228
- drain: worker.drain
84090
+ drainThrough: Effect.fn("ThreadDeletionReactor.drainThrough")(function* (targetSequence) {
84091
+ yield* SubscriptionRef.changes(seenSequence).pipe(Stream.filter((seen) => seen >= targetSequence), Stream.runHead);
84092
+ yield* worker.drain;
84093
+ })
83229
84094
  };
83230
84095
  });
83231
84096
  const ThreadDeletionReactorLive = Layer.effect(ThreadDeletionReactor, make);
@@ -97543,10 +98408,21 @@ const OrchestrationEventPersistedRowSchema = Schema.Struct({
97543
98408
  payload: UnknownFromJsonString,
97544
98409
  metadata: EventMetadataFromJsonString
97545
98410
  });
98411
+ const HasEventAfterRequestSchema = Schema.Struct({
98412
+ aggregateKind: OrchestrationAggregateKind,
98413
+ aggregateId: Schema.String,
98414
+ type: OrchestrationEventType,
98415
+ sequenceExclusive: NonNegativeInt
98416
+ });
97546
98417
  const ReadFromSequenceRequestSchema = Schema.Struct({
97547
98418
  sequenceExclusive: NonNegativeInt,
97548
98419
  limit: Schema.Number
97549
98420
  });
98421
+ const ReadThroughSequenceRequestSchema = Schema.Struct({
98422
+ sequenceExclusive: NonNegativeInt,
98423
+ sequenceInclusive: NonNegativeInt,
98424
+ limit: Schema.Number
98425
+ });
97550
98426
  const DEFAULT_READ_FROM_SEQUENCE_LIMIT = 1e3;
97551
98427
  const READ_PAGE_SIZE = 500;
97552
98428
  function inferActorKind(event) {
@@ -97639,6 +98515,34 @@ const makeEventStore = Effect.gen(function* () {
97639
98515
  LIMIT ${request.limit}
97640
98516
  `
97641
98517
  });
98518
+ const readEventRowsThroughSequence = SqlSchema.findAll({
98519
+ Request: ReadThroughSequenceRequestSchema,
98520
+ Result: OrchestrationEventPersistedRowSchema,
98521
+ execute: (request) => sql`
98522
+ SELECT
98523
+ sequence,
98524
+ event_id AS "eventId",
98525
+ event_type AS "type",
98526
+ aggregate_kind AS "aggregateKind",
98527
+ stream_id AS "aggregateId",
98528
+ occurred_at AS "occurredAt",
98529
+ command_id AS "commandId",
98530
+ causation_event_id AS "causationEventId",
98531
+ correlation_id AS "correlationId",
98532
+ payload_json AS "payload",
98533
+ metadata_json AS "metadata"
98534
+ FROM orchestration_events
98535
+ WHERE sequence > ${request.sequenceExclusive}
98536
+ AND sequence <= ${request.sequenceInclusive}
98537
+ ORDER BY sequence ASC
98538
+ LIMIT ${request.limit}
98539
+ `
98540
+ });
98541
+ const readLatestSequence = SqlSchema.findOne({
98542
+ Request: Schema.Void,
98543
+ Result: Schema.Struct({ sequence: Schema.NullOr(NonNegativeInt) }),
98544
+ execute: () => sql`SELECT MAX(sequence) AS "sequence" FROM orchestration_events`
98545
+ });
97642
98546
  const readRecentEventRows = SqlSchema.findAll({
97643
98547
  Request: Schema.Struct({
97644
98548
  since: IsoDateTime,
@@ -97656,6 +98560,20 @@ const makeEventStore = Effect.gen(function* () {
97656
98560
  ORDER BY sequence DESC
97657
98561
  LIMIT ${limit}
97658
98562
  `
98563
+ });
98564
+ const findEventAfter = SqlSchema.findOneOption({
98565
+ Request: HasEventAfterRequestSchema,
98566
+ Result: Schema.Struct({ sequence: NonNegativeInt }),
98567
+ execute: (request) => sql`
98568
+ SELECT sequence
98569
+ FROM orchestration_events
98570
+ WHERE aggregate_kind = ${request.aggregateKind}
98571
+ AND stream_id = ${request.aggregateId}
98572
+ AND event_type = ${request.type}
98573
+ AND sequence > ${request.sequenceExclusive}
98574
+ ORDER BY sequence ASC
98575
+ LIMIT 1
98576
+ `
97659
98577
  });
97660
98578
  const append = (event) => appendEventRow({
97661
98579
  eventId: event.eventId,
@@ -97684,6 +98602,22 @@ const makeEventStore = Effect.gen(function* () {
97684
98602
  }));
97685
98603
  return readPage(sequenceExclusive, normalizedLimit);
97686
98604
  };
98605
+ const readThroughSequence = (sequenceExclusive, sequenceInclusive) => {
98606
+ const normalizedStart = Math.max(0, Math.floor(sequenceExclusive));
98607
+ const normalizedEnd = Math.max(0, Math.floor(sequenceInclusive));
98608
+ if (normalizedEnd <= normalizedStart) return Stream.empty;
98609
+ const readPage = (cursor) => Stream.fromEffect(readEventRowsThroughSequence({
98610
+ sequenceExclusive: cursor,
98611
+ sequenceInclusive: normalizedEnd,
98612
+ limit: READ_PAGE_SIZE
98613
+ }).pipe(Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.readThroughSequence:query", "OrchestrationEventStore.readThroughSequence:decodeRows")), Effect.flatMap((rows) => Effect.forEach(rows, (row) => decodeEvent(row).pipe(Effect.mapError(toPersistenceDecodeError("OrchestrationEventStore.readThroughSequence:rowToEvent"))))))).pipe(Stream.flatMap((events) => {
98614
+ if (events.length === 0) return Stream.empty;
98615
+ const nextCursor = events[events.length - 1].sequence;
98616
+ return Stream.concat(Stream.fromIterable(events), nextCursor < normalizedEnd ? readPage(nextCursor) : Stream.empty);
98617
+ }));
98618
+ return readPage(normalizedStart);
98619
+ };
98620
+ const latestSequence = readLatestSequence(void 0).pipe(Effect.map((row) => row.sequence ?? 0), Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.latestSequence:query", "OrchestrationEventStore.latestSequence:decodeRow")));
97687
98621
  const readPage = (sequenceExclusive, limit) => {
97688
98622
  const normalizedLimit = Math.max(0, Math.floor(limit));
97689
98623
  const normalizedSequenceExclusive = Math.max(0, Math.floor(sequenceExclusive));
@@ -97705,12 +98639,16 @@ const makeEventStore = Effect.gen(function* () {
97705
98639
  since: input.since,
97706
98640
  limit: Math.min(Math.max(1, Math.floor(input.limit)), 500)
97707
98641
  }).pipe(Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.readRecent:query", "OrchestrationEventStore.readRecent:decodeRows")), Effect.flatMap((rows) => Effect.forEach(rows, (row) => decodeEvent(row).pipe(Effect.mapError(toPersistenceDecodeError("OrchestrationEventStore.readRecent:rowToEvent"))))));
98642
+ const hasEventAfter = (input) => findEventAfter(input).pipe(Effect.map(Option.isSome), Effect.mapError(toPersistenceSqlOrDecodeError$2("OrchestrationEventStore.hasEventAfter:query", "OrchestrationEventStore.hasEventAfter:decodeRow")));
97708
98643
  return {
97709
98644
  append,
97710
98645
  readPage,
97711
98646
  readRecent,
97712
98647
  readFromSequence,
97713
- readAll: () => readFromSequence(0, Number.MAX_SAFE_INTEGER)
98648
+ readThroughSequence,
98649
+ latestSequence,
98650
+ readAll: () => readFromSequence(0, Number.MAX_SAFE_INTEGER),
98651
+ hasEventAfter
97714
98652
  };
97715
98653
  });
97716
98654
  const OrchestrationEventStoreLive = Layer.effect(OrchestrationEventStore, makeEventStore);
@@ -98028,7 +98966,8 @@ function requireThreadHasUserMessage(input) {
98028
98966
  return requireThread(input).pipe(Effect.flatMap((thread) => thread.messages.some((message) => message.role === "user") ? Effect.succeed(thread) : Effect.fail(invariantError(input.command.type, `Thread '${input.threadId}' cannot be archived before a message has been sent.`))));
98029
98967
  }
98030
98968
  function requireThreadAbsent(input) {
98031
- if (!findThreadById(input.readModel, input.threadId)) return Effect.void;
98969
+ const existing = findThreadById(input.readModel, input.threadId);
98970
+ if (existing === void 0 || existing.deletedAt !== null) return Effect.void;
98032
98971
  return Effect.fail(invariantError(input.command.type, `Thread '${input.threadId}' already exists and cannot be created twice.`));
98033
98972
  }
98034
98973
  //#endregion
@@ -100441,17 +101380,26 @@ const makeProjectionPendingApprovalRepository = Effect.gen(function* () {
100441
101380
  execute: ({ requestId }) => sql`
100442
101381
  DELETE FROM projection_pending_approvals
100443
101382
  WHERE request_id = ${requestId}
101383
+ `
101384
+ });
101385
+ const deleteProjectionPendingApprovalRowsByThread = SqlSchema.void({
101386
+ Request: ListProjectionPendingApprovalsInput,
101387
+ execute: ({ threadId }) => sql`
101388
+ DELETE FROM projection_pending_approvals
101389
+ WHERE thread_id = ${threadId}
100444
101390
  `
100445
101391
  });
100446
101392
  const upsert = (row) => upsertProjectionPendingApprovalRow(row).pipe(Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.upsert:query")));
100447
101393
  const listByThreadId = (input) => listProjectionPendingApprovalRows(input).pipe(Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.listByThreadId:query")));
100448
101394
  const getByRequestId = (input) => getProjectionPendingApprovalRow(input).pipe(Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.getByRequestId:query")));
100449
101395
  const deleteByRequestId = (input) => deleteProjectionPendingApprovalRow(input).pipe(Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.deleteByRequestId:query")));
101396
+ const deleteByThreadId = (input) => deleteProjectionPendingApprovalRowsByThread(input).pipe(Effect.mapError(toPersistenceSqlError("ProjectionPendingApprovalRepository.deleteByThreadId:query")));
100450
101397
  return {
100451
101398
  upsert,
100452
101399
  listByThreadId,
100453
101400
  getByRequestId,
100454
- deleteByRequestId
101401
+ deleteByRequestId,
101402
+ deleteByThreadId
100455
101403
  };
100456
101404
  });
100457
101405
  const ProjectionPendingApprovalRepositoryLive = Layer.effect(ProjectionPendingApprovalRepository, makeProjectionPendingApprovalRepository);
@@ -101399,7 +102347,15 @@ const ORCHESTRATION_EVENT_PROJECTORS = {
101399
102347
  "project.meta-updated": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101400
102348
  "project.avatar-set": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101401
102349
  "project.deleted": [ORCHESTRATION_PROJECTOR_NAMES.projects],
101402
- "thread.created": [ORCHESTRATION_PROJECTOR_NAMES.threads],
102350
+ "thread.created": [
102351
+ ORCHESTRATION_PROJECTOR_NAMES.threadMessages,
102352
+ ORCHESTRATION_PROJECTOR_NAMES.threadProposedPlans,
102353
+ ORCHESTRATION_PROJECTOR_NAMES.threadActivities,
102354
+ ORCHESTRATION_PROJECTOR_NAMES.threadSessions,
102355
+ ORCHESTRATION_PROJECTOR_NAMES.threadTurns,
102356
+ ORCHESTRATION_PROJECTOR_NAMES.pendingApprovals,
102357
+ ORCHESTRATION_PROJECTOR_NAMES.threads
102358
+ ],
101403
102359
  "thread.deleted": [ORCHESTRATION_PROJECTOR_NAMES.threads],
101404
102360
  "thread.archived": [ORCHESTRATION_PROJECTOR_NAMES.threads],
101405
102361
  "thread.unarchived": [ORCHESTRATION_PROJECTOR_NAMES.threads],
@@ -101464,7 +102420,7 @@ function extractActivityRequestId(payload) {
101464
102420
  }
101465
102421
  function isStalePendingApprovalFailureDetail(detail) {
101466
102422
  if (detail === null) return false;
101467
- return detail.includes("stale pending approval request") || detail.includes("unknown pending approval request") || detail.includes("unknown pending permission request");
102423
+ 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");
101468
102424
  }
101469
102425
  function derivePendingUserInputStatesFromActivities(activities) {
101470
102426
  const states = /* @__PURE__ */ new Map();
@@ -101549,7 +102505,6 @@ function collectThreadAttachmentRelativePaths(threadId, messages) {
101549
102505
  if (!threadSegment) return /* @__PURE__ */ new Set();
101550
102506
  const relativePaths = /* @__PURE__ */ new Set();
101551
102507
  for (const message of messages) for (const attachment of message.attachments ?? []) {
101552
- if (attachment.type !== "image") continue;
101553
102508
  const attachmentThreadSegment = parseThreadSegmentFromAttachmentId(attachment.id);
101554
102509
  if (!attachmentThreadSegment || attachmentThreadSegment !== threadSegment) continue;
101555
102510
  relativePaths.add(attachmentRelativePath(attachment));
@@ -101851,7 +102806,12 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
101851
102806
  return;
101852
102807
  }
101853
102808
  case "thread.deleted": {
101854
- attachmentSideEffects.deletedThreadIds.add(event.payload.threadId);
102809
+ if (!(yield* eventStore.hasEventAfter({
102810
+ aggregateKind: "thread",
102811
+ aggregateId: event.payload.threadId,
102812
+ type: "thread.created",
102813
+ sequenceExclusive: event.sequence
102814
+ }))) attachmentSideEffects.deletedThreadIds.add(event.payload.threadId);
101855
102815
  const existingRow = yield* projectionThreadRepository.getById({ threadId: event.payload.threadId });
101856
102816
  if (Option.isNone(existingRow)) return;
101857
102817
  yield* projectionThreadRepository.upsert({
@@ -102086,6 +103046,9 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102086
103046
  });
102087
103047
  const applyThreadMessagesProjection = Effect.fn("applyThreadMessagesProjection")(function* (event, attachmentSideEffects) {
102088
103048
  switch (event.type) {
103049
+ case "thread.created":
103050
+ yield* projectionThreadMessageRepository.deleteByThreadId({ threadId: event.payload.threadId });
103051
+ return;
102089
103052
  case "thread.message-sent": {
102090
103053
  const existingMessage = yield* projectionThreadMessageRepository.getByMessageId({ messageId: event.payload.messageId });
102091
103054
  const previousMessage = Option.getOrUndefined(existingMessage);
@@ -102127,6 +103090,9 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102127
103090
  });
102128
103091
  const applyThreadProposedPlansProjection = Effect.fn("applyThreadProposedPlansProjection")(function* (event, _attachmentSideEffects) {
102129
103092
  switch (event.type) {
103093
+ case "thread.created":
103094
+ yield* projectionThreadProposedPlanRepository.deleteByThreadId({ threadId: event.payload.threadId });
103095
+ return;
102130
103096
  case "thread.proposed-plan-upserted":
102131
103097
  yield* projectionThreadProposedPlanRepository.upsert({
102132
103098
  planId: event.payload.proposedPlan.id,
@@ -102153,6 +103119,10 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102153
103119
  });
102154
103120
  const applyThreadActivitiesProjection = Effect.fn("applyThreadActivitiesProjection")(function* (event, attachmentSideEffects) {
102155
103121
  switch (event.type) {
103122
+ case "thread.created":
103123
+ yield* projectionThreadActivityRepository.deleteByThreadId({ threadId: event.payload.threadId });
103124
+ yield* projectionThreadUserInputRequestRepository.deleteByThreadId({ threadId: event.payload.threadId });
103125
+ return;
102156
103126
  case "thread.activity-appended": {
102157
103127
  const requestId = extractActivityRequestId(event.payload.activity.payload);
102158
103128
  const activityPayload = typeof event.payload.activity.payload === "object" && event.payload.activity.payload !== null ? event.payload.activity.payload : null;
@@ -102208,6 +103178,10 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102208
103178
  }
102209
103179
  });
102210
103180
  const applyThreadSessionsProjection = Effect.fn("applyThreadSessionsProjection")(function* (event, _attachmentSideEffects) {
103181
+ if (event.type === "thread.created") {
103182
+ yield* projectionThreadSessionRepository.deleteByThreadId({ threadId: event.payload.threadId });
103183
+ return;
103184
+ }
102211
103185
  if (event.type !== "thread.session-set") return;
102212
103186
  yield* projectionThreadSessionRepository.upsert({
102213
103187
  threadId: event.payload.threadId,
@@ -102224,6 +103198,9 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102224
103198
  });
102225
103199
  const applyThreadTurnsProjection = Effect.fn("applyThreadTurnsProjection")(function* (event, _attachmentSideEffects) {
102226
103200
  switch (event.type) {
103201
+ case "thread.created":
103202
+ yield* projectionTurnRepository.deleteByThreadId({ threadId: event.payload.threadId });
103203
+ return;
102227
103204
  case "thread.turn-start-requested":
102228
103205
  yield* projectionTurnRepository.replacePendingTurnStart({
102229
103206
  threadId: event.payload.threadId,
@@ -102399,6 +103376,9 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102399
103376
  const applyCheckpointsProjection = () => Effect.void;
102400
103377
  const applyPendingApprovalsProjection = Effect.fn("applyPendingApprovalsProjection")(function* (event, attachmentSideEffects) {
102401
103378
  switch (event.type) {
103379
+ case "thread.created":
103380
+ yield* projectionPendingApprovalRepository.deleteByThreadId({ threadId: event.payload.threadId });
103381
+ return;
102402
103382
  case "thread.activity-appended": {
102403
103383
  const requestId = extractActivityRequestId(event.payload.activity.payload) ?? event.metadata.requestId ?? null;
102404
103384
  if (requestId === null) return;
@@ -102556,7 +103536,8 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
102556
103536
  const lastAppliedByProjector = new Map(projectors.map((projector) => [projector.name, 0]));
102557
103537
  for (const row of stateRows) if (lastAppliedByProjector.has(row.projector)) lastAppliedByProjector.set(row.projector, row.lastAppliedSequence);
102558
103538
  const replayFromSequence = Math.min(...lastAppliedByProjector.values());
102559
- yield* Stream.runForEach(eventStore.readFromSequence(replayFromSequence), (event) => Effect.gen(function* () {
103539
+ const replayThroughSequence = yield* eventStore.latestSequence;
103540
+ yield* Stream.runForEach(eventStore.readThroughSequence(replayFromSequence, replayThroughSequence), (event) => Effect.gen(function* () {
102560
103541
  const projectorsToAdvance = projectors.filter((projector) => event.sequence > (lastAppliedByProjector.get(projector.name) ?? 0));
102561
103542
  if (projectorsToAdvance.length === 0) return;
102562
103543
  const postCommit = yield* sql.withTransaction(applyProjectorsForEvent(event, projectorsToAdvance));
@@ -106475,4 +107456,4 @@ else if (external !== null) (external.action === "pair" ? promptAndPairExternalM
106475
107456
  });
106476
107457
  else NodeRuntime.runMain(program);
106477
107458
  //#endregion
106478
- export { spawnAndCollect as $, V2ThreadRealtimeErrorNotification as $t, normalizeCliError as A, makeProviderMaintenanceCapabilities as An, ToolRequestUserInputParams as At, buildCodexInitializeParams as B, getModelSelectionBooleanOptionValue as Bn, V2ItemCompletedNotification as Bt, buildCommitMessagePrompt as C, decodeGitHubPullRequestListJson as Cn, SERVER_NOTIFICATION_METHODS as Ct, buildThreadPriorityPrompt as D, enrichProviderSnapshotWithVersionAdvisory as Dn, ServerRequest__ExecCommandApprovalParams as Dt, buildPrContentPrompt as E, AzureDevOpsCli as En, ServerRequest__DynamicToolCallParams as Et, makeClaudeCapabilitiesCacheKey as F, ServerSettingsService as Fn, V2CommandExecutionOutputDeltaNotification as Ft, buildSelectOptionDescriptor as G, getProviderOptionStringSelectionValue as Gn, V2PlanDeltaNotification as Gt, makePendingCodexProvider as H, getProviderOptionBooleanSelectionValue as Hn, V2McpServerOauthLoginCompletedNotification as Ht, makeClaudeContinuationGroupKey as I, resolveAttachmentPath as In, V2ConfigWarningNotification as It, detailFromResult as J, V2ServerRequestResolvedNotification as Jt, buildServerProvider as K, normalizeModelSlug as Kn, V2ReasoningSummaryTextDeltaNotification as Kt, makeClaudeEnvironment as L, resolveCommandPath as Ln, V2DeprecationNoticeNotification as Lt, sanitizePrTitle as M, normalizeCommandPath as Mn, V2AccountRateLimitsUpdatedNotification as Mt, sanitizeThreadTitle as N, resolveProviderMaintenanceCapabilitiesEffect as Nn, V2AccountUpdatedNotification as Nt, buildThreadTitlePrompt as O, makeManualOnlyProviderMaintenanceCapabilities as On, ServerRequest__FileChangeRequestApprovalParams as Ot, toJsonSchemaObject as P, compareCliVersions as Pn, V2AgentMessageDeltaNotification as Pt, providerModelsFromSettings as Q, V2ThreadRealtimeClosedNotification as Qt, resolveClaudeHomePath$1 as R, applyClaudePromptEffortPrefix as Rn, V2ErrorNotification as Rt, buildBranchNamePrompt as S, withoutStatusCheckRollupJsonField as Sn, CodexAppServerTransportError as St, buildIssueContentTitlePrompt as T, BitbucketApi as Tn, ServerRequest__CommandExecutionRequestApprovalParams as Tt, DEFAULT_TIMEOUT_MS as U, getProviderOptionCurrentValue as Un, V2McpToolCallProgressNotification as Ut, checkCodexProviderStatus as V, getModelSelectionStringOptionValue as Vn, V2ItemStartedNotification as Vt, buildBooleanOptionDescriptor as W, getProviderOptionDescriptors as Wn, V2ModelReroutedNotification as Wt, nonEmptyTrimmed as X, V2ThreadGoalUpdatedNotification as Xt, isCommandMissingCause as Y, V2ThreadGoalClearedNotification as Yt, parseGenericCliVersion as Z, V2ThreadNameUpdatedNotification as Zt, ProviderEventLoggers as _, GITHUB_PULL_REQUEST_LIST_JSON_FIELDS as _n, layerChildProcess as _t, PtyAdapter as a, V2ThreadTokenUsageUpdatedNotification as an, createProcessDeviceToolBinding as at, checkRtkAvailability as b, formatGitHubJsonFields as bn, CodexAppServerRequestError as bt, OpenCodeRuntimeError as c, V2TurnPlanUpdatedNotification as cn, ProviderAdapterSessionClosedError as ct, openCodeRuntimeErrorDetail as d, V2TurnStartResponse as dn, ProviderDriverError as dt, V2ThreadRealtimeItemAddedNotification as en, AGENT_CONTROL_INTERNAL_SERVER_NAME as et, parseOpenCodeModelSlug as f, V2TurnSteerParams as fn, codexContinuationIdentity as ft, toOpenCodeQuestionAnswers as g, GitLabCli as gn, CodexAppServerClient as gt, toOpenCodePermissionReply as h, V2WindowsWorldWritableWarningNotification as hn, expandHomePath$3 as ht, classifyTaskAgentKind as i, V2ThreadStatusChangedNotification as in, redactAgentControlSecrets as it, sanitizeCommitSubject as j, makeStaticProviderMaintenanceResolver as jn, ToolRequestUserInputResponse as jt, extractJsonObject as k, makePackageManagedProviderMaintenanceResolver as kn, ServerRequest__ToolRequestUserInputParams as kt, buildOpenCodePermissionRules as l, V2TurnStartParams as ln, ProviderAdapterSessionNotFoundError as lt, toOpenCodeFileParts as m, V2WindowsSandboxSetupCompletedNotification as mn, resolveCodexHomeLayout as mt, AgentControlSessionRegistry as n, V2ThreadRealtimeStartedNotification as nn, installAgentControlAcp as nt, PtySpawnError as o, V2TurnCompletedNotification as on, ProviderAdapterProcessError as ot, runOpenCodeSdk as p, V2TurnSteerResponse as pn, materializeCodexShadowHome as pt, collectStreamAsString as q, resolvePromptInjectedEffort as qn, V2ReasoningTextDeltaNotification as qt, ignoreProviderBackgroundCause as r, V2ThreadStartedNotification as rn, installAgentControlNativeHttp as rt, OpenCodeRuntime as s, V2TurnDiffUpdatedNotification as sn, ProviderAdapterRequestError as st, makeServerQueueMetrics as t, V2ThreadRealtimeOutputAudioDeltaNotification as tn, agentControlHostContext as tt, openCodeQuestionId as u, V2TurnStartParams__CollaborationMode as un, ProviderAdapterValidationError as ut, makeEventNdjsonLogger as v, GitHubCli as vn, CodexAppServerProcessExitedError as vt, buildIssueContentPolishPrompt as w, ForgejoApi as wn, ServerRequest__ApplyPatchApprovalParams as wt, validateRankInboxThreadsResult as x, isStatusCheckRollupAccessError as xn, CodexAppServerSpawnError as xt, buildTokenReductionInstructions as y, GitHubCliError as yn, CodexAppServerProtocolParseError as yt, mergeProviderInstanceEnvironment as z, createModelCapabilities as zn, V2FileChangeOutputDeltaNotification as zt };
107459
+ export { parseGenericCliVersion as $, V2ThreadNameUpdatedNotification as $t, buildThreadTitlePrompt as A, makeManualOnlyProviderMaintenanceCapabilities as An, ServerRequest__FileChangeRequestApprovalParams as At, resolveClaudeHomePath$1 as B, resolveCommandPath as Bn, V2ErrorNotification as Bt, validateRankInboxThreadsResult as C, isStatusCheckRollupAccessError as Cn, CodexAppServerSpawnError as Ct, buildIssueContentTitlePrompt as D, BitbucketApi as Dn, ServerRequest__CommandExecutionRequestApprovalParams as Dt, buildIssueContentPolishPrompt as E, ForgejoApi as En, ServerRequest__ApplyPatchApprovalParams as Et, sanitizeThreadTitle as F, resolveProviderMaintenanceCapabilitiesEffect as Fn, V2AccountUpdatedNotification as Ft, DEFAULT_TIMEOUT_MS as G, getProviderOptionBooleanSelectionValue as Gn, V2McpToolCallProgressNotification as Gt, buildCodexInitializeParams as H, createModelCapabilities as Hn, V2ItemCompletedNotification as Ht, toJsonSchemaObject as I, compareCliVersions as In, V2AgentMessageDeltaNotification as It, buildServerProvider as J, getProviderOptionStringSelectionValue as Jn, V2ReasoningSummaryTextDeltaNotification as Jt, buildBooleanOptionDescriptor as K, getProviderOptionCurrentValue as Kn, V2ModelReroutedNotification as Kt, makeClaudeCapabilitiesCacheKey as L, ServerSettingsService as Ln, V2CommandExecutionOutputDeltaNotification as Lt, normalizeCliError as M, makeProviderMaintenanceCapabilities as Mn, ToolRequestUserInputParams as Mt, sanitizeCommitSubject as N, makeStaticProviderMaintenanceResolver as Nn, ToolRequestUserInputResponse as Nt, buildPrContentPrompt as O, AzureDevOpsCli as On, ServerRequest__DynamicToolCallParams as Ot, sanitizePrTitle as P, normalizeCommandPath as Pn, V2AccountRateLimitsUpdatedNotification as Pt, nonEmptyTrimmed as Q, V2ThreadGoalUpdatedNotification as Qt, makeClaudeContinuationGroupKey as R, readPersistedAttachment as Rn, V2ConfigWarningNotification as Rt, checkRtkAvailability as S, formatGitHubJsonFields as Sn, CodexAppServerRequestError as St, buildCommitMessagePrompt as T, decodeGitHubPullRequestListJson as Tn, SERVER_NOTIFICATION_METHODS as Tt, checkCodexProviderStatus as U, getModelSelectionBooleanOptionValue as Un, V2ItemStartedNotification as Ut, mergeProviderInstanceEnvironment as V, applyClaudePromptEffortPrefix as Vn, V2FileChangeOutputDeltaNotification as Vt, makePendingCodexProvider as W, getModelSelectionStringOptionValue as Wn, V2McpServerOauthLoginCompletedNotification as Wt, detailFromResult as X, resolvePromptInjectedEffort as Xn, V2ServerRequestResolvedNotification as Xt, collectStreamAsString as Y, normalizeModelSlug as Yn, V2ReasoningTextDeltaNotification as Yt, isCommandMissingCause as Z, V2ThreadGoalClearedNotification as Zt, toOpenCodeQuestionAnswers as _, V2WindowsWorldWritableWarningNotification as _n, expandHomePath$3 as _t, PtyAdapter as a, V2ThreadStartedNotification as an, installAgentControlNativeHttp as at, makeEventNdjsonLogger as b, GitHubCli as bn, CodexAppServerProcessExitedError as bt, OpenCodeRuntime as c, V2TurnCompletedNotification as cn, ProviderAdapterProcessError as ct, openCodeQuestionId as d, V2TurnStartParams as dn, ProviderAdapterSessionNotFoundError as dt, V2ThreadRealtimeClosedNotification as en, providerModelsFromSettings as et, openCodeRuntimeErrorDetail as f, V2TurnStartParams__CollaborationMode as fn, ProviderAdapterValidationError as ft, toOpenCodePermissionReply as g, V2WindowsSandboxSetupCompletedNotification as gn, resolveCodexHomeLayout as gt, toOpenCodeFileParts as h, V2TurnSteerResponse as hn, materializeCodexShadowHome as ht, classifyTaskAgentKind as i, V2ThreadRealtimeStartedNotification as in, installAgentControlAcp as it, extractJsonObject as j, makePackageManagedProviderMaintenanceResolver as jn, ServerRequest__ToolRequestUserInputParams as jt, buildThreadPriorityPrompt as k, enrichProviderSnapshotWithVersionAdvisory as kn, ServerRequest__ExecCommandApprovalParams as kt, OpenCodeRuntimeError as l, V2TurnDiffUpdatedNotification as ln, ProviderAdapterRequestError as lt, runOpenCodeSdk as m, V2TurnSteerParams as mn, codexContinuationIdentity as mt, AgentControlSessionRegistry as n, V2ThreadRealtimeItemAddedNotification as nn, AGENT_CONTROL_INTERNAL_SERVER_NAME as nt, PtySpawnError as o, V2ThreadStatusChangedNotification as on, redactAgentControlSecrets as ot, parseOpenCodeModelSlug as p, V2TurnStartResponse as pn, ProviderDriverError as pt, buildSelectOptionDescriptor as q, getProviderOptionDescriptors as qn, V2PlanDeltaNotification as qt, ignoreProviderBackgroundCause as r, V2ThreadRealtimeOutputAudioDeltaNotification as rn, agentControlHostContext as rt, MINIMUM_OPENCODE_VERSION as s, V2ThreadTokenUsageUpdatedNotification as sn, createProcessDeviceToolBinding as st, makeServerQueueMetrics as t, V2ThreadRealtimeErrorNotification as tn, spawnAndCollect as tt, buildOpenCodePermissionRules as u, V2TurnPlanUpdatedNotification as un, ProviderAdapterSessionClosedError as ut, verifyOpenCodeServerVersion as v, GitLabCli as vn, CodexAppServerClient as vt, buildBranchNamePrompt as w, withoutStatusCheckRollupJsonField as wn, CodexAppServerTransportError as wt, buildTokenReductionInstructions as x, GitHubCliError as xn, CodexAppServerProtocolParseError as xt, ProviderEventLoggers as y, GITHUB_PULL_REQUEST_LIST_JSON_FIELDS as yn, layerChildProcess as yt, makeClaudeEnvironment as z, resolveAttachmentPath as zn, V2DeprecationNoticeNotification as zt };