@openhands/agent-canvas 1.0.0-rc.9 → 1.0.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 (595) hide show
  1. package/README.md +46 -31
  2. package/README.windows.md +2 -2
  3. package/bin/agent-canvas.mjs +3 -1
  4. package/build/assets/Trans-CBypf0vt.js +1 -0
  5. package/build/assets/{acp-providers-Dzb4nxxB.js → acp-providers-BMyF5WII.js} +1 -1
  6. package/build/assets/active-backend-context-Cy_Ui5d7.js +1 -0
  7. package/build/assets/add-backend-modal-CUw7x0zm.js +1 -0
  8. package/build/assets/{agent-server-client-options-wXLeJYeM.js → agent-server-client-options-FoO1qgAQ.js} +1 -1
  9. package/build/assets/agent-server-conversation-service.api-D6Cmbnhd.js +5 -0
  10. package/build/assets/{agent-settings-Blipgztd.js → agent-settings-DW4vwOaz.js} +2 -2
  11. package/build/assets/{alert-banner-Bsvys-hT.js → alert-banner-BHmoArV2.js} +1 -1
  12. package/build/assets/{analytics-consent-form-modal-Cujm1lCj.js → analytics-consent-form-modal-BNK0yu4L.js} +1 -1
  13. package/build/assets/api-key-entry-screen-BjVajIjf.js +1 -0
  14. package/build/assets/app-settings-C-5X6RzZ.js +1 -0
  15. package/build/assets/automation-detail-uDMoYmAc.js +1 -0
  16. package/build/assets/automations-list-DBCKCbId.js +1 -0
  17. package/build/assets/{back-nav-button-D20Avel_.js → back-nav-button-Bckz5Wh6.js} +1 -1
  18. package/build/assets/backend-form-modal-D2-XqJA4.js +1 -0
  19. package/build/assets/{backend-synced-settings-badge-Da0G6Lwv.js → backend-synced-settings-badge-Dx16CR_k.js} +1 -1
  20. package/build/assets/{base-modal-DvuGYyu1.js → base-modal-7QRNzf6r.js} +1 -1
  21. package/build/assets/{brand-button-9SOzmqPP.js → brand-button-CKLvirxz.js} +1 -1
  22. package/build/assets/browser-D1ZybR7v.js +5 -0
  23. package/build/assets/browser-store-hzasvz9c.js +1 -0
  24. package/build/assets/{browser-tab-bveyJhG9.js → browser-tab-iOQjXzmI.js} +1 -1
  25. package/build/assets/chat-send-button-_Uc9iFpG.js +1 -0
  26. package/build/assets/check-DfvhVBub.js +1 -0
  27. package/build/assets/{checkmark--JWAesua.js → checkmark-BHPhb50L.js} +1 -1
  28. package/build/assets/{chevron-down-B9j6lcFg.js → chevron-down-CMkqyPEY.js} +1 -1
  29. package/build/assets/{circle-plus-check-toggle-AO9DWyDX.js → circle-plus-check-toggle-ChmnRlpR.js} +1 -1
  30. package/build/assets/{close--W-tHn1h.js → close-DBs90sI6.js} +1 -1
  31. package/build/assets/{code-tag-chmctf4w.js → code-tag-BtHOqHwB.js} +1 -1
  32. package/build/assets/{color-themes-0biOprdo.js → color-themes-CBikRn3w.js} +1 -1
  33. package/build/assets/{combobox-caret-C9BNHfSu.js → combobox-caret-evUAh6YW.js} +1 -1
  34. package/build/assets/{command-store-UzKGSUC2.js → command-store-DZfR8QtE.js} +1 -1
  35. package/build/assets/condenser-settings-0tw3yXX8.js +1 -0
  36. package/build/assets/{confirmation-modal-Cq3eqvqH.js → confirmation-modal-DWuxe1zG.js} +1 -1
  37. package/build/assets/{context-menu-list-item-BQU0jZPq.js → context-menu-list-item-BbHFxHaq.js} +1 -1
  38. package/build/assets/conversation-B1v96pQf.js +19 -0
  39. package/build/assets/conversation-DgfcjCPm.js +1 -0
  40. package/build/assets/{conversation-local-storage-an3MiIiJ.js → conversation-local-storage-Btum2xBJ.js} +1 -1
  41. package/build/assets/conversation-panel-TJ7swm6a.js +1 -0
  42. package/build/assets/conversation-service.api-DXawvmNN.js +1 -0
  43. package/build/assets/conversation-state-store-DmuPn875.js +1 -0
  44. package/build/assets/{conversation-store-FQmakEd-.js → conversation-store-Bu89Yxg1.js} +1 -1
  45. package/build/assets/{conversation-tab-empty-state-C8tztloo.js → conversation-tab-empty-state-7js7FjYM.js} +1 -1
  46. package/build/assets/{copy-CdKN5rtJ.js → copy-B0SkXenR.js} +1 -1
  47. package/build/assets/copy-to-clipboard-button-CfH2EQz9.js +1 -0
  48. package/build/assets/{createLucideIcon-CkGTf9Qj.js → createLucideIcon-Bazr-V-B.js} +1 -1
  49. package/build/assets/declaration-Cn-NXHEy.js +1 -0
  50. package/build/assets/{device-verify-YuGXnpRk.js → device-verify-CWKyQ680.js} +1 -1
  51. package/build/assets/{dist-5dObF4p4.js → dist-Cbu6eGx8.js} +1 -1
  52. package/build/assets/dist-Dg2JWLGc.js +1 -0
  53. package/build/assets/{dropdown-classes-CVp0kVdt.js → dropdown-classes-BI1bI1ho.js} +1 -1
  54. package/build/assets/edit-automation-modal-DdAG6kFZ.js +1 -0
  55. package/build/assets/{ellipsis-button-k7HLwYth.js → ellipsis-button-DdCsOBHV.js} +1 -1
  56. package/build/assets/entry.client-DXyvKj5G.js +2 -0
  57. package/build/assets/{enum-filter-dropdown-COqUq3mB.js → enum-filter-dropdown-WROAIeys.js} +1 -1
  58. package/build/assets/{environment-switch-overlay-wB5LxfYZ.js → environment-switch-overlay-Dv0imPE6.js} +1 -1
  59. package/build/assets/{extensions-hub-BYCLWP3d.js → extensions-hub-CkyDPXvn.js} +1 -1
  60. package/build/assets/{extensions-navigation-3FLKfb6g.js → extensions-navigation-gMR-la1J.js} +1 -1
  61. package/build/assets/{external-link-BATfjnkz.js → external-link-FsutnU75.js} +1 -1
  62. package/build/assets/files-tab-DNUoveJZ.js +1 -0
  63. package/build/assets/files-tab-store-SyvkH3ic.js +1 -0
  64. package/build/assets/{folder-DPTBlxWb.js → folder-DusyBXDE.js} +1 -1
  65. package/build/assets/{globe-Dpgjreyy.js → globe-BUcin4kT.js} +1 -1
  66. package/build/assets/home-D809jWVS.js +1 -0
  67. package/build/assets/{iconBase-BVhFI-0E.js → iconBase-B6CXDDaE.js} +1 -1
  68. package/build/assets/index-redirect-nMYgOTBX.js +1 -0
  69. package/build/assets/install-server-modal-D92Qy57I.js +1 -0
  70. package/build/assets/{launch-CMZknx1e.js → launch-BnCG2g2a.js} +1 -1
  71. package/build/assets/lesson-plan-j-ZaE8vK.js +3 -0
  72. package/build/assets/{lightbulb-S616sGEL.js → lightbulb-BJ5tWmAh.js} +1 -1
  73. package/build/assets/{link-external-ooNztGLp.js → link-external-DUtmHAHi.js} +1 -1
  74. package/build/assets/{list-todo-nCa9zxVE.js → list-todo-C-gekh-4.js} +1 -1
  75. package/build/assets/{llm-client-D6EtdLBs.js → llm-client-BZUkZYlc.js} +1 -1
  76. package/build/assets/llm-not-configured-banner-PlvJ99rE.js +27 -0
  77. package/build/assets/llm-settings-Dgk32xRW.js +1 -0
  78. package/build/assets/llm-settings-Dxo7owKm.js +1 -0
  79. package/build/assets/llm-subscription-Bvu8BLXc.js +1 -0
  80. package/build/assets/llm-subscription-service-Bq6z3Wkv.js +1 -0
  81. package/build/assets/loader-circle-Cw7_q9hg.js +1 -0
  82. package/build/assets/{loading-spinner-D7bOU6I7.js → loading-spinner-RF3IlMF5.js} +1 -1
  83. package/build/assets/manage-backends-modal-BT66a6e0.js +1 -0
  84. package/build/assets/manifest-b8402d59.js +1 -0
  85. package/build/assets/markdown-renderer-Tw6FR2ad.js +2 -0
  86. package/build/assets/mcp-B_pA7vZg.js +9 -0
  87. package/build/assets/mcp-client-ppbYplKX.js +1 -0
  88. package/build/assets/messages-Cg9aNVi6.js +41 -0
  89. package/build/assets/{modal-backdrop-_VbcKk5K.js → modal-backdrop-DRpBVVW5.js} +1 -1
  90. package/build/assets/{modal-body-Cd-PtMHr.js → modal-body-CEV2O67p.js} +1 -1
  91. package/build/assets/{modal-classes-CNm4ovfm.js → modal-classes-B2DuQ9qD.js} +1 -1
  92. package/build/assets/{modal-close-button-Dbo0NAMt.js → modal-close-button-gtb7RHFB.js} +1 -1
  93. package/build/assets/model-selector-CAv3RrJ3.js +1 -0
  94. package/build/assets/{mouse-pointer-click-D0QNGSIo.js → mouse-pointer-click-B3i6HcaF.js} +1 -1
  95. package/build/assets/{navigation-context-BpAOh_t5.js → navigation-context-CM9JmTvm.js} +1 -1
  96. package/build/assets/{navigation-link-Dci7Nuyf.js → navigation-link-FmXzqR1J.js} +1 -1
  97. package/build/assets/onboarding-Q9CzuVWy.js +1 -0
  98. package/build/assets/{openhands-logo-Dzm-d_V_.js → openhands-logo-B4aEO2sf.js} +1 -1
  99. package/build/assets/option-service.api-C-s2BYZp.js +1 -0
  100. package/build/assets/organization-service.api-CXTKpFnV.js +1 -0
  101. package/build/assets/{path-utils-DKu3CNkH.js → path-utils-CE98fIFP.js} +1 -1
  102. package/build/assets/{pencil-DPEtl5QD.js → pencil-bWrxRWlr.js} +1 -1
  103. package/build/assets/{plan-components-CutRBi0G.js → plan-components-BF-X7vnQ.js} +1 -1
  104. package/build/assets/{planner-tab-YkOp7QXt.js → planner-tab-jkyaGiRc.js} +1 -1
  105. package/build/assets/plus-BTCK8WtR.js +1 -0
  106. package/build/assets/{profiles-client-BjUo3q05.js → profiles-client-CQ9L1yHR.js} +1 -1
  107. package/build/assets/providers-B3hkV58J.js +1 -0
  108. package/build/assets/proxy-BOcEWkCD.js +1 -0
  109. package/build/assets/{react-dom-hVBnwgwZ.js → react-dom-BBXlXOZX.js} +1 -1
  110. package/build/assets/{react-CM_dJw1Z.js → react-uQK8du1l.js} +1 -1
  111. package/build/assets/{react-Dy05vyj5.js → react-x84lbX6s.js} +1 -1
  112. package/build/assets/{recommended-automations-launcher-WxaZcjRD.js → recommended-automations-launcher-DMk35aFI.js} +11 -11
  113. package/build/assets/root-CV0kyxfP.js +2 -0
  114. package/build/assets/root-PB2Jnj61.css +1 -0
  115. package/build/assets/root-layout-Bl4Qzg5J.js +2 -0
  116. package/build/assets/{runtime-waiting-state-8i0Z3A_i.js → runtime-waiting-state-C1hJpXxl.js} +1 -1
  117. package/build/assets/sdk-section-page-DHbC2_j3.js +1 -0
  118. package/build/assets/sdk-settings-schema-z51bBmMl.js +1 -0
  119. package/build/assets/{search-C_l_XW4e.js → search-Dxm1MUMi.js} +1 -1
  120. package/build/assets/{secrets-service-Skzza9sx.js → secrets-service-DlScPUwy.js} +1 -1
  121. package/build/assets/secrets-settings-B97-JKBe.js +1 -0
  122. package/build/assets/settings-BpmooyBV.js +1 -0
  123. package/build/assets/{settings-dropdown-input-BP-arqjU.js → settings-dropdown-input-hIIAlmHb.js} +1 -1
  124. package/build/assets/{settings-gear-f-zWpxfI.js → settings-gear-DQLTCnFx.js} +1 -1
  125. package/build/assets/{settings-index-BLfmrKRl.js → settings-index-kKASonWk.js} +1 -1
  126. package/build/assets/{settings-input-BM8ANxDb.js → settings-input-BlOzCtP3.js} +1 -1
  127. package/build/assets/{settings-list-classes-B9uo5WES.js → settings-list-classes-BFRbCy4U.js} +1 -1
  128. package/build/assets/settings-modal-C4pZwj-l.js +1 -0
  129. package/build/assets/{settings-section-header-context-Cid25HM2.js → settings-section-header-context-iz4Go0dL.js} +1 -1
  130. package/build/assets/settings-service.api-DVLwi82B.js +1 -0
  131. package/build/assets/{settings-switch-xa6q4M6j.js → settings-switch-6cXIH-UE.js} +1 -1
  132. package/build/assets/{settings-utils--H_EvFjx.js → settings-utils-CfScEaPn.js} +1 -1
  133. package/build/assets/shared-conversation-CLkayApe.js +1 -0
  134. package/build/assets/sidebar-mobile-menu-toggle-C8uT4Mhd.js +1 -0
  135. package/build/assets/{sidebar-nav-link-BekRAssb.js → sidebar-nav-link-BKZiAQxQ.js} +1 -1
  136. package/build/assets/{skill-card-pill-row-DeodrwPG.js → skill-card-pill-row-D13WRKIE.js} +1 -1
  137. package/build/assets/{skills-BE5HJuGM.js → skills-NpRk6v79.js} +1 -1
  138. package/build/assets/{skills-client-CgraS-wA.js → skills-client-DsqwQEwj.js} +1 -1
  139. package/build/assets/{skills-plugins-rIza_fUf.js → skills-plugins-bkwxItAw.js} +1 -1
  140. package/build/assets/{skills-settings-Dvl7gpEx.js → skills-settings-DMbrlB2b.js} +2 -2
  141. package/build/assets/{square-chevron-right-BWAB7NPp.js → square-chevron-right-DxZKcVq4.js} +1 -1
  142. package/build/assets/{styled-tooltip-X61SEwqk.js → styled-tooltip-DG1ofAcS.js} +1 -1
  143. package/build/assets/suspense-sOGeme-f.js +1 -0
  144. package/build/assets/{switch-skeleton-BbIWemkK.js → switch-skeleton-CZ6XCVZk.js} +1 -1
  145. package/build/assets/{task-list-tab-BFnyHGsn.js → task-list-tab-CddMPNCD.js} +1 -1
  146. package/build/assets/telemetry-CX4mTZUw.js +2 -0
  147. package/build/assets/{terminal-BFypysgZ.js → terminal-BOAVxAej.js} +1 -1
  148. package/build/assets/{terminal-B92mACR5.js → terminal-DbtwHqt4.js} +1 -1
  149. package/build/assets/{toggle-switch-CL_wRiGs.js → toggle-switch-C0t6ge2m.js} +1 -1
  150. package/build/assets/{trash-2-C-RvV8WA.js → trash-2-Dmprz0A0.js} +1 -1
  151. package/build/assets/{typography-BLSEGjph.js → typography-CNHbO1eE.js} +1 -1
  152. package/build/assets/{u-check-circle-dG_VJqx5.js → u-check-circle-CX66WzfT.js} +1 -1
  153. package/build/assets/{u-check-circle-half-D-5ZPRnd.js → u-check-circle-half-Bj853Ub0.js} +1 -1
  154. package/build/assets/{u-circuit-BXoisXOA.js → u-circuit-B9bLCP7N.js} +1 -1
  155. package/build/assets/{u-edit-DIgADxLH.js → u-edit-D7JyvoWm.js} +1 -1
  156. package/build/assets/use-acp-credential-form-Cj_oUYd5.js +1 -0
  157. package/build/assets/{use-active-conversation-BkohEtaN.js → use-active-conversation-B64-yy2X.js} +1 -1
  158. package/build/assets/use-agent-settings-schema-BzbQYEzb.js +1 -0
  159. package/build/assets/{use-agent-state-DITv5qV7.js → use-agent-state-DxFk391r.js} +1 -1
  160. package/build/assets/{use-breakpoint-DpxHDmuH.js → use-breakpoint-Cent5lpI.js} +1 -1
  161. package/build/assets/{use-click-outside-element-DhxCUyWl.js → use-click-outside-element-DOYR26nw.js} +1 -1
  162. package/build/assets/{use-cloud-current-user-id-CSm3kgqy.js → use-cloud-current-user-id-BVf7pb8n.js} +1 -1
  163. package/build/assets/use-config-CvdJUq4E.js +1 -0
  164. package/build/assets/use-create-conversation-Cnouynop.js +1 -0
  165. package/build/assets/{use-create-secret-LObNBU3M.js → use-create-secret-Cgu4uxyr.js} +1 -1
  166. package/build/assets/{use-event-store-DNSmyzUh.js → use-event-store-Nv92IYMU.js} +1 -1
  167. package/build/assets/use-handle-plan-click-C7824bbe.js +1 -0
  168. package/build/assets/use-is-authed-mnJtd2bw.js +1 -0
  169. package/build/assets/{use-launch-skill-in-chat-BTgXIu3N.js → use-launch-skill-in-chat-NDUo_UCA.js} +1 -1
  170. package/build/assets/use-llm-profiles-9eH3Y3Ef.js +1 -0
  171. package/build/assets/use-runtime-is-ready-DEnxJH7W.js +1 -0
  172. package/build/assets/use-save-settings-DrClHnX7.js +1 -0
  173. package/build/assets/use-settings-BNAoCX93.js +1 -0
  174. package/build/assets/{use-settings-nav-items-ykMjd_NG.js → use-settings-nav-items-CLIW2p2n.js} +2 -2
  175. package/build/assets/{use-skills-_unimM2d.js → use-skills-B9gOHrOj.js} +1 -1
  176. package/build/assets/{use-task-list-E5t-jtgs.js → use-task-list-DLKPnq3I.js} +1 -1
  177. package/build/assets/{use-tracking-C9P88zSo.js → use-tracking-Dph_dRlL.js} +1 -1
  178. package/build/assets/{use-user-conversation-2jZZ-MLA.js → use-user-conversation-leIsQH1B.js} +1 -1
  179. package/build/assets/useMutation-cXADjWAv.js +1 -0
  180. package/build/assets/useQuery-BQr6A6ry.js +1 -0
  181. package/build/assets/useTranslation-Bp1btAjp.js +1 -0
  182. package/build/assets/{utils-eXk6yerZ.js → utils-o-OXNtEy.js} +1 -1
  183. package/build/assets/v4-DOSjXdIn.js +1 -0
  184. package/build/assets/{vendor~browser-tab-BGJDGHyS.js → vendor~browser-tab-642bOcE1.js} +1 -1
  185. package/build/assets/{vendor~conversation-panel~conversation-D98u43rl.js → vendor~conversation-panel~conversation-DqmbnXRn.js} +1 -1
  186. package/build/assets/{vendor~conversation-panel~conversation~alert-banner-CtjHOMO_.js → vendor~conversation-panel~conversation~alert-banner-CSDVP1nw.js} +1 -1
  187. package/build/assets/{vendor~conversation-panel~conversation~index-BXt2-3Cc.js → vendor~conversation-panel~conversation~index-DITarr3F.js} +1 -1
  188. package/build/assets/{vendor~entry.client-DrAdOKqA.js → vendor~entry.client-CQ77DucR.js} +1 -1
  189. package/build/assets/{vendor~entry.client-EcEhmoJW.js → vendor~entry.client-ePAFmSwg.js} +1 -1
  190. package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~f0pn7nss-DUk-MwlC.js +177 -0
  191. package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lb3qbbk3-BvmOva8I.js +1 -0
  192. package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~lpdshwee-Cl4h-NSi.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~lpdshwee-BkQQxq_q.js} +1 -1
  193. package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-BmOMM-6e.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-8xF3WeB9.js} +1 -1
  194. package/build/assets/{vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-BjMt2JeR.js → vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~nyk4vv4g-UzR6fe3Y.js} +1 -1
  195. package/build/assets/{vendor~files-tab--640YzQO.js → vendor~files-tab-Cko7Kr5k.js} +1 -1
  196. package/build/assets/{vendor~home~conversation-panel~conversation-dhKA2JVJ.js → vendor~home~conversation-panel~conversation-D3otw5Jn.js} +1 -1
  197. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DMOoHVBy.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CMdKUYP2.js} +1 -1
  198. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BoE6JRJj.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DSR6Mugx.js} +1 -1
  199. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Dqpi2xyZ.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DdOzMvB1.js} +1 -1
  200. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DX2CmDJ0.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Dj2eezvL.js} +1 -1
  201. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BNExlCqT.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DyN8jeZz.js} +1 -1
  202. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DCn1M97v.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-lpEWrbMA.js} +1 -1
  203. package/build/assets/{vendor~launch-C0VvUe2W.js → vendor~launch-DoYO54df.js} +1 -1
  204. package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-COLUW-6M.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-BGwU2SbU.js} +1 -1
  205. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation-eG1kjEbj.js → vendor~root-layout~home~conversation-panel~conversation-Iqs0j4Wo.js} +1 -1
  206. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-7eqKdLSQ.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-BdS6bbw9.js} +1 -1
  207. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-BP3MGAAY.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-Fd3F3jth.js} +1 -1
  208. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~ceijy54y-Dkd2wxJA.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~ceijy54y-Cg0AqwMN.js} +2 -2
  209. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~bxn4ldi1-_LydBB1e.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~bxn4ldi1-BlsbqRyZ.js} +1 -1
  210. package/build/assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~ec6pk3ix-CBICqfKC.js +48 -0
  211. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~mcp~automati~dou5smdo-DavKsAvB.js → vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~nv6afr11-BYNoKMU0.js} +97 -69
  212. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CsO1gYxF.js → vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BspUuSsP.js} +1 -1
  213. package/build/assets/{vendor~root-layout~home~mcp~automations-list-D40jgugf.js → vendor~root-layout~home~mcp~automations-list-C9U_eOqU.js} +1 -1
  214. package/build/assets/{vendor~root-layout~home~mcp~automations-list-cNHi83v_.js → vendor~root-layout~home~mcp~automations-list-DhQ3LPVw.js} +1 -1
  215. package/build/assets/{vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-xCM3k6Rd.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-BEbhHQYg.js} +1 -1
  216. package/build/assets/{vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-BIm99UaF.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-DdgDNzMc.js} +2 -2
  217. package/build/assets/{verification-settings-EUkt_CkZ.js → verification-settings-D7R-Ne6L.js} +1 -1
  218. package/build/assets/x-DCZg87p7.js +1 -0
  219. package/build/assets/{x-mark-C42svtnu.js → x-mark-jrBTJbnP.js} +1 -1
  220. package/build/index.html +4 -4
  221. package/build/locales/ar/openhands.json +22 -0
  222. package/build/locales/ca/openhands.json +22 -0
  223. package/build/locales/de/openhands.json +22 -0
  224. package/build/locales/en/openhands.json +22 -0
  225. package/build/locales/es/openhands.json +22 -0
  226. package/build/locales/fr/openhands.json +22 -0
  227. package/build/locales/it/openhands.json +22 -0
  228. package/build/locales/ja/openhands.json +22 -0
  229. package/build/locales/ko-KR/openhands.json +22 -0
  230. package/build/locales/no/openhands.json +22 -0
  231. package/build/locales/pt/openhands.json +22 -0
  232. package/build/locales/tr/openhands.json +22 -0
  233. package/build/locales/uk/openhands.json +22 -0
  234. package/build/locales/zh-CN/openhands.json +22 -0
  235. package/build/locales/zh-TW/openhands.json +22 -0
  236. package/config/defaults.json +4 -2
  237. package/dist/api/agent-server-adapter.cjs +3 -3
  238. package/dist/api/agent-server-adapter.cjs.map +1 -1
  239. package/dist/api/agent-server-adapter.d.ts +8 -0
  240. package/dist/api/agent-server-adapter.js +82 -80
  241. package/dist/api/agent-server-adapter.js.map +1 -1
  242. package/dist/api/agent-server-compatibility.cjs +1 -1
  243. package/dist/api/agent-server-compatibility.cjs.map +1 -1
  244. package/dist/api/agent-server-compatibility.d.ts +10 -0
  245. package/dist/api/agent-server-compatibility.js +69 -25
  246. package/dist/api/agent-server-compatibility.js.map +1 -1
  247. package/dist/api/backend-registry/default-backend.cjs +1 -1
  248. package/dist/api/backend-registry/default-backend.cjs.map +1 -1
  249. package/dist/api/backend-registry/default-backend.d.ts +6 -5
  250. package/dist/api/backend-registry/default-backend.js +1 -1
  251. package/dist/api/backend-registry/default-backend.js.map +1 -1
  252. package/dist/api/backend-registry/storage.cjs +1 -1
  253. package/dist/api/backend-registry/storage.cjs.map +1 -1
  254. package/dist/api/backend-registry/storage.js +38 -68
  255. package/dist/api/backend-registry/storage.js.map +1 -1
  256. package/dist/api/cloud/proxy.cjs +1 -1
  257. package/dist/api/cloud/proxy.cjs.map +1 -1
  258. package/dist/api/cloud/proxy.d.ts +3 -16
  259. package/dist/api/cloud/proxy.js +1 -1
  260. package/dist/api/cloud/proxy.js.map +1 -1
  261. package/dist/api/conversation-service/agent-server-conversation-service.api.cjs +1 -1
  262. package/dist/api/conversation-service/agent-server-conversation-service.api.cjs.map +1 -1
  263. package/dist/api/conversation-service/agent-server-conversation-service.api.js +75 -75
  264. package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
  265. package/dist/api/llm-subscription-service.cjs +2 -0
  266. package/dist/api/llm-subscription-service.cjs.map +1 -0
  267. package/dist/api/llm-subscription-service.d.ts +23 -0
  268. package/dist/api/llm-subscription-service.js +109 -0
  269. package/dist/api/llm-subscription-service.js.map +1 -0
  270. package/dist/api/mcp-service/mcp-service.api.cjs +1 -1
  271. package/dist/api/mcp-service/mcp-service.api.cjs.map +1 -1
  272. package/dist/api/mcp-service/mcp-service.api.d.ts +2 -3
  273. package/dist/api/mcp-service/mcp-service.api.js +38 -13
  274. package/dist/api/mcp-service/mcp-service.api.js.map +1 -1
  275. package/dist/api/settings-service/settings-service.api.cjs +1 -1
  276. package/dist/api/settings-service/settings-service.api.cjs.map +1 -1
  277. package/dist/api/settings-service/settings-service.api.js +41 -42
  278. package/dist/api/settings-service/settings-service.api.js.map +1 -1
  279. package/dist/components/conversation-events/chat/messages.cjs +1 -1
  280. package/dist/components/conversation-events/chat/messages.cjs.map +1 -1
  281. package/dist/components/conversation-events/chat/messages.js +4 -4
  282. package/dist/components/conversation-events/chat/messages.js.map +1 -1
  283. package/dist/components/features/backends/backend-form-modal.cjs +1 -1
  284. package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
  285. package/dist/components/features/backends/backend-form-modal.js +136 -135
  286. package/dist/components/features/backends/backend-form-modal.js.map +1 -1
  287. package/dist/components/features/backends/backend-selector.cjs +1 -1
  288. package/dist/components/features/backends/backend-selector.cjs.map +1 -1
  289. package/dist/components/features/backends/backend-selector.js +103 -91
  290. package/dist/components/features/backends/backend-selector.js.map +1 -1
  291. package/dist/components/features/backends/manage-backends-modal.cjs +1 -1
  292. package/dist/components/features/backends/manage-backends-modal.cjs.map +1 -1
  293. package/dist/components/features/backends/manage-backends-modal.js +14 -8
  294. package/dist/components/features/backends/manage-backends-modal.js.map +1 -1
  295. package/dist/components/features/chat/path-component.cjs +1 -1
  296. package/dist/components/features/chat/path-component.cjs.map +1 -1
  297. package/dist/components/features/chat/path-component.js +1 -1
  298. package/dist/components/features/chat/path-component.js.map +1 -1
  299. package/dist/components/features/home/workspace-dropdown/folder-browser-modal.cjs +1 -1
  300. package/dist/components/features/home/workspace-dropdown/folder-browser-modal.cjs.map +1 -1
  301. package/dist/components/features/home/workspace-dropdown/folder-browser-modal.js +77 -66
  302. package/dist/components/features/home/workspace-dropdown/folder-browser-modal.js.map +1 -1
  303. package/dist/components/features/mcp-page/custom-server-editor.cjs +1 -1
  304. package/dist/components/features/mcp-page/custom-server-editor.cjs.map +1 -1
  305. package/dist/components/features/mcp-page/custom-server-editor.js +1 -0
  306. package/dist/components/features/mcp-page/custom-server-editor.js.map +1 -1
  307. package/dist/components/features/mcp-page/install-server-modal.cjs +1 -1
  308. package/dist/components/features/mcp-page/install-server-modal.cjs.map +1 -1
  309. package/dist/components/features/mcp-page/install-server-modal.js +73 -46
  310. package/dist/components/features/mcp-page/install-server-modal.js.map +1 -1
  311. package/dist/components/features/mcp-page/marketplace-card.cjs +1 -1
  312. package/dist/components/features/mcp-page/marketplace-card.cjs.map +1 -1
  313. package/dist/components/features/mcp-page/marketplace-card.js +6 -2
  314. package/dist/components/features/mcp-page/marketplace-card.js.map +1 -1
  315. package/dist/components/features/settings/brand-button.cjs +1 -1
  316. package/dist/components/features/settings/brand-button.cjs.map +1 -1
  317. package/dist/components/features/settings/brand-button.js +1 -1
  318. package/dist/components/features/settings/brand-button.js.map +1 -1
  319. package/dist/components/features/settings/llm-settings/openai-subscription-auth-card.cjs +2 -0
  320. package/dist/components/features/settings/llm-settings/openai-subscription-auth-card.cjs.map +1 -0
  321. package/dist/components/features/settings/llm-settings/openai-subscription-auth-card.d.ts +5 -0
  322. package/dist/components/features/settings/llm-settings/openai-subscription-auth-card.js +167 -0
  323. package/dist/components/features/settings/llm-settings/openai-subscription-auth-card.js.map +1 -0
  324. package/dist/components/shared/modals/settings/model-selector.cjs +1 -1
  325. package/dist/components/shared/modals/settings/model-selector.cjs.map +1 -1
  326. package/dist/components/shared/modals/settings/model-selector.d.ts +1 -2
  327. package/dist/components/shared/modals/settings/model-selector.js +59 -65
  328. package/dist/components/shared/modals/settings/model-selector.js.map +1 -1
  329. package/dist/components/shared/modals/settings/settings-form.cjs +1 -1
  330. package/dist/components/shared/modals/settings/settings-form.cjs.map +1 -1
  331. package/dist/components/shared/modals/settings/settings-form.js +1 -2
  332. package/dist/components/shared/modals/settings/settings-form.js.map +1 -1
  333. package/dist/config/defaults.cjs +2 -0
  334. package/dist/config/defaults.cjs.map +1 -0
  335. package/dist/config/defaults.js +35 -0
  336. package/dist/config/defaults.js.map +1 -0
  337. package/dist/constants/llm-subscription.cjs +2 -0
  338. package/dist/constants/llm-subscription.cjs.map +1 -0
  339. package/dist/constants/llm-subscription.d.ts +16 -0
  340. package/dist/constants/llm-subscription.js +47 -0
  341. package/dist/constants/llm-subscription.js.map +1 -0
  342. package/dist/contexts/conversation-websocket-context.cjs +1 -1
  343. package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
  344. package/dist/contexts/conversation-websocket-context.js +1 -1
  345. package/dist/contexts/conversation-websocket-context.js.map +1 -1
  346. package/dist/hooks/mutation/use-llm-subscription-auth.cjs +2 -0
  347. package/dist/hooks/mutation/use-llm-subscription-auth.cjs.map +1 -0
  348. package/dist/hooks/mutation/use-llm-subscription-auth.d.ts +3 -0
  349. package/dist/hooks/mutation/use-llm-subscription-auth.js +30 -0
  350. package/dist/hooks/mutation/use-llm-subscription-auth.js.map +1 -0
  351. package/dist/hooks/mutation/use-save-fields-as-secrets.cjs +1 -1
  352. package/dist/hooks/mutation/use-save-fields-as-secrets.cjs.map +1 -1
  353. package/dist/hooks/mutation/use-save-fields-as-secrets.d.ts +8 -6
  354. package/dist/hooks/mutation/use-save-fields-as-secrets.js +1 -1
  355. package/dist/hooks/mutation/use-save-fields-as-secrets.js.map +1 -1
  356. package/dist/hooks/mutation/use-test-mcp-server.d.ts +1 -1
  357. package/dist/hooks/query/query-keys.cjs +1 -1
  358. package/dist/hooks/query/query-keys.cjs.map +1 -1
  359. package/dist/hooks/query/query-keys.d.ts +5 -0
  360. package/dist/hooks/query/query-keys.js +14 -2
  361. package/dist/hooks/query/query-keys.js.map +1 -1
  362. package/dist/hooks/query/use-agent-settings-schema.cjs +1 -1
  363. package/dist/hooks/query/use-agent-settings-schema.cjs.map +1 -1
  364. package/dist/hooks/query/use-agent-settings-schema.d.ts +2 -2
  365. package/dist/hooks/query/use-agent-settings-schema.js +21 -19
  366. package/dist/hooks/query/use-agent-settings-schema.js.map +1 -1
  367. package/dist/hooks/query/use-backends-health.cjs +1 -1
  368. package/dist/hooks/query/use-backends-health.cjs.map +1 -1
  369. package/dist/hooks/query/use-backends-health.js +38 -36
  370. package/dist/hooks/query/use-backends-health.js.map +1 -1
  371. package/dist/hooks/query/use-llm-subscription-models.cjs +2 -0
  372. package/dist/hooks/query/use-llm-subscription-models.cjs.map +1 -0
  373. package/dist/hooks/query/use-llm-subscription-models.d.ts +3 -0
  374. package/dist/hooks/query/use-llm-subscription-models.js +19 -0
  375. package/dist/hooks/query/use-llm-subscription-models.js.map +1 -0
  376. package/dist/hooks/query/use-llm-subscription-status.cjs +2 -0
  377. package/dist/hooks/query/use-llm-subscription-status.cjs.map +1 -0
  378. package/dist/hooks/query/use-llm-subscription-status.d.ts +3 -0
  379. package/dist/hooks/query/use-llm-subscription-status.js +19 -0
  380. package/dist/hooks/query/use-llm-subscription-status.js.map +1 -0
  381. package/dist/hooks/use-websocket.cjs +1 -1
  382. package/dist/hooks/use-websocket.cjs.map +1 -1
  383. package/dist/hooks/use-websocket.d.ts +0 -1
  384. package/dist/hooks/use-websocket.js +37 -38
  385. package/dist/hooks/use-websocket.js.map +1 -1
  386. package/dist/i18n/declaration.cjs +1 -1
  387. package/dist/i18n/declaration.cjs.map +1 -1
  388. package/dist/i18n/declaration.d.ts +22 -0
  389. package/dist/i18n/declaration.js +1 -1
  390. package/dist/i18n/declaration.js.map +1 -1
  391. package/dist/i18n/translation.cjs +2 -2
  392. package/dist/i18n/translation.cjs.map +1 -1
  393. package/dist/i18n/translation.js +374 -0
  394. package/dist/i18n/translation.js.map +1 -1
  395. package/dist/locales/ar/openhands.json +22 -0
  396. package/dist/locales/ca/openhands.json +22 -0
  397. package/dist/locales/de/openhands.json +22 -0
  398. package/dist/locales/en/openhands.json +22 -0
  399. package/dist/locales/es/openhands.json +22 -0
  400. package/dist/locales/fr/openhands.json +22 -0
  401. package/dist/locales/it/openhands.json +22 -0
  402. package/dist/locales/ja/openhands.json +22 -0
  403. package/dist/locales/ko-KR/openhands.json +22 -0
  404. package/dist/locales/no/openhands.json +22 -0
  405. package/dist/locales/pt/openhands.json +22 -0
  406. package/dist/locales/tr/openhands.json +22 -0
  407. package/dist/locales/uk/openhands.json +22 -0
  408. package/dist/locales/zh-CN/openhands.json +22 -0
  409. package/dist/locales/zh-TW/openhands.json +22 -0
  410. package/dist/node_modules/@openhands/extensions/integrations/catalog/github.cjs +1 -1
  411. package/dist/node_modules/@openhands/extensions/integrations/catalog/github.cjs.map +1 -1
  412. package/dist/node_modules/@openhands/extensions/integrations/catalog/github.js +10 -22
  413. package/dist/node_modules/@openhands/extensions/integrations/catalog/github.js.map +1 -1
  414. package/dist/node_modules/@openhands/extensions/skills/index.cjs +97 -69
  415. package/dist/node_modules/@openhands/extensions/skills/index.cjs.map +1 -1
  416. package/dist/node_modules/@openhands/extensions/skills/index.js +3 -3
  417. package/dist/node_modules/@openhands/extensions/skills/index.js.map +1 -1
  418. package/dist/package.cjs +1 -1
  419. package/dist/package.cjs.map +1 -1
  420. package/dist/package.js +3 -5
  421. package/dist/package.js.map +1 -1
  422. package/dist/routes/files-tab.cjs +1 -1
  423. package/dist/routes/files-tab.cjs.map +1 -1
  424. package/dist/routes/files-tab.js +28 -17
  425. package/dist/routes/files-tab.js.map +1 -1
  426. package/dist/routes/llm-settings.cjs +1 -1
  427. package/dist/routes/llm-settings.cjs.map +1 -1
  428. package/dist/routes/llm-settings.js +142 -85
  429. package/dist/routes/llm-settings.js.map +1 -1
  430. package/dist/services/canvas-ui.cjs +1 -1
  431. package/dist/services/canvas-ui.cjs.map +1 -1
  432. package/dist/services/canvas-ui.d.ts +1 -1
  433. package/dist/services/canvas-ui.js +2 -2
  434. package/dist/services/canvas-ui.js.map +1 -1
  435. package/dist/stores/files-tab-store.cjs +1 -1
  436. package/dist/stores/files-tab-store.cjs.map +1 -1
  437. package/dist/stores/files-tab-store.d.ts +2 -1
  438. package/dist/stores/files-tab-store.js +5 -1
  439. package/dist/stores/files-tab-store.js.map +1 -1
  440. package/dist/stores/use-event-store.cjs +1 -1
  441. package/dist/stores/use-event-store.cjs.map +1 -1
  442. package/dist/stores/use-event-store.js +39 -34
  443. package/dist/stores/use-event-store.js.map +1 -1
  444. package/dist/types/mcp-server.d.ts +21 -0
  445. package/dist/ui/dropdown/dropdown.cjs +1 -1
  446. package/dist/ui/dropdown/dropdown.cjs.map +1 -1
  447. package/dist/ui/dropdown/dropdown.js +6 -2
  448. package/dist/ui/dropdown/dropdown.js.map +1 -1
  449. package/dist/utils/handle-event-for-ui.cjs +1 -1
  450. package/dist/utils/handle-event-for-ui.cjs.map +1 -1
  451. package/dist/utils/handle-event-for-ui.d.ts +2 -0
  452. package/dist/utils/handle-event-for-ui.js +1 -1
  453. package/dist/utils/handle-event-for-ui.js.map +1 -1
  454. package/dist/utils/llm-subscription-schema.cjs +2 -0
  455. package/dist/utils/llm-subscription-schema.cjs.map +1 -0
  456. package/dist/utils/llm-subscription-schema.d.ts +2 -0
  457. package/dist/utils/llm-subscription-schema.js +22 -0
  458. package/dist/utils/llm-subscription-schema.js.map +1 -0
  459. package/dist/utils/mcp-config.cjs +1 -1
  460. package/dist/utils/mcp-config.cjs.map +1 -1
  461. package/dist/utils/mcp-config.js +32 -17
  462. package/dist/utils/mcp-config.js.map +1 -1
  463. package/dist/utils/mcp-credential-validation.cjs +2 -0
  464. package/dist/utils/mcp-credential-validation.cjs.map +1 -0
  465. package/dist/utils/mcp-credential-validation.d.ts +22 -0
  466. package/dist/utils/mcp-credential-validation.js +31 -0
  467. package/dist/utils/mcp-credential-validation.js.map +1 -0
  468. package/dist/utils/mcp-marketplace-utils.cjs +1 -1
  469. package/dist/utils/mcp-marketplace-utils.cjs.map +1 -1
  470. package/dist/utils/mcp-marketplace-utils.d.ts +7 -2
  471. package/dist/utils/mcp-marketplace-utils.js +33 -48
  472. package/dist/utils/mcp-marketplace-utils.js.map +1 -1
  473. package/dist/utils/sdk-settings-schema.cjs +1 -1
  474. package/dist/utils/sdk-settings-schema.cjs.map +1 -1
  475. package/dist/utils/sdk-settings-schema.js +64 -61
  476. package/dist/utils/sdk-settings-schema.js.map +1 -1
  477. package/package.json +3 -5
  478. package/scripts/check-sdk-version-sync.mjs +9 -27
  479. package/scripts/dev-with-automation.mjs +1 -3
  480. package/scripts/docker-build.mjs +0 -4
  481. package/scripts/run-staged-typecheck.mjs +44 -0
  482. package/build/assets/QueryClientProvider-XcSjsfpb.js +0 -1
  483. package/build/assets/Trans-sy4l4TyQ.js +0 -1
  484. package/build/assets/active-backend-context-B2OSC-qe.js +0 -1
  485. package/build/assets/add-backend-modal-lG8XDYjr.js +0 -1
  486. package/build/assets/agent-server-adapter-BPpZcLOE.js +0 -5
  487. package/build/assets/agent-server-conversation-service.api-C4Fc9Jnp.js +0 -1
  488. package/build/assets/api-key-entry-screen-BarZU9nr.js +0 -1
  489. package/build/assets/app-settings-CofRfixq.js +0 -1
  490. package/build/assets/automation-detail-BV4Cn0O8.js +0 -1
  491. package/build/assets/automations-list-BaJ61q7P.js +0 -1
  492. package/build/assets/backend-form-modal-B3BCZDPq.js +0 -1
  493. package/build/assets/browser-store-JRrcGdlk.js +0 -1
  494. package/build/assets/browser-wz8UzRmF.js +0 -5
  495. package/build/assets/chat-send-button-DzRpAQr4.js +0 -1
  496. package/build/assets/check-BhnsMsWy.js +0 -1
  497. package/build/assets/condenser-settings-Bo07FAEi.js +0 -1
  498. package/build/assets/context-CI9FqkUp.js +0 -1
  499. package/build/assets/conversation-DDdRyW4z.js +0 -19
  500. package/build/assets/conversation-panel-Dww2uJOd.js +0 -1
  501. package/build/assets/conversation-rGQV1Eym.js +0 -1
  502. package/build/assets/conversation-service.api-ByRiRU1e.js +0 -1
  503. package/build/assets/conversation-state-store-NEktJKfL.js +0 -1
  504. package/build/assets/declaration-D9ucT0fq.js +0 -1
  505. package/build/assets/dist-BCpEDEJq.js +0 -1
  506. package/build/assets/edit-automation-modal-CpA_JKLY.js +0 -1
  507. package/build/assets/entry.client-DUpefbBp.js +0 -2
  508. package/build/assets/files-tab-CBUPwSV1.js +0 -1
  509. package/build/assets/files-tab-store-DSKUhziI.js +0 -1
  510. package/build/assets/home-BDCL0Psk.js +0 -1
  511. package/build/assets/index-redirect-BQ_55qN6.js +0 -1
  512. package/build/assets/install-server-modal-CWZhBKwH.js +0 -1
  513. package/build/assets/lesson-plan-y520IDs6.js +0 -3
  514. package/build/assets/llm-not-configured-banner-CJyURBCm.js +0 -27
  515. package/build/assets/llm-settings-BW6yW2Go.js +0 -1
  516. package/build/assets/llm-settings-CiY22Wzi.js +0 -1
  517. package/build/assets/loader-circle-1XB9nbwF.js +0 -1
  518. package/build/assets/manage-backends-modal-v5POMal5.js +0 -1
  519. package/build/assets/manifest-eccb7f46.js +0 -1
  520. package/build/assets/markdown-renderer-z446oW0Z.js +0 -2
  521. package/build/assets/mcp-DgPFZ_Dv.js +0 -9
  522. package/build/assets/mcp-settings-redirect-l3Zbmc0F.js +0 -1
  523. package/build/assets/messages-Dq6AQ8mp.js +0 -41
  524. package/build/assets/model-selector-CdZs21EZ.js +0 -1
  525. package/build/assets/onboarding-Cdwu8QIy.js +0 -1
  526. package/build/assets/option-service.api-CdYnKVsu.js +0 -1
  527. package/build/assets/organization-service.api-CzMvXIQT.js +0 -1
  528. package/build/assets/plus-DKUID4kd.js +0 -1
  529. package/build/assets/providers-CbpQft-X.js +0 -1
  530. package/build/assets/proxy-Bx3NeKeo.js +0 -1
  531. package/build/assets/query-client-config-Ca3tW1AH.js +0 -1
  532. package/build/assets/root-CRkz_h2T.css +0 -1
  533. package/build/assets/root-CiNoOVrb.js +0 -2
  534. package/build/assets/root-layout-DUw-s9LS.js +0 -2
  535. package/build/assets/sdk-section-page-DPBwwLle.js +0 -1
  536. package/build/assets/sdk-settings-schema-Big50zDH.js +0 -1
  537. package/build/assets/secrets-settings-DmpsTC9V.js +0 -1
  538. package/build/assets/settings-ChsRtIJQ.js +0 -1
  539. package/build/assets/settings-modal-Cth7Zb-I.js +0 -1
  540. package/build/assets/settings-service.api-CcpckquT.js +0 -1
  541. package/build/assets/shared-conversation-Y0C8zqdr.js +0 -1
  542. package/build/assets/sidebar-mobile-menu-toggle-BvcBXvLY.js +0 -1
  543. package/build/assets/suspense-Bqb0V0q1.js +0 -1
  544. package/build/assets/telemetry-CAWBJ_rB.js +0 -2
  545. package/build/assets/use-acp-credential-form-Dj7Jkhgp.js +0 -1
  546. package/build/assets/use-agent-settings-schema-Lf_lBAky.js +0 -1
  547. package/build/assets/use-config-DVU9HaPf.js +0 -1
  548. package/build/assets/use-create-conversation-CJUAOf1q.js +0 -1
  549. package/build/assets/use-handle-plan-click-BdcdMWbv.js +0 -1
  550. package/build/assets/use-is-authed-B8eLO-Xq.js +0 -1
  551. package/build/assets/use-llm-profiles-BBTR-OsK.js +0 -1
  552. package/build/assets/use-runtime-is-ready-BOQpqCvp.js +0 -1
  553. package/build/assets/use-save-settings-7_MLft-Y.js +0 -1
  554. package/build/assets/use-settings-CNsxccvQ.js +0 -1
  555. package/build/assets/useMutation-Dm84WAKR.js +0 -1
  556. package/build/assets/useQuery-DGRSm7IT.js +0 -1
  557. package/build/assets/useTranslation-CL6FTf1b.js +0 -1
  558. package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~dqseey1n-D_BSEDk4.js +0 -1
  559. package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~jfbjdnyv-C5ZIbuq8.js +0 -177
  560. package/build/assets/vendor~root-layout~home~conversation-panel~conversation~launch~mcp~settings~settings-index~~m3acswdn-DQE89epK.js +0 -48
  561. package/build/assets/x-CCfDppg5.js +0 -1
  562. package/dist/api/settings-service/legacy-app-preferences-migration.cjs +0 -2
  563. package/dist/api/settings-service/legacy-app-preferences-migration.cjs.map +0 -1
  564. package/dist/api/settings-service/legacy-app-preferences-migration.d.ts +0 -34
  565. package/dist/api/settings-service/legacy-app-preferences-migration.js +0 -52
  566. package/dist/api/settings-service/legacy-app-preferences-migration.js.map +0 -1
  567. package/dist/hooks/query/use-openhands-verified-models.cjs +0 -2
  568. package/dist/hooks/query/use-openhands-verified-models.cjs.map +0 -1
  569. package/dist/hooks/query/use-openhands-verified-models.d.ts +0 -1
  570. package/dist/hooks/query/use-openhands-verified-models.js +0 -14
  571. package/dist/hooks/query/use-openhands-verified-models.js.map +0 -1
  572. package/dist/utils/normalize-display-model.cjs +0 -2
  573. package/dist/utils/normalize-display-model.cjs.map +0 -1
  574. package/dist/utils/normalize-display-model.d.ts +0 -9
  575. package/dist/utils/normalize-display-model.js +0 -13
  576. package/dist/utils/normalize-display-model.js.map +0 -1
  577. package/dist/utils/openhands-llm.cjs +0 -2
  578. package/dist/utils/openhands-llm.cjs.map +0 -1
  579. package/dist/utils/openhands-llm.d.ts +0 -15
  580. package/dist/utils/openhands-llm.js +0 -15
  581. package/dist/utils/openhands-llm.js.map +0 -1
  582. /package/build/assets/{agent-server-ui-style-scope-BwIZYdC1.js → agent-server-ui-style-scope-1MuaCC1k.js} +0 -0
  583. /package/build/assets/{common-Dh7OqABE.js → common-DqjLSBOt.js} +0 -0
  584. /package/build/assets/{environment-switch-store-CiurvTtK.js → environment-switch-store-CBXkf5bS.js} +0 -0
  585. /package/build/assets/{extension-module-card-classes-DP5J6ngE.js → extension-module-card-classes-CVGfXtoL.js} +0 -0
  586. /package/build/assets/{git-status-mapper-BI8FyUVp.js → git-status-mapper-DVFXF1_X.js} +0 -0
  587. /package/build/assets/{handle-capture-consent-CPMXU29K.js → handle-capture-consent-BTvatyfE.js} +0 -0
  588. /package/build/assets/{map-provider-BM2SJarp.js → map-provider-COgsZR9p.js} +0 -0
  589. /package/build/assets/{objectWithoutPropertiesLoose-DSQKyRhw.js → objectWithoutPropertiesLoose-B80nTzVc.js} +0 -0
  590. /package/build/assets/{preload-helper-CT1Z6Pdu.js → preload-helper-D_sPnjeL.js} +0 -0
  591. /package/build/assets/{rolldown-runtime-BFRubm34.js → rolldown-runtime-wFmyQBCi.js} +0 -0
  592. /package/build/assets/{sdk-settings-field-metadata-p2GVlft7.js → sdk-settings-field-metadata-Cc4D-ut7.js} +0 -0
  593. /package/build/assets/{settings-wh2sLLJM.js → settings-1287uR2J.js} +0 -0
  594. /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nh19ovoo-DJTFnsA1.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~cg1m3bv7-aUIHudsf.js} +0 -0
  595. /package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~ntycl9e1-BmZcy_kH.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~ntycl9e1-DPPGSgT1.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"storage.cjs","names":[],"sources":["../../../src/api/backend-registry/storage.ts"],"sourcesContent":["import {\n DEFAULT_LOCAL_BACKEND_ID,\n DEFAULT_LOCAL_BACKEND_NAME,\n makeDefaultLocalBackend,\n} from \"./default-backend\";\nimport type { Backend, BackendKind, BackendSelection } from \"./types\";\n\nexport const BACKENDS_STORAGE_KEY = \"openhands-backends\";\nexport const ACTIVE_BACKEND_STORAGE_KEY = \"openhands-active-backend\";\n\nconst LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY = \"openhands-agent-server-config\";\n\nfunction isValidKind(value: unknown): value is BackendKind {\n return value === \"local\" || value === \"cloud\";\n}\n\nfunction isValidBackend(value: unknown): value is Backend {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Partial<Backend>;\n return (\n typeof v.id === \"string\" &&\n v.id.length > 0 &&\n typeof v.name === \"string\" &&\n typeof v.host === \"string\" &&\n typeof v.apiKey === \"string\" &&\n isValidKind(v.kind)\n );\n}\n\nfunction normalizeLegacyBaseUrl(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed;\n return `http://${trimmed}`;\n}\n\nfunction readLegacyBackend(): Backend | null {\n const raw = window.localStorage.getItem(\n LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY,\n );\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n const host = normalizeLegacyBaseUrl(parsed.baseUrl);\n const apiKey =\n typeof parsed.sessionApiKey === \"string\"\n ? parsed.sessionApiKey.trim()\n : \"\";\n\n if (!host || !apiKey) return null;\n\n return {\n id: DEFAULT_LOCAL_BACKEND_ID,\n name: DEFAULT_LOCAL_BACKEND_NAME,\n host,\n apiKey,\n kind: \"local\",\n };\n } catch {\n return null;\n }\n}\n\nfunction clearLegacyBackendConfig(): void {\n window.localStorage.removeItem(LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY);\n}\n\nfunction seedBackends(backends: Backend[]): Backend[] {\n writeStoredBackends(backends);\n clearLegacyBackendConfig();\n return backends;\n}\n\nfunction isLoopbackUrl(value: string): boolean {\n try {\n const { hostname } = new URL(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"::1\" ||\n hostname === \"[::1]\"\n );\n } catch {\n return false;\n }\n}\n\nfunction shouldSyncLauncherDefaultLocalBackend(\n backend: Backend,\n defaultBackend: Backend,\n): boolean {\n if (backend.id !== DEFAULT_LOCAL_BACKEND_ID || backend.kind !== \"local\") {\n return false;\n }\n\n return (\n backend.host === defaultBackend.host ||\n (isLoopbackUrl(backend.host) && isLoopbackUrl(defaultBackend.host))\n );\n}\n\nfunction syncLauncherDefaultLocalBackend(backends: Backend[]): Backend[] {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return backends;\n\n let didSync = false;\n const syncedBackends = backends.map((backend) => {\n if (!shouldSyncLauncherDefaultLocalBackend(backend, defaultBackend)) {\n return backend;\n }\n\n if (backend.apiKey === defaultBackend.apiKey) return backend;\n\n didSync = true;\n return {\n ...backend,\n apiKey: defaultBackend.apiKey,\n };\n });\n\n if (!didSync) return backends;\n\n writeStoredBackends(syncedBackends);\n return syncedBackends;\n}\n\nexport function writeStoredBackends(backends: Backend[]): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(BACKENDS_STORAGE_KEY, JSON.stringify(backends));\n } catch {\n /* ignore quota / serialization errors */\n }\n}\n\nexport function readStoredBackends(): Backend[] {\n if (typeof window === \"undefined\") return [];\n\n try {\n const raw = window.localStorage.getItem(BACKENDS_STORAGE_KEY);\n\n // First install: migrate one legacy local backend if present, otherwise\n // seed only when the launcher supplied enough information for a usable\n // local backend.\n if (raw === null) {\n const legacyBackend = readLegacyBackend();\n if (legacyBackend) return seedBackends([legacyBackend]);\n\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n return seedBackends([defaultBackend]);\n }\n\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n const valid = parsed.filter(isValidBackend);\n\n // If the stored array is empty (or everything in it failed validation),\n // only re-seed when the launcher supplied both a host and API key.\n if (valid.length === 0) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n return seedBackends([defaultBackend]);\n }\n\n const synced = syncLauncherDefaultLocalBackend(valid);\n clearLegacyBackendConfig();\n return synced;\n } catch {\n return [];\n }\n}\n\nfunction parseBackendSelection(raw: string | null): BackendSelection | null {\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw);\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n typeof (parsed as BackendSelection).backendId !== \"string\"\n ) {\n return null;\n }\n const orgIdRaw = (parsed as BackendSelection).orgId;\n return {\n backendId: (parsed as BackendSelection).backendId,\n orgId:\n typeof orgIdRaw === \"string\" && orgIdRaw.length > 0 ? orgIdRaw : null,\n };\n } catch {\n return null;\n }\n}\n\nfunction readStorageItem(\n storage: Storage | undefined,\n key: string,\n): string | null {\n try {\n return storage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction writeStorageItem(\n storage: Storage | undefined,\n key: string,\n value: string,\n): void {\n try {\n storage?.setItem(key, value);\n } catch {\n /* ignore */\n }\n}\n\nfunction removeStorageItem(storage: Storage | undefined, key: string): void {\n try {\n storage?.removeItem(key);\n } catch {\n /* ignore */\n }\n}\n\nexport function readStoredActiveBackend(): BackendSelection | null {\n if (typeof window === \"undefined\") return null;\n\n // Active backend is tab-scoped so reloading tab A does not adopt tab B's\n // backend. localStorage remains a last-used fallback for fresh tabs and old\n // persisted state.\n const sessionSelection = parseBackendSelection(\n readStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n if (sessionSelection) return sessionSelection;\n\n return parseBackendSelection(\n readStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n}\n\nexport function writeStoredActiveBackend(\n selection: BackendSelection | null,\n): void {\n if (typeof window === \"undefined\") return;\n\n if (!selection) {\n removeStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY);\n removeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY);\n return;\n }\n\n const serialized = JSON.stringify({\n backendId: selection.backendId,\n orgId: selection.orgId ?? null,\n });\n // Mirror to localStorage only as the default for new tabs/backward\n // compatibility; reads in existing tabs prefer sessionStorage.\n writeStorageItem(\n window.sessionStorage,\n ACTIVE_BACKEND_STORAGE_KEY,\n serialized,\n );\n writeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY, serialized);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"storage.cjs","names":[],"sources":["../../../src/api/backend-registry/storage.ts"],"sourcesContent":["import {\n SEEDED_DEFAULT_BACKEND_ID,\n makeDefaultLocalBackend,\n} from \"./default-backend\";\nimport type { Backend, BackendKind, BackendSelection } from \"./types\";\n\nexport const BACKENDS_STORAGE_KEY = \"openhands-backends\";\nexport const ACTIVE_BACKEND_STORAGE_KEY = \"openhands-active-backend\";\n\nfunction isValidKind(value: unknown): value is BackendKind {\n return value === \"local\" || value === \"cloud\";\n}\n\nfunction isValidBackend(value: unknown): value is Backend {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Partial<Backend>;\n return (\n typeof v.id === \"string\" &&\n v.id.length > 0 &&\n typeof v.name === \"string\" &&\n typeof v.host === \"string\" &&\n typeof v.apiKey === \"string\" &&\n isValidKind(v.kind)\n );\n}\n\nfunction isLoopbackUrl(value: string): boolean {\n try {\n const { hostname } = new URL(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"::1\" ||\n hostname === \"[::1]\"\n );\n } catch {\n return false;\n }\n}\n\nfunction shouldSyncLauncherDefaultLocalBackend(\n backend: Backend,\n defaultBackend: Backend,\n): boolean {\n if (backend.id !== SEEDED_DEFAULT_BACKEND_ID || backend.kind !== \"local\") {\n return false;\n }\n\n return (\n backend.host === defaultBackend.host ||\n (isLoopbackUrl(backend.host) && isLoopbackUrl(defaultBackend.host))\n );\n}\n\nfunction syncLauncherDefaultLocalBackend(backends: Backend[]): Backend[] {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return backends;\n\n let didSync = false;\n const syncedBackends = backends.map((backend) => {\n if (!shouldSyncLauncherDefaultLocalBackend(backend, defaultBackend)) {\n return backend;\n }\n\n if (backend.apiKey === defaultBackend.apiKey) return backend;\n\n didSync = true;\n return {\n ...backend,\n apiKey: defaultBackend.apiKey,\n };\n });\n\n if (!didSync) return backends;\n\n writeStoredBackends(syncedBackends);\n return syncedBackends;\n}\n\nexport function writeStoredBackends(backends: Backend[]): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(BACKENDS_STORAGE_KEY, JSON.stringify(backends));\n } catch {\n /* ignore quota / serialization errors */\n }\n}\n\nexport function readStoredBackends(): Backend[] {\n if (typeof window === \"undefined\") return [];\n\n try {\n const raw = window.localStorage.getItem(BACKENDS_STORAGE_KEY);\n\n // First install: seed only when the launcher supplied enough information\n // for a usable local backend.\n if (raw === null) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n writeStoredBackends([defaultBackend]);\n return [defaultBackend];\n }\n\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n const valid = parsed.filter(isValidBackend);\n\n // If the stored array is empty (or everything in it failed validation),\n // only re-seed when the launcher supplied both a host and API key.\n if (valid.length === 0) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n writeStoredBackends([defaultBackend]);\n return [defaultBackend];\n }\n\n const synced = syncLauncherDefaultLocalBackend(valid);\n return synced;\n } catch {\n return [];\n }\n}\n\nfunction parseBackendSelection(raw: string | null): BackendSelection | null {\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw);\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n typeof (parsed as BackendSelection).backendId !== \"string\"\n ) {\n return null;\n }\n const orgIdRaw = (parsed as BackendSelection).orgId;\n return {\n backendId: (parsed as BackendSelection).backendId,\n orgId:\n typeof orgIdRaw === \"string\" && orgIdRaw.length > 0 ? orgIdRaw : null,\n };\n } catch {\n return null;\n }\n}\n\nfunction readStorageItem(\n storage: Storage | undefined,\n key: string,\n): string | null {\n try {\n return storage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction writeStorageItem(\n storage: Storage | undefined,\n key: string,\n value: string,\n): void {\n try {\n storage?.setItem(key, value);\n } catch {\n /* ignore */\n }\n}\n\nfunction removeStorageItem(storage: Storage | undefined, key: string): void {\n try {\n storage?.removeItem(key);\n } catch {\n /* ignore */\n }\n}\n\nexport function readStoredActiveBackend(): BackendSelection | null {\n if (typeof window === \"undefined\") return null;\n\n // Active backend is tab-scoped so reloading tab A does not adopt tab B's\n // backend. localStorage remains a last-used fallback for fresh tabs and old\n // persisted state.\n const sessionSelection = parseBackendSelection(\n readStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n if (sessionSelection) return sessionSelection;\n\n return parseBackendSelection(\n readStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n}\n\nexport function writeStoredActiveBackend(\n selection: BackendSelection | null,\n): void {\n if (typeof window === \"undefined\") return;\n\n if (!selection) {\n removeStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY);\n removeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY);\n return;\n }\n\n const serialized = JSON.stringify({\n backendId: selection.backendId,\n orgId: selection.orgId ?? null,\n });\n // Mirror to localStorage only as the default for new tabs/backward\n // compatibility; reads in existing tabs prefer sessionStorage.\n writeStorageItem(\n window.sessionStorage,\n ACTIVE_BACKEND_STORAGE_KEY,\n serialized,\n );\n writeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY, serialized);\n}\n"],"mappings":"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"}
