@openhands/agent-canvas 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (732) hide show
  1. package/README.md +1 -1
  2. package/README.windows.md +2 -2
  3. package/build/assets/{acp-providers-BkL3HWa3.js → acp-providers-D1PORKc0.js} +1 -1
  4. package/build/assets/active-backend-context-IqOjobNK.js +2 -0
  5. package/build/assets/{agent-context-settings-CzWS1DgR.js → agent-context-settings-DMrObcIS.js} +1 -1
  6. package/build/assets/agent-profiles-settings-DororXN5.js +1 -0
  7. package/build/assets/agent-server-conversation-service.api-DWBe0rbX.js +86 -0
  8. package/build/assets/{agent-settings-D2J1dKVd.js → agent-settings-BJVk92PU.js} +1 -1
  9. package/build/assets/agent-settings-COfJsQ1d.js +1 -0
  10. package/build/assets/{alert-banner-lrK-2_0Y.js → alert-banner-CzZsm7ms.js} +1 -1
  11. package/build/assets/{api-key-entry-screen-D70oJj2c.js → api-key-entry-screen-D8Fade_-.js} +1 -1
  12. package/build/assets/{app-settings-D0OKHB3M.js → app-settings-CpyGB3AT.js} +1 -1
  13. package/build/assets/{automation-detail-C0SxWTnQ.js → automation-detail-B-jQ39Mm.js} +1 -1
  14. package/build/assets/{automation-export-BjQa_fT6.js → automation-export-B1dywoqk.js} +1 -1
  15. package/build/assets/{automation-setup-route-BzCNpljP.js → automation-setup-route-C-bWUZBi.js} +1 -1
  16. package/build/assets/{automation-templates-D9gs6ihu.js → automation-templates-DgpCGOJV.js} +1 -1
  17. package/build/assets/{automations-list-dZg8zOCl.js → automations-list-DnMxlxsL.js} +1 -1
  18. package/build/assets/{back-nav-button-B3pYwmUJ.js → back-nav-button-HHEneWMw.js} +1 -1
  19. package/build/assets/{backend-form-modal-HwclKrUS.js → backend-form-modal-DiVrD4Cm.js} +1 -1
  20. package/build/assets/{backend-synced-settings-badge-YI3k09Wr.js → backend-synced-settings-badge-7MIjpr8M.js} +1 -1
  21. package/build/assets/{badge-Dpn3-LTV.js → badge-CpYmcVZV.js} +1 -1
  22. package/build/assets/{base-modal-3NmIOKDm.js → base-modal-Fnh6Uln9.js} +1 -1
  23. package/build/assets/bot-BQZx8e2i.js +1 -0
  24. package/build/assets/{brand-button-CJcwjnfb.js → brand-button-swT1RyO0.js} +1 -1
  25. package/build/assets/browser-B9AbV6kG.js +7 -0
  26. package/build/assets/{browser-tab-4CPdj3J3.js → browser-tab-zAY12m_i.js} +1 -1
  27. package/build/assets/{chat-send-button-B8n6-DQA.js → chat-send-button-DsJtivmL.js} +1 -1
  28. package/build/assets/check-WAFXrrs_.js +1 -0
  29. package/build/assets/chevron-down-CifNWzme.js +1 -0
  30. package/build/assets/circle-check-CtnimJa8.js +1 -0
  31. package/build/assets/{circle-plus-check-toggle-BVzv5EkZ.js → circle-plus-check-toggle-Cuzx55bo.js} +1 -1
  32. package/build/assets/{cloud-funnel-analytics-CcSez21r.js → cloud-funnel-analytics-86CwNdSh.js} +1 -1
  33. package/build/assets/{combobox-caret-BlmRwiM8.js → combobox-caret-D0fRotFi.js} +1 -1
  34. package/build/assets/{command-menu-BKOLj-TC.js → command-menu-BXy03FBl.js} +1 -1
  35. package/build/assets/{condenser-settings-DLQogFnB.js → condenser-settings-BmZa0ui_.js} +1 -1
  36. package/build/assets/{confirmation-modal-DAH0XtOp.js → confirmation-modal-BgoN6lbN.js} +1 -1
  37. package/build/assets/{context-menu-list-item-BQhmFVEK.js → context-menu-list-item-Bq02tc-P.js} +1 -1
  38. package/build/assets/conversation-BPo8SvLN.js +1 -0
  39. package/build/assets/conversation-CPCVsCUY.js +90 -0
  40. package/build/assets/conversation-panel-BPo8SvLN.js +1 -0
  41. package/build/assets/{conversation-state-store-CtgILxWF.js → conversation-state-store-C5YpjMNy.js} +1 -1
  42. package/build/assets/conversation-store-Blc5xysY.js +6 -0
  43. package/build/assets/{conversation-tab-empty-state-C9sfDOlt.js → conversation-tab-empty-state-CMqo_0Bd.js} +1 -1
  44. package/build/assets/{copy-to-clipboard-button-DatoElj8.js → copy-to-clipboard-button-Cg1pF0xn.js} +1 -1
  45. package/build/assets/{device-verify-BIjXeW9N.js → device-verify-BfQLgNyq.js} +1 -1
  46. package/build/assets/{dropdown-classes-zFW7qPSK.js → dropdown-classes-BIqQr5mx.js} +1 -1
  47. package/build/assets/{entry.client-EBn3ZtNP.js → entry.client-CxFjRYqH.js} +2 -2
  48. package/build/assets/{enum-filter-dropdown-CctILg5t.js → enum-filter-dropdown-C_yV4_bo.js} +1 -1
  49. package/build/assets/{environment-switch-overlay-Cvmo6clk.js → environment-switch-overlay-Bi4qbh2g.js} +1 -1
  50. package/build/assets/{extensions-hub-BZ3HYztk.js → extensions-hub-BqUINAhp.js} +1 -1
  51. package/build/assets/{extensions-navigation-Bnx32WAb.js → extensions-navigation-lraj88Wk.js} +1 -1
  52. package/build/assets/external-link-CgtpA_a1.js +1 -0
  53. package/build/assets/{file-text-RecuaId_.js → file-text-DEK4LSVw.js} +1 -1
  54. package/build/assets/files-tab-DV0L-lFE.js +1 -0
  55. package/build/assets/{form-control-classes-DLN3Qgub.js → form-control-classes-7yFSQJq_.js} +1 -1
  56. package/build/assets/{format-relative-time-BerVamGl.js → format-relative-time-DSErAuVr.js} +1 -1
  57. package/build/assets/git-provider-icon-BvlLAche.js +1 -0
  58. package/build/assets/{git-repo-dropdown-B5VnMftu.js → git-repo-dropdown-ByMzpNko.js} +1 -1
  59. package/build/assets/git-repo-dropdown-C6R7hgM8.js +1 -0
  60. package/build/assets/{highlighted-source-view-CgJfD5VT.js → highlighted-source-view-C_sfncLZ.js} +1 -1
  61. package/build/assets/{home-Y0aDou-a.js → home-BOrlwLqG.js} +1 -1
  62. package/build/assets/home-BvMNC6E-.js +1 -0
  63. package/build/assets/{home-store-Cubdq0uP.js → home-store-CxqsY9Fi.js} +1 -1
  64. package/build/assets/index-home-BvMNC6E-.js +1 -0
  65. package/build/assets/info-BRVcJAUg.js +1 -0
  66. package/build/assets/{install-server-modal-DW6dSyGr.js → install-server-modal-Bl4G1zF4.js} +1 -1
  67. package/build/assets/{kebab-menu-item-content-CKydZrbH.js → kebab-menu-item-content-BGoGFEAg.js} +1 -1
  68. package/build/assets/{launch-c4GEP8oo.js → launch-CkqiSCqi.js} +1 -1
  69. package/build/assets/{list-todo-CheUtB7F.js → list-todo-DNWlzfaM.js} +1 -1
  70. package/build/assets/llm-not-configured-banner-DLw_tu-G.js +27 -0
  71. package/build/assets/llm-settings-B-pkVCrt.js +1 -0
  72. package/build/assets/llm-settings-DSC0-IQ7.js +1 -0
  73. package/build/assets/llm-subscription-service-BAdOl5Xx.js +1 -0
  74. package/build/assets/loader-circle-B47W9XqT.js +1 -0
  75. package/build/assets/{loading-spinner-CN3riY7k.js → loading-spinner-xhnrGP4Y.js} +1 -1
  76. package/build/assets/{manage-backends-modal-DTCME_Pu.js → manage-backends-modal-DhGk5mJt.js} +1 -1
  77. package/build/assets/manifest-653b89aa.js +1 -0
  78. package/build/assets/{manifest-subpage-layout-Ds7G5GZ8.js → manifest-subpage-layout-CKWvL2ig.js} +1 -1
  79. package/build/assets/{map-provider-7Bp2aih5.js → map-provider-Mx8mZuE-.js} +1 -1
  80. package/build/assets/markdown-renderer-DUmk7pFc.js +8 -0
  81. package/build/assets/{mcp-Da7wFU7A.js → mcp-DCkvl6K0.js} +2 -2
  82. package/build/assets/mcp-marketplace-utils-DEbMXlQr.js +1 -0
  83. package/build/assets/messages-DSXvyc21.js +40 -0
  84. package/build/assets/{modal-body-duRaxj_K.js → modal-body-gIe21fDv.js} +1 -1
  85. package/build/assets/{modal-classes-CLEXO6dj.js → modal-classes-D66dlgZ7.js} +1 -1
  86. package/build/assets/{modal-close-button-D0aT02hs.js → modal-close-button-B6iOGYpI.js} +1 -1
  87. package/build/assets/{mouse-pointer-click-Px-dXWcS.js → mouse-pointer-click-BYX1Pw5W.js} +1 -1
  88. package/build/assets/{npm-Cswluf6-.js → npm-DLckoeJc.js} +1 -1
  89. package/build/assets/{onboarding-BKbTYlW1.js → onboarding-D7WDG66N.js} +1 -1
  90. package/build/assets/{onboarding-modal-DrrGlEQq.js → onboarding-modal-C_xVrFNv.js} +1 -1
  91. package/build/assets/{organization-service.api-DK8csGvK.js → organization-service.api-D-s9z18a.js} +1 -1
  92. package/build/assets/pencil-BGOCPRyu.js +1 -0
  93. package/build/assets/{planner-tab-D-mZ1I7n.js → planner-tab-AKaXIIfg.js} +1 -1
  94. package/build/assets/{plugins-management-service-CywqyfLK.js → plugins-management-service-wtmY4QQw.js} +1 -1
  95. package/build/assets/plus-zNEL8rcX.js +1 -0
  96. package/build/assets/{profiles-service.api-vcE_jJCe.js → profiles-service.api-DCMYxHMi.js} +1 -1
  97. package/build/assets/{providers-CdrPPm0z.js → providers-BjrtjX4L.js} +1 -1
  98. package/build/assets/{proxy-b4aqL4SX.js → proxy-9Z_WZggZ.js} +1 -1
  99. package/build/assets/{puzzle-B3v361yY.js → puzzle-BWLmN8z4.js} +1 -1
  100. package/build/assets/recommended-automations-launcher-CFlzhu1o.js +1 -0
  101. package/build/assets/refresh-cw-CXtFWpwv.js +1 -0
  102. package/build/assets/root-CanxKlNV.css +1 -0
  103. package/build/assets/{root-CBBi6IAe.js → root-DkfG_UWR.js} +2 -2
  104. package/build/assets/root-layout-D75LHYhh.js +2 -0
  105. package/build/assets/{schema-field-Z-rMg9ti.js → schema-field-OnM5Uob_.js} +1 -1
  106. package/build/assets/{sdk-section-page-m_cjygxR.js → sdk-section-page-m5WQm2sy.js} +1 -1
  107. package/build/assets/search-CycosyjN.js +1 -0
  108. package/build/assets/{secrets-service-BHF4fxML.js → secrets-service-B26R61C1.js} +1 -1
  109. package/build/assets/{secrets-settings-aBGXtQhX.js → secrets-settings-CbLYCKOX.js} +1 -1
  110. package/build/assets/{segmented-toggle-SmvsR3jW.js → segmented-toggle-DCspm2U5.js} +1 -1
  111. package/build/assets/{settings-CZPGNens.js → settings-BJQI_iBM.js} +1 -1
  112. package/build/assets/{settings-dropdown-input-TWIeiG02.js → settings-dropdown-input-BI8V_Nov.js} +1 -1
  113. package/build/assets/{settings-index-Dtlegd6s.js → settings-index-BiTqJoH7.js} +1 -1
  114. package/build/assets/{settings-input-D61Vzp9e.js → settings-input-Cz62hWVW.js} +1 -1
  115. package/build/assets/{settings-list-classes-sE0ASr1s.js → settings-list-classes-z_3FW5H3.js} +1 -1
  116. package/build/assets/{settings-modal-CalzJP2l.js → settings-modal-BIrIVn97.js} +1 -1
  117. package/build/assets/{settings-service.api-DfPYaxZJ.js → settings-service.api--rJmnuLa.js} +1 -1
  118. package/build/assets/{settings-switch-Drt-rF5s.js → settings-switch-BRsSI8Vs.js} +1 -1
  119. package/build/assets/{settings-utils-gw2ppAvw.js → settings-utils-Ba7vel6T.js} +1 -1
  120. package/build/assets/shared-conversation-CQK_PqHx.js +1 -0
  121. package/build/assets/shield-check-T3JsDJiM.js +1 -0
  122. package/build/assets/{sidebar-layout-Dxg6zc2K.js → sidebar-layout-Bhi3hVcu.js} +1 -1
  123. package/build/assets/{sidebar-mobile-menu-toggle-C6HpQ55l.js → sidebar-mobile-menu-toggle-YWJNRN4p.js} +1 -1
  124. package/build/assets/{sidebar-nav-link-CxLoG-dG.js → sidebar-nav-link-BSUlY5Ml.js} +1 -1
  125. package/build/assets/{sidebar-store-BJeYY-E9.js → sidebar-store-Cl1cUv_F.js} +1 -1
  126. package/build/assets/{skill-card-pill-row-B_BYBONu.js → skill-card-pill-row-BXz8L8Rn.js} +1 -1
  127. package/build/assets/{skill-icon-badge-CN41Hy9l.js → skill-icon-badge-QgfKv31M.js} +1 -1
  128. package/build/assets/{skill-scope-Dt1V5X2p.js → skill-scope-Dc3JPW-8.js} +1 -1
  129. package/build/assets/{skills-plugins-B-H0cCOP.js → skills-plugins-CpTV27n3.js} +1 -1
  130. package/build/assets/{skills-settings-DthdIDUb.js → skills-settings-CSW__IW4.js} +1 -1
  131. package/build/assets/{sparkles-g7y3r-Ut.js → sparkles-TJ0mdECe.js} +1 -1
  132. package/build/assets/{styled-tooltip-C5C07RQC.js → styled-tooltip-BUMSbgrF.js} +1 -1
  133. package/build/assets/{task-list-tab-BTde81Iu.js → task-list-tab-mAHMOkUz.js} +1 -1
  134. package/build/assets/{terminal-DRrJo-cR.js → terminal-BzxBaHx2.js} +1 -1
  135. package/build/assets/{toggle-switch-CIioisto.js → toggle-switch-O5v1FgxW.js} +1 -1
  136. package/build/assets/trash-2-C0xNVp9c.js +1 -0
  137. package/build/assets/{typography-D9tiHct7.js → typography-NOKSk9_R.js} +1 -1
  138. package/build/assets/usage-tab-tEmVN0KD.js +1 -0
  139. package/build/assets/{use-acp-credential-form-DGyo0QvL.js → use-acp-credential-form-BPNi0Zbm.js} +1 -1
  140. package/build/assets/{use-activate-agent-profile-DrPzIKJF.js → use-activate-agent-profile-D9YRQPTF.js} +1 -1
  141. package/build/assets/{use-agent-profiles-B37XWDLq.js → use-agent-profiles-Cb2zUW3l.js} +1 -1
  142. package/build/assets/{use-can-manage-org-profiles-BzE28H3x.js → use-can-manage-org-profiles-Dxzq2AEd.js} +1 -1
  143. package/build/assets/{use-cloud-current-user-id-U6HPjy50.js → use-cloud-current-user-id-Co2eJk2A.js} +1 -1
  144. package/build/assets/{use-config-DapX3pjC.js → use-config-DKAMiI5R.js} +1 -1
  145. package/build/assets/use-create-conversation-CoHTiCbI.js +1 -0
  146. package/build/assets/{use-create-secret-DcpT3RPw.js → use-create-secret-2zBlCDsF.js} +1 -1
  147. package/build/assets/use-is-authed-C52-ivnB.js +1 -0
  148. package/build/assets/{use-is-creating-conversation-CVefC9Ns.js → use-is-creating-conversation-DdaAE6jV.js} +1 -1
  149. package/build/assets/{use-launch-skill-in-chat-BcKNjxxd.js → use-launch-skill-in-chat-COnDpxCQ.js} +1 -1
  150. package/build/assets/use-llm-profiles-C_BHue65.js +1 -0
  151. package/build/assets/{use-manifest-capabilities-zihHDbMW.js → use-manifest-capabilities-DPrQsaPP.js} +1 -1
  152. package/build/assets/{use-onboarding-completion-6kWOW3ul.js → use-onboarding-completion-CCE8OQgV.js} +1 -1
  153. package/build/assets/{use-plugins-marketplace-CqkR8kLE.js → use-plugins-marketplace-CEiak69h.js} +1 -1
  154. package/build/assets/use-save-agent-profile-DK9idD6a.js +1 -0
  155. package/build/assets/{use-save-settings-DIEurJ3D.js → use-save-settings-DNmnbG6f.js} +1 -1
  156. package/build/assets/{use-settings-nav-items-DV9qgeu7.js → use-settings-nav-items-BlFL7YhM.js} +1 -1
  157. package/build/assets/{use-settings-BmLzQjnC.js → use-settings-wCwPaSIv.js} +1 -1
  158. package/build/assets/{use-tracking-salbPJxT.js → use-tracking-CVwPmhlX.js} +1 -1
  159. package/build/assets/{use-user-conversation-Dt-W6uNw.js → use-user-conversation-DVtfg0B_.js} +1 -1
  160. package/build/assets/{useInfiniteQuery-DbCv0Jzd.js → useInfiniteQuery-p1xq35r2.js} +1 -1
  161. package/build/assets/{useMutation-ChpkYxI5.js → useMutation-BFDQmgk9.js} +1 -1
  162. package/build/assets/{useQueries-Cjv3E8_1.js → useQueries-DF1NAAeC.js} +1 -1
  163. package/build/assets/{useQuery-BCnzy4LX.js → useQuery-DRv--6bK.js} +1 -1
  164. package/build/assets/utils-zxEjKE70.js +1 -0
  165. package/build/assets/{vendor~browser-DJ1pl_wn.js → vendor~browser-B-fae1JU.js} +14 -14
  166. package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~kv3pap4j-oGvLV0dO.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~kv3pap4j-B8i84bh4.js} +3 -3
  167. package/build/assets/{vendor~files-tab-C87pjSpi.js → vendor~files-tab-D9wR9yM2.js} +1 -1
  168. package/build/assets/vendor~index-home~home~conversation-panel~conversation-Ipoe6hvY.js +13 -0
  169. package/build/assets/vendor~root-layout-C-IgVx6e.js +1 -0
  170. package/build/assets/{vendor~root-layout~conversation-panel~conversation-DEzjR4K7.js → vendor~root-layout~conversation-panel~conversation-Dhd_I4H4.js} +1 -1
  171. package/build/assets/{vendor~root-layout~conversation-panel~conversation~skills-settings~automations-list~shared-~bovqqk8e-U-xdsAEx.js → vendor~root-layout~conversation-panel~conversation~skills-settings~automations-list~shared-~bovqqk8e-Cc0f9kPP.js} +1 -1
  172. package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-CQR5Sa0H.js → vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-d7svw-BB.js} +1 -1
  173. package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~gxu4j2ea-Cwhh3zLe.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~gxu4j2ea-D5DWZVc7.js} +1 -1
  174. package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hjcjabwg-CuQhkiS7.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hjcjabwg-4WsUP-tz.js} +2 -2
  175. package/build/assets/{verification-settings-oi54wEc1.js → verification-settings-B8UMQ7MG.js} +1 -1
  176. package/build/assets/{wrench-B1_H-tL1.js → wrench-DIka3hCq.js} +1 -1
  177. package/build/assets/x-BWKA2Ver.js +1 -0
  178. package/build/assets/zap-DHddTPc0.js +1 -0
  179. package/build/index.html +4 -4
  180. package/build/locales/ar/openhands.json +28 -1
  181. package/build/locales/ca/openhands.json +28 -1
  182. package/build/locales/de/openhands.json +28 -1
  183. package/build/locales/en/openhands.json +28 -1
  184. package/build/locales/es/openhands.json +28 -1
  185. package/build/locales/fr/openhands.json +28 -1
  186. package/build/locales/it/openhands.json +28 -1
  187. package/build/locales/ja/openhands.json +28 -1
  188. package/build/locales/ko-KR/openhands.json +28 -1
  189. package/build/locales/no/openhands.json +28 -1
  190. package/build/locales/pt/openhands.json +28 -1
  191. package/build/locales/tr/openhands.json +28 -1
  192. package/build/locales/uk/openhands.json +28 -1
  193. package/build/locales/zh-CN/openhands.json +28 -1
  194. package/build/locales/zh-TW/openhands.json +28 -1
  195. package/config/defaults.json +3 -3
  196. package/dist/api/agent-server-compatibility.cjs +1 -1
  197. package/dist/api/agent-server-compatibility.cjs.map +1 -1
  198. package/dist/api/agent-server-compatibility.js +1 -1
  199. package/dist/api/agent-server-compatibility.js.map +1 -1
  200. package/dist/api/conversation-service/agent-server-conversation-service.api.cjs +1 -1
  201. package/dist/api/conversation-service/agent-server-conversation-service.api.cjs.map +1 -1
  202. package/dist/api/conversation-service/agent-server-conversation-service.api.d.ts +24 -1
  203. package/dist/api/conversation-service/agent-server-conversation-service.api.js +116 -97
  204. package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
  205. package/dist/api/llm-balance-service.cjs +2 -0
  206. package/dist/api/llm-balance-service.cjs.map +1 -0
  207. package/dist/api/llm-balance-service.d.ts +33 -0
  208. package/dist/api/llm-balance-service.js +53 -0
  209. package/dist/api/llm-balance-service.js.map +1 -0
  210. package/dist/api/llm-subscription-service.cjs +1 -1
  211. package/dist/api/llm-subscription-service.cjs.map +1 -1
  212. package/dist/api/llm-subscription-service.js +42 -34
  213. package/dist/api/llm-subscription-service.js.map +1 -1
  214. package/dist/components/conversation/index.cjs +1 -1
  215. package/dist/components/conversation/index.d.ts +0 -1
  216. package/dist/components/conversation/index.js +0 -1
  217. package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.cjs +1 -1
  218. package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.cjs.map +1 -1
  219. package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.js +1 -1
  220. package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.js.map +1 -1
  221. package/dist/components/conversation-events/chat/event-message-components/generic-event-message-wrapper.cjs +1 -1
  222. package/dist/components/conversation-events/chat/event-message-components/generic-event-message-wrapper.cjs.map +1 -1
  223. package/dist/components/conversation-events/chat/event-message-components/generic-event-message-wrapper.js +24 -23
  224. package/dist/components/conversation-events/chat/event-message-components/generic-event-message-wrapper.js.map +1 -1
  225. package/dist/components/conversation-events/chat/group-events.cjs +1 -1
  226. package/dist/components/conversation-events/chat/group-events.cjs.map +1 -1
  227. package/dist/components/conversation-events/chat/group-events.d.ts +3 -3
  228. package/dist/components/conversation-events/chat/group-events.js +27 -26
  229. package/dist/components/conversation-events/chat/group-events.js.map +1 -1
  230. package/dist/components/features/automations/recommended-automations-section.d.ts +7 -0
  231. package/dist/components/features/chat/components/chat-input-actions.cjs +1 -1
  232. package/dist/components/features/chat/components/chat-input-actions.cjs.map +1 -1
  233. package/dist/components/features/chat/components/chat-input-actions.js +123 -118
  234. package/dist/components/features/chat/components/chat-input-actions.js.map +1 -1
  235. package/dist/components/features/chat/components/chat-input-grip.cjs +1 -1
  236. package/dist/components/features/chat/components/chat-input-grip.cjs.map +1 -1
  237. package/dist/components/features/chat/components/chat-input-grip.d.ts +2 -1
  238. package/dist/components/features/chat/components/chat-input-grip.js +7 -7
  239. package/dist/components/features/chat/components/chat-input-grip.js.map +1 -1
  240. package/dist/components/features/chat/components/context-window-meter.cjs +2 -0
  241. package/dist/components/features/chat/components/context-window-meter.cjs.map +1 -0
  242. package/dist/components/features/chat/components/context-window-meter.d.ts +2 -0
  243. package/dist/components/features/chat/components/context-window-meter.js +131 -0
  244. package/dist/components/features/chat/components/context-window-meter.js.map +1 -0
  245. package/dist/components/features/chat/components/context-window-ring.cjs +2 -0
  246. package/dist/components/features/chat/components/context-window-ring.cjs.map +1 -0
  247. package/dist/components/features/chat/components/context-window-ring.d.ts +26 -0
  248. package/dist/components/features/chat/components/context-window-ring.js +45 -0
  249. package/dist/components/features/chat/components/context-window-ring.js.map +1 -0
  250. package/dist/components/features/chat/custom-chat-input.cjs +1 -1
  251. package/dist/components/features/chat/custom-chat-input.cjs.map +1 -1
  252. package/dist/components/features/chat/custom-chat-input.js +68 -67
  253. package/dist/components/features/chat/custom-chat-input.js.map +1 -1
  254. package/dist/components/features/chat/path-component.cjs +1 -1
  255. package/dist/components/features/chat/path-component.cjs.map +1 -1
  256. package/dist/components/features/chat/path-component.js +9 -6
  257. package/dist/components/features/chat/path-component.js.map +1 -1
  258. package/dist/components/features/chat/plan-preview.cjs +1 -1
  259. package/dist/components/features/chat/plan-preview.js +4 -4
  260. package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.cjs +1 -1
  261. package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.cjs.map +1 -1
  262. package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.d.ts +0 -8
  263. package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.js +92 -50
  264. package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.js.map +1 -1
  265. package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.cjs +1 -1
  266. package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.cjs.map +1 -1
  267. package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.d.ts +7 -2
  268. package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.js +15 -9
  269. package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.js.map +1 -1
  270. package/dist/components/features/chat/tool-visualizers/primitives/markdown-file-preview.cjs +2 -0
  271. package/dist/components/features/chat/tool-visualizers/primitives/markdown-file-preview.cjs.map +1 -0
  272. package/dist/components/features/chat/tool-visualizers/primitives/markdown-file-preview.d.ts +20 -0
  273. package/dist/components/features/chat/tool-visualizers/primitives/markdown-file-preview.js +76 -0
  274. package/dist/components/features/chat/tool-visualizers/primitives/markdown-file-preview.js.map +1 -0
  275. package/dist/components/features/controls/server-status-context-menu.cjs +1 -1
  276. package/dist/components/features/controls/server-status-context-menu.cjs.map +1 -1
  277. package/dist/components/features/controls/server-status-context-menu.d.ts +5 -3
  278. package/dist/components/features/controls/server-status-context-menu.js +8 -8
  279. package/dist/components/features/controls/server-status-context-menu.js.map +1 -1
  280. package/dist/components/features/conversation/conversation-name-context-menu.cjs +1 -1
  281. package/dist/components/features/conversation/conversation-name-context-menu.cjs.map +1 -1
  282. package/dist/components/features/conversation/conversation-name-context-menu.js +58 -61
  283. package/dist/components/features/conversation/conversation-name-context-menu.js.map +1 -1
  284. package/dist/components/features/conversation/conversation-name-with-status.cjs +1 -1
  285. package/dist/components/features/conversation/conversation-name-with-status.cjs.map +1 -1
  286. package/dist/components/features/conversation/conversation-name-with-status.js +74 -46
  287. package/dist/components/features/conversation/conversation-name-with-status.js.map +1 -1
  288. package/dist/components/features/conversation/conversation-name.cjs +1 -1
  289. package/dist/components/features/conversation/conversation-name.cjs.map +1 -1
  290. package/dist/components/features/conversation/conversation-name.js +69 -71
  291. package/dist/components/features/conversation/conversation-name.js.map +1 -1
  292. package/dist/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.cjs +1 -1
  293. package/dist/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.cjs.map +1 -1
  294. package/dist/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.js +7 -6
  295. package/dist/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.js.map +1 -1
  296. package/dist/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.cjs +1 -1
  297. package/dist/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.cjs.map +1 -1
  298. package/dist/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.js +92 -86
  299. package/dist/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.js.map +1 -1
  300. package/dist/components/features/conversation/conversation-tabs/conversation-tabs.cjs +1 -1
  301. package/dist/components/features/conversation/conversation-tabs/conversation-tabs.cjs.map +1 -1
  302. package/dist/components/features/conversation/conversation-tabs/conversation-tabs.js +81 -71
  303. package/dist/components/features/conversation/conversation-tabs/conversation-tabs.js.map +1 -1
  304. package/dist/components/features/conversation/metrics-modal/cost-section.cjs +1 -1
  305. package/dist/components/features/conversation/metrics-modal/cost-section.cjs.map +1 -1
  306. package/dist/components/features/conversation/metrics-modal/cost-section.js +6 -6
  307. package/dist/components/features/conversation/metrics-modal/cost-section.js.map +1 -1
  308. package/dist/components/features/conversation/metrics-modal/metric-row.cjs +1 -1
  309. package/dist/components/features/conversation/metrics-modal/metric-row.cjs.map +1 -1
  310. package/dist/components/features/conversation/metrics-modal/metric-row.d.ts +2 -1
  311. package/dist/components/features/conversation/metrics-modal/metric-row.js +10 -9
  312. package/dist/components/features/conversation/metrics-modal/metric-row.js.map +1 -1
  313. package/dist/components/features/conversation/metrics-modal/usage-section.cjs +1 -1
  314. package/dist/components/features/conversation/metrics-modal/usage-section.cjs.map +1 -1
  315. package/dist/components/features/conversation/metrics-modal/usage-section.js +2 -1
  316. package/dist/components/features/conversation/metrics-modal/usage-section.js.map +1 -1
  317. package/dist/components/features/conversation/usage-panel/compact-context-button.cjs +2 -0
  318. package/dist/components/features/conversation/usage-panel/compact-context-button.cjs.map +1 -0
  319. package/dist/components/features/conversation/usage-panel/compact-context-button.d.ts +16 -0
  320. package/dist/components/features/conversation/usage-panel/compact-context-button.js +59 -0
  321. package/dist/components/features/conversation/usage-panel/compact-context-button.js.map +1 -0
  322. package/dist/components/features/conversation/usage-panel/context-meter.cjs +2 -0
  323. package/dist/components/features/conversation/usage-panel/context-meter.cjs.map +1 -0
  324. package/dist/components/features/conversation/usage-panel/context-meter.d.ts +19 -0
  325. package/dist/components/features/conversation/usage-panel/context-meter.js +46 -0
  326. package/dist/components/features/conversation/usage-panel/context-meter.js.map +1 -0
  327. package/dist/components/features/conversation/usage-panel/provider-balance-card.cjs +2 -0
  328. package/dist/components/features/conversation/usage-panel/provider-balance-card.cjs.map +1 -0
  329. package/dist/components/features/conversation/usage-panel/provider-balance-card.d.ts +7 -0
  330. package/dist/components/features/conversation/usage-panel/provider-balance-card.js +57 -0
  331. package/dist/components/features/conversation/usage-panel/provider-balance-card.js.map +1 -0
  332. package/dist/components/features/conversation/usage-panel/usage-panel.cjs +2 -0
  333. package/dist/components/features/conversation/usage-panel/usage-panel.cjs.map +1 -0
  334. package/dist/components/features/conversation/usage-panel/usage-panel.d.ts +9 -0
  335. package/dist/components/features/conversation/usage-panel/usage-panel.js +68 -0
  336. package/dist/components/features/conversation/usage-panel/usage-panel.js.map +1 -0
  337. package/dist/components/features/conversation-panel/budget-display.cjs +1 -1
  338. package/dist/components/features/conversation-panel/budget-display.cjs.map +1 -1
  339. package/dist/components/features/conversation-panel/budget-display.js +10 -13
  340. package/dist/components/features/conversation-panel/budget-display.js.map +1 -1
  341. package/dist/components/features/conversation-panel/budget-progress-bar.cjs +1 -1
  342. package/dist/components/features/conversation-panel/budget-progress-bar.cjs.map +1 -1
  343. package/dist/components/features/conversation-panel/budget-progress-bar.js +2 -2
  344. package/dist/components/features/conversation-panel/budget-progress-bar.js.map +1 -1
  345. package/dist/components/features/conversation-panel/confirm-archive-modal.cjs +2 -0
  346. package/dist/components/features/conversation-panel/confirm-archive-modal.cjs.map +1 -0
  347. package/dist/components/features/conversation-panel/confirm-archive-modal.d.ts +8 -0
  348. package/dist/components/features/conversation-panel/confirm-archive-modal.js +48 -0
  349. package/dist/components/features/conversation-panel/confirm-archive-modal.js.map +1 -0
  350. package/dist/components/features/conversation-panel/conversation-card/conversation-card-actions.cjs +1 -1
  351. package/dist/components/features/conversation-panel/conversation-card/conversation-card-actions.cjs.map +1 -1
  352. package/dist/components/features/conversation-panel/conversation-card/conversation-card-actions.d.ts +3 -1
  353. package/dist/components/features/conversation-panel/conversation-card/conversation-card-actions.js +39 -34
  354. package/dist/components/features/conversation-panel/conversation-card/conversation-card-actions.js.map +1 -1
  355. package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs +1 -1
  356. package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs.map +1 -1
  357. package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.d.ts +3 -1
  358. package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js +104 -80
  359. package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js.map +1 -1
  360. package/dist/components/features/conversation-panel/conversation-card/conversation-card-footer.cjs +1 -1
  361. package/dist/components/features/conversation-panel/conversation-card/conversation-card-footer.cjs.map +1 -1
  362. package/dist/components/features/conversation-panel/conversation-card/conversation-card-footer.d.ts +7 -1
  363. package/dist/components/features/conversation-panel/conversation-card/conversation-card-footer.js +25 -17
  364. package/dist/components/features/conversation-panel/conversation-card/conversation-card-footer.js.map +1 -1
  365. package/dist/components/features/conversation-panel/conversation-card/conversation-card.cjs +1 -1
  366. package/dist/components/features/conversation-panel/conversation-card/conversation-card.cjs.map +1 -1
  367. package/dist/components/features/conversation-panel/conversation-card/conversation-card.d.ts +9 -1
  368. package/dist/components/features/conversation-panel/conversation-card/conversation-card.js +94 -84
  369. package/dist/components/features/conversation-panel/conversation-card/conversation-card.js.map +1 -1
  370. package/dist/components/features/conversation-panel/conversation-group-folder-list.cjs +1 -1
  371. package/dist/components/features/conversation-panel/conversation-group-folder-list.cjs.map +1 -1
  372. package/dist/components/features/conversation-panel/conversation-group-folder-list.d.ts +2 -1
  373. package/dist/components/features/conversation-panel/conversation-group-folder-list.js +32 -31
  374. package/dist/components/features/conversation-panel/conversation-group-folder-list.js.map +1 -1
  375. package/dist/components/features/conversation-panel/conversation-group-folder-row.cjs +1 -1
  376. package/dist/components/features/conversation-panel/conversation-group-folder-row.cjs.map +1 -1
  377. package/dist/components/features/conversation-panel/conversation-group-folder-row.d.ts +2 -1
  378. package/dist/components/features/conversation-panel/conversation-group-folder-row.js +27 -26
  379. package/dist/components/features/conversation-panel/conversation-group-folder-row.js.map +1 -1
  380. package/dist/components/features/conversation-panel/conversation-panel-filter-menu.cjs +1 -1
  381. package/dist/components/features/conversation-panel/conversation-panel-filter-menu.cjs.map +1 -1
  382. package/dist/components/features/conversation-panel/conversation-panel-filter-menu.d.ts +3 -1
  383. package/dist/components/features/conversation-panel/conversation-panel-filter-menu.js +116 -106
  384. package/dist/components/features/conversation-panel/conversation-panel-filter-menu.js.map +1 -1
  385. package/dist/components/features/conversation-panel/conversation-panel-list-helpers.cjs +1 -1
  386. package/dist/components/features/conversation-panel/conversation-panel-list-helpers.cjs.map +1 -1
  387. package/dist/components/features/conversation-panel/conversation-panel-list-helpers.d.ts +27 -0
  388. package/dist/components/features/conversation-panel/conversation-panel-list-helpers.js +69 -46
  389. package/dist/components/features/conversation-panel/conversation-panel-list-helpers.js.map +1 -1
  390. package/dist/components/features/conversation-panel/conversation-panel.cjs +1 -1
  391. package/dist/components/features/conversation-panel/conversation-panel.cjs.map +1 -1
  392. package/dist/components/features/conversation-panel/conversation-panel.js +230 -165
  393. package/dist/components/features/conversation-panel/conversation-panel.js.map +1 -1
  394. package/dist/components/features/files-tab/file-content-viewer.cjs +1 -1
  395. package/dist/components/features/files-tab/file-content-viewer.cjs.map +1 -1
  396. package/dist/components/features/files-tab/file-content-viewer.js +22 -25
  397. package/dist/components/features/files-tab/file-content-viewer.js.map +1 -1
  398. package/dist/components/features/markdown/markdown-table-scroll.cjs +1 -1
  399. package/dist/components/features/markdown/markdown-table-scroll.cjs.map +1 -1
  400. package/dist/components/features/markdown/markdown-table-scroll.js +2 -2
  401. package/dist/components/features/markdown/markdown-table-scroll.js.map +1 -1
  402. package/dist/components/shared/buttons/conversation-confirmation-buttons.cjs +1 -1
  403. package/dist/components/shared/buttons/conversation-confirmation-buttons.cjs.map +1 -1
  404. package/dist/components/shared/buttons/conversation-confirmation-buttons.js +2 -2
  405. package/dist/components/shared/buttons/conversation-confirmation-buttons.js.map +1 -1
  406. package/dist/components/shared/modals/confirmation-modals/base-modal.cjs +1 -1
  407. package/dist/components/shared/modals/confirmation-modals/base-modal.cjs.map +1 -1
  408. package/dist/components/shared/modals/confirmation-modals/base-modal.js +1 -1
  409. package/dist/components/shared/modals/confirmation-modals/base-modal.js.map +1 -1
  410. package/dist/config/defaults.cjs +1 -1
  411. package/dist/config/defaults.cjs.map +1 -1
  412. package/dist/config/defaults.js +3 -3
  413. package/dist/config/defaults.js.map +1 -1
  414. package/dist/constants/llm-balance.cjs +2 -0
  415. package/dist/constants/llm-balance.cjs.map +1 -0
  416. package/dist/constants/llm-balance.d.ts +13 -0
  417. package/dist/constants/llm-balance.js +6 -0
  418. package/dist/constants/llm-balance.js.map +1 -0
  419. package/dist/contexts/conversation-websocket-context.cjs +2 -2
  420. package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
  421. package/dist/contexts/conversation-websocket-context.js +217 -209
  422. package/dist/contexts/conversation-websocket-context.js.map +1 -1
  423. package/dist/hooks/chat/use-grip-resize.cjs +1 -1
  424. package/dist/hooks/chat/use-grip-resize.cjs.map +1 -1
  425. package/dist/hooks/chat/use-grip-resize.d.ts +1 -0
  426. package/dist/hooks/chat/use-grip-resize.js +39 -30
  427. package/dist/hooks/chat/use-grip-resize.js.map +1 -1
  428. package/dist/hooks/mutation/use-condense-conversation.cjs +2 -0
  429. package/dist/hooks/mutation/use-condense-conversation.cjs.map +1 -0
  430. package/dist/hooks/mutation/use-condense-conversation.d.ts +12 -0
  431. package/dist/hooks/mutation/use-condense-conversation.js +17 -0
  432. package/dist/hooks/mutation/use-condense-conversation.js.map +1 -0
  433. package/dist/hooks/mutation/use-create-conversation.cjs +1 -1
  434. package/dist/hooks/mutation/use-create-conversation.cjs.map +1 -1
  435. package/dist/hooks/mutation/use-create-conversation.js +30 -21
  436. package/dist/hooks/mutation/use-create-conversation.js.map +1 -1
  437. package/dist/hooks/mutation/use-new-conversation-command.cjs +1 -1
  438. package/dist/hooks/mutation/use-new-conversation-command.cjs.map +1 -1
  439. package/dist/hooks/mutation/use-new-conversation-command.js +1 -1
  440. package/dist/hooks/mutation/use-new-conversation-command.js.map +1 -1
  441. package/dist/hooks/query/use-conversation-metrics.cjs +1 -1
  442. package/dist/hooks/query/use-conversation-metrics.cjs.map +1 -1
  443. package/dist/hooks/query/use-conversation-metrics.js +1 -1
  444. package/dist/hooks/query/use-conversation-metrics.js.map +1 -1
  445. package/dist/hooks/query/use-llm-balance.cjs +2 -0
  446. package/dist/hooks/query/use-llm-balance.cjs.map +1 -0
  447. package/dist/hooks/query/use-llm-balance.d.ts +10 -0
  448. package/dist/hooks/query/use-llm-balance.js +24 -0
  449. package/dist/hooks/query/use-llm-balance.js.map +1 -0
  450. package/dist/hooks/query/use-search-providers.cjs +1 -1
  451. package/dist/hooks/query/use-search-providers.cjs.map +1 -1
  452. package/dist/hooks/query/use-search-providers.js +1 -1
  453. package/dist/hooks/query/use-search-providers.js.map +1 -1
  454. package/dist/hooks/use-await-context-compaction.cjs +2 -0
  455. package/dist/hooks/use-await-context-compaction.cjs.map +1 -0
  456. package/dist/hooks/use-await-context-compaction.d.ts +38 -0
  457. package/dist/hooks/use-await-context-compaction.js +61 -0
  458. package/dist/hooks/use-await-context-compaction.js.map +1 -0
  459. package/dist/hooks/use-compact-context-action.cjs +2 -0
  460. package/dist/hooks/use-compact-context-action.cjs.map +1 -0
  461. package/dist/hooks/use-compact-context-action.d.ts +10 -0
  462. package/dist/hooks/use-compact-context-action.js +61 -0
  463. package/dist/hooks/use-compact-context-action.js.map +1 -0
  464. package/dist/hooks/use-context-window-usage.cjs +2 -0
  465. package/dist/hooks/use-context-window-usage.cjs.map +1 -0
  466. package/dist/hooks/use-context-window-usage.d.ts +5 -0
  467. package/dist/hooks/use-context-window-usage.js +20 -0
  468. package/dist/hooks/use-context-window-usage.js.map +1 -0
  469. package/dist/hooks/use-conversation-name-context-menu.cjs +1 -1
  470. package/dist/hooks/use-conversation-name-context-menu.cjs.map +1 -1
  471. package/dist/hooks/use-conversation-name-context-menu.d.ts +0 -3
  472. package/dist/hooks/use-conversation-name-context-menu.js +54 -57
  473. package/dist/hooks/use-conversation-name-context-menu.js.map +1 -1
  474. package/dist/hooks/use-drag-resize.cjs +1 -1
  475. package/dist/hooks/use-drag-resize.cjs.map +1 -1
  476. package/dist/hooks/use-drag-resize.d.ts +8 -0
  477. package/dist/hooks/use-drag-resize.js +21 -18
  478. package/dist/hooks/use-drag-resize.js.map +1 -1
  479. package/dist/hooks/use-live-conversation-metrics.cjs +2 -0
  480. package/dist/hooks/use-live-conversation-metrics.cjs.map +1 -0
  481. package/dist/hooks/use-live-conversation-metrics.d.ts +18 -0
  482. package/dist/hooks/use-live-conversation-metrics.js +37 -0
  483. package/dist/hooks/use-live-conversation-metrics.js.map +1 -0
  484. package/dist/hooks/use-select-conversation-tab.cjs +1 -1
  485. package/dist/hooks/use-select-conversation-tab.cjs.map +1 -1
  486. package/dist/hooks/use-select-conversation-tab.js +2 -2
  487. package/dist/hooks/use-select-conversation-tab.js.map +1 -1
  488. package/dist/i18n/declaration.cjs +1 -1
  489. package/dist/i18n/declaration.cjs.map +1 -1
  490. package/dist/i18n/declaration.d.ts +27 -0
  491. package/dist/i18n/declaration.js +1 -1
  492. package/dist/i18n/declaration.js.map +1 -1
  493. package/dist/i18n/translation.cjs +2 -2
  494. package/dist/i18n/translation.cjs.map +1 -1
  495. package/dist/i18n/translation.js +474 -15
  496. package/dist/i18n/translation.js.map +1 -1
  497. package/dist/index.cjs +1 -1
  498. package/dist/index.js +28 -29
  499. package/dist/lib/index.cjs +1 -1
  500. package/dist/lib/index.js +0 -1
  501. package/dist/locales/ar/openhands.json +28 -1
  502. package/dist/locales/ca/openhands.json +28 -1
  503. package/dist/locales/de/openhands.json +28 -1
  504. package/dist/locales/en/openhands.json +28 -1
  505. package/dist/locales/es/openhands.json +28 -1
  506. package/dist/locales/fr/openhands.json +28 -1
  507. package/dist/locales/it/openhands.json +28 -1
  508. package/dist/locales/ja/openhands.json +28 -1
  509. package/dist/locales/ko-KR/openhands.json +28 -1
  510. package/dist/locales/no/openhands.json +28 -1
  511. package/dist/locales/pt/openhands.json +28 -1
  512. package/dist/locales/tr/openhands.json +28 -1
  513. package/dist/locales/uk/openhands.json +28 -1
  514. package/dist/locales/zh-CN/openhands.json +28 -1
  515. package/dist/locales/zh-TW/openhands.json +28 -1
  516. package/dist/node_modules/@microlink/react-json-view/dist/main.cjs +5 -5
  517. package/dist/node_modules/@microlink/react-json-view/dist/main.cjs.map +1 -1
  518. package/dist/node_modules/@microlink/react-json-view/dist/main.js +5194 -5187
  519. package/dist/node_modules/@microlink/react-json-view/dist/main.js.map +1 -1
  520. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs +2 -1
  521. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs.map +1 -0
  522. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js +21 -1
  523. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js.map +1 -0
  524. package/dist/node_modules/@openhands/typescript-client/dist/client/hooks-client.cjs +2 -1
  525. package/dist/node_modules/@openhands/typescript-client/dist/client/hooks-client.cjs.map +1 -0
  526. package/dist/node_modules/@openhands/typescript-client/dist/client/hooks-client.js +22 -1
  527. package/dist/node_modules/@openhands/typescript-client/dist/client/hooks-client.js.map +1 -0
  528. package/dist/node_modules/@openhands/typescript-client/dist/client/meta-profiles-client.cjs +2 -1
  529. package/dist/node_modules/@openhands/typescript-client/dist/client/meta-profiles-client.cjs.map +1 -0
  530. package/dist/node_modules/@openhands/typescript-client/dist/client/meta-profiles-client.js +33 -1
  531. package/dist/node_modules/@openhands/typescript-client/dist/client/meta-profiles-client.js.map +1 -0
  532. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs +1 -1
  533. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs.map +1 -1
  534. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js +56 -22
  535. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js.map +1 -1
  536. package/dist/node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs +1 -1
  537. package/dist/node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs.map +1 -1
  538. package/dist/node_modules/@openhands/typescript-client/dist/client/profiles-client.js +3 -0
  539. package/dist/node_modules/@openhands/typescript-client/dist/client/profiles-client.js.map +1 -1
  540. package/dist/node_modules/@openhands/typescript-client/dist/client/shared-client.cjs +2 -1
  541. package/dist/node_modules/@openhands/typescript-client/dist/client/shared-client.cjs.map +1 -0
  542. package/dist/node_modules/@openhands/typescript-client/dist/client/shared-client.js +31 -1
  543. package/dist/node_modules/@openhands/typescript-client/dist/client/shared-client.js.map +1 -0
  544. package/dist/node_modules/@openhands/typescript-client/dist/client/sub-agents-client.cjs +2 -1
  545. package/dist/node_modules/@openhands/typescript-client/dist/client/sub-agents-client.cjs.map +1 -0
  546. package/dist/node_modules/@openhands/typescript-client/dist/client/sub-agents-client.js +21 -1
  547. package/dist/node_modules/@openhands/typescript-client/dist/client/sub-agents-client.js.map +1 -0
  548. package/dist/node_modules/@openhands/typescript-client/dist/client/tool-client.cjs +2 -1
  549. package/dist/node_modules/@openhands/typescript-client/dist/client/tool-client.cjs.map +1 -0
  550. package/dist/node_modules/@openhands/typescript-client/dist/client/tool-client.js +21 -1
  551. package/dist/node_modules/@openhands/typescript-client/dist/client/tool-client.js.map +1 -0
  552. package/dist/node_modules/@openhands/typescript-client/dist/conversation/local-conversation.cjs.map +1 -1
  553. package/dist/node_modules/@openhands/typescript-client/dist/conversation/local-conversation.js.map +1 -1
  554. package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs +1 -1
  555. package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs.map +1 -1
  556. package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js +9 -5
  557. package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js.map +1 -1
  558. package/dist/node_modules/i18next-http-backend/esm/index.cjs +1 -1
  559. package/dist/node_modules/i18next-http-backend/esm/index.cjs.map +1 -1
  560. package/dist/node_modules/i18next-http-backend/esm/index.js +2 -2
  561. package/dist/node_modules/i18next-http-backend/esm/index.js.map +1 -1
  562. package/dist/node_modules/lucide-react/dist/esm/icons/archive-restore.cjs +2 -0
  563. package/dist/node_modules/lucide-react/dist/esm/icons/archive-restore.cjs.map +1 -0
  564. package/dist/node_modules/lucide-react/dist/esm/icons/archive-restore.js +31 -0
  565. package/dist/node_modules/lucide-react/dist/esm/icons/archive-restore.js.map +1 -0
  566. package/dist/node_modules/lucide-react/dist/esm/icons/archive.cjs +2 -0
  567. package/dist/node_modules/lucide-react/dist/esm/icons/archive.cjs.map +1 -0
  568. package/dist/node_modules/lucide-react/dist/esm/icons/archive.js +23 -0
  569. package/dist/node_modules/lucide-react/dist/esm/icons/archive.js.map +1 -0
  570. package/dist/node_modules/lucide-react/dist/esm/icons/gauge.cjs +2 -0
  571. package/dist/node_modules/lucide-react/dist/esm/icons/gauge.cjs.map +1 -0
  572. package/dist/node_modules/lucide-react/dist/esm/icons/gauge.js +12 -0
  573. package/dist/node_modules/lucide-react/dist/esm/icons/gauge.js.map +1 -0
  574. package/dist/node_modules/lucide-react/dist/esm/icons/minimize.cjs +2 -0
  575. package/dist/node_modules/lucide-react/dist/esm/icons/minimize.cjs.map +1 -0
  576. package/dist/node_modules/lucide-react/dist/esm/icons/minimize.js +23 -0
  577. package/dist/node_modules/lucide-react/dist/esm/icons/minimize.js.map +1 -0
  578. package/dist/node_modules/zustand/esm/middleware.cjs +3 -3
  579. package/dist/node_modules/zustand/esm/middleware.cjs.map +1 -1
  580. package/dist/node_modules/zustand/esm/middleware.js +33 -31
  581. package/dist/node_modules/zustand/esm/middleware.js.map +1 -1
  582. package/dist/package.cjs +1 -1
  583. package/dist/package.cjs.map +1 -1
  584. package/dist/package.js +17 -16
  585. package/dist/package.js.map +1 -1
  586. package/dist/routes/usage-tab.cjs +2 -0
  587. package/dist/routes/usage-tab.cjs.map +1 -0
  588. package/dist/routes/usage-tab.d.ts +2 -0
  589. package/dist/routes/usage-tab.js +10 -0
  590. package/dist/routes/usage-tab.js.map +1 -0
  591. package/dist/services/child-conversation-launch.cjs +1 -1
  592. package/dist/services/child-conversation-launch.cjs.map +1 -1
  593. package/dist/services/child-conversation-launch.js +11 -5
  594. package/dist/services/child-conversation-launch.js.map +1 -1
  595. package/dist/stores/archived-conversations-store.cjs +2 -0
  596. package/dist/stores/archived-conversations-store.cjs.map +1 -0
  597. package/dist/stores/archived-conversations-store.d.ts +24 -0
  598. package/dist/stores/archived-conversations-store.js +33 -0
  599. package/dist/stores/archived-conversations-store.js.map +1 -0
  600. package/dist/stores/conversation-panel-preferences-store.cjs +1 -1
  601. package/dist/stores/conversation-panel-preferences-store.cjs.map +1 -1
  602. package/dist/stores/conversation-panel-preferences-store.d.ts +3 -0
  603. package/dist/stores/conversation-panel-preferences-store.js +4 -0
  604. package/dist/stores/conversation-panel-preferences-store.js.map +1 -1
  605. package/dist/stores/conversation-store.cjs.map +1 -1
  606. package/dist/stores/conversation-store.d.ts +1 -1
  607. package/dist/stores/conversation-store.js.map +1 -1
  608. package/dist/stores/metrics-store.cjs +1 -1
  609. package/dist/stores/metrics-store.cjs.map +1 -1
  610. package/dist/stores/metrics-store.d.ts +1 -0
  611. package/dist/stores/metrics-store.js +7 -4
  612. package/dist/stores/metrics-store.js.map +1 -1
  613. package/dist/types/agent-server/core/events/condensation-event.d.ts +3 -0
  614. package/dist/types/agent-server/core/events/conversation-state-event.d.ts +4 -6
  615. package/dist/types/agent-server/type-guards.cjs +1 -1
  616. package/dist/types/agent-server/type-guards.cjs.map +1 -1
  617. package/dist/types/agent-server/type-guards.d.ts +5 -0
  618. package/dist/types/agent-server/type-guards.js +3 -3
  619. package/dist/types/agent-server/type-guards.js.map +1 -1
  620. package/dist/utils/conversation-local-storage.cjs +1 -1
  621. package/dist/utils/conversation-local-storage.cjs.map +1 -1
  622. package/dist/utils/conversation-local-storage.js +2 -1
  623. package/dist/utils/conversation-local-storage.js.map +1 -1
  624. package/dist/utils/format-token-count.cjs +2 -0
  625. package/dist/utils/format-token-count.cjs.map +1 -0
  626. package/dist/utils/format-token-count.d.ts +3 -0
  627. package/dist/utils/format-token-count.js +19 -0
  628. package/dist/utils/format-token-count.js.map +1 -0
  629. package/dist/utils/hover-reveal-classes.cjs +2 -0
  630. package/dist/utils/hover-reveal-classes.cjs.map +1 -0
  631. package/dist/utils/hover-reveal-classes.d.ts +34 -0
  632. package/dist/utils/hover-reveal-classes.js +41 -0
  633. package/dist/utils/hover-reveal-classes.js.map +1 -0
  634. package/dist/utils/is-markdown-file-path.cjs +2 -0
  635. package/dist/utils/is-markdown-file-path.cjs.map +1 -0
  636. package/dist/utils/is-markdown-file-path.d.ts +4 -0
  637. package/dist/utils/is-markdown-file-path.js +14 -0
  638. package/dist/utils/is-markdown-file-path.js.map +1 -0
  639. package/dist/utils/mcp-marketplace-utils.cjs +1 -1
  640. package/dist/utils/mcp-marketplace-utils.cjs.map +1 -1
  641. package/dist/utils/mcp-marketplace-utils.d.ts +7 -0
  642. package/dist/utils/mcp-marketplace-utils.js +19 -16
  643. package/dist/utils/mcp-marketplace-utils.js.map +1 -1
  644. package/dist/utils/transcript-export/index.cjs +3 -3
  645. package/dist/utils/transcript-export/index.cjs.map +1 -1
  646. package/dist/utils/transcript-export/index.js +12 -12
  647. package/dist/utils/transcript-export/index.js.map +1 -1
  648. package/dist/utils/transcript-export/load-complete-events.cjs +1 -1
  649. package/dist/utils/transcript-export/load-complete-events.cjs.map +1 -1
  650. package/dist/utils/transcript-export/load-complete-events.js +4 -4
  651. package/dist/utils/transcript-export/load-complete-events.js.map +1 -1
  652. package/dist/utils/workspace-relative-path.cjs +2 -0
  653. package/dist/utils/workspace-relative-path.cjs.map +1 -0
  654. package/dist/utils/workspace-relative-path.d.ts +10 -0
  655. package/dist/utils/workspace-relative-path.js +22 -0
  656. package/dist/utils/workspace-relative-path.js.map +1 -0
  657. package/package.json +17 -16
  658. package/scripts/check-sdk-version-sync.mjs +6 -6
  659. package/scripts/dev-process-utils.mjs +6 -1
  660. package/scripts/dev-safe.mjs +57 -2
  661. package/build/assets/active-backend-context-B_bg5h9O.js +0 -2
  662. package/build/assets/agent-profiles-settings-hd2cAIZM.js +0 -1
  663. package/build/assets/agent-server-conversation-service.api-BheU4HX3.js +0 -86
  664. package/build/assets/agent-settings-D_SVrWhI.js +0 -1
  665. package/build/assets/bot-DuN83i3p.js +0 -1
  666. package/build/assets/browser--eoQOo4M.js +0 -6
  667. package/build/assets/check-DLOKoFU9.js +0 -1
  668. package/build/assets/chevron-down-CnIbtM6i.js +0 -1
  669. package/build/assets/circle-check-CxCYJrpZ.js +0 -1
  670. package/build/assets/conversation-Cmyw9bFh.js +0 -90
  671. package/build/assets/conversation-CvoGZ5vC.js +0 -1
  672. package/build/assets/conversation-panel-CvoGZ5vC.js +0 -1
  673. package/build/assets/conversation-store-B8Eahyeg.js +0 -6
  674. package/build/assets/external-link-zWbg5KXS.js +0 -1
  675. package/build/assets/files-tab-D5zuU5TY.js +0 -1
  676. package/build/assets/git-provider-icon-zuKz2cwo.js +0 -1
  677. package/build/assets/git-repo-dropdown-Bo7ciSNX.js +0 -1
  678. package/build/assets/home-DqyeeFA_.js +0 -1
  679. package/build/assets/index-home-DqyeeFA_.js +0 -1
  680. package/build/assets/info-C9lpK5pw.js +0 -1
  681. package/build/assets/llm-not-configured-banner-DCE_0B4I.js +0 -27
  682. package/build/assets/llm-settings-8eWBF3Ij.js +0 -1
  683. package/build/assets/llm-settings-D9ko42Pi.js +0 -1
  684. package/build/assets/llm-subscription-service-B3K-97lP.js +0 -1
  685. package/build/assets/loader-circle-C5AnEN8r.js +0 -1
  686. package/build/assets/manifest-e1c3bc3b.js +0 -1
  687. package/build/assets/markdown-renderer-DzvgdZey.js +0 -8
  688. package/build/assets/mcp-marketplace-utils-DSLou4n7.js +0 -1
  689. package/build/assets/messages-B2l0qLVk.js +0 -40
  690. package/build/assets/pencil-Bl3GWhgq.js +0 -1
  691. package/build/assets/plus-CtzlyAoF.js +0 -1
  692. package/build/assets/recommended-automations-launcher-DIYgUdMm.js +0 -1
  693. package/build/assets/refresh-cw-B9GhC3QC.js +0 -1
  694. package/build/assets/root-CRK9fOFd.css +0 -1
  695. package/build/assets/root-layout-BFN2rCOy.js +0 -2
  696. package/build/assets/search-CYaiKHRp.js +0 -1
  697. package/build/assets/shared-conversation-BIAcuORk.js +0 -1
  698. package/build/assets/shield-check-D2cpEpv3.js +0 -1
  699. package/build/assets/trash-2-CzDVN-Iw.js +0 -1
  700. package/build/assets/use-create-conversation-CRf1dCm5.js +0 -1
  701. package/build/assets/use-is-authed-Bka89Xmm.js +0 -1
  702. package/build/assets/use-llm-profiles-CHxqoHiN.js +0 -1
  703. package/build/assets/use-save-agent-profile-CH9_EXQG.js +0 -1
  704. package/build/assets/utils-DPQfkd-7.js +0 -1
  705. package/build/assets/vendor~index-home~home~conversation-panel~conversation-DiXf0dkj.js +0 -13
  706. package/build/assets/x-RYDBg-e2.js +0 -1
  707. package/build/assets/zap-tbKDzCe3.js +0 -1
  708. package/dist/components/features/conversation/metrics-modal/context-window-section.cjs +0 -2
  709. package/dist/components/features/conversation/metrics-modal/context-window-section.cjs.map +0 -1
  710. package/dist/components/features/conversation/metrics-modal/context-window-section.d.ts +0 -6
  711. package/dist/components/features/conversation/metrics-modal/context-window-section.js +0 -46
  712. package/dist/components/features/conversation/metrics-modal/context-window-section.js.map +0 -1
  713. package/dist/components/features/conversation/metrics-modal/empty-state.cjs +0 -2
  714. package/dist/components/features/conversation/metrics-modal/empty-state.cjs.map +0 -1
  715. package/dist/components/features/conversation/metrics-modal/empty-state.d.ts +0 -1
  716. package/dist/components/features/conversation/metrics-modal/empty-state.js +0 -18
  717. package/dist/components/features/conversation/metrics-modal/empty-state.js.map +0 -1
  718. package/dist/components/features/conversation/metrics-modal/metrics-modal-header.cjs +0 -2
  719. package/dist/components/features/conversation/metrics-modal/metrics-modal-header.cjs.map +0 -1
  720. package/dist/components/features/conversation/metrics-modal/metrics-modal-header.d.ts +0 -5
  721. package/dist/components/features/conversation/metrics-modal/metrics-modal-header.js +0 -20
  722. package/dist/components/features/conversation/metrics-modal/metrics-modal-header.js.map +0 -1
  723. package/dist/components/features/conversation/metrics-modal/metrics-modal.cjs +0 -2
  724. package/dist/components/features/conversation/metrics-modal/metrics-modal.cjs.map +0 -1
  725. package/dist/components/features/conversation/metrics-modal/metrics-modal.d.ts +0 -6
  726. package/dist/components/features/conversation/metrics-modal/metrics-modal.js +0 -57
  727. package/dist/components/features/conversation/metrics-modal/metrics-modal.js.map +0 -1
  728. package/dist/icons/u-credit-card.cjs +0 -2
  729. package/dist/icons/u-credit-card.cjs.map +0 -1
  730. package/dist/icons/u-credit-card.js +0 -21
  731. package/dist/icons/u-credit-card.js.map +0 -1
  732. /package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~cy4jtuc2-rfV8mQ9m.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dh9v73sa-rfV8mQ9m.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"agent-server-conversation-service.api.cjs","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type ForkConversationRequest,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { AgentKind, Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport { resolveAbsoluteAgentServerPath } from \"../agent-server-home\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport ProfilesService from \"../profiles-service/profiles-service.api\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n assertSubscriptionAuthReady,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n type WorkspaceMode,\n} from \"../conversation-metadata-store\";\nimport { resolveTitleLlmProfile } from \"#/utils/title-llm-profile\";\nimport type {\n GetHooksResponse,\n PluginSpec,\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n MetricsSnapshot,\n RuntimeConversationInfo,\n SendMessageRequest,\n SendMessageResponse,\n} from \"./agent-server-conversation-service.types\";\n\nconst DEFAULT_CONVERSATION_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\n// Creating the first conversation right after a cold agent-server boot (fresh\n// machine or the packaged desktop app, where uvx may still be warming caches)\n// can exceed the client's 60s default timeout.\nconst CREATE_CONVERSATION_TIMEOUT_MS = 5 * 60 * 1000;\nconst INVALID_CONVERSATION_RESPONSE_MESSAGE =\n \"Unable to load conversations because the selected agent server returned \" +\n \"data this UI does not understand. Check the backend URL/session key and \" +\n \"update the agent server if needed.\";\nfunction invalidConversationResponse(): Error {\n return new Error(INVALID_CONVERSATION_RESPONSE_MESSAGE);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === \"number\" ? value : null;\n}\n\nfunction numberOrZero(value: unknown): number {\n return typeof value === \"number\" ? value : 0;\n}\n\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readTimestamp(\n item: Record<string, unknown>,\n snakeKey: \"created_at\" | \"updated_at\",\n camelKey: \"createdAt\" | \"updatedAt\",\n): string {\n const value = item[snakeKey] ?? item[camelKey];\n return typeof value === \"string\" && value.trim()\n ? value\n : DEFAULT_CONVERSATION_TIMESTAMP;\n}\n\nfunction normalizeTokenUsage(\n value: unknown,\n): NonNullable<MetricsSnapshot[\"accumulated_token_usage\"]> | null {\n if (!isRecord(value)) return null;\n\n return {\n prompt_tokens: numberOrZero(value.prompt_tokens),\n completion_tokens: numberOrZero(value.completion_tokens),\n cache_read_tokens: numberOrZero(value.cache_read_tokens),\n cache_write_tokens: numberOrZero(value.cache_write_tokens),\n context_window: numberOrZero(value.context_window),\n per_turn_token: numberOrZero(value.per_turn_token),\n };\n}\n\nfunction normalizeMetrics(value: unknown): MetricsSnapshot | null {\n if (!isRecord(value)) return null;\n\n return {\n accumulated_cost: numberOrNull(value.accumulated_cost),\n max_budget_per_task: numberOrNull(value.max_budget_per_task),\n accumulated_token_usage: normalizeTokenUsage(value.accumulated_token_usage),\n };\n}\n\nfunction normalizeAgent(value: unknown): DirectConversationInfo[\"agent\"] {\n if (!isRecord(value)) return null;\n const llm = isRecord(value.llm)\n ? { model: stringOrNull(value.llm.model) }\n : null;\n // ``kind`` is the SDK's pydantic discriminator (``\"Agent\"`` vs ``\"ACPAgent\"``);\n // ``toAppConversation`` reads it to derive ``agent_kind``. ``acp_server`` is\n // the ACP provider identity (``ACPAgent.acp_server``, SDK #3692) — required so\n // the adapter can source the chip + in-conversation model list from the agent\n // when the ``acpserver`` tag is absent (a profile launch doesn't stamp it,\n // #1571). ``acp_model`` is the Canvas-configured model — preserved so the chip\n // can fall back to it when the SDK runtime model fields aren't populated.\n // Preserving these makes the wire path agree with the unit-test path that\n // builds ``DirectConversationInfo`` directly\n // (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_server: stringOrNull(value.acp_server),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction normalizeLaunchedAgentProfile(\n value: unknown,\n): DirectConversationInfo[\"launched_agent_profile\"] {\n if (!isRecord(value)) return null;\n const { agent_profile_id: agentProfileId, revision } = value;\n if (typeof agentProfileId !== \"string\" || typeof revision !== \"number\") {\n return null;\n }\n return { agent_profile_id: agentProfileId, revision };\n}\n\nfunction normalizeAbsolutePath(path: string): string | null {\n if (!path.startsWith(\"/\")) return null;\n\n const segments: string[] = [];\n for (const segment of path.split(\"/\")) {\n if (segment && segment !== \".\") {\n if (segment === \"..\") {\n if (!segments.length) return null;\n segments.pop();\n } else {\n segments.push(segment);\n }\n }\n }\n\n return `/${segments.join(\"/\")}`;\n}\n\nfunction requirePathInsideDirectory(path: string, directory: string): string {\n const normalizedPath = normalizeAbsolutePath(path);\n const normalizedDirectory = normalizeAbsolutePath(directory);\n\n if (\n !normalizedPath ||\n !normalizedDirectory ||\n (normalizedPath !== normalizedDirectory &&\n !normalizedPath.startsWith(`${normalizedDirectory}/`))\n ) {\n throw new Error(\"Conversation file path must stay inside the workspace\");\n }\n\n return normalizedPath;\n}\n\nfunction requireDirectConversationInfo(item: unknown): DirectConversationInfo {\n if (!isRecord(item) || typeof item.id !== \"string\" || !item.id.trim()) {\n throw invalidConversationResponse();\n }\n\n return {\n id: item.id.trim(),\n title: stringOrNull(item.title),\n created_at: readTimestamp(item, \"created_at\", \"createdAt\"),\n updated_at: readTimestamp(item, \"updated_at\", \"updatedAt\"),\n execution_status: stringOrNull(item.execution_status),\n sandbox_status: stringOrNull(item.sandbox_status),\n metrics: normalizeMetrics(item.metrics),\n agent: normalizeAgent(item.agent),\n workspace: normalizeWorkspace(item.workspace),\n tags: normalizeTags(item.tags),\n launched_agent_profile: normalizeLaunchedAgentProfile(\n item.launched_agent_profile,\n ),\n // SDK-runtime ACP model fields (populated when the agent-server supports\n // ``ConversationInfo.current_model_*``). Consumed by the conversation\n // adapter to drive the per-card chip's model text. Older agent-servers\n // omit these — adapter handles ``undefined`` / ``null`` gracefully.\n current_model_id: stringOrNull(item.current_model_id),\n current_model_name: stringOrNull(item.current_model_name),\n };\n}\n\nfunction requireDirectConversationItems(\n items: unknown,\n): DirectConversationInfo[] {\n if (!Array.isArray(items)) {\n throw invalidConversationResponse();\n }\n return items.map(requireDirectConversationInfo);\n}\n\nfunction requireConversationSearchPage(page: unknown): {\n items: DirectConversationInfo[];\n next_page_id: string | null;\n} {\n if (Array.isArray(page)) {\n return {\n items: requireDirectConversationItems(page),\n next_page_id: null,\n };\n }\n\n if (!isRecord(page)) {\n throw invalidConversationResponse();\n }\n\n return {\n items: requireDirectConversationItems(page.items),\n next_page_id:\n typeof page.next_page_id === \"string\" ? page.next_page_id : null,\n };\n}\n\nconst RUNTIME_STATUSES = new Set<string>([\n \"idle\",\n \"running\",\n \"paused\",\n \"waiting_for_confirmation\",\n \"finished\",\n \"error\",\n \"stuck\",\n]);\n\nfunction toRuntimeStatus(\n status: DirectConversationInfo[\"execution_status\"],\n): RuntimeConversationInfo[\"status\"] {\n const nextStatus = status ?? \"idle\";\n return (\n RUNTIME_STATUSES.has(nextStatus) ? nextStatus : \"idle\"\n ) as RuntimeConversationInfo[\"status\"];\n}\n\nfunction requireAppConversation(\n conversation: AppConversation | null | undefined,\n conversationId: string,\n): AppConversation {\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} was not found`);\n }\n return conversation;\n}\n\nclass AgentServerConversationService {\n static async sendMessage(\n conversationId: string,\n message: SendMessageRequest,\n runtime?: ConversationRuntimeContext | null,\n ): Promise<SendMessageResponse> {\n const active = getActiveBackend().backend;\n let conversationUrl = runtime?.conversationUrl ?? null;\n let sessionApiKey = runtime?.sessionApiKey ?? null;\n\n if (active.kind === \"cloud\") {\n if (!conversationUrl || !sessionApiKey) {\n const [conversation] = await batchGetCloudConversations([\n conversationId,\n ]);\n conversationUrl = conversation?.conversation_url?.trim() ?? null;\n sessionApiKey = conversation?.session_api_key?.trim() ?? null;\n }\n\n if (!conversationUrl || !sessionApiKey) {\n throw new Error(\n \"Conversation sandbox is still starting. Wait for it to finish, then try again.\",\n );\n }\n\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/events`,\n body: { ...message, run: true },\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n\n return message;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).sendEvent(conversationId, message, {\n run: true,\n });\n\n return message;\n }\n\n static async createConversation(\n initialUserMsg?: string,\n conversationInstructions?: string,\n plugins?: PluginSpec[],\n metadata?: ConversationMetadata | null,\n workingDirOverride?: string,\n workspaceMode?: WorkspaceMode,\n parentConversationId?: string,\n agentType?: \"default\" | \"plan\",\n sandboxId?: string,\n // Launch from a saved AgentProfile (resolved server-side) instead of the\n // current encrypted agent_settings (#3727). Supported on both local and the\n // cloud app-server (OpenHands #15060): local threads it through the\n // encrypted-settings builder; cloud sends it as a flat request field.\n agentProfileId?: string,\n agentProfileKind?: AgentKind,\n ): Promise<AppConversationStartTask> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n // When launching from a profile, send `agent_profile_id`; the backend\n // resolves it to agent_settings server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n agent_profile_id: agentProfileId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const [settings, profiles] = await Promise.all([\n SettingsService.getSettings(),\n ProfilesService.listProfiles().catch(() => undefined),\n ]);\n const titleLlmProfile = resolveTitleLlmProfile(\n settings.title_llm_profile,\n profiles,\n );\n const conversationId = uuidv4();\n // @spec WUP-001 — Send an absolute working_dir to the agent-server.\n // The default is `workspace/project/<hex>` (relative); without\n // resolving it here, `/api/file/upload` later prepends `/` and writes\n // to `/workspace/...` (read-only on macOS and fresh containers). When\n // the user picks an explicit workspace, `workingDirOverride` is\n // already absolute (it comes from `search_subdirs`).\n const workingDir = await resolveAbsoluteAgentServerPath(\n workingDirOverride ?? buildConversationWorkingDir(conversationId),\n );\n const resolvedWorkspaceMode =\n workspaceMode ?? (workingDirOverride ? \"local_repo\" : \"new_worktree\");\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n // The agent-server rejects a parent in a different workspace, so callers\n // launching a child must pass the parent's own `working_dir` as\n // `workingDirOverride` (see `resolveConversationWorkingDir`). Servers\n // older than 1.37.1 ignore the field and create an unlinked conversation.\n parentConversationId,\n workingDir,\n worktree: resolvedWorkspaceMode === \"new_worktree\",\n agentProfileId,\n agentProfileKind,\n titleLlmProfile,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions({ timeout: CREATE_CONVERSATION_TIMEOUT_MS }),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n workspace_mode: resolvedWorkspaceMode,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n type RawRuntime = DirectConversationInfo & {\n stats?: RuntimeConversationInfo[\"stats\"];\n };\n\n // Fetch directly from the per-conversation runtime agent-server at conversationUrl.\n const response = await new ConversationClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getConversation<RawRuntime>(conversationId);\n const data = requireDirectConversationInfo(response);\n const stats = isRecord(response) ? response.stats : null;\n\n return {\n id: data.id,\n title: data.title?.trim()\n ? data.title\n : getDefaultConversationTitle(data.id),\n metrics: normalizeMetrics(data.metrics),\n created_at: data.created_at,\n updated_at: data.updated_at,\n status: toRuntimeStatus(data.execution_status),\n stats: isRecord(stats) ? stats : { usage_to_metrics: {} },\n };\n }\n\n static async searchConversations(\n limit: number = 20,\n pageId?: string,\n ): Promise<AppConversationPage> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return searchCloudConversations(limit, pageId);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).searchConversations({\n limit,\n page_id: pageId,\n sort_order: ConversationSortOrder.UPDATED_AT_DESC,\n });\n\n return toConversationPage(requireConversationSearchPage(data));\n }\n\n static async deleteConversation(conversationId: string): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n await deleteCloudConversation(conversationId);\n } else {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).deleteConversation(conversationId);\n }\n removeStoredConversationMetadata(conversationId);\n }\n\n static async updateConversationTitle(\n conversationId: string,\n title: string,\n ): Promise<AppConversation> {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).updateConversation(conversationId, {\n title,\n });\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n /**\n * Forks a conversation, copying event history up to and including\n * `fromEventId`. Local agent-server only; needs agent-server >= 1.31.0 for\n * `from_event_id` (older backends copy the whole conversation).\n */\n static async forkConversation(\n sourceConversationId: string,\n fromEventId: string,\n title?: string,\n ): Promise<DirectConversationInfo> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"Branching a conversation isn't supported on the cloud backend yet.\",\n );\n }\n\n // `from_event_id` is accepted by `/fork` but not yet typed in\n // ForkConversationRequest (through client 1.32.0); the client forwards the\n // body verbatim, so cast to carry it. A title also suppresses the backend\n // auto-title, so the \"(branch)\" marker sticks.\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).forkConversation<DirectConversationInfo>(sourceConversationId, {\n from_event_id: fromEventId,\n ...(title ? { title } : {}),\n } as ForkConversationRequest & { from_event_id: string });\n\n // Carry over the source's client-side metadata (repo/branch/workspace/\n // profile/plugins) so the fork hydrates its chat-page badges the same way.\n const sourceMetadata = getStoredConversationMetadata(sourceConversationId);\n if (sourceMetadata) {\n setStoredConversationMetadata(data.id, sourceMetadata);\n }\n\n return data;\n }\n\n /**\n * Returns an event's `parent_id` (the fork point for branching *before* it),\n * or undefined at the root. Uses the single-event endpoint because the events\n * *search* API omits `parent_id`.\n */\n static async getEventParentId(\n conversationId: string,\n eventId: string,\n ): Promise<string | undefined> {\n const event = (await new ConversationClient(\n getAgentServerClientOptions(),\n ).getEvent(conversationId, eventId)) as { parent_id?: string | null };\n return event.parent_id ?? undefined;\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n *\n * Cloud backends route to the app-server's per-conversation\n * `/switch_profile`, which owns the profiles and resolves the swap\n * server-side (base_url/api_key fixups, usage_id derivation, then the\n * agent-server's switch_llm) — so the client only forwards the profile name,\n * mirroring {@link switchAcpModel}.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n\n if (backend.kind === \"cloud\") {\n // No conversation (home page): activate globally so the next\n // conversation starts with it. ProfilesService routes to the cloud\n // activate endpoint.\n if (!conversationId) {\n await ProfilesService.activateProfile(profileName);\n return;\n }\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_profile`,\n body: { profile_name: profileName },\n });\n return;\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await assertSubscriptionAuthReady({ llm: profile.config });\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Keep streaming on after a switch (parity with conversation start);\n // the profile config would otherwise default it to stream=False.\n stream: true,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * Works on a created-but-not-yet-run conversation too: the agent-server\n * treats a pre-first-run switch as a persist-only deferral (the model is\n * mirrored into the conversation's stored agent and applied when the session\n * starts). The home/no-conversation default is persisted via the active ACP\n * profile / Settings instead (see ``use-switch-acp-model``).\n */\n static async switchAcpModel(\n conversationId: string,\n model: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n if (backend.kind === \"cloud\") {\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_acp_model`,\n body: { model },\n });\n return;\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":"+vCAwEA,IAAM,EAAiC,2BAIjC,EAAiC,IAAS,IAC1C,EACJ,qLAGF,SAAS,GAAqC,CAC5C,OAAW,MAAM,CAAqC,CACxD,CAEA,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,IAC7C,CAEA,SAAS,EAAa,EAAwB,CAC5C,OAAO,OAAO,GAAU,SAAW,EAAQ,CAC7C,CAEA,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,IAC7C,CAEA,SAAS,EACP,EACA,EACA,EACQ,CACR,IAAM,EAAQ,EAAK,IAAa,EAAK,GACrC,OAAO,OAAO,GAAU,UAAY,EAAM,KAAK,EAC3C,EACA,CACN,CAEA,SAAS,EACP,EACgE,CAGhE,OAFK,EAAS,CAAK,EAEZ,CACL,cAAe,EAAa,EAAM,aAAa,EAC/C,kBAAmB,EAAa,EAAM,iBAAiB,EACvD,kBAAmB,EAAa,EAAM,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ACX,EACA,EACe,CACf,GAAM,CAAE,WAAY,EAAA,iBAAiB,EAErC,GAAI,EAAQ,OAAS,QAAS,CAI5B,GAAI,CAAC,EAAgB,CACnB,MAAM,EAAA,QAAgB,gBAAgB,CAAW,EACjD,MACF,CACA,MAAM,EAAA,eAAe,CACnB,UACA,OAAQ,OACR,KAAM,6BAA6B,EAAe,iBAClD,KAAM,CAAE,aAAc,CAAY,CACpC,CAAC,EACD,MACF,CAEA,GAAI,CAAC,EAAgB,CACnB,MAAM,IAAI,EAAA,eAAe,EAAA,4BAA4B,CAAC,EAAE,gBACtD,CACF,EACA,MACF,CAEA,IAAM,EAAgB,EAAA,4BAA4B,EAC5C,EAAqB,IAAI,EAAA,mBAAmB,CAAa,EACzD,EAAU,MAAM,IAAI,EAAA,eAAe,CAAa,EAAE,WACtD,EACA,CAAE,cAAe,WAAY,CAC/B,EACM,EACJ,OAAO,EAAQ,OAAO,OAAU,SAAW,EAAQ,OAAO,MAAQ,GACpE,GAAI,CAAC,EAAO,MAAU,MAAM,YAAY,EAAY,gBAAgB,EACpE,MAAM,EAAA,4BAA4B,CAAE,IAAK,EAAQ,MAAO,CAAC,EACzD,MAAM,EAAmB,UAAU,EAAgB,CACjD,GAAG,EAAQ,OACX,QAGA,OAAQ,GAER,SAAU,WAAW,EAAY,GAAG,EAAA,QAAO,GAC7C,CAAc,CAChB,CAeA,aAAa,eACX,EACA,EACe,CACf,GAAM,CAAE,WAAY,EAAA,iBAAiB,EACrC,GAAI,EAAQ,OAAS,QAAS,CAC5B,MAAM,EAAA,eAAe,CACnB,UACA,OAAQ,OACR,KAAM,6BAA6B,EAAe,mBAClD,KAAM,CAAE,OAAM,CAChB,CAAC,EACD,MACF,CAEA,MAAM,IAAI,EAAA,mBAAmB,EAAA,4BAA4B,CAAC,EAAE,eAC1D,EACA,CACF,CACF,CACF"}
1
+ {"version":3,"file":"agent-server-conversation-service.api.cjs","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type ForkConversationRequest,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { AgentKind, Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport { resolveAbsoluteAgentServerPath } from \"../agent-server-home\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport ProfilesService from \"../profiles-service/profiles-service.api\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n assertSubscriptionAuthReady,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n type WorkspaceMode,\n} from \"../conversation-metadata-store\";\nimport { resolveTitleLlmProfile } from \"#/utils/title-llm-profile\";\nimport type {\n GetHooksResponse,\n PluginSpec,\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n MetricsSnapshot,\n RuntimeConversationInfo,\n SendMessageRequest,\n SendMessageResponse,\n} from \"./agent-server-conversation-service.types\";\n\nconst DEFAULT_CONVERSATION_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\n// Creating the first conversation right after a cold agent-server boot (fresh\n// machine or the packaged desktop app, where uvx may still be warming caches)\n// can exceed the client's 60s default timeout.\nconst CREATE_CONVERSATION_TIMEOUT_MS = 5 * 60 * 1000;\nconst INVALID_CONVERSATION_RESPONSE_MESSAGE =\n \"Unable to load conversations because the selected agent server returned \" +\n \"data this UI does not understand. Check the backend URL/session key and \" +\n \"update the agent server if needed.\";\nfunction invalidConversationResponse(): Error {\n return new Error(INVALID_CONVERSATION_RESPONSE_MESSAGE);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === \"number\" ? value : null;\n}\n\nfunction numberOrZero(value: unknown): number {\n return typeof value === \"number\" ? value : 0;\n}\n\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readTimestamp(\n item: Record<string, unknown>,\n snakeKey: \"created_at\" | \"updated_at\",\n camelKey: \"createdAt\" | \"updatedAt\",\n): string {\n const value = item[snakeKey] ?? item[camelKey];\n return typeof value === \"string\" && value.trim()\n ? value\n : DEFAULT_CONVERSATION_TIMESTAMP;\n}\n\nfunction normalizeTokenUsage(\n value: unknown,\n): NonNullable<MetricsSnapshot[\"accumulated_token_usage\"]> | null {\n if (!isRecord(value)) return null;\n\n return {\n prompt_tokens: numberOrZero(value.prompt_tokens),\n completion_tokens: numberOrZero(value.completion_tokens),\n cache_read_tokens: numberOrZero(value.cache_read_tokens),\n cache_write_tokens: numberOrZero(value.cache_write_tokens),\n context_window: numberOrZero(value.context_window),\n per_turn_token: numberOrZero(value.per_turn_token),\n };\n}\n\nfunction normalizeMetrics(value: unknown): MetricsSnapshot | null {\n if (!isRecord(value)) return null;\n\n return {\n accumulated_cost: numberOrNull(value.accumulated_cost),\n max_budget_per_task: numberOrNull(value.max_budget_per_task),\n accumulated_token_usage: normalizeTokenUsage(value.accumulated_token_usage),\n };\n}\n\nfunction normalizeAgent(value: unknown): DirectConversationInfo[\"agent\"] {\n if (!isRecord(value)) return null;\n const llm = isRecord(value.llm)\n ? { model: stringOrNull(value.llm.model) }\n : null;\n // ``kind`` is the SDK's pydantic discriminator (``\"Agent\"`` vs ``\"ACPAgent\"``);\n // ``toAppConversation`` reads it to derive ``agent_kind``. ``acp_server`` is\n // the ACP provider identity (``ACPAgent.acp_server``, SDK #3692) — required so\n // the adapter can source the chip + in-conversation model list from the agent\n // when the ``acpserver`` tag is absent (a profile launch doesn't stamp it,\n // #1571). ``acp_model`` is the Canvas-configured model — preserved so the chip\n // can fall back to it when the SDK runtime model fields aren't populated.\n // Preserving these makes the wire path agree with the unit-test path that\n // builds ``DirectConversationInfo`` directly\n // (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_server: stringOrNull(value.acp_server),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction normalizeLaunchedAgentProfile(\n value: unknown,\n): DirectConversationInfo[\"launched_agent_profile\"] {\n if (!isRecord(value)) return null;\n const { agent_profile_id: agentProfileId, revision } = value;\n if (typeof agentProfileId !== \"string\" || typeof revision !== \"number\") {\n return null;\n }\n return { agent_profile_id: agentProfileId, revision };\n}\n\nfunction normalizeAbsolutePath(path: string): string | null {\n if (!path.startsWith(\"/\")) return null;\n\n const segments: string[] = [];\n for (const segment of path.split(\"/\")) {\n if (segment && segment !== \".\") {\n if (segment === \"..\") {\n if (!segments.length) return null;\n segments.pop();\n } else {\n segments.push(segment);\n }\n }\n }\n\n return `/${segments.join(\"/\")}`;\n}\n\nfunction requirePathInsideDirectory(path: string, directory: string): string {\n const normalizedPath = normalizeAbsolutePath(path);\n const normalizedDirectory = normalizeAbsolutePath(directory);\n\n if (\n !normalizedPath ||\n !normalizedDirectory ||\n (normalizedPath !== normalizedDirectory &&\n !normalizedPath.startsWith(`${normalizedDirectory}/`))\n ) {\n throw new Error(\"Conversation file path must stay inside the workspace\");\n }\n\n return normalizedPath;\n}\n\nfunction requireDirectConversationInfo(item: unknown): DirectConversationInfo {\n if (!isRecord(item) || typeof item.id !== \"string\" || !item.id.trim()) {\n throw invalidConversationResponse();\n }\n\n return {\n id: item.id.trim(),\n title: stringOrNull(item.title),\n created_at: readTimestamp(item, \"created_at\", \"createdAt\"),\n updated_at: readTimestamp(item, \"updated_at\", \"updatedAt\"),\n execution_status: stringOrNull(item.execution_status),\n sandbox_status: stringOrNull(item.sandbox_status),\n metrics: normalizeMetrics(item.metrics),\n agent: normalizeAgent(item.agent),\n workspace: normalizeWorkspace(item.workspace),\n tags: normalizeTags(item.tags),\n launched_agent_profile: normalizeLaunchedAgentProfile(\n item.launched_agent_profile,\n ),\n // SDK-runtime ACP model fields (populated when the agent-server supports\n // ``ConversationInfo.current_model_*``). Consumed by the conversation\n // adapter to drive the per-card chip's model text. Older agent-servers\n // omit these — adapter handles ``undefined`` / ``null`` gracefully.\n current_model_id: stringOrNull(item.current_model_id),\n current_model_name: stringOrNull(item.current_model_name),\n };\n}\n\nfunction requireDirectConversationItems(\n items: unknown,\n): DirectConversationInfo[] {\n if (!Array.isArray(items)) {\n throw invalidConversationResponse();\n }\n return items.map(requireDirectConversationInfo);\n}\n\nfunction requireConversationSearchPage(page: unknown): {\n items: DirectConversationInfo[];\n next_page_id: string | null;\n} {\n if (Array.isArray(page)) {\n return {\n items: requireDirectConversationItems(page),\n next_page_id: null,\n };\n }\n\n if (!isRecord(page)) {\n throw invalidConversationResponse();\n }\n\n return {\n items: requireDirectConversationItems(page.items),\n next_page_id:\n typeof page.next_page_id === \"string\" ? page.next_page_id : null,\n };\n}\n\nconst RUNTIME_STATUSES = new Set<string>([\n \"idle\",\n \"running\",\n \"paused\",\n \"waiting_for_confirmation\",\n \"finished\",\n \"error\",\n \"stuck\",\n]);\n\nfunction toRuntimeStatus(\n status: DirectConversationInfo[\"execution_status\"],\n): RuntimeConversationInfo[\"status\"] {\n const nextStatus = status ?? \"idle\";\n return (\n RUNTIME_STATUSES.has(nextStatus) ? nextStatus : \"idle\"\n ) as RuntimeConversationInfo[\"status\"];\n}\n\nfunction requireAppConversation(\n conversation: AppConversation | null | undefined,\n conversationId: string,\n): AppConversation {\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} was not found`);\n }\n return conversation;\n}\n\n/**\n * Options for {@link AgentServerConversationService.createConversation}.\n */\nexport interface CreateConversationOptions {\n initialUserMsg?: string;\n conversationInstructions?: string;\n plugins?: PluginSpec[];\n metadata?: ConversationMetadata | null;\n workingDirOverride?: string;\n workspaceMode?: WorkspaceMode;\n parentConversationId?: string;\n agentType?: \"default\" | \"plan\";\n sandboxId?: string;\n // Launch from a saved AgentProfile (resolved server-side) instead of the\n // current encrypted agent_settings (#3727). Supported on both local and the\n // cloud app-server (OpenHands #15060): local threads it through the\n // encrypted-settings builder; cloud sends it as a flat request field.\n agentProfileId?: string;\n agentProfileKind?: AgentKind;\n}\n\nclass AgentServerConversationService {\n static async sendMessage(\n conversationId: string,\n message: SendMessageRequest,\n runtime?: ConversationRuntimeContext | null,\n ): Promise<SendMessageResponse> {\n const active = getActiveBackend().backend;\n let conversationUrl = runtime?.conversationUrl ?? null;\n let sessionApiKey = runtime?.sessionApiKey ?? null;\n\n if (active.kind === \"cloud\") {\n if (!conversationUrl || !sessionApiKey) {\n const [conversation] = await batchGetCloudConversations([\n conversationId,\n ]);\n conversationUrl = conversation?.conversation_url?.trim() ?? null;\n sessionApiKey = conversation?.session_api_key?.trim() ?? null;\n }\n\n if (!conversationUrl || !sessionApiKey) {\n throw new Error(\n \"Conversation sandbox is still starting. Wait for it to finish, then try again.\",\n );\n }\n\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/events`,\n body: { ...message, run: true },\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n\n return message;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).sendEvent(conversationId, message, {\n run: true,\n });\n\n return message;\n }\n\n static async createConversation(\n options: CreateConversationOptions = {},\n ): Promise<AppConversationStartTask> {\n const {\n initialUserMsg,\n conversationInstructions,\n plugins,\n metadata,\n workingDirOverride,\n workspaceMode,\n parentConversationId,\n agentType,\n sandboxId,\n agentProfileId,\n agentProfileKind,\n } = options;\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n // When launching from a profile, send `agent_profile_id`; the backend\n // resolves it to agent_settings server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n agent_profile_id: agentProfileId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const [settings, profiles] = await Promise.all([\n SettingsService.getSettings(),\n ProfilesService.listProfiles().catch(() => undefined),\n ]);\n const titleLlmProfile = resolveTitleLlmProfile(\n settings.title_llm_profile,\n profiles,\n );\n const conversationId = uuidv4();\n // @spec WUP-001 — Send an absolute working_dir to the agent-server.\n // The default is `workspace/project/<hex>` (relative); without\n // resolving it here, `/api/file/upload` later prepends `/` and writes\n // to `/workspace/...` (read-only on macOS and fresh containers). When\n // the user picks an explicit workspace, `workingDirOverride` is\n // already absolute (it comes from `search_subdirs`).\n const workingDir = await resolveAbsoluteAgentServerPath(\n workingDirOverride ?? buildConversationWorkingDir(conversationId),\n );\n const resolvedWorkspaceMode =\n workspaceMode ?? (workingDirOverride ? \"local_repo\" : \"new_worktree\");\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n // The agent-server rejects a parent in a different workspace, so callers\n // launching a child must pass the parent's own `working_dir` as\n // `workingDirOverride` (see `resolveConversationWorkingDir`). Servers\n // older than 1.37.1 ignore the field and create an unlinked conversation.\n parentConversationId,\n workingDir,\n worktree: resolvedWorkspaceMode === \"new_worktree\",\n agentProfileId,\n agentProfileKind,\n titleLlmProfile,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions({ timeout: CREATE_CONVERSATION_TIMEOUT_MS }),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n workspace_mode: resolvedWorkspaceMode,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n type RawRuntime = DirectConversationInfo & {\n stats?: RuntimeConversationInfo[\"stats\"];\n };\n\n // Fetch directly from the per-conversation runtime agent-server at conversationUrl.\n const response = await new ConversationClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getConversation<RawRuntime>(conversationId);\n const data = requireDirectConversationInfo(response);\n const stats = isRecord(response) ? response.stats : null;\n\n return {\n id: data.id,\n title: data.title?.trim()\n ? data.title\n : getDefaultConversationTitle(data.id),\n metrics: normalizeMetrics(data.metrics),\n created_at: data.created_at,\n updated_at: data.updated_at,\n status: toRuntimeStatus(data.execution_status),\n stats: isRecord(stats) ? stats : { usage_to_metrics: {} },\n };\n }\n\n /**\n * Force condensation (\"compact\") of the conversation history via\n * `POST /api/conversations/{id}/condense`. Routed the same way as\n * {@link sendMessage}: through the cloud proxy at the conversation's own\n * runtime host for cloud backends, directly against that runtime otherwise.\n */\n static async condenseConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<void> {\n const active = getActiveBackend().backend;\n\n if (active.kind === \"cloud\" && conversationUrl) {\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/condense`,\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n return;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).condenseConversation(conversationId);\n }\n\n static async searchConversations(\n limit: number = 20,\n pageId?: string,\n ): Promise<AppConversationPage> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return searchCloudConversations(limit, pageId);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).searchConversations({\n limit,\n page_id: pageId,\n sort_order: ConversationSortOrder.UPDATED_AT_DESC,\n });\n\n return toConversationPage(requireConversationSearchPage(data));\n }\n\n static async deleteConversation(conversationId: string): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n await deleteCloudConversation(conversationId);\n } else {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).deleteConversation(conversationId);\n }\n removeStoredConversationMetadata(conversationId);\n }\n\n static async updateConversationTitle(\n conversationId: string,\n title: string,\n ): Promise<AppConversation> {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).updateConversation(conversationId, {\n title,\n });\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n /**\n * Forks a conversation, copying event history up to and including\n * `fromEventId`. Local agent-server only; needs agent-server >= 1.31.0 for\n * `from_event_id` (older backends copy the whole conversation).\n */\n static async forkConversation(\n sourceConversationId: string,\n fromEventId: string,\n title?: string,\n ): Promise<DirectConversationInfo> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"Branching a conversation isn't supported on the cloud backend yet.\",\n );\n }\n\n // `from_event_id` is accepted by `/fork` but not yet typed in\n // ForkConversationRequest (through client 1.32.0); the client forwards the\n // body verbatim, so cast to carry it. A title also suppresses the backend\n // auto-title, so the \"(branch)\" marker sticks.\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).forkConversation<DirectConversationInfo>(sourceConversationId, {\n from_event_id: fromEventId,\n ...(title ? { title } : {}),\n } as ForkConversationRequest & { from_event_id: string });\n\n // Carry over the source's client-side metadata (repo/branch/workspace/\n // profile/plugins) so the fork hydrates its chat-page badges the same way.\n const sourceMetadata = getStoredConversationMetadata(sourceConversationId);\n if (sourceMetadata) {\n setStoredConversationMetadata(data.id, sourceMetadata);\n }\n\n return data;\n }\n\n /**\n * Returns an event's `parent_id` (the fork point for branching *before* it),\n * or undefined at the root. Uses the single-event endpoint because the events\n * *search* API omits `parent_id`.\n */\n static async getEventParentId(\n conversationId: string,\n eventId: string,\n ): Promise<string | undefined> {\n const event = (await new ConversationClient(\n getAgentServerClientOptions(),\n ).getEvent(conversationId, eventId)) as { parent_id?: string | null };\n return event.parent_id ?? undefined;\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n *\n * Cloud backends route to the app-server's per-conversation\n * `/switch_profile`, which owns the profiles and resolves the swap\n * server-side (base_url/api_key fixups, usage_id derivation, then the\n * agent-server's switch_llm) — so the client only forwards the profile name,\n * mirroring {@link switchAcpModel}.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n\n if (backend.kind === \"cloud\") {\n // No conversation (home page): activate globally so the next\n // conversation starts with it. ProfilesService routes to the cloud\n // activate endpoint.\n if (!conversationId) {\n await ProfilesService.activateProfile(profileName);\n return;\n }\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_profile`,\n body: { profile_name: profileName },\n });\n return;\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await assertSubscriptionAuthReady({ llm: profile.config });\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Keep streaming on after a switch (parity with conversation start);\n // the profile config would otherwise default it to stream=False.\n stream: true,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * Works on a created-but-not-yet-run conversation too: the agent-server\n * treats a pre-first-run switch as a persist-only deferral (the model is\n * mirrored into the conversation's stored agent and applied when the session\n * starts). The home/no-conversation default is persisted via the active ACP\n * profile / Settings instead (see ``use-switch-acp-model``).\n */\n static async switchAcpModel(\n conversationId: string,\n model: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n if (backend.kind === \"cloud\") {\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_acp_model`,\n body: { model },\n });\n return;\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":"+vCAwEA,IAAM,EAAiC,2BAIjC,EAAiC,IAAS,IAC1C,EACJ,qLAGF,SAAS,GAAqC,CAC5C,OAAW,MAAM,CAAqC,CACxD,CAEA,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,IAC7C,CAEA,SAAS,EAAa,EAAwB,CAC5C,OAAO,OAAO,GAAU,SAAW,EAAQ,CAC7C,CAEA,SAAS,EAAa,EAA+B,CACn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,CAAE,cAAe,WAAY,CAC/B,EACM,EACJ,OAAO,EAAQ,OAAO,OAAU,SAAW,EAAQ,OAAO,MAAQ,GACpE,GAAI,CAAC,EAAO,MAAU,MAAM,YAAY,EAAY,gBAAgB,EACpE,MAAM,EAAA,4BAA4B,CAAE,IAAK,EAAQ,MAAO,CAAC,EACzD,MAAM,EAAmB,UAAU,EAAgB,CACjD,GAAG,EAAQ,OACX,QAGA,OAAQ,GAER,SAAU,WAAW,EAAY,GAAG,EAAA,QAAO,GAC7C,CAAc,CAChB,CAeA,aAAa,eACX,EACA,EACe,CACf,GAAM,CAAE,WAAY,EAAA,iBAAiB,EACrC,GAAI,EAAQ,OAAS,QAAS,CAC5B,MAAM,EAAA,eAAe,CACnB,UACA,OAAQ,OACR,KAAM,6BAA6B,EAAe,mBAClD,KAAM,CAAE,OAAM,CAChB,CAAC,EACD,MACF,CAEA,MAAM,IAAI,EAAA,mBAAmB,EAAA,4BAA4B,CAAC,EAAE,eAC1D,EACA,CACF,CACF,CACF"}
@@ -4,9 +4,25 @@ import { DirectConversationInfo } from "../agent-server-adapter";
4
4
  import { GetVSCodeUrlResponse } from "../open-hands.types";
5
5
  import { ConversationMetadata, type WorkspaceMode } from "../conversation-metadata-store";
6
6
  import type { GetHooksResponse, PluginSpec, AppConversation, AppConversationPage, AppConversationStartTask, RuntimeConversationInfo, SendMessageRequest, SendMessageResponse } from "./agent-server-conversation-service.types";
7
+ /**
8
+ * Options for {@link AgentServerConversationService.createConversation}.
9
+ */
10
+ export interface CreateConversationOptions {
11
+ initialUserMsg?: string;
12
+ conversationInstructions?: string;
13
+ plugins?: PluginSpec[];
14
+ metadata?: ConversationMetadata | null;
15
+ workingDirOverride?: string;
16
+ workspaceMode?: WorkspaceMode;
17
+ parentConversationId?: string;
18
+ agentType?: "default" | "plan";
19
+ sandboxId?: string;
20
+ agentProfileId?: string;
21
+ agentProfileKind?: AgentKind;
22
+ }
7
23
  declare class AgentServerConversationService {
8
24
  static sendMessage(conversationId: string, message: SendMessageRequest, runtime?: ConversationRuntimeContext | null): Promise<SendMessageResponse>;
9
- static createConversation(initialUserMsg?: string, conversationInstructions?: string, plugins?: PluginSpec[], metadata?: ConversationMetadata | null, workingDirOverride?: string, workspaceMode?: WorkspaceMode, parentConversationId?: string, agentType?: "default" | "plan", sandboxId?: string, agentProfileId?: string, agentProfileKind?: AgentKind): Promise<AppConversationStartTask>;
25
+ static createConversation(options?: CreateConversationOptions): Promise<AppConversationStartTask>;
10
26
  static getStartTask(taskId: string): Promise<AppConversationStartTask | null>;
11
27
  static getVSCodeUrl(conversationId: string, conversationUrl: string | null | undefined, sessionApiKey?: string | null): Promise<GetVSCodeUrlResponse>;
12
28
  static resolveConversationWorkingDir(conversationId: string): Promise<string>;
@@ -17,6 +33,13 @@ declare class AgentServerConversationService {
17
33
  static downloadConversation(conversationId: string): Promise<Blob>;
18
34
  static getHooks(conversationId: string): Promise<GetHooksResponse>;
19
35
  static getRuntimeConversation(conversationId: string, conversationUrl: string | null | undefined, sessionApiKey?: string | null): Promise<RuntimeConversationInfo>;
36
+ /**
37
+ * Force condensation ("compact") of the conversation history via
38
+ * `POST /api/conversations/{id}/condense`. Routed the same way as
39
+ * {@link sendMessage}: through the cloud proxy at the conversation's own
40
+ * runtime host for cloud backends, directly against that runtime otherwise.
41
+ */
42
+ static condenseConversation(conversationId: string, conversationUrl: string | null | undefined, sessionApiKey?: string | null): Promise<void>;
20
43
  static searchConversations(limit?: number, pageId?: string): Promise<AppConversationPage>;
21
44
  static deleteConversation(conversationId: string): Promise<void>;
22
45
  static updateConversationTitle(conversationId: string, title: string): Promise<AppConversation>;
@@ -16,67 +16,67 @@ import w from "../../node_modules/uuid/dist/v4.js";
16
16
  import { resolveAbsoluteAgentServerPath as T } from "../agent-server-home.js";
17
17
  import E from "../profiles-service/profiles-service.api.js";
18
18
  import D from "../settings-service/settings-service.api.js";
19
- import { assertSubscriptionAuthReady as O, buildStartConversationRequestWithEncryptedSettings as ee, emptyHooksResponse as k, getDefaultConversationTitle as A, toAppConversation as j, toConversationPage as M } from "../agent-server-adapter.js";
20
- import { resolveTitleLlmProfile as N } from "../../utils/title-llm-profile.js";
19
+ import { assertSubscriptionAuthReady as O, buildStartConversationRequestWithEncryptedSettings as k, emptyHooksResponse as A, getDefaultConversationTitle as j, toAppConversation as M, toConversationPage as N } from "../agent-server-adapter.js";
20
+ import { resolveTitleLlmProfile as P } from "../../utils/title-llm-profile.js";
21
21
  //#region src/api/conversation-service/agent-server-conversation-service.api.ts
22
- var P = "1970-01-01T00:00:00.000Z", F = 300 * 1e3, I = "Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.";
23
- function L() {
24
- return /* @__PURE__ */ Error(I);
22
+ var F = "1970-01-01T00:00:00.000Z", I = 300 * 1e3, L = "Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.";
23
+ function R() {
24
+ return /* @__PURE__ */ Error(L);
25
25
  }
26
- function R(e) {
26
+ function z(e) {
27
27
  return typeof e == "object" && !!e && !Array.isArray(e);
28
28
  }
29
- function z(e) {
29
+ function B(e) {
30
30
  return typeof e == "number" ? e : null;
31
31
  }
32
- function B(e) {
32
+ function V(e) {
33
33
  return typeof e == "number" ? e : 0;
34
34
  }
35
- function V(e) {
35
+ function H(e) {
36
36
  return typeof e == "string" ? e : null;
37
37
  }
38
- function H(e, t, n) {
38
+ function U(e, t, n) {
39
39
  let r = e[t] ?? e[n];
40
- return typeof r == "string" && r.trim() ? r : P;
41
- }
42
- function U(e) {
43
- return R(e) ? {
44
- prompt_tokens: B(e.prompt_tokens),
45
- completion_tokens: B(e.completion_tokens),
46
- cache_read_tokens: B(e.cache_read_tokens),
47
- cache_write_tokens: B(e.cache_write_tokens),
48
- context_window: B(e.context_window),
49
- per_turn_token: B(e.per_turn_token)
50
- } : null;
40
+ return typeof r == "string" && r.trim() ? r : F;
51
41
  }
52
42
  function W(e) {
53
- return R(e) ? {
54
- accumulated_cost: z(e.accumulated_cost),
55
- max_budget_per_task: z(e.max_budget_per_task),
56
- accumulated_token_usage: U(e.accumulated_token_usage)
43
+ return z(e) ? {
44
+ prompt_tokens: V(e.prompt_tokens),
45
+ completion_tokens: V(e.completion_tokens),
46
+ cache_read_tokens: V(e.cache_read_tokens),
47
+ cache_write_tokens: V(e.cache_write_tokens),
48
+ context_window: V(e.context_window),
49
+ per_turn_token: V(e.per_turn_token)
57
50
  } : null;
58
51
  }
59
52
  function G(e) {
60
- if (!R(e)) return null;
61
- let t = R(e.llm) ? { model: V(e.llm.model) } : null;
53
+ return z(e) ? {
54
+ accumulated_cost: B(e.accumulated_cost),
55
+ max_budget_per_task: B(e.max_budget_per_task),
56
+ accumulated_token_usage: W(e.accumulated_token_usage)
57
+ } : null;
58
+ }
59
+ function K(e) {
60
+ if (!z(e)) return null;
61
+ let t = z(e.llm) ? { model: H(e.llm.model) } : null;
62
62
  return {
63
- kind: V(e.kind),
64
- acp_server: V(e.acp_server),
65
- acp_model: V(e.acp_model),
63
+ kind: H(e.kind),
64
+ acp_server: H(e.acp_server),
65
+ acp_model: H(e.acp_model),
66
66
  llm: t
67
67
  };
68
68
  }
69
- function K(e) {
70
- return R(e) ? { working_dir: V(e.working_dir) } : null;
71
- }
72
69
  function q(e) {
73
- if (!R(e)) return null;
70
+ return z(e) ? { working_dir: H(e.working_dir) } : null;
71
+ }
72
+ function J(e) {
73
+ if (!z(e)) return null;
74
74
  let t = {};
75
75
  for (let [n, r] of Object.entries(e)) typeof r == "string" && (t[n] = r);
76
76
  return t;
77
77
  }
78
- function J(e) {
79
- if (!R(e)) return null;
78
+ function ee(e) {
79
+ if (!z(e)) return null;
80
80
  let { agent_profile_id: t, revision: n } = e;
81
81
  return typeof t != "string" || typeof n != "number" ? null : {
82
82
  agent_profile_id: t,
@@ -98,25 +98,25 @@ function X(e, t) {
98
98
  return n;
99
99
  }
100
100
  function Z(e) {
101
- if (!R(e) || typeof e.id != "string" || !e.id.trim()) throw L();
101
+ if (!z(e) || typeof e.id != "string" || !e.id.trim()) throw R();
102
102
  return {
103
103
  id: e.id.trim(),
104
- title: V(e.title),
105
- created_at: H(e, "created_at", "createdAt"),
106
- updated_at: H(e, "updated_at", "updatedAt"),
107
- execution_status: V(e.execution_status),
108
- sandbox_status: V(e.sandbox_status),
109
- metrics: W(e.metrics),
110
- agent: G(e.agent),
111
- workspace: K(e.workspace),
112
- tags: q(e.tags),
113
- launched_agent_profile: J(e.launched_agent_profile),
114
- current_model_id: V(e.current_model_id),
115
- current_model_name: V(e.current_model_name)
104
+ title: H(e.title),
105
+ created_at: U(e, "created_at", "createdAt"),
106
+ updated_at: U(e, "updated_at", "updatedAt"),
107
+ execution_status: H(e.execution_status),
108
+ sandbox_status: H(e.sandbox_status),
109
+ metrics: G(e.metrics),
110
+ agent: K(e.agent),
111
+ workspace: q(e.workspace),
112
+ tags: J(e.tags),
113
+ launched_agent_profile: ee(e.launched_agent_profile),
114
+ current_model_id: H(e.current_model_id),
115
+ current_model_name: H(e.current_model_name)
116
116
  };
117
117
  }
118
118
  function Q(e) {
119
- if (!Array.isArray(e)) throw L();
119
+ if (!Array.isArray(e)) throw R();
120
120
  return e.map(Z);
121
121
  }
122
122
  function te(e) {
@@ -124,7 +124,7 @@ function te(e) {
124
124
  items: Q(e),
125
125
  next_page_id: null
126
126
  };
127
- if (!R(e)) throw L();
127
+ if (!z(e)) throw R();
128
128
  return {
129
129
  items: Q(e.items),
130
130
  next_page_id: typeof e.next_page_id == "string" ? e.next_page_id : null
@@ -174,58 +174,59 @@ var ie = class {
174
174
  sessionApiKey: c
175
175
  })).sendEvent(t, n, { run: !0 }), n;
176
176
  }
177
- static async createConversation(t, n, r, i, o, d, f, m, h, _, v) {
177
+ static async createConversation(t = {}) {
178
+ let { initialUserMsg: n, conversationInstructions: r, plugins: i, metadata: o, workingDirOverride: d, workspaceMode: f, parentConversationId: m, agentType: h, sandboxId: _, agentProfileId: v, agentProfileKind: y } = t;
178
179
  if (s().backend.kind === "cloud") return g({
179
- initial_message: t ? {
180
+ initial_message: n ? {
180
181
  role: "user",
181
182
  content: [{
182
183
  type: "text",
183
- text: t
184
+ text: n
184
185
  }]
185
186
  } : null,
186
- title: n ?? null,
187
- selected_repository: i?.selected_repository ?? null,
188
- selected_branch: i?.selected_branch ?? null,
189
- git_provider: i?.git_provider ?? null,
190
- plugins: r ?? null,
191
- parent_conversation_id: f ?? null,
192
- agent_type: m,
193
- sandbox_id: h ?? null,
194
- agent_profile_id: _ ?? null
187
+ title: r ?? null,
188
+ selected_repository: o?.selected_repository ?? null,
189
+ selected_branch: o?.selected_branch ?? null,
190
+ git_provider: o?.git_provider ?? null,
191
+ plugins: i ?? null,
192
+ parent_conversation_id: m ?? null,
193
+ agent_type: h,
194
+ sandbox_id: _ ?? null,
195
+ agent_profile_id: v ?? null
195
196
  });
196
- let [y, b] = await Promise.all([D.getSettings(), E.listProfiles().catch(() => void 0)]), x = N(y.title_llm_profile, b), S = w(), C = await T(o ?? a(S)), O = d ?? (o ? "local_repo" : "new_worktree"), k = await ee({
197
- settings: y,
198
- query: t,
199
- conversationInstructions: n,
200
- plugins: r,
201
- conversationId: S,
202
- parentConversationId: f,
203
- workingDir: C,
204
- worktree: O === "new_worktree",
205
- agentProfileId: _,
206
- agentProfileKind: v,
207
- titleLlmProfile: x
208
- }), A = await new e(u({ timeout: F })).createConversation(k), j = c();
209
- if (!j) throw new l();
210
- return (i?.selected_repository || o) && p(A.id, {
211
- selected_repository: i?.selected_repository ?? null,
212
- selected_branch: i?.selected_branch ?? null,
213
- git_provider: i?.git_provider ?? null,
214
- selected_workspace: o ?? null,
215
- workspace_mode: O
197
+ let [b, x] = await Promise.all([D.getSettings(), E.listProfiles().catch(() => void 0)]), S = P(b.title_llm_profile, x), C = w(), O = await T(d ?? a(C)), A = f ?? (d ? "local_repo" : "new_worktree"), j = await k({
198
+ settings: b,
199
+ query: n,
200
+ conversationInstructions: r,
201
+ plugins: i,
202
+ conversationId: C,
203
+ parentConversationId: m,
204
+ workingDir: O,
205
+ worktree: A === "new_worktree",
206
+ agentProfileId: v,
207
+ agentProfileKind: y,
208
+ titleLlmProfile: S
209
+ }), M = await new e(u({ timeout: I })).createConversation(j), N = c();
210
+ if (!N) throw new l();
211
+ return (o?.selected_repository || d) && p(M.id, {
212
+ selected_repository: o?.selected_repository ?? null,
213
+ selected_branch: o?.selected_branch ?? null,
214
+ git_provider: o?.git_provider ?? null,
215
+ selected_workspace: d ?? null,
216
+ workspace_mode: A
216
217
  }), {
217
- id: A.id,
218
+ id: M.id,
218
219
  created_by_user_id: null,
219
220
  status: "READY",
220
221
  detail: null,
221
- app_conversation_id: A.id,
222
- agent_server_url: j.host,
222
+ app_conversation_id: M.id,
223
+ agent_server_url: N.host,
223
224
  request: {
224
- initial_message: k.initial_message,
225
- plugins: r ?? null
225
+ initial_message: j.initial_message,
226
+ plugins: i ?? null
226
227
  },
227
- created_at: A.created_at,
228
- updated_at: A.updated_at
228
+ created_at: M.created_at,
229
+ updated_at: M.updated_at
229
230
  };
230
231
  }
231
232
  static async getStartTask(e) {
@@ -246,7 +247,7 @@ var ie = class {
246
247
  return t?.workspace?.working_dir ?? o();
247
248
  }
248
249
  static async batchGetAppConversations(t) {
249
- return t.length === 0 ? [] : s().backend.kind === "cloud" ? h(t) : Q(await new e(u()).getConversations(t)).map((e) => j(e));
250
+ return t.length === 0 ? [] : s().backend.kind === "cloud" ? h(t) : Q(await new e(u()).getConversations(t)).map((e) => M(e));
250
251
  }
251
252
  static async updateConversationPublicFlag(e, t) {
252
253
  if (s().backend.kind !== "cloud") throw Error("Public sharing requires a cloud backend.");
@@ -271,25 +272,43 @@ var ie = class {
271
272
  return s().backend.kind === "cloud" ? v(e) : new t(u()).downloadTrajectory(e);
272
273
  }
273
274
  static async getHooks(e) {
274
- return k();
275
+ return A();
275
276
  }
276
277
  static async getRuntimeConversation(t, n, r) {
277
278
  let i = await new e(u({
278
279
  conversationUrl: n,
279
280
  sessionApiKey: r
280
- })).getConversation(t), a = Z(i), o = R(i) ? i.stats : null;
281
+ })).getConversation(t), a = Z(i), o = z(i) ? i.stats : null;
281
282
  return {
282
283
  id: a.id,
283
- title: a.title?.trim() ? a.title : A(a.id),
284
- metrics: W(a.metrics),
284
+ title: a.title?.trim() ? a.title : j(a.id),
285
+ metrics: G(a.metrics),
285
286
  created_at: a.created_at,
286
287
  updated_at: a.updated_at,
287
288
  status: re(a.execution_status),
288
- stats: R(o) ? o : { usage_to_metrics: {} }
289
+ stats: z(o) ? o : { usage_to_metrics: {} }
289
290
  };
290
291
  }
292
+ static async condenseConversation(t, n, r) {
293
+ let a = s().backend;
294
+ if (a.kind === "cloud" && n) {
295
+ await m({
296
+ backend: a,
297
+ method: "POST",
298
+ hostOverride: i(n),
299
+ path: `/api/conversations/${t}/condense`,
300
+ authMode: "session-api-key",
301
+ sessionApiKey: r
302
+ });
303
+ return;
304
+ }
305
+ await new e(u({
306
+ conversationUrl: n,
307
+ sessionApiKey: r
308
+ })).condenseConversation(t);
309
+ }
291
310
  static async searchConversations(t = 20, n) {
292
- return s().backend.kind === "cloud" ? x(t, n) : M(te(await new e(u()).searchConversations({
311
+ return s().backend.kind === "cloud" ? x(t, n) : N(te(await new e(u()).searchConversations({
293
312
  limit: t,
294
313
  page_id: n,
295
314
  sort_order: C.UPDATED_AT_DESC