@@ -1,42 +1,15 @@
1
- import { DEFAULT_LOCAL_BACKEND_ID as e, DEFAULT_LOCAL_BACKEND_NAME as t, makeDefaultLocalBackend as n } from "./default-backend.js";
1
+ import { makeDefaultLocalBackend as e } from "./default-backend.js";
2
2
  //#region src/api/backend-registry/storage.ts
3
- var r = "openhands-backends", i = "openhands-active-backend", a = "openhands-agent-server-config";
4
- function o(e) {
3
+ var t = "openhands-backends", n = "openhands-active-backend";
4
+ function r(e) {
5
5
  return e === "local" || e === "cloud";
6
6
  }
7
- function s(e) {
7
+ function i(e) {
8
8
  if (typeof e != "object" || !e) return !1;
9
9
  let t = e;
10
- return typeof t.id == "string" && t.id.length > 0 && typeof t.name == "string" && typeof t.host == "string" && typeof t.apiKey == "string" && o(t.kind);
10
+ return typeof t.id == "string" && t.id.length > 0 && typeof t.name == "string" && typeof t.host == "string" && typeof t.apiKey == "string" && r(t.kind);
11
11
  }
12
- function c(e) {
13
- if (typeof e != "string") return null;
14
- let t = e.trim().replace(/\/+$/, "");
15
- return t ? /^https?:\/\//i.test(t) ? t : `http://${t}` : null;
16
- }
17
- function l() {
18
- let n = window.localStorage.getItem(a);
19
- if (!n) return null;
20
- try {
21
- let r = JSON.parse(n), i = c(r.baseUrl), a = typeof r.sessionApiKey == "string" ? r.sessionApiKey.trim() : "";
22
- return !i || !a ? null : {
23
- id: e,
24
- name: t,
25
- host: i,
26
- apiKey: a,
27
- kind: "local"
28
- };
29
- } catch {
30
- return null;
31
- }
32
- }
33
- function u() {
34
- window.localStorage.removeItem(a);
35
- }
36
- function d(e) {
37
- return h(e), u(), e;
38
- }
39
- function f(e) {
12
+ function a(e) {
40
13
  try {
41
14
  let { hostname: t } = new URL(e);
42
15
  return t === "localhost" || t === "127.0.0.1" || t === "::1" || t === "[::1]";
@@ -44,47 +17,44 @@ function f(e) {
44
17
  return !1;
45
18
  }
46
19
  }
47
- function p(e, t) {
48
- return e.id !== "default-local" || e.kind !== "local" ? !1 : e.host === t.host || f(e.host) && f(t.host);
20
+ function o(e, t) {
21
+ return e.id !== "default-local" || e.kind !== "local" ? !1 : e.host === t.host || a(e.host) && a(t.host);
49
22
  }
50
- function m(e) {
51
- let t = n();
52
- if (!t) return e;
53
- let r = !1, i = e.map((e) => !p(e, t) || e.apiKey === t.apiKey ? e : (r = !0, {
23
+ function s(t) {
24
+ let n = e();
25
+ if (!n) return t;
26
+ let r = !1, i = t.map((e) => !o(e, n) || e.apiKey === n.apiKey ? e : (r = !0, {
54
27
  ...e,
55
- apiKey: t.apiKey
28
+ apiKey: n.apiKey
56
29
  }));
57
- return r ? (h(i), i) : e;
30
+ return r ? (c(i), i) : t;
58
31
  }
59
- function h(e) {
32
+ function c(e) {
60
33
  if (!(typeof window > "u")) try {
61
- window.localStorage.setItem(r, JSON.stringify(e));
34
+ window.localStorage.setItem(t, JSON.stringify(e));
62
35
  } catch {}
63
36
  }
64
- function g() {
37
+ function l() {
65
38
  if (typeof window > "u") return [];
66
39
  try {
67
- let e = window.localStorage.getItem(r);
68
- if (e === null) {
69
- let e = l();
70
- if (e) return d([e]);
71
- let t = n();
72
- return t ? d([t]) : [];
40
+ let n = window.localStorage.getItem(t);
41
+ if (n === null) {
42
+ let t = e();
43
+ return t ? (c([t]), [t]) : [];
73
44
  }
74
- let t = JSON.parse(e);
75
- if (!Array.isArray(t)) return [];
76
- let i = t.filter(s);
77
- if (i.length === 0) {
78
- let e = n();
79
- return e ? d([e]) : [];
45
+ let r = JSON.parse(n);
46
+ if (!Array.isArray(r)) return [];
47
+ let a = r.filter(i);
48
+ if (a.length === 0) {
49
+ let t = e();
50
+ return t ? (c([t]), [t]) : [];
80
51
  }
81
- let a = m(i);
82
- return u(), a;
52
+ return s(a);
83
53
  } catch {
84
54
  return [];
85
55
  }
86
56
  }
87
- function _(e) {
57
+ function u(e) {
88
58
  if (!e) return null;
89
59
  try {
90
60
  let t = JSON.parse(e);
@@ -98,39 +68,39 @@ function _(e) {
98
68
  return null;
99
69
  }
100
70
  }
101
- function v(e, t) {
71
+ function d(e, t) {
102
72
  try {
103
73
  return e?.getItem(t) ?? null;
104
74
  } catch {
105
75
  return null;
106
76
  }
107
77
  }
108
- function y(e, t, n) {
78
+ function f(e, t, n) {
109
79
  try {
110
80
  e?.setItem(t, n);
111
81
  } catch {}
112
82
  }
113
- function b(e, t) {
83
+ function p(e, t) {
114
84
  try {
115
85
  e?.removeItem(t);
116
86
  } catch {}
117
87
  }
118
- function x() {
119
- return typeof window > "u" ? null : _(v(window.sessionStorage, i)) || _(v(window.localStorage, i));
88
+ function m() {
89
+ return typeof window > "u" ? null : u(d(window.sessionStorage, n)) || u(d(window.localStorage, n));
120
90
  }
121
- function S(e) {
91
+ function h(e) {
122
92
  if (typeof window > "u") return;
123
93
  if (!e) {
124
- b(window.sessionStorage, i), b(window.localStorage, i);
94
+ p(window.sessionStorage, n), p(window.localStorage, n);
125
95
  return;
126
96
  }
127
97
  let t = JSON.stringify({
128
98
  backendId: e.backendId,
129
99
  orgId: e.orgId ?? null
130
100
  });
131
- y(window.sessionStorage, i, t), y(window.localStorage, i, t);
101
+ f(window.sessionStorage, n, t), f(window.localStorage, n, t);
132
102
  }
133
103
  //#endregion
134
- export { x as readStoredActiveBackend, g as readStoredBackends, S as writeStoredActiveBackend, h as writeStoredBackends };
104
+ export { m as readStoredActiveBackend, l as readStoredBackends, h as writeStoredActiveBackend, c as writeStoredBackends };
135
105
 
136
106
  //# sourceMappingURL=storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.js","names":[],"sources":["../../../src/api/backend-registry/storage.ts"],"sourcesContent":["import {\n DEFAULT_LOCAL_BACKEND_ID,\n DEFAULT_LOCAL_BACKEND_NAME,\n makeDefaultLocalBackend,\n} from \"./default-backend\";\nimport type { Backend, BackendKind, BackendSelection } from \"./types\";\n\nexport const BACKENDS_STORAGE_KEY = \"openhands-backends\";\nexport const ACTIVE_BACKEND_STORAGE_KEY = \"openhands-active-backend\";\n\nconst LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY = \"openhands-agent-server-config\";\n\nfunction isValidKind(value: unknown): value is BackendKind {\n return value === \"local\" || value === \"cloud\";\n}\n\nfunction isValidBackend(value: unknown): value is Backend {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Partial<Backend>;\n return (\n typeof v.id === \"string\" &&\n v.id.length > 0 &&\n typeof v.name === \"string\" &&\n typeof v.host === \"string\" &&\n typeof v.apiKey === \"string\" &&\n isValidKind(v.kind)\n );\n}\n\nfunction normalizeLegacyBaseUrl(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed;\n return `http://${trimmed}`;\n}\n\nfunction readLegacyBackend(): Backend | null {\n const raw = window.localStorage.getItem(\n LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY,\n );\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n const host = normalizeLegacyBaseUrl(parsed.baseUrl);\n const apiKey =\n typeof parsed.sessionApiKey === \"string\"\n ? parsed.sessionApiKey.trim()\n : \"\";\n\n if (!host || !apiKey) return null;\n\n return {\n id: DEFAULT_LOCAL_BACKEND_ID,\n name: DEFAULT_LOCAL_BACKEND_NAME,\n host,\n apiKey,\n kind: \"local\",\n };\n } catch {\n return null;\n }\n}\n\nfunction clearLegacyBackendConfig(): void {\n window.localStorage.removeItem(LEGACY_AGENT_SERVER_CONFIG_STORAGE_KEY);\n}\n\nfunction seedBackends(backends: Backend[]): Backend[] {\n writeStoredBackends(backends);\n clearLegacyBackendConfig();\n return backends;\n}\n\nfunction isLoopbackUrl(value: string): boolean {\n try {\n const { hostname } = new URL(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"::1\" ||\n hostname === \"[::1]\"\n );\n } catch {\n return false;\n }\n}\n\nfunction shouldSyncLauncherDefaultLocalBackend(\n backend: Backend,\n defaultBackend: Backend,\n): boolean {\n if (backend.id !== DEFAULT_LOCAL_BACKEND_ID || backend.kind !== \"local\") {\n return false;\n }\n\n return (\n backend.host === defaultBackend.host ||\n (isLoopbackUrl(backend.host) && isLoopbackUrl(defaultBackend.host))\n );\n}\n\nfunction syncLauncherDefaultLocalBackend(backends: Backend[]): Backend[] {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return backends;\n\n let didSync = false;\n const syncedBackends = backends.map((backend) => {\n if (!shouldSyncLauncherDefaultLocalBackend(backend, defaultBackend)) {\n return backend;\n }\n\n if (backend.apiKey === defaultBackend.apiKey) return backend;\n\n didSync = true;\n return {\n ...backend,\n apiKey: defaultBackend.apiKey,\n };\n });\n\n if (!didSync) return backends;\n\n writeStoredBackends(syncedBackends);\n return syncedBackends;\n}\n\nexport function writeStoredBackends(backends: Backend[]): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(BACKENDS_STORAGE_KEY, JSON.stringify(backends));\n } catch {\n /* ignore quota / serialization errors */\n }\n}\n\nexport function readStoredBackends(): Backend[] {\n if (typeof window === \"undefined\") return [];\n\n try {\n const raw = window.localStorage.getItem(BACKENDS_STORAGE_KEY);\n\n // First install: migrate one legacy local backend if present, otherwise\n // seed only when the launcher supplied enough information for a usable\n // local backend.\n if (raw === null) {\n const legacyBackend = readLegacyBackend();\n if (legacyBackend) return seedBackends([legacyBackend]);\n\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n return seedBackends([defaultBackend]);\n }\n\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n const valid = parsed.filter(isValidBackend);\n\n // If the stored array is empty (or everything in it failed validation),\n // only re-seed when the launcher supplied both a host and API key.\n if (valid.length === 0) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n return seedBackends([defaultBackend]);\n }\n\n const synced = syncLauncherDefaultLocalBackend(valid);\n clearLegacyBackendConfig();\n return synced;\n } catch {\n return [];\n }\n}\n\nfunction parseBackendSelection(raw: string | null): BackendSelection | null {\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw);\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n typeof (parsed as BackendSelection).backendId !== \"string\"\n ) {\n return null;\n }\n const orgIdRaw = (parsed as BackendSelection).orgId;\n return {\n backendId: (parsed as BackendSelection).backendId,\n orgId:\n typeof orgIdRaw === \"string\" && orgIdRaw.length > 0 ? orgIdRaw : null,\n };\n } catch {\n return null;\n }\n}\n\nfunction readStorageItem(\n storage: Storage | undefined,\n key: string,\n): string | null {\n try {\n return storage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction writeStorageItem(\n storage: Storage | undefined,\n key: string,\n value: string,\n): void {\n try {\n storage?.setItem(key, value);\n } catch {\n /* ignore */\n }\n}\n\nfunction removeStorageItem(storage: Storage | undefined, key: string): void {\n try {\n storage?.removeItem(key);\n } catch {\n /* ignore */\n }\n}\n\nexport function readStoredActiveBackend(): BackendSelection | null {\n if (typeof window === \"undefined\") return null;\n\n // Active backend is tab-scoped so reloading tab A does not adopt tab B's\n // backend. localStorage remains a last-used fallback for fresh tabs and old\n // persisted state.\n const sessionSelection = parseBackendSelection(\n readStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n if (sessionSelection) return sessionSelection;\n\n return parseBackendSelection(\n readStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n}\n\nexport function writeStoredActiveBackend(\n selection: BackendSelection | null,\n): void {\n if (typeof window === \"undefined\") return;\n\n if (!selection) {\n removeStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY);\n removeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY);\n return;\n }\n\n const serialized = JSON.stringify({\n backendId: selection.backendId,\n orgId: selection.orgId ?? null,\n });\n // Mirror to localStorage only as the default for new tabs/backward\n // compatibility; reads in existing tabs prefer sessionStorage.\n writeStorageItem(\n window.sessionStorage,\n ACTIVE_BACKEND_STORAGE_KEY,\n serialized,\n );\n writeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY, serialized);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"storage.js","names":[],"sources":["../../../src/api/backend-registry/storage.ts"],"sourcesContent":["import {\n SEEDED_DEFAULT_BACKEND_ID,\n makeDefaultLocalBackend,\n} from \"./default-backend\";\nimport type { Backend, BackendKind, BackendSelection } from \"./types\";\n\nexport const BACKENDS_STORAGE_KEY = \"openhands-backends\";\nexport const ACTIVE_BACKEND_STORAGE_KEY = \"openhands-active-backend\";\n\nfunction isValidKind(value: unknown): value is BackendKind {\n return value === \"local\" || value === \"cloud\";\n}\n\nfunction isValidBackend(value: unknown): value is Backend {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Partial<Backend>;\n return (\n typeof v.id === \"string\" &&\n v.id.length > 0 &&\n typeof v.name === \"string\" &&\n typeof v.host === \"string\" &&\n typeof v.apiKey === \"string\" &&\n isValidKind(v.kind)\n );\n}\n\nfunction isLoopbackUrl(value: string): boolean {\n try {\n const { hostname } = new URL(value);\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"::1\" ||\n hostname === \"[::1]\"\n );\n } catch {\n return false;\n }\n}\n\nfunction shouldSyncLauncherDefaultLocalBackend(\n backend: Backend,\n defaultBackend: Backend,\n): boolean {\n if (backend.id !== SEEDED_DEFAULT_BACKEND_ID || backend.kind !== \"local\") {\n return false;\n }\n\n return (\n backend.host === defaultBackend.host ||\n (isLoopbackUrl(backend.host) && isLoopbackUrl(defaultBackend.host))\n );\n}\n\nfunction syncLauncherDefaultLocalBackend(backends: Backend[]): Backend[] {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return backends;\n\n let didSync = false;\n const syncedBackends = backends.map((backend) => {\n if (!shouldSyncLauncherDefaultLocalBackend(backend, defaultBackend)) {\n return backend;\n }\n\n if (backend.apiKey === defaultBackend.apiKey) return backend;\n\n didSync = true;\n return {\n ...backend,\n apiKey: defaultBackend.apiKey,\n };\n });\n\n if (!didSync) return backends;\n\n writeStoredBackends(syncedBackends);\n return syncedBackends;\n}\n\nexport function writeStoredBackends(backends: Backend[]): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(BACKENDS_STORAGE_KEY, JSON.stringify(backends));\n } catch {\n /* ignore quota / serialization errors */\n }\n}\n\nexport function readStoredBackends(): Backend[] {\n if (typeof window === \"undefined\") return [];\n\n try {\n const raw = window.localStorage.getItem(BACKENDS_STORAGE_KEY);\n\n // First install: seed only when the launcher supplied enough information\n // for a usable local backend.\n if (raw === null) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n writeStoredBackends([defaultBackend]);\n return [defaultBackend];\n }\n\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n const valid = parsed.filter(isValidBackend);\n\n // If the stored array is empty (or everything in it failed validation),\n // only re-seed when the launcher supplied both a host and API key.\n if (valid.length === 0) {\n const defaultBackend = makeDefaultLocalBackend();\n if (!defaultBackend) return [];\n\n writeStoredBackends([defaultBackend]);\n return [defaultBackend];\n }\n\n const synced = syncLauncherDefaultLocalBackend(valid);\n return synced;\n } catch {\n return [];\n }\n}\n\nfunction parseBackendSelection(raw: string | null): BackendSelection | null {\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw);\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n typeof (parsed as BackendSelection).backendId !== \"string\"\n ) {\n return null;\n }\n const orgIdRaw = (parsed as BackendSelection).orgId;\n return {\n backendId: (parsed as BackendSelection).backendId,\n orgId:\n typeof orgIdRaw === \"string\" && orgIdRaw.length > 0 ? orgIdRaw : null,\n };\n } catch {\n return null;\n }\n}\n\nfunction readStorageItem(\n storage: Storage | undefined,\n key: string,\n): string | null {\n try {\n return storage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction writeStorageItem(\n storage: Storage | undefined,\n key: string,\n value: string,\n): void {\n try {\n storage?.setItem(key, value);\n } catch {\n /* ignore */\n }\n}\n\nfunction removeStorageItem(storage: Storage | undefined, key: string): void {\n try {\n storage?.removeItem(key);\n } catch {\n /* ignore */\n }\n}\n\nexport function readStoredActiveBackend(): BackendSelection | null {\n if (typeof window === \"undefined\") return null;\n\n // Active backend is tab-scoped so reloading tab A does not adopt tab B's\n // backend. localStorage remains a last-used fallback for fresh tabs and old\n // persisted state.\n const sessionSelection = parseBackendSelection(\n readStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n if (sessionSelection) return sessionSelection;\n\n return parseBackendSelection(\n readStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY),\n );\n}\n\nexport function writeStoredActiveBackend(\n selection: BackendSelection | null,\n): void {\n if (typeof window === \"undefined\") return;\n\n if (!selection) {\n removeStorageItem(window.sessionStorage, ACTIVE_BACKEND_STORAGE_KEY);\n removeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY);\n return;\n }\n\n const serialized = JSON.stringify({\n backendId: selection.backendId,\n orgId: selection.orgId ?? null,\n });\n // Mirror to localStorage only as the default for new tabs/backward\n // compatibility; reads in existing tabs prefer sessionStorage.\n writeStorageItem(\n window.sessionStorage,\n ACTIVE_BACKEND_STORAGE_KEY,\n serialized,\n );\n writeStorageItem(window.localStorage, ACTIVE_BACKEND_STORAGE_KEY, serialized);\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../agent-server-config.cjs`),t=require(`../backend-registry/active-store.cjs`),n=require(`../agent-server-client-options.cjs`),r=require(`../../node_modules/axios/lib/axios.cjs`),i=require(`../backend-registry/auth.cjs`);function a(e){let t=e.authMode??`bearer`;return t===`bearer`?i.buildAuthHeaders(e.backend):t===`session-api-key`&&e.sessionApiKey?{"X-Session-API-Key":e.sessionApiKey}:{}}async function o(i){let o=t.getActiveBackend(),s=o.backend.id===i.backend.id&&o.orgId?{"X-Org-Id":o.orgId}:{},c={...a(i),...s,...i.headers??{}},l=i.hostOverride??i.backend.host;if(!i.hostOverride&&!i.forceProxy)return(await r.default.request({url:`${l.replace(/\/+$/,``)}${i.path}`,method:i.method,headers:c,...i.body===void 0?{}:{data:i.body},timeout:(i.timeoutSeconds??30)*1e3,...i.responseType?{responseType:i.responseType}:{}})).data;let u=e.getAgentServerBaseUrl();if(!u)throw new n.NoBackendAvailableError;let d=e.getAgentServerHeaders();return(await r.default.post(`${u.replace(/\/+$/,``)}/api/cloud-proxy`,{host:l,method:i.method,path:i.path,headers:c,body:i.body??null,...i.timeoutSeconds?{timeout_seconds:i.timeoutSeconds}:{}},{headers:d,timeout:3e4,...i.responseType?{responseType:i.responseType}:{}})).data}exports.callCloudProxy=o;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../agent-server-config.cjs`),t=require(`../backend-registry/active-store.cjs`),n=require(`../agent-server-client-options.cjs`),r=require(`../../node_modules/axios/lib/axios.cjs`),i=require(`../backend-registry/auth.cjs`);function a(e){let t=e.authMode??`bearer`;return t===`bearer`?i.buildAuthHeaders(e.backend):t===`session-api-key`&&e.sessionApiKey?{"X-Session-API-Key":e.sessionApiKey}:{}}async function o(i){let o=t.getActiveBackend(),s=o.backend.id===i.backend.id&&o.orgId?{"X-Org-Id":o.orgId}:{},c={...a(i),...s,...i.headers??{}},l=i.hostOverride??i.backend.host;if(!i.hostOverride)return(await r.default.request({url:`${l.replace(/\/+$/,``)}${i.path}`,method:i.method,headers:c,...i.body===void 0?{}:{data:i.body},timeout:(i.timeoutSeconds??30)*1e3,...i.responseType?{responseType:i.responseType}:{}})).data;let u=e.getAgentServerBaseUrl();if(!u)throw new n.NoBackendAvailableError;let d=e.getAgentServerHeaders();return(await r.default.post(`${u.replace(/\/+$/,``)}/api/cloud-proxy`,{host:l,method:i.method,path:i.path,headers:c,body:i.body??null,...i.timeoutSeconds?{timeout_seconds:i.timeoutSeconds}:{}},{headers:d,timeout:3e4,...i.responseType?{responseType:i.responseType}:{}})).data}exports.callCloudProxy=o;
2
2
  //# sourceMappingURL=proxy.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.cjs","names":[],"sources":["../../../src/api/cloud/proxy.ts"],"sourcesContent":["import axios from \"axios\";\nimport {\n getAgentServerBaseUrl,\n getAgentServerHeaders,\n} from \"../agent-server-config\";\nimport { getActiveBackend } from \"../backend-registry/active-store\";\nimport { NoBackendAvailableError } from \"../agent-server-client-options\";\nimport { buildAuthHeaders } from \"../backend-registry/auth\";\nimport type { Backend } from \"../backend-registry/types\";\n\nexport interface CloudProxyRequest {\n /**\n * Cloud backend whose bearer token authenticates the upstream call.\n * `backend.host` is also the default upstream host unless `hostOverride`\n * is set.\n */\n backend: Backend;\n /** HTTP method against the upstream host. */\n method: \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n /** Path on the upstream host, e.g. \"/api/v1/conversation/123/events/search\". */\n path: string;\n /** Optional JSON body for non-GET methods. */\n body?: unknown;\n /** Extra headers merged with the auth header for the upstream call. */\n headers?: Record<string, string>;\n /** Override the upstream timeout, in seconds. */\n timeoutSeconds?: number;\n /**\n * Override the upstream host. When set, the proxy targets this host\n * instead of `backend.host`. Used for runtime-sandbox calls where the\n * upstream lives at the conversation's runtime URL (e.g.\n * `http://<id>.prod-runtime.all-hands.dev`) rather than the cloud API.\n * The host must still pass the proxy's allowlist server-side.\n */\n hostOverride?: string;\n /**\n * Auth strategy for the upstream call. Defaults to \"bearer\" (uses the\n * cloud backend's bearer token via `buildAuthHeaders`). For\n * runtime-sandbox calls, set to \"session-api-key\" and pass\n * `sessionApiKey` — those endpoints don't accept bearer tokens, only\n * `X-Session-API-Key`. \"none\" sends no auth header.\n */\n authMode?: \"bearer\" | \"session-api-key\" | \"none\";\n /** Required when `authMode === \"session-api-key\"`. */\n sessionApiKey?: string | null;\n /**\n * Axios responseType for the inner POST to the bundled agent-server.\n * Set to \"blob\" when the upstream cloud endpoint returns a binary\n * payload (e.g. ZIP downloads); leave undefined for default JSON.\n */\n responseType?: \"blob\";\n /**\n * Force this app-host call through the bundled agent-server's\n * `/api/cloud-proxy` instead of calling the cloud host directly from the\n * browser. App-host calls normally go direct because the main cloud API\n * loosens CORS for bearer-token requests (ApiKeyAwareCORSMiddleware →\n * `Access-Control-Allow-Origin: *`). The standalone automation service\n * (`/api/automation/*`) uses a strict origin allowlist instead, so direct\n * browser requests fail CORS preflight; the same-origin proxy hop avoids\n * cross-origin entirely while attaching the same auth and `X-Org-Id`\n * headers server-side.\n */\n forceProxy?: boolean;\n}\n\nfunction buildUpstreamAuthHeaders(\n req: CloudProxyRequest,\n): Record<string, string> {\n const mode = req.authMode ?? \"bearer\";\n if (mode === \"bearer\") return buildAuthHeaders(req.backend);\n if (mode === \"session-api-key\") {\n return req.sessionApiKey ? { \"X-Session-API-Key\": req.sessionApiKey } : {};\n }\n return {};\n}\n\n/**\n * Send a cloud request. App-host calls (`backend.host`) go directly to the\n * cloud API with the cloud backend's auth headers, unless `forceProxy` is\n * set. Runtime-sandbox calls pass `hostOverride`, and those still go through\n * `/api/cloud-proxy` because the per-conversation runtime hosts are not the\n * configured cloud app origin.\n *\n * App-host auth headers are sent directly to the cloud host. Proxied auth\n * headers are carried in the proxy envelope and attached server-side.\n */\nexport async function callCloudProxy<TResponse = unknown>(\n req: CloudProxyRequest,\n): Promise<TResponse> {\n // Send `X-Org-Id` so the upstream scopes per-request to the org the user\n // selected locally, instead of the user's globally-shared\n // `current_org_id` on the cloud backend. Restricted to calls against the active\n // backend: the selector also fans out per-backend bookkeeping calls\n // (e.g. `getCloudOrganizations(b)`) that would otherwise carry the\n // active backend's orgId across an unrelated API key, which the cloud backend\n // rejects when api_key_org_id and X-Org-Id disagree.\n const active = getActiveBackend();\n const orgIdHeader =\n active.backend.id === req.backend.id && active.orgId\n ? { \"X-Org-Id\": active.orgId }\n : {};\n const upstreamHeaders = {\n ...buildUpstreamAuthHeaders(req),\n ...orgIdHeader,\n ...(req.headers ?? {}),\n };\n const upstreamHost = req.hostOverride ?? req.backend.host;\n\n if (!req.hostOverride && !req.forceProxy) {\n const response = await axios.request<TResponse>({\n url: `${upstreamHost.replace(/\\/+$/, \"\")}${req.path}`,\n method: req.method,\n headers: upstreamHeaders,\n ...(req.body !== undefined ? { data: req.body } : {}),\n timeout: (req.timeoutSeconds ?? 30) * 1000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n });\n\n return response.data;\n }\n\n const proxyBaseUrl = getAgentServerBaseUrl();\n if (!proxyBaseUrl) throw new NoBackendAvailableError();\n const localAuthHeaders = getAgentServerHeaders();\n\n // Talk to the configured app/ingress origin that exposes /api/cloud-proxy.\n // Do not resolve this through the backend registry: when the active backend\n // is cloud, borrowing some other registered local backend would silently\n // route cloud traffic through the wrong user-configured server.\n const response = await axios.post<TResponse>(\n `${proxyBaseUrl.replace(/\\/+$/, \"\")}/api/cloud-proxy`,\n {\n host: upstreamHost,\n method: req.method,\n path: req.path,\n headers: upstreamHeaders,\n body: req.body ?? null,\n ...(req.timeoutSeconds ? { timeout_seconds: req.timeoutSeconds } : {}),\n },\n {\n headers: localAuthHeaders,\n timeout: 30_000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n },\n );\n\n return response.data;\n}\n"],"mappings":"8RAiEA,SAAS,EACP,EACwB,CACxB,IAAM,EAAO,EAAI,UAAY,SAK7B,OAJI,IAAS,SAAiB,EAAA,iBAAiB,EAAI,QAAQ,CACvD,IAAS,mBACJ,EAAI,cAAgB,CAAE,oBAAqB,EAAI,cAAe,CAAG,EAAE,CAe9E,eAAsB,EACpB,EACoB,CAQpB,IAAM,EAAS,EAAA,kBAAkB,CAC3B,EACJ,EAAO,QAAQ,KAAO,EAAI,QAAQ,IAAM,EAAO,MAC3C,CAAE,WAAY,EAAO,MAAO,CAC5B,EAAE,CACF,EAAkB,CACtB,GAAG,EAAyB,EAAI,CAChC,GAAG,EACH,GAAI,EAAI,SAAW,EAAE,CACtB,CACK,EAAe,EAAI,cAAgB,EAAI,QAAQ,KAErD,GAAI,CAAC,EAAI,cAAgB,CAAC,EAAI,WAU5B,OAAO,MATgB,EAAA,QAAM,QAAmB,CAC9C,IAAK,GAAG,EAAa,QAAQ,OAAQ,GAAG,GAAG,EAAI,OAC/C,OAAQ,EAAI,OACZ,QAAS,EACT,GAAI,EAAI,OAAS,IAAA,GAAiC,EAAE,CAAvB,CAAE,KAAM,EAAI,KAAM,CAC/C,SAAU,EAAI,gBAAkB,IAAM,IACtC,GAAI,EAAI,aAAe,CAAE,aAAc,EAAI,aAAc,CAAG,EAAE,CAC/D,CAAC,EAEc,KAGlB,IAAM,EAAe,EAAA,uBAAuB,CAC5C,GAAI,CAAC,EAAc,MAAM,IAAI,EAAA,wBAC7B,IAAM,EAAmB,EAAA,uBAAuB,CAuBhD,OAAO,MAjBgB,EAAA,QAAM,KAC3B,GAAG,EAAa,QAAQ,OAAQ,GAAG,CAAC,kBACpC,CACE,KAAM,EACN,OAAQ,EAAI,OACZ,KAAM,EAAI,KACV,QAAS,EACT,KAAM,EAAI,MAAQ,KAClB,GAAI,EAAI,eAAiB,CAAE,gBAAiB,EAAI,eAAgB,CAAG,EAAE,CACtE,CACD,CACE,QAAS,EACT,QAAS,IACT,GAAI,EAAI,aAAe,CAAE,aAAc,EAAI,aAAc,CAAG,EAAE,CAC/D,CACF,EAEe"}
1
+ {"version":3,"file":"proxy.cjs","names":[],"sources":["../../../src/api/cloud/proxy.ts"],"sourcesContent":["import axios from \"axios\";\nimport {\n getAgentServerBaseUrl,\n getAgentServerHeaders,\n} from \"../agent-server-config\";\nimport { getActiveBackend } from \"../backend-registry/active-store\";\nimport { NoBackendAvailableError } from \"../agent-server-client-options\";\nimport { buildAuthHeaders } from \"../backend-registry/auth\";\nimport type { Backend } from \"../backend-registry/types\";\n\nexport interface CloudProxyRequest {\n /**\n * Cloud backend whose bearer token authenticates the upstream call.\n * `backend.host` is also the default upstream host unless `hostOverride`\n * is set.\n */\n backend: Backend;\n /** HTTP method against the upstream host. */\n method: \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n /** Path on the upstream host, e.g. \"/api/v1/conversation/123/events/search\". */\n path: string;\n /** Optional JSON body for non-GET methods. */\n body?: unknown;\n /** Extra headers merged with the auth header for the upstream call. */\n headers?: Record<string, string>;\n /** Override the upstream timeout, in seconds. */\n timeoutSeconds?: number;\n /**\n * Override the upstream host. When set, the proxy targets this host\n * instead of `backend.host`. Used for runtime-sandbox calls where the\n * upstream lives at the conversation's runtime URL (e.g.\n * `http://<id>.prod-runtime.all-hands.dev`) rather than the cloud API.\n * The host must still pass the proxy's allowlist server-side.\n */\n hostOverride?: string;\n /**\n * Auth strategy for the upstream call. Defaults to \"bearer\" (uses the\n * cloud backend's bearer token via `buildAuthHeaders`). For\n * runtime-sandbox calls, set to \"session-api-key\" and pass\n * `sessionApiKey` — those endpoints don't accept bearer tokens, only\n * `X-Session-API-Key`. \"none\" sends no auth header.\n */\n authMode?: \"bearer\" | \"session-api-key\" | \"none\";\n /** Required when `authMode === \"session-api-key\"`. */\n sessionApiKey?: string | null;\n /**\n * Axios responseType for the inner POST to the bundled agent-server.\n * Set to \"blob\" when the upstream cloud endpoint returns a binary\n * payload (e.g. ZIP downloads); leave undefined for default JSON.\n */\n responseType?: \"blob\";\n}\n\nfunction buildUpstreamAuthHeaders(\n req: CloudProxyRequest,\n): Record<string, string> {\n const mode = req.authMode ?? \"bearer\";\n if (mode === \"bearer\") return buildAuthHeaders(req.backend);\n if (mode === \"session-api-key\") {\n return req.sessionApiKey ? { \"X-Session-API-Key\": req.sessionApiKey } : {};\n }\n return {};\n}\n\n/**\n * Send a cloud request. App-host calls (`backend.host`) go directly to the\n * cloud API with the cloud backend's auth headers. Runtime-sandbox calls\n * pass `hostOverride`, and those go through `/api/cloud-proxy` because the\n * per-conversation runtime hosts are not the configured cloud app origin.\n *\n * App-host auth headers are sent directly to the cloud host. Proxied auth\n * headers are carried in the proxy envelope and attached server-side.\n */\nexport async function callCloudProxy<TResponse = unknown>(\n req: CloudProxyRequest,\n): Promise<TResponse> {\n // Send `X-Org-Id` so the upstream scopes per-request to the org the user\n // selected locally, instead of the user's globally-shared\n // `current_org_id` on the cloud backend. Restricted to calls against the active\n // backend: the selector also fans out per-backend bookkeeping calls\n // (e.g. `getCloudOrganizations(b)`) that would otherwise carry the\n // active backend's orgId across an unrelated API key, which the cloud backend\n // rejects when api_key_org_id and X-Org-Id disagree.\n const active = getActiveBackend();\n const orgIdHeader =\n active.backend.id === req.backend.id && active.orgId\n ? { \"X-Org-Id\": active.orgId }\n : {};\n const upstreamHeaders = {\n ...buildUpstreamAuthHeaders(req),\n ...orgIdHeader,\n ...(req.headers ?? {}),\n };\n const upstreamHost = req.hostOverride ?? req.backend.host;\n\n if (!req.hostOverride) {\n const response = await axios.request<TResponse>({\n url: `${upstreamHost.replace(/\\/+$/, \"\")}${req.path}`,\n method: req.method,\n headers: upstreamHeaders,\n ...(req.body !== undefined ? { data: req.body } : {}),\n timeout: (req.timeoutSeconds ?? 30) * 1000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n });\n\n return response.data;\n }\n\n const proxyBaseUrl = getAgentServerBaseUrl();\n if (!proxyBaseUrl) throw new NoBackendAvailableError();\n const localAuthHeaders = getAgentServerHeaders();\n\n // Talk to the configured app/ingress origin that exposes /api/cloud-proxy.\n // Do not resolve this through the backend registry: when the active backend\n // is cloud, borrowing some other registered local backend would silently\n // route cloud traffic through the wrong user-configured server.\n const response = await axios.post<TResponse>(\n `${proxyBaseUrl.replace(/\\/+$/, \"\")}/api/cloud-proxy`,\n {\n host: upstreamHost,\n method: req.method,\n path: req.path,\n headers: upstreamHeaders,\n body: req.body ?? null,\n ...(req.timeoutSeconds ? { timeout_seconds: req.timeoutSeconds } : {}),\n },\n {\n headers: localAuthHeaders,\n timeout: 30_000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n },\n );\n\n return response.data;\n}\n"],"mappings":"8RAqDA,SAAS,EACP,EACwB,CACxB,IAAM,EAAO,EAAI,UAAY,SAK7B,OAJI,IAAS,SAAiB,EAAA,iBAAiB,EAAI,QAAQ,CACvD,IAAS,mBACJ,EAAI,cAAgB,CAAE,oBAAqB,EAAI,cAAe,CAAG,EAAE,CAc9E,eAAsB,EACpB,EACoB,CAQpB,IAAM,EAAS,EAAA,kBAAkB,CAC3B,EACJ,EAAO,QAAQ,KAAO,EAAI,QAAQ,IAAM,EAAO,MAC3C,CAAE,WAAY,EAAO,MAAO,CAC5B,EAAE,CACF,EAAkB,CACtB,GAAG,EAAyB,EAAI,CAChC,GAAG,EACH,GAAI,EAAI,SAAW,EAAE,CACtB,CACK,EAAe,EAAI,cAAgB,EAAI,QAAQ,KAErD,GAAI,CAAC,EAAI,aAUP,OAAO,MATgB,EAAA,QAAM,QAAmB,CAC9C,IAAK,GAAG,EAAa,QAAQ,OAAQ,GAAG,GAAG,EAAI,OAC/C,OAAQ,EAAI,OACZ,QAAS,EACT,GAAI,EAAI,OAAS,IAAA,GAAiC,EAAE,CAAvB,CAAE,KAAM,EAAI,KAAM,CAC/C,SAAU,EAAI,gBAAkB,IAAM,IACtC,GAAI,EAAI,aAAe,CAAE,aAAc,EAAI,aAAc,CAAG,EAAE,CAC/D,CAAC,EAEc,KAGlB,IAAM,EAAe,EAAA,uBAAuB,CAC5C,GAAI,CAAC,EAAc,MAAM,IAAI,EAAA,wBAC7B,IAAM,EAAmB,EAAA,uBAAuB,CAuBhD,OAAO,MAjBgB,EAAA,QAAM,KAC3B,GAAG,EAAa,QAAQ,OAAQ,GAAG,CAAC,kBACpC,CACE,KAAM,EACN,OAAQ,EAAI,OACZ,KAAM,EAAI,KACV,QAAS,EACT,KAAM,EAAI,MAAQ,KAClB,GAAI,EAAI,eAAiB,CAAE,gBAAiB,EAAI,eAAgB,CAAG,EAAE,CACtE,CACD,CACE,QAAS,EACT,QAAS,IACT,GAAI,EAAI,aAAe,CAAE,aAAc,EAAI,aAAc,CAAG,EAAE,CAC/D,CACF,EAEe"}
@@ -40,25 +40,12 @@ export interface CloudProxyRequest {
40
40
  * payload (e.g. ZIP downloads); leave undefined for default JSON.
41
41
  */
42
42
  responseType?: "blob";
43
- /**
44
- * Force this app-host call through the bundled agent-server's
45
- * `/api/cloud-proxy` instead of calling the cloud host directly from the
46
- * browser. App-host calls normally go direct because the main cloud API
47
- * loosens CORS for bearer-token requests (ApiKeyAwareCORSMiddleware →
48
- * `Access-Control-Allow-Origin: *`). The standalone automation service
49
- * (`/api/automation/*`) uses a strict origin allowlist instead, so direct
50
- * browser requests fail CORS preflight; the same-origin proxy hop avoids
51
- * cross-origin entirely while attaching the same auth and `X-Org-Id`
52
- * headers server-side.
53
- */
54
- forceProxy?: boolean;
55
43
  }
56
44
  /**
57
45
  * Send a cloud request. App-host calls (`backend.host`) go directly to the
58
- * cloud API with the cloud backend's auth headers, unless `forceProxy` is
59
- * set. Runtime-sandbox calls pass `hostOverride`, and those still go through
60
- * `/api/cloud-proxy` because the per-conversation runtime hosts are not the
61
- * configured cloud app origin.
46
+ * cloud API with the cloud backend's auth headers. Runtime-sandbox calls
47
+ * pass `hostOverride`, and those go through `/api/cloud-proxy` because the
48
+ * per-conversation runtime hosts are not the configured cloud app origin.
62
49
  *
63
50
  * App-host auth headers are sent directly to the cloud host. Proxied auth
64
51
  * headers are carried in the proxy envelope and attached server-side.
@@ -14,7 +14,7 @@ async function s(a) {
14
14
  ...c,
15
15
  ...a.headers ?? {}
16
16
  }, u = a.hostOverride ?? a.backend.host;
17
- if (!a.hostOverride && !a.forceProxy) return (await i.request({
17
+ if (!a.hostOverride) return (await i.request({
18
18
  url: `${u.replace(/\/+$/, "")}${a.path}`,
19
19
  method: a.method,
20
20
  headers: l,
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","names":[],"sources":["../../../src/api/cloud/proxy.ts"],"sourcesContent":["import axios from \"axios\";\nimport {\n getAgentServerBaseUrl,\n getAgentServerHeaders,\n} from \"../agent-server-config\";\nimport { getActiveBackend } from \"../backend-registry/active-store\";\nimport { NoBackendAvailableError } from \"../agent-server-client-options\";\nimport { buildAuthHeaders } from \"../backend-registry/auth\";\nimport type { Backend } from \"../backend-registry/types\";\n\nexport interface CloudProxyRequest {\n /**\n * Cloud backend whose bearer token authenticates the upstream call.\n * `backend.host` is also the default upstream host unless `hostOverride`\n * is set.\n */\n backend: Backend;\n /** HTTP method against the upstream host. */\n method: \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n /** Path on the upstream host, e.g. \"/api/v1/conversation/123/events/search\". */\n path: string;\n /** Optional JSON body for non-GET methods. */\n body?: unknown;\n /** Extra headers merged with the auth header for the upstream call. */\n headers?: Record<string, string>;\n /** Override the upstream timeout, in seconds. */\n timeoutSeconds?: number;\n /**\n * Override the upstream host. When set, the proxy targets this host\n * instead of `backend.host`. Used for runtime-sandbox calls where the\n * upstream lives at the conversation's runtime URL (e.g.\n * `http://<id>.prod-runtime.all-hands.dev`) rather than the cloud API.\n * The host must still pass the proxy's allowlist server-side.\n */\n hostOverride?: string;\n /**\n * Auth strategy for the upstream call. Defaults to \"bearer\" (uses the\n * cloud backend's bearer token via `buildAuthHeaders`). For\n * runtime-sandbox calls, set to \"session-api-key\" and pass\n * `sessionApiKey` — those endpoints don't accept bearer tokens, only\n * `X-Session-API-Key`. \"none\" sends no auth header.\n */\n authMode?: \"bearer\" | \"session-api-key\" | \"none\";\n /** Required when `authMode === \"session-api-key\"`. */\n sessionApiKey?: string | null;\n /**\n * Axios responseType for the inner POST to the bundled agent-server.\n * Set to \"blob\" when the upstream cloud endpoint returns a binary\n * payload (e.g. ZIP downloads); leave undefined for default JSON.\n */\n responseType?: \"blob\";\n /**\n * Force this app-host call through the bundled agent-server's\n * `/api/cloud-proxy` instead of calling the cloud host directly from the\n * browser. App-host calls normally go direct because the main cloud API\n * loosens CORS for bearer-token requests (ApiKeyAwareCORSMiddleware →\n * `Access-Control-Allow-Origin: *`). The standalone automation service\n * (`/api/automation/*`) uses a strict origin allowlist instead, so direct\n * browser requests fail CORS preflight; the same-origin proxy hop avoids\n * cross-origin entirely while attaching the same auth and `X-Org-Id`\n * headers server-side.\n */\n forceProxy?: boolean;\n}\n\nfunction buildUpstreamAuthHeaders(\n req: CloudProxyRequest,\n): Record<string, string> {\n const mode = req.authMode ?? \"bearer\";\n if (mode === \"bearer\") return buildAuthHeaders(req.backend);\n if (mode === \"session-api-key\") {\n return req.sessionApiKey ? { \"X-Session-API-Key\": req.sessionApiKey } : {};\n }\n return {};\n}\n\n/**\n * Send a cloud request. App-host calls (`backend.host`) go directly to the\n * cloud API with the cloud backend's auth headers, unless `forceProxy` is\n * set. Runtime-sandbox calls pass `hostOverride`, and those still go through\n * `/api/cloud-proxy` because the per-conversation runtime hosts are not the\n * configured cloud app origin.\n *\n * App-host auth headers are sent directly to the cloud host. Proxied auth\n * headers are carried in the proxy envelope and attached server-side.\n */\nexport async function callCloudProxy<TResponse = unknown>(\n req: CloudProxyRequest,\n): Promise<TResponse> {\n // Send `X-Org-Id` so the upstream scopes per-request to the org the user\n // selected locally, instead of the user's globally-shared\n // `current_org_id` on the cloud backend. Restricted to calls against the active\n // backend: the selector also fans out per-backend bookkeeping calls\n // (e.g. `getCloudOrganizations(b)`) that would otherwise carry the\n // active backend's orgId across an unrelated API key, which the cloud backend\n // rejects when api_key_org_id and X-Org-Id disagree.\n const active = getActiveBackend();\n const orgIdHeader =\n active.backend.id === req.backend.id && active.orgId\n ? { \"X-Org-Id\": active.orgId }\n : {};\n const upstreamHeaders = {\n ...buildUpstreamAuthHeaders(req),\n ...orgIdHeader,\n ...(req.headers ?? {}),\n };\n const upstreamHost = req.hostOverride ?? req.backend.host;\n\n if (!req.hostOverride && !req.forceProxy) {\n const response = await axios.request<TResponse>({\n url: `${upstreamHost.replace(/\\/+$/, \"\")}${req.path}`,\n method: req.method,\n headers: upstreamHeaders,\n ...(req.body !== undefined ? { data: req.body } : {}),\n timeout: (req.timeoutSeconds ?? 30) * 1000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n });\n\n return response.data;\n }\n\n const proxyBaseUrl = getAgentServerBaseUrl();\n if (!proxyBaseUrl) throw new NoBackendAvailableError();\n const localAuthHeaders = getAgentServerHeaders();\n\n // Talk to the configured app/ingress origin that exposes /api/cloud-proxy.\n // Do not resolve this through the backend registry: when the active backend\n // is cloud, borrowing some other registered local backend would silently\n // route cloud traffic through the wrong user-configured server.\n const response = await axios.post<TResponse>(\n `${proxyBaseUrl.replace(/\\/+$/, \"\")}/api/cloud-proxy`,\n {\n host: upstreamHost,\n method: req.method,\n path: req.path,\n headers: upstreamHeaders,\n body: req.body ?? null,\n ...(req.timeoutSeconds ? { timeout_seconds: req.timeoutSeconds } : {}),\n },\n {\n headers: localAuthHeaders,\n timeout: 30_000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n },\n );\n\n return response.data;\n}\n"],"mappings":";;;;;;AAiEA,SAAS,EACP,GACwB;CACxB,IAAM,IAAO,EAAI,YAAY;AAK7B,QAJI,MAAS,WAAiB,EAAiB,EAAI,QAAQ,GACvD,MAAS,qBACJ,EAAI,gBAAgB,EAAE,qBAAqB,EAAI,eAAe,GAAG,EAAE;;AAe9E,eAAsB,EACpB,GACoB;CAQpB,IAAM,IAAS,GAAkB,EAC3B,IACJ,EAAO,QAAQ,OAAO,EAAI,QAAQ,MAAM,EAAO,QAC3C,EAAE,YAAY,EAAO,OAAO,GAC5B,EAAE,EACF,IAAkB;EACtB,GAAG,EAAyB,EAAI;EAChC,GAAG;EACH,GAAI,EAAI,WAAW,EAAE;EACtB,EACK,IAAe,EAAI,gBAAgB,EAAI,QAAQ;AAErD,KAAI,CAAC,EAAI,gBAAgB,CAAC,EAAI,WAU5B,SAAO,MATgB,EAAM,QAAmB;EAC9C,KAAK,GAAG,EAAa,QAAQ,QAAQ,GAAG,GAAG,EAAI;EAC/C,QAAQ,EAAI;EACZ,SAAS;EACT,GAAI,EAAI,SAAS,KAAA,IAAiC,EAAE,GAAvB,EAAE,MAAM,EAAI,MAAM;EAC/C,UAAU,EAAI,kBAAkB,MAAM;EACtC,GAAI,EAAI,eAAe,EAAE,cAAc,EAAI,cAAc,GAAG,EAAE;EAC/D,CAAC,EAEc;CAGlB,IAAM,IAAe,GAAuB;AAC5C,KAAI,CAAC,EAAc,OAAM,IAAI,GAAyB;CACtD,IAAM,IAAmB,GAAuB;AAuBhD,SAAO,MAjBgB,EAAM,KAC3B,GAAG,EAAa,QAAQ,QAAQ,GAAG,CAAC,mBACpC;EACE,MAAM;EACN,QAAQ,EAAI;EACZ,MAAM,EAAI;EACV,SAAS;EACT,MAAM,EAAI,QAAQ;EAClB,GAAI,EAAI,iBAAiB,EAAE,iBAAiB,EAAI,gBAAgB,GAAG,EAAE;EACtE,EACD;EACE,SAAS;EACT,SAAS;EACT,GAAI,EAAI,eAAe,EAAE,cAAc,EAAI,cAAc,GAAG,EAAE;EAC/D,CACF,EAEe"}
1
+ {"version":3,"file":"proxy.js","names":[],"sources":["../../../src/api/cloud/proxy.ts"],"sourcesContent":["import axios from \"axios\";\nimport {\n getAgentServerBaseUrl,\n getAgentServerHeaders,\n} from \"../agent-server-config\";\nimport { getActiveBackend } from \"../backend-registry/active-store\";\nimport { NoBackendAvailableError } from \"../agent-server-client-options\";\nimport { buildAuthHeaders } from \"../backend-registry/auth\";\nimport type { Backend } from \"../backend-registry/types\";\n\nexport interface CloudProxyRequest {\n /**\n * Cloud backend whose bearer token authenticates the upstream call.\n * `backend.host` is also the default upstream host unless `hostOverride`\n * is set.\n */\n backend: Backend;\n /** HTTP method against the upstream host. */\n method: \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n /** Path on the upstream host, e.g. \"/api/v1/conversation/123/events/search\". */\n path: string;\n /** Optional JSON body for non-GET methods. */\n body?: unknown;\n /** Extra headers merged with the auth header for the upstream call. */\n headers?: Record<string, string>;\n /** Override the upstream timeout, in seconds. */\n timeoutSeconds?: number;\n /**\n * Override the upstream host. When set, the proxy targets this host\n * instead of `backend.host`. Used for runtime-sandbox calls where the\n * upstream lives at the conversation's runtime URL (e.g.\n * `http://<id>.prod-runtime.all-hands.dev`) rather than the cloud API.\n * The host must still pass the proxy's allowlist server-side.\n */\n hostOverride?: string;\n /**\n * Auth strategy for the upstream call. Defaults to \"bearer\" (uses the\n * cloud backend's bearer token via `buildAuthHeaders`). For\n * runtime-sandbox calls, set to \"session-api-key\" and pass\n * `sessionApiKey` — those endpoints don't accept bearer tokens, only\n * `X-Session-API-Key`. \"none\" sends no auth header.\n */\n authMode?: \"bearer\" | \"session-api-key\" | \"none\";\n /** Required when `authMode === \"session-api-key\"`. */\n sessionApiKey?: string | null;\n /**\n * Axios responseType for the inner POST to the bundled agent-server.\n * Set to \"blob\" when the upstream cloud endpoint returns a binary\n * payload (e.g. ZIP downloads); leave undefined for default JSON.\n */\n responseType?: \"blob\";\n}\n\nfunction buildUpstreamAuthHeaders(\n req: CloudProxyRequest,\n): Record<string, string> {\n const mode = req.authMode ?? \"bearer\";\n if (mode === \"bearer\") return buildAuthHeaders(req.backend);\n if (mode === \"session-api-key\") {\n return req.sessionApiKey ? { \"X-Session-API-Key\": req.sessionApiKey } : {};\n }\n return {};\n}\n\n/**\n * Send a cloud request. App-host calls (`backend.host`) go directly to the\n * cloud API with the cloud backend's auth headers. Runtime-sandbox calls\n * pass `hostOverride`, and those go through `/api/cloud-proxy` because the\n * per-conversation runtime hosts are not the configured cloud app origin.\n *\n * App-host auth headers are sent directly to the cloud host. Proxied auth\n * headers are carried in the proxy envelope and attached server-side.\n */\nexport async function callCloudProxy<TResponse = unknown>(\n req: CloudProxyRequest,\n): Promise<TResponse> {\n // Send `X-Org-Id` so the upstream scopes per-request to the org the user\n // selected locally, instead of the user's globally-shared\n // `current_org_id` on the cloud backend. Restricted to calls against the active\n // backend: the selector also fans out per-backend bookkeeping calls\n // (e.g. `getCloudOrganizations(b)`) that would otherwise carry the\n // active backend's orgId across an unrelated API key, which the cloud backend\n // rejects when api_key_org_id and X-Org-Id disagree.\n const active = getActiveBackend();\n const orgIdHeader =\n active.backend.id === req.backend.id && active.orgId\n ? { \"X-Org-Id\": active.orgId }\n : {};\n const upstreamHeaders = {\n ...buildUpstreamAuthHeaders(req),\n ...orgIdHeader,\n ...(req.headers ?? {}),\n };\n const upstreamHost = req.hostOverride ?? req.backend.host;\n\n if (!req.hostOverride) {\n const response = await axios.request<TResponse>({\n url: `${upstreamHost.replace(/\\/+$/, \"\")}${req.path}`,\n method: req.method,\n headers: upstreamHeaders,\n ...(req.body !== undefined ? { data: req.body } : {}),\n timeout: (req.timeoutSeconds ?? 30) * 1000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n });\n\n return response.data;\n }\n\n const proxyBaseUrl = getAgentServerBaseUrl();\n if (!proxyBaseUrl) throw new NoBackendAvailableError();\n const localAuthHeaders = getAgentServerHeaders();\n\n // Talk to the configured app/ingress origin that exposes /api/cloud-proxy.\n // Do not resolve this through the backend registry: when the active backend\n // is cloud, borrowing some other registered local backend would silently\n // route cloud traffic through the wrong user-configured server.\n const response = await axios.post<TResponse>(\n `${proxyBaseUrl.replace(/\\/+$/, \"\")}/api/cloud-proxy`,\n {\n host: upstreamHost,\n method: req.method,\n path: req.path,\n headers: upstreamHeaders,\n body: req.body ?? null,\n ...(req.timeoutSeconds ? { timeout_seconds: req.timeoutSeconds } : {}),\n },\n {\n headers: localAuthHeaders,\n timeout: 30_000,\n ...(req.responseType ? { responseType: req.responseType } : {}),\n },\n );\n\n return response.data;\n}\n"],"mappings":";;;;;;AAqDA,SAAS,EACP,GACwB;CACxB,IAAM,IAAO,EAAI,YAAY;AAK7B,QAJI,MAAS,WAAiB,EAAiB,EAAI,QAAQ,GACvD,MAAS,qBACJ,EAAI,gBAAgB,EAAE,qBAAqB,EAAI,eAAe,GAAG,EAAE;;AAc9E,eAAsB,EACpB,GACoB;CAQpB,IAAM,IAAS,GAAkB,EAC3B,IACJ,EAAO,QAAQ,OAAO,EAAI,QAAQ,MAAM,EAAO,QAC3C,EAAE,YAAY,EAAO,OAAO,GAC5B,EAAE,EACF,IAAkB;EACtB,GAAG,EAAyB,EAAI;EAChC,GAAG;EACH,GAAI,EAAI,WAAW,EAAE;EACtB,EACK,IAAe,EAAI,gBAAgB,EAAI,QAAQ;AAErD,KAAI,CAAC,EAAI,aAUP,SAAO,MATgB,EAAM,QAAmB;EAC9C,KAAK,GAAG,EAAa,QAAQ,QAAQ,GAAG,GAAG,EAAI;EAC/C,QAAQ,EAAI;EACZ,SAAS;EACT,GAAI,EAAI,SAAS,KAAA,IAAiC,EAAE,GAAvB,EAAE,MAAM,EAAI,MAAM;EAC/C,UAAU,EAAI,kBAAkB,MAAM;EACtC,GAAI,EAAI,eAAe,EAAE,cAAc,EAAI,cAAc,GAAG,EAAE;EAC/D,CAAC,EAEc;CAGlB,IAAM,IAAe,GAAuB;AAC5C,KAAI,CAAC,EAAc,OAAM,IAAI,GAAyB;CACtD,IAAM,IAAmB,GAAuB;AAuBhD,SAAO,MAjBgB,EAAM,KAC3B,GAAG,EAAa,QAAQ,QAAQ,GAAG,CAAC,mBACpC;EACE,MAAM;EACN,QAAQ,EAAI;EACZ,MAAM,EAAI;EACV,SAAS;EACT,MAAM,EAAI,QAAQ;EAClB,GAAI,EAAI,iBAAiB,EAAE,iBAAiB,EAAI,gBAAgB,GAAG,EAAE;EACtE,EACD;EACE,SAAS;EACT,SAAS;EACT,GAAI,EAAI,eAAe,EAAE,cAAc,EAAI,cAAc,GAAG,EAAE;EAC/D,CACF,EAEe"}
@@ -1,2 +1,2 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs`),t=require(`../../node_modules/@openhands/typescript-client/dist/client/file-client.cjs`),n=require(`../../node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs`),r=require(`../../node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs`),i=require(`../../utils/websocket-url.cjs`),a=require(`../agent-server-config.cjs`),o=require(`../backend-registry/active-store.cjs`),s=require(`../agent-server-client-options.cjs`),c=require(`../../node_modules/uuid/dist/v4.cjs`),l=require(`../cloud/proxy.cjs`),u=require(`../../node_modules/@openhands/typescript-client/dist/models/conversation.cjs`);require(`../../node_modules/@openhands/typescript-client/dist/index.cjs`);const d=require(`../agent-server-home.cjs`),f=require(`../conversation-metadata-store.cjs`),p=require(`../cloud/conversation-service.api.cjs`),m=require(`../settings-service/settings-service.api.cjs`),h=require(`../agent-server-adapter.cjs`);var g=`1970-01-01T00:00:00.000Z`,_=`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.`;function v(){return Error(_)}function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e){return typeof e==`number`?e:null}function x(e){return typeof e==`number`?e:0}function S(e){return typeof e==`string`?e:null}function C(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:g}function w(e){return y(e)?{prompt_tokens:x(e.prompt_tokens),completion_tokens:x(e.completion_tokens),cache_read_tokens:x(e.cache_read_tokens),cache_write_tokens:x(e.cache_write_tokens),context_window:x(e.context_window),per_turn_token:x(e.per_turn_token)}:null}function T(e){return y(e)?{accumulated_cost:b(e.accumulated_cost),max_budget_per_task:b(e.max_budget_per_task),accumulated_token_usage:w(e.accumulated_token_usage)}:null}function E(e){if(!y(e))return null;let t=y(e.llm)?{model:S(e.llm.model)}:null;return{kind:S(e.kind),acp_model:S(e.acp_model),llm:t}}function D(e){return y(e)?{working_dir:S(e.working_dir)}:null}function O(e){if(!y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function k(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function A(e,t){let n=k(e),r=k(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function j(e){if(!y(e)||typeof e.id!=`string`||!e.id.trim())throw v();return{id:e.id.trim(),title:S(e.title),created_at:C(e,`created_at`,`createdAt`),updated_at:C(e,`updated_at`,`updatedAt`),execution_status:S(e.execution_status),sandbox_status:S(e.sandbox_status),metrics:T(e.metrics),agent:E(e.agent),workspace:D(e.workspace),tags:O(e.tags),current_model_id:S(e.current_model_id),current_model_name:S(e.current_model_name)}}function M(e){if(!Array.isArray(e))throw v();return e.map(j)}function N(e){if(Array.isArray(e))return{items:M(e),next_page_id:null};if(!y(e))throw v();return{items:M(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var P=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function F(e){let t=e??`idle`;return P.has(t)?t:`idle`}function I(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var L=class{static async sendMessage(t,n,r){let a=o.getActiveBackend().backend,c=r?.conversationUrl??null,u=r?.sessionApiKey??null;if(a.kind===`cloud`){if(!c||!u){let[e]=await p.batchGetCloudConversations([t]);c=e?.conversation_url?.trim()??null,u=e?.session_api_key?.trim()??null}if(!c||!u)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await l.callCloudProxy({backend:a,method:`POST`,hostOverride:i.buildHttpBaseUrl(c),path:`/api/conversations/${t}/events`,body:{...n,run:!0},authMode:`session-api-key`,sessionApiKey:u}),n}return await new e.ConversationClient(s.getAgentServerClientOptions({conversationUrl:c,sessionApiKey:u})).sendEvent(t,n,{run:!0}),n}static async createConversation(t,n,r,i,l,u,g,_,v){if(o.getActiveBackend().backend.kind===`cloud`)return p.createCloudAppConversation({initial_message:t?{role:`user`,content:[{type:`text`,text:t}]}:null,title:n??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:g??null,agent_type:_,sandbox_id:v??null});let y=await m.default.getSettings(),b=c.default(),x=await d.resolveAbsoluteAgentServerPath(l??a.buildConversationWorkingDir(b)),S=u??(l?`local_repo`:`new_worktree`),C=await h.buildStartConversationRequestWithEncryptedSettings({settings:y,query:t,conversationInstructions:n,plugins:r,conversationId:b,workingDir:x,worktree:S===`new_worktree`}),w=await new e.ConversationClient(s.getAgentServerClientOptions()).createConversation(C),T=o.getEffectiveLocalBackend();if(!T)throw new s.NoBackendAvailableError;return(i?.selected_repository||l)&&f.setStoredConversationMetadata(w.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:l??null,workspace_mode:S}),{id:w.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:w.id,agent_server_url:T.host,request:{initial_message:C.initial_message,plugins:r??null},created_at:w.created_at,updated_at:w.updated_at}}static async getStartTask(e){return o.getActiveBackend().backend.kind===`cloud`?p.getCloudAppConversationStartTask(e):null}static async getVSCodeUrl(e,t,n){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new r.VSCodeClient(s.getAgentServerClientOptions({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??a.getAgentServerWorkingDir()}static async batchGetAppConversations(t){return t.length===0?[]:o.getActiveBackend().backend.kind===`cloud`?p.batchGetCloudConversations(t):M(await new e.ConversationClient(s.getAgentServerClientOptions()).getConversations(t)).map(e=>h.toAppConversation(e))}static async updateConversationPublicFlag(e,t){if(o.getActiveBackend().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return p.updateCloudConversationPublicFlag(e,t)}static async updateConversationRepository(e,t,n,r){t?f.setStoredConversationMetadata(e,{...f.getStoredConversationMetadata(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):f.removeStoredConversationMetadata(e);let[i]=await this.batchGetAppConversations([e]);return I(i,e)}static async readConversationFile(e,n){if(o.getActiveBackend().backend.kind===`cloud`)return p.readCloudConversationFile(e,A(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let r=await this.resolveConversationWorkingDir(e),i=A(n??`${r}/.agents_tmp/PLAN.md`,r);return new t.FileClient(s.getAgentServerClientOptions()).downloadTextFile(i)}static async downloadConversation(e){return o.getActiveBackend().backend.kind===`cloud`?p.downloadCloudConversation(e):new t.FileClient(s.getAgentServerClientOptions()).downloadTrajectory(e)}static async getHooks(e){return h.emptyHooksResponse()}static async getRuntimeConversation(t,n,r){let a=o.getActiveBackend().backend,c=a.kind===`cloud`&&n?await l.callCloudProxy({backend:a,method:`GET`,hostOverride:i.buildHttpBaseUrl(n),path:`/api/conversations/${t}`,authMode:`session-api-key`,sessionApiKey:r}):await new e.ConversationClient(s.getAgentServerClientOptions({conversationUrl:n,sessionApiKey:r})).getConversation(t),u=j(c),d=y(c)?c.stats:null;return{id:u.id,title:u.title?.trim()?u.title:h.getDefaultConversationTitle(u.id),metrics:T(u.metrics),created_at:u.created_at,updated_at:u.updated_at,status:F(u.execution_status),stats:y(d)?d:{usage_to_metrics:{}}}}static async searchConversations(t=20,n){return o.getActiveBackend().backend.kind===`cloud`?p.searchCloudConversations(t,n):h.toConversationPage(N(await new e.ConversationClient(s.getAgentServerClientOptions()).searchConversations({limit:t,page_id:n,sort_order:u.ConversationSortOrder.UPDATED_AT_DESC})))}static async deleteConversation(t){o.getActiveBackend().backend.kind===`cloud`?await p.deleteCloudConversation(t):await new e.ConversationClient(s.getAgentServerClientOptions()).deleteConversation(t),f.removeStoredConversationMetadata(t)}static async updateConversationTitle(t,n){await new e.ConversationClient(s.getAgentServerClientOptions()).updateConversation(t,{title:n});let[r]=await this.batchGetAppConversations([t]);return I(r,t)}static async switchProfile(t,r){if(o.getActiveBackend().backend.kind===`cloud`)throw Error(`LLM profile switching is only supported for local agent-server backends.`);if(!t){await new n.ProfilesClient(s.getAgentServerClientOptions()).activateProfile(r);return}let i=s.getAgentServerClientOptions(),a=new e.ConversationClient(i),l=await new n.ProfilesClient(i).getProfile(r,{exposeSecrets:`encrypted`}),u=typeof l.config.model==`string`?l.config.model:``;if(!u)throw Error(`Profile '${r}' has no model.`);await a.switchLLM(t,{...l.config,model:u,usage_id:`profile:${r}:${c.default()}`})}static async switchAcpModel(t,n){let{backend:r}=o.getActiveBackend();if(r.kind===`cloud`){await l.callCloudProxy({backend:r,method:`POST`,path:`/api/v1/app-conversations/${t}/switch_acp_model`,body:{model:n}});return}await new e.ConversationClient(s.getAgentServerClientOptions()).switchAcpModel(t,n)}};exports.default=L;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs`),t=require(`../../node_modules/@openhands/typescript-client/dist/client/file-client.cjs`),n=require(`../../node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs`),r=require(`../../node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs`),i=require(`../../utils/websocket-url.cjs`),a=require(`../agent-server-config.cjs`),o=require(`../backend-registry/active-store.cjs`),s=require(`../agent-server-client-options.cjs`),c=require(`../../node_modules/uuid/dist/v4.cjs`),l=require(`../cloud/proxy.cjs`),u=require(`../../node_modules/@openhands/typescript-client/dist/models/conversation.cjs`);require(`../../node_modules/@openhands/typescript-client/dist/index.cjs`);const d=require(`../agent-server-home.cjs`),f=require(`../conversation-metadata-store.cjs`),p=require(`../cloud/conversation-service.api.cjs`),m=require(`../settings-service/settings-service.api.cjs`),h=require(`../agent-server-adapter.cjs`);var g=`1970-01-01T00:00:00.000Z`,_=`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.`;function v(){return Error(_)}function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e){return typeof e==`number`?e:null}function x(e){return typeof e==`number`?e:0}function S(e){return typeof e==`string`?e:null}function C(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:g}function w(e){return y(e)?{prompt_tokens:x(e.prompt_tokens),completion_tokens:x(e.completion_tokens),cache_read_tokens:x(e.cache_read_tokens),cache_write_tokens:x(e.cache_write_tokens),context_window:x(e.context_window),per_turn_token:x(e.per_turn_token)}:null}function T(e){return y(e)?{accumulated_cost:b(e.accumulated_cost),max_budget_per_task:b(e.max_budget_per_task),accumulated_token_usage:w(e.accumulated_token_usage)}:null}function E(e){if(!y(e))return null;let t=y(e.llm)?{model:S(e.llm.model)}:null;return{kind:S(e.kind),acp_model:S(e.acp_model),llm:t}}function D(e){return y(e)?{working_dir:S(e.working_dir)}:null}function O(e){if(!y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function k(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function A(e,t){let n=k(e),r=k(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function j(e){if(!y(e)||typeof e.id!=`string`||!e.id.trim())throw v();return{id:e.id.trim(),title:S(e.title),created_at:C(e,`created_at`,`createdAt`),updated_at:C(e,`updated_at`,`updatedAt`),execution_status:S(e.execution_status),sandbox_status:S(e.sandbox_status),metrics:T(e.metrics),agent:E(e.agent),workspace:D(e.workspace),tags:O(e.tags),current_model_id:S(e.current_model_id),current_model_name:S(e.current_model_name)}}function M(e){if(!Array.isArray(e))throw v();return e.map(j)}function N(e){if(Array.isArray(e))return{items:M(e),next_page_id:null};if(!y(e))throw v();return{items:M(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var P=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function F(e){let t=e??`idle`;return P.has(t)?t:`idle`}function I(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var L=class{static async sendMessage(t,n,r){let a=o.getActiveBackend().backend,c=r?.conversationUrl??null,u=r?.sessionApiKey??null;if(a.kind===`cloud`){if(!c||!u){let[e]=await p.batchGetCloudConversations([t]);c=e?.conversation_url?.trim()??null,u=e?.session_api_key?.trim()??null}if(!c||!u)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await l.callCloudProxy({backend:a,method:`POST`,hostOverride:i.buildHttpBaseUrl(c),path:`/api/conversations/${t}/events`,body:{...n,run:!0},authMode:`session-api-key`,sessionApiKey:u}),n}return await new e.ConversationClient(s.getAgentServerClientOptions({conversationUrl:c,sessionApiKey:u})).sendEvent(t,n,{run:!0}),n}static async createConversation(t,n,r,i,l,u,g,_,v){if(o.getActiveBackend().backend.kind===`cloud`)return p.createCloudAppConversation({initial_message:t?{role:`user`,content:[{type:`text`,text:t}]}:null,title:n??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:g??null,agent_type:_,sandbox_id:v??null});let y=await m.default.getSettings(),b=c.default(),x=await d.resolveAbsoluteAgentServerPath(l??a.buildConversationWorkingDir(b)),S=u??(l?`local_repo`:`new_worktree`),C=await h.buildStartConversationRequestWithEncryptedSettings({settings:y,query:t,conversationInstructions:n,plugins:r,conversationId:b,workingDir:x,worktree:S===`new_worktree`}),w=await new e.ConversationClient(s.getAgentServerClientOptions()).createConversation(C),T=o.getEffectiveLocalBackend();if(!T)throw new s.NoBackendAvailableError;return(i?.selected_repository||l)&&f.setStoredConversationMetadata(w.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:l??null,workspace_mode:S}),{id:w.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:w.id,agent_server_url:T.host,request:{initial_message:C.initial_message,plugins:r??null},created_at:w.created_at,updated_at:w.updated_at}}static async getStartTask(e){return o.getActiveBackend().backend.kind===`cloud`?p.getCloudAppConversationStartTask(e):null}static async getVSCodeUrl(e,t,n){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new r.VSCodeClient(s.getAgentServerClientOptions({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??a.getAgentServerWorkingDir()}static async batchGetAppConversations(t){return t.length===0?[]:o.getActiveBackend().backend.kind===`cloud`?p.batchGetCloudConversations(t):M(await new e.ConversationClient(s.getAgentServerClientOptions()).getConversations(t)).map(e=>h.toAppConversation(e))}static async updateConversationPublicFlag(e,t){if(o.getActiveBackend().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return p.updateCloudConversationPublicFlag(e,t)}static async updateConversationRepository(e,t,n,r){t?f.setStoredConversationMetadata(e,{...f.getStoredConversationMetadata(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):f.removeStoredConversationMetadata(e);let[i]=await this.batchGetAppConversations([e]);return I(i,e)}static async readConversationFile(e,n){if(o.getActiveBackend().backend.kind===`cloud`)return p.readCloudConversationFile(e,A(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let r=await this.resolveConversationWorkingDir(e),i=A(n??`${r}/.agents_tmp/PLAN.md`,r);return new t.FileClient(s.getAgentServerClientOptions()).downloadTextFile(i)}static async downloadConversation(e){return o.getActiveBackend().backend.kind===`cloud`?p.downloadCloudConversation(e):new t.FileClient(s.getAgentServerClientOptions()).downloadTrajectory(e)}static async getHooks(e){return h.emptyHooksResponse()}static async getRuntimeConversation(t,n,r){let a=o.getActiveBackend().backend,c=a.kind===`cloud`&&n?await l.callCloudProxy({backend:a,method:`GET`,hostOverride:i.buildHttpBaseUrl(n),path:`/api/conversations/${t}`,authMode:`session-api-key`,sessionApiKey:r}):await new e.ConversationClient(s.getAgentServerClientOptions({conversationUrl:n,sessionApiKey:r})).getConversation(t),u=j(c),d=y(c)?c.stats:null;return{id:u.id,title:u.title?.trim()?u.title:h.getDefaultConversationTitle(u.id),metrics:T(u.metrics),created_at:u.created_at,updated_at:u.updated_at,status:F(u.execution_status),stats:y(d)?d:{usage_to_metrics:{}}}}static async searchConversations(t=20,n){return o.getActiveBackend().backend.kind===`cloud`?p.searchCloudConversations(t,n):h.toConversationPage(N(await new e.ConversationClient(s.getAgentServerClientOptions()).searchConversations({limit:t,page_id:n,sort_order:u.ConversationSortOrder.UPDATED_AT_DESC})))}static async deleteConversation(t){o.getActiveBackend().backend.kind===`cloud`?await p.deleteCloudConversation(t):await new e.ConversationClient(s.getAgentServerClientOptions()).deleteConversation(t),f.removeStoredConversationMetadata(t)}static async updateConversationTitle(t,n){await new e.ConversationClient(s.getAgentServerClientOptions()).updateConversation(t,{title:n});let[r]=await this.batchGetAppConversations([t]);return I(r,t)}static async switchProfile(t,r){if(o.getActiveBackend().backend.kind===`cloud`)throw Error(`LLM profile switching is only supported for local agent-server backends.`);if(!t){await new n.ProfilesClient(s.getAgentServerClientOptions()).activateProfile(r);return}let i=s.getAgentServerClientOptions(),a=new e.ConversationClient(i),l=await new n.ProfilesClient(i).getProfile(r,{exposeSecrets:`encrypted`}),u=typeof l.config.model==`string`?l.config.model:``;if(!u)throw Error(`Profile '${r}' has no model.`);await h.assertSubscriptionAuthReady({llm:l.config}),await a.switchLLM(t,{...l.config,model:u,usage_id:`profile:${r}:${c.default()}`})}static async switchAcpModel(t,n){let{backend:r}=o.getActiveBackend();if(r.kind===`cloud`){await l.callCloudProxy({backend:r,method:`POST`,path:`/api/v1/app-conversations/${t}/switch_acp_model`,body:{model:n}});return}await new e.ConversationClient(s.getAgentServerClientOptions()).switchAcpModel(t,n)}};exports.default=L;
2
2
  //# sourceMappingURL=agent-server-conversation-service.api.cjs.map