@openhands/agent-canvas 1.0.0-beta.7 → 1.0.0-beta.9
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.
- package/README.md +2 -2
- package/README.windows.md +2 -2
- package/build/assets/{QueryClientProvider-Cnr-Yl3j.js → QueryClientProvider-w1cZWY41.js} +1 -1
- package/build/assets/{Trans-4jmk54WC.js → Trans-BJeYqz2A.js} +1 -1
- package/build/assets/{acp-providers-CPdgcp13.js → acp-providers-DJr8DlNG.js} +1 -1
- package/build/assets/{acp-route-guard-BoVmCn0e.js → acp-route-guard-A__sWgbc.js} +1 -1
- package/build/assets/{active-backend-context-Beu-LZL-.js → active-backend-context-I2w666XY.js} +1 -1
- package/build/assets/add-backend-modal-BDBDBXsJ.js +1 -0
- package/build/assets/agent-server-client-options-9agOSarV.js +1 -0
- package/build/assets/{agent-server-compatibility-CdI3N7dr.js → agent-server-compatibility-B7QStIcH.js} +1 -1
- package/build/assets/agent-server-conversation-service.api-Cagoqq1V.js +5 -0
- package/build/assets/agent-settings-BXBaybB_.js +2 -0
- package/build/assets/{alert-banner-DFnn_lC6.js → alert-banner-NeUl1-PQ.js} +1 -1
- package/build/assets/analytics-consent-form-modal-CmWcFlc6.js +1 -0
- package/build/assets/{api-key-entry-screen-M6su2VSf.js → api-key-entry-screen-ByXA4hXH.js} +1 -1
- package/build/assets/{app-settings-BlvBhBdc.js → app-settings-C-U6jONZ.js} +1 -1
- package/build/assets/automation-detail-Dbmgt974.js +1 -0
- package/build/assets/automations-list-BLJzAd-p.js +1 -0
- package/build/assets/{back-nav-button-7dQJ2k3O.js → back-nav-button-DgkK0Ka6.js} +1 -1
- package/build/assets/{backend-form-modal-CDnEYjaU.js → backend-form-modal-CeB983Sj.js} +1 -1
- package/build/assets/{backend-synced-settings-badge-BTIj-Ffq.js → backend-synced-settings-badge-BktJcGgH.js} +1 -1
- package/build/assets/{base-modal-C2oy2EBG.js → base-modal-DZCNv0A4.js} +1 -1
- package/build/assets/{brand-button-DJ_S16rO.js → brand-button-LBFNic99.js} +1 -1
- package/build/assets/browser-D08Sp3ZY.js +5 -0
- package/build/assets/{browser-tab-dvSPdvkm.js → browser-tab-be3QvXg9.js} +1 -1
- package/build/assets/chat-send-button-5qz0zj6R.js +1 -0
- package/build/assets/{checkmark-Dus0b6jt.js → checkmark-Rmpruj7q.js} +1 -1
- package/build/assets/{chevron-left-small-_uvG7RVM.js → chevron-left-small-6nyFCWVQ.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-DKS8MAVV.js → circle-plus-check-toggle-DquBwJ_6.js} +1 -1
- package/build/assets/{close-BU5iTc66.js → close-D_o3d8QM.js} +1 -1
- package/build/assets/{code-tag-BzyqOtPD.js → code-tag-DhsjDB-v.js} +1 -1
- package/build/assets/{combobox-caret-BJC7XJsz.js → combobox-caret-CO7eozIY.js} +1 -1
- package/build/assets/{condenser-settings-BolbDvm5.js → condenser-settings-BulzYEuW.js} +1 -1
- package/build/assets/{confirmation-modal-B5Ca6qFE.js → confirmation-modal-CMAtd9R0.js} +1 -1
- package/build/assets/{context-menu-list-item-7tAcm2c3.js → context-menu-list-item-D0swnhFt.js} +1 -1
- package/build/assets/conversation-BrjF2-Ky.js +1 -0
- package/build/assets/conversation-HgR_TTPE.js +19 -0
- package/build/assets/conversation-panel-BlRcO5AC.js +1 -0
- package/build/assets/conversation-service.api-B_Pdmwsa.js +1 -0
- package/build/assets/{conversation-tab-empty-state-CStQLPVW.js → conversation-tab-empty-state-DYjKsg_c.js} +1 -1
- package/build/assets/conversation-websocket-context-G95yfL81.js +3 -0
- package/build/assets/{copy-Chg-sFu3.js → copy-BM0RpLez.js} +1 -1
- package/build/assets/{custom-toast-handlers-ufGJ6_Rc.js → custom-toast-handlers-BohXx7uh.js} +1 -1
- package/build/assets/{declaration-CR6HMp29.js → declaration-DaUdB2Wg.js} +1 -1
- package/build/assets/{device-verify-C6mj28zv.js → device-verify-DiEJqpJb.js} +1 -1
- package/build/assets/dist-Bl-1K5Tv.js +1 -0
- package/build/assets/{dist-C3NfioQC.js → dist-xtCm0O6P.js} +1 -1
- package/build/assets/{dropdown-classes-BsVmxlNG.js → dropdown-classes-Vqz86I0R.js} +1 -1
- package/build/assets/{edit-automation-modal-BpX-t-HD.js → edit-automation-modal-CNZgSSiH.js} +1 -1
- package/build/assets/{entry.client-Ck9rQCg-.js → entry.client-BvKgdCQ9.js} +2 -2
- package/build/assets/{enum-filter-dropdown-5JeF2RLb.js → enum-filter-dropdown-DdFgk0EM.js} +1 -1
- package/build/assets/{environment-switch-overlay-Tf_BIfeR.js → environment-switch-overlay-CuBuZOaa.js} +1 -1
- package/build/assets/{extensions-hub-CE9QOb5n.js → extensions-hub-Dayqvv0n.js} +1 -1
- package/build/assets/{extensions-navigation-DSLGNGbS.js → extensions-navigation-yFLAU06N.js} +1 -1
- package/build/assets/{file-BTY6Gyy9.js → file-DwHCkWZT.js} +1 -1
- package/build/assets/files-tab-CMredyYX.js +1 -0
- package/build/assets/{folder-D1T2W1cj.js → folder-2h1hR1Qb.js} +1 -1
- package/build/assets/git-control-bar-branch-button-D8blTNXh.js +27 -0
- package/build/assets/{globe-Bzj_0oXT.js → globe-qFjFNG6J.js} +1 -1
- package/build/assets/home-TrU0fLgG.js +1 -0
- package/build/assets/{i18n-DET2iOyh.js → i18n-zDndR1Ne.js} +1 -1
- package/build/assets/install-server-modal-D8Q0xZcN.js +1 -0
- package/build/assets/{launch-CWz0dm4o.js → launch-I00QV8YT.js} +1 -1
- package/build/assets/{lesson-plan-duSsqWVs.js → lesson-plan-C18uB_56.js} +1 -1
- package/build/assets/{link-external-DGxVm4Ps.js → link-external-DtcdPFbw.js} +1 -1
- package/build/assets/{llm-client-CYEaUjGx.js → llm-client-BqyLKgUN.js} +1 -1
- package/build/assets/llm-settings-C4R4HMUO.js +1 -0
- package/build/assets/llm-settings-Dq3w2cob.js +1 -0
- package/build/assets/{loading-spinner-5GT9q1xy.js → loading-spinner-DNwR4--Z.js} +1 -1
- package/build/assets/{manage-backends-modal-DpBD_vR9.js → manage-backends-modal-Ceo_SOcf.js} +1 -1
- package/build/assets/manifest-8c2efa8a.js +1 -0
- package/build/assets/{markdown-renderer-B3IAVfv4.js → markdown-renderer-D6B-u2nM.js} +1 -1
- package/build/assets/{mcp-BUe7kiYM.js → mcp-EvrLVTla.js} +1 -1
- package/build/assets/messages-Bz9TWjlh.js +36 -0
- package/build/assets/modal-backdrop-BDqI1zBV.js +1 -0
- package/build/assets/{modal-body-aoa2fx5W.js → modal-body-CCLCqX1J.js} +1 -1
- package/build/assets/{modal-classes-6YqcqA6y.js → modal-classes-DwTdT3IK.js} +1 -1
- package/build/assets/{modal-close-button-CtWOUMmw.js → modal-close-button-gQgKqUf-.js} +1 -1
- package/build/assets/{model-selector-BvSTrkhT.js → model-selector-DoL0CL0_.js} +1 -1
- package/build/assets/{mutation-D0OogFCz.js → mutation-CaJwPR9O.js} +1 -1
- package/build/assets/{navigation-context-BdKYH32C.js → navigation-context-aNGUUtdq.js} +1 -1
- package/build/assets/{navigation-link-U4vY9i_C.js → navigation-link-CYkF2y3K.js} +1 -1
- package/build/assets/onboarding-DLr9jbKH.js +1 -0
- package/build/assets/{openhands-logo-CCo0wJZX.js → openhands-logo-CHmtDV-t.js} +1 -1
- package/build/assets/{option-service.api-DmNVxAvS.js → option-service.api-CGNANEcT.js} +1 -1
- package/build/assets/{organization-service.api-DbnougaQ.js → organization-service.api-Dn74hBTH.js} +1 -1
- package/build/assets/path-utils-BjxzIGLp.js +1 -0
- package/build/assets/{plan-components-CRDMQzsS.js → plan-components--aLlpASH.js} +1 -1
- package/build/assets/{planner-tab-CmIjLz7q.js → planner-tab-B-5EeCEm.js} +1 -1
- package/build/assets/{profiles-client-fEmgWkCW.js → profiles-client-BrqNmaDV.js} +1 -1
- package/build/assets/{providers-CbD7fiic.js → providers-DknP6O2g.js} +1 -1
- package/build/assets/{proxy-BAdHH8QB.js → proxy-sRh0WKI7.js} +1 -1
- package/build/assets/{query-client-config-CRnGSujB.js → query-client-config-CWWGQWvw.js} +1 -1
- package/build/assets/{recommended-automations-launcher-uTyODuzB.js → recommended-automations-launcher-BIul0osB.js} +3 -3
- package/build/assets/root-BietmyRa.js +2 -0
- package/build/assets/{root-Z2VHU4R3.css → root-CN7qsvxg.css} +1 -1
- package/build/assets/root-layout-BgPi-t57.js +2 -0
- package/build/assets/{sdk-section-page-BgDlMhcq.js → sdk-section-page-VmtJWH3A.js} +1 -1
- package/build/assets/{sdk-settings-schema-CLmJ9sho.js → sdk-settings-schema-DFievvEK.js} +1 -1
- package/build/assets/{search-SuJctqNJ.js → search-BeVRXvX7.js} +1 -1
- package/build/assets/{secrets-service-B7CxNinp.js → secrets-service-DVtlLWY8.js} +1 -1
- package/build/assets/{secrets-settings-yK7CqIpm.js → secrets-settings-BLMvCkKm.js} +1 -1
- package/build/assets/{server-client-Kh4QSwDJ.js → server-client-DYv_GHPl.js} +1 -1
- package/build/assets/{settings-DN5PpgRD.js → settings-CXvJUx_j.js} +1 -1
- package/build/assets/{settings-dropdown-input-BtoovFre.js → settings-dropdown-input-DA_pzHWE.js} +1 -1
- package/build/assets/{settings-gear-Dd8K2_8B.js → settings-gear-aNebYlCy.js} +1 -1
- package/build/assets/{settings-index-DKC8IY1P.js → settings-index-CycvkOoq.js} +1 -1
- package/build/assets/{settings-input-CehsXnb3.js → settings-input-8y5p4kze.js} +1 -1
- package/build/assets/{settings-list-classes-E3v_f6QG.js → settings-list-classes-Qk7zl0Wu.js} +1 -1
- package/build/assets/settings-modal-nJYxCsyp.js +1 -0
- package/build/assets/{settings-section-header-context-DewwJ0-F.js → settings-section-header-context-B77tsYlx.js} +1 -1
- package/build/assets/{settings-service.api-C3rxTtPj.js → settings-service.api-DxIEtvx6.js} +1 -1
- package/build/assets/{settings-switch-BiBuS3xa.js → settings-switch-ba4DuiNO.js} +1 -1
- package/build/assets/{settings-utils-DY04tWG1.js → settings-utils-BxzHqLmZ.js} +1 -1
- package/build/assets/{shared-conversation-h9YnBtCU.js → shared-conversation-x41nZQi7.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-D0-AvsnT.js → sidebar-mobile-menu-toggle-C0mmabKj.js} +1 -1
- package/build/assets/{sidebar-nav-link-OhIeFyna.js → sidebar-nav-link-BsYdDFfb.js} +1 -1
- package/build/assets/{skill-card-pill-row-BW9qvhoK.js → skill-card-pill-row-BhUlGcYB.js} +1 -1
- package/build/assets/{skills-0GRKX5Xj.js → skills-TYjOUQ2d.js} +1 -1
- package/build/assets/{skills-plugins-DNcsNF88.js → skills-plugins-D0pdqgKa.js} +1 -1
- package/build/assets/{skills-settings-7liFiSY6.js → skills-settings-VqKTkmVl.js} +2 -2
- package/build/assets/{styled-tooltip-hdfMXPQC.js → styled-tooltip-TCp7svY3.js} +1 -1
- package/build/assets/{switch-skeleton-DSKqSx2A.js → switch-skeleton-cKrdaYGj.js} +1 -1
- package/build/assets/{task-list-tab-DT6_zfUs.js → task-list-tab-BiizRsY3.js} +1 -1
- package/build/assets/telemetry-3piyXm5H.js +2 -0
- package/build/assets/{terminal-CPYWdo4j.js → terminal-BSYITdM0.js} +1 -1
- package/build/assets/{terminal-CDhQGDua.js → terminal-CpgZx6go.js} +1 -1
- package/build/assets/{toggle-switch-T2v6sJ6l.js → toggle-switch-CUgOZqZu.js} +1 -1
- package/build/assets/{typography-BDgnT7Yp.js → typography-Bvw0IxaN.js} +1 -1
- package/build/assets/{u-check-circle-half-steSK_JB.js → u-check-circle-half-DjpjzWu3.js} +1 -1
- package/build/assets/{u-check-circle-DOauqQKb.js → u-check-circle-u9QiS4Fr.js} +1 -1
- package/build/assets/{u-circuit-x3ExjBbU.js → u-circuit-DlBlOwx9.js} +1 -1
- package/build/assets/{u-edit-BbrptMCa.js → u-edit-BIYzjs3v.js} +1 -1
- package/build/assets/{use-active-conversation-DHGcmjCK.js → use-active-conversation-q1wT8LI5.js} +1 -1
- package/build/assets/{use-agent-settings-schema-CLoTOSJI.js → use-agent-settings-schema-Yxf7KGyG.js} +1 -1
- package/build/assets/{use-agent-state-PKrUPMJ3.js → use-agent-state-CCHlVqvY.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-Ddr75hEz.js → use-cloud-current-user-id-BAKf91Zx.js} +1 -1
- package/build/assets/{use-config-OIMQLQ2s.js → use-config-DwfigQ_Y.js} +1 -1
- package/build/assets/use-create-conversation-BEzddjXn.js +1 -0
- package/build/assets/{use-get-secrets-8Jby8ele.js → use-get-secrets-BlO1BfUo.js} +1 -1
- package/build/assets/{use-handle-plan-click-CohJPvvW.js → use-handle-plan-click-Bfl0zIBr.js} +1 -1
- package/build/assets/use-is-authed-hHndEep7.js +1 -0
- package/build/assets/{use-launch-skill-in-chat-sQNEOLGD.js → use-launch-skill-in-chat-3ydwpi_M.js} +1 -1
- package/build/assets/use-llm-profiles-E-jjZMZw.js +1 -0
- package/build/assets/use-runtime-is-ready-DBWzvAmc.js +1 -0
- package/build/assets/use-save-settings-rE9aA29R.js +1 -0
- package/build/assets/{use-settings-D5hbTS9t.js → use-settings-BPTbE7lg.js} +1 -1
- package/build/assets/{use-settings-nav-items-BcSbo02d.js → use-settings-nav-items-C7MOWj09.js} +1 -1
- package/build/assets/{use-skills-D7PS0fH0.js → use-skills-QhoaIYGF.js} +1 -1
- package/build/assets/{use-task-list-CsT10CBb.js → use-task-list-YMkSzdDv.js} +1 -1
- package/build/assets/use-tracking-DQYdZpxi.js +1 -0
- package/build/assets/{use-unified-vscode-url-DEoe-NRI.js → use-unified-vscode-url-DFtNIC1Q.js} +1 -1
- package/build/assets/{use-user-conversation-Cs5H1pUF.js → use-user-conversation-BRAseenw.js} +1 -1
- package/build/assets/{useMutation-GSSKKebK.js → useMutation-DDo48A8t.js} +1 -1
- package/build/assets/{useTranslation-B6voJV4y.js → useTranslation-CEcjrme-.js} +1 -1
- package/build/assets/{utils-DCVfKFRt.js → utils-CdgBzLA7.js} +1 -1
- package/build/assets/{vendor~browser-BrOJLj3y.js → vendor~browser-DWk6fNtJ.js} +1 -1
- package/build/assets/{vendor~browser-tab-BxhTtM9_.js → vendor~browser-tab-NZdVoI2Z.js} +1 -1
- package/build/assets/{vendor~conversation-panel~conversation-C9o-K1hW.js → vendor~conversation-panel~conversation-gp03cWZW.js} +1 -1
- package/build/assets/{vendor~conversation-panel~conversation~index-RXYdJYxU.js → vendor~conversation-panel~conversation~index-BZ5C6Xpz.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jfc6hidu-DJS-rJdI.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-BodGsxSf.js} +1 -1
- package/build/assets/{vendor~files-tab-BtkpAiMX.js → vendor~files-tab-Buz36Y-q.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation-PK1-gtXU.js → vendor~home~conversation-panel~conversation-DG0H5SkJ.js} +2 -2
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-6ByzelMS.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-1pTajrpX.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BED5W_c4.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9Il_wz8U.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CCbqAFiI.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B7I1ZxCx.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-E4d6IEfI.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Ceeqkj0k.js} +1 -1
- package/build/assets/{vendor~launch-BXgl67Re.js → vendor~launch-DXL78kBf.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-DW31UyBp.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-CfAc3nMS.js} +1 -1
- package/build/assets/vendor~root-layout~home~conversation-panel~conversation-DkwcKRtv.js +1 -0
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-tTR8C6m0.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-BC9XTECT.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-6Rm8U_Sr.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-DSqEbr0N.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~k776hupu-BJbu9kpL.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~k776hupu-D0XUSHNN.js} +2 -2
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-hTzSytKK.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-D8soyAAx.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-d2oallMa.js → vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CcFtthyg.js} +1 -1
- package/build/assets/vendor~root-layout~home~mcp~automations-list-BnIlGhjl.js +1 -0
- package/build/assets/{vendor~home~mcp~automations-list-BgV86Sti.js → vendor~root-layout~home~mcp~automations-list-cNHi83v_.js} +1 -1
- package/build/assets/{vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-CjJdFLoM.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-BGWUbqUq.js} +1 -1
- package/build/assets/{vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-m8dOii0J.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-BuCSnjsW.js} +2 -2
- package/build/assets/{vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js → vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~jaomi49z-Cw89stA6.js} +1 -1
- package/build/assets/{verification-settings-Dlt8pINd.js → verification-settings-CIqtxWat.js} +1 -1
- package/build/assets/{vscode-tab-DgepcYtF.js → vscode-tab-DEt72yJX.js} +1 -1
- package/build/assets/{waiting-for-runtime-message-CdK3btDZ.js → waiting-for-runtime-message-DSjJfeoj.js} +1 -1
- package/build/assets/{x-mark-BrkSPIiT.js → x-mark-DsJ9tDD0.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +4 -2
- package/build/locales/ca/openhands.json +4 -2
- package/build/locales/de/openhands.json +4 -2
- package/build/locales/en/openhands.json +4 -2
- package/build/locales/es/openhands.json +4 -2
- package/build/locales/fr/openhands.json +4 -2
- package/build/locales/it/openhands.json +4 -2
- package/build/locales/ja/openhands.json +4 -2
- package/build/locales/ko-KR/openhands.json +4 -2
- package/build/locales/no/openhands.json +4 -2
- package/build/locales/pt/openhands.json +4 -2
- package/build/locales/tr/openhands.json +4 -2
- package/build/locales/uk/openhands.json +4 -2
- package/build/locales/zh-CN/openhands.json +4 -2
- package/build/locales/zh-TW/openhands.json +4 -2
- package/config/defaults.json +1 -1
- package/dist/api/agent-server-config.cjs +1 -1
- package/dist/api/agent-server-config.cjs.map +1 -1
- package/dist/api/agent-server-config.d.ts +17 -0
- package/dist/api/agent-server-config.js +7 -1
- package/dist/api/agent-server-config.js.map +1 -1
- package/dist/api/agent-server-home.cjs +2 -0
- package/dist/api/agent-server-home.cjs.map +1 -0
- package/dist/api/agent-server-home.d.ts +34 -0
- package/dist/api/agent-server-home.js +33 -0
- package/dist/api/agent-server-home.js.map +1 -0
- package/dist/api/conversation-file-upload.api.cjs +1 -1
- package/dist/api/conversation-file-upload.api.cjs.map +1 -1
- package/dist/api/conversation-file-upload.api.js +4 -1
- package/dist/api/conversation-file-upload.api.js.map +1 -1
- package/dist/api/conversation-service/agent-server-conversation-service.api.cjs +1 -1
- package/dist/api/conversation-service/agent-server-conversation-service.api.cjs.map +1 -1
- package/dist/api/conversation-service/agent-server-conversation-service.api.js +101 -100
- package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
- package/dist/api/option-service/option-service.api.cjs.map +1 -1
- package/dist/api/option-service/option-service.api.js.map +1 -1
- package/dist/api/workspace-upload-path.cjs +1 -1
- package/dist/api/workspace-upload-path.cjs.map +1 -1
- package/dist/api/workspace-upload-path.d.ts +44 -2
- package/dist/api/workspace-upload-path.js +16 -14
- package/dist/api/workspace-upload-path.js.map +1 -1
- package/dist/components/features/automations/recommended-automations-launcher.d.ts +3 -1
- package/dist/components/features/automations/recommended-automations-section.d.ts +3 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +7 -1
- package/dist/components/features/backends/backend-form-modal.js +94 -91
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/chat/chat-interface.cjs +2 -2
- package/dist/components/features/chat/chat-interface.cjs.map +1 -1
- package/dist/components/features/chat/chat-interface.js +66 -66
- package/dist/components/features/chat/chat-interface.js.map +1 -1
- package/dist/components/features/chat/confirmation-mode-enabled.cjs +1 -1
- package/dist/components/features/chat/confirmation-mode-enabled.js +4 -4
- package/dist/components/features/chat/switch-profile-button.cjs +1 -1
- package/dist/components/features/chat/switch-profile-button.js +3 -3
- package/dist/components/features/conversation-panel/conversation-card/conversation-card.cjs +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card.cjs.map +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card.js +5 -5
- package/dist/components/features/conversation-panel/conversation-card/conversation-card.js.map +1 -1
- package/dist/components/features/onboarding/index.d.ts +1 -0
- package/dist/components/features/onboarding/onboarding-host.d.ts +3 -1
- package/dist/components/features/onboarding/onboarding-modal.d.ts +7 -3
- package/dist/components/features/onboarding/onboarding-preview.d.ts +4 -0
- package/dist/components/features/onboarding/steps/say-hello-step.d.ts +3 -1
- package/dist/components/features/settings/llm-profiles/llm-settings-local-view.cjs +1 -1
- package/dist/components/features/settings/llm-profiles/llm-settings-local-view.js +1 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.cjs +1 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.cjs.map +1 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.d.ts +3 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js +56 -56
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js.map +1 -1
- package/dist/components/features/skills/extensions-navigation.cjs +1 -1
- package/dist/components/features/skills/extensions-navigation.js +7 -7
- package/dist/components/shared/modals/modal-backdrop.cjs +1 -1
- package/dist/components/shared/modals/modal-backdrop.cjs.map +1 -1
- package/dist/components/shared/modals/modal-backdrop.d.ts +3 -1
- package/dist/components/shared/modals/modal-backdrop.js +3 -3
- package/dist/components/shared/modals/modal-backdrop.js.map +1 -1
- package/dist/components/shared/modals/settings/settings-form.cjs +1 -1
- package/dist/components/shared/modals/settings/settings-form.cjs.map +1 -1
- package/dist/components/shared/modals/settings/settings-form.js +7 -7
- package/dist/components/shared/modals/settings/settings-form.js.map +1 -1
- package/dist/hooks/chat/use-model-interceptor.cjs +1 -1
- package/dist/hooks/chat/use-model-interceptor.js +4 -4
- package/dist/hooks/mutation/use-save-settings.cjs +1 -1
- package/dist/hooks/mutation/use-save-settings.cjs.map +1 -1
- package/dist/hooks/mutation/use-save-settings.js +13 -14
- package/dist/hooks/mutation/use-save-settings.js.map +1 -1
- package/dist/hooks/query/use-llm-profiles.cjs +1 -1
- package/dist/hooks/query/use-llm-profiles.js +5 -5
- package/dist/hooks/use-download-conversation.cjs +1 -1
- package/dist/hooks/use-download-conversation.cjs.map +1 -1
- package/dist/hooks/use-download-conversation.js +4 -4
- package/dist/hooks/use-download-conversation.js.map +1 -1
- package/dist/hooks/use-tracking.cjs +1 -1
- package/dist/hooks/use-tracking.cjs.map +1 -1
- package/dist/hooks/use-tracking.d.ts +31 -0
- package/dist/hooks/use-tracking.js +51 -14
- package/dist/hooks/use-tracking.js.map +1 -1
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +2 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +1 -1
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +64 -30
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +4 -2
- package/dist/locales/ca/openhands.json +4 -2
- package/dist/locales/de/openhands.json +4 -2
- package/dist/locales/en/openhands.json +4 -2
- package/dist/locales/es/openhands.json +4 -2
- package/dist/locales/fr/openhands.json +4 -2
- package/dist/locales/it/openhands.json +4 -2
- package/dist/locales/ja/openhands.json +4 -2
- package/dist/locales/ko-KR/openhands.json +4 -2
- package/dist/locales/no/openhands.json +4 -2
- package/dist/locales/pt/openhands.json +4 -2
- package/dist/locales/tr/openhands.json +4 -2
- package/dist/locales/uk/openhands.json +4 -2
- package/dist/locales/zh-CN/openhands.json +4 -2
- package/dist/locales/zh-TW/openhands.json +4 -2
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/routes/llm-settings.cjs +1 -1
- package/dist/routes/llm-settings.cjs.map +1 -1
- package/dist/routes/llm-settings.d.ts +3 -1
- package/dist/routes/llm-settings.js +17 -16
- package/dist/routes/llm-settings.js.map +1 -1
- package/package.json +1 -1
- package/scripts/dev-static.mjs +0 -2
- package/scripts/dev-with-automation.mjs +0 -2
- package/scripts/static-server.mjs +28 -6
- package/build/assets/add-backend-modal-BheqYXHK.js +0 -1
- package/build/assets/agent-server-client-options-HEOwGVIU.js +0 -1
- package/build/assets/agent-server-conversation-service.api-CORdqJZg.js +0 -5
- package/build/assets/agent-settings-UFvcGjoI.js +0 -2
- package/build/assets/analytics-consent-form-modal-CVNugqzu.js +0 -1
- package/build/assets/automation-detail-BWrQk4Oa.js +0 -1
- package/build/assets/automations-list-ux9KvYsU.js +0 -1
- package/build/assets/browser-CGM-k-sH.js +0 -5
- package/build/assets/conversation-D0N4dw_p.js +0 -19
- package/build/assets/conversation-DhRJuZLG.js +0 -1
- package/build/assets/conversation-panel-CNqHbS_Z.js +0 -1
- package/build/assets/conversation-service.api-BsJy6uuL.js +0 -1
- package/build/assets/conversation-websocket-context-DvHgx_FE.js +0 -3
- package/build/assets/dist-DNeWJ2bh.js +0 -1
- package/build/assets/ellipsis-button-Vh5MvRZa.js +0 -1
- package/build/assets/files-tab-cL668j1I.js +0 -1
- package/build/assets/git-branch-DQS2nMK4.js +0 -1
- package/build/assets/git-control-bar-branch-button-DtIrOrie.js +0 -27
- package/build/assets/git-provider-icon-CHdGBdU2.js +0 -1
- package/build/assets/home-Cz2Veg56.js +0 -1
- package/build/assets/install-server-modal-B9nXCS3u.js +0 -1
- package/build/assets/llm-settings-DFkXHuvT.js +0 -1
- package/build/assets/llm-settings-DhrdCXqX.js +0 -1
- package/build/assets/manage-workspaces-modal-CtRbxREx.js +0 -1
- package/build/assets/manifest-eed90ff5.js +0 -1
- package/build/assets/messages-dqp_KYyl.js +0 -36
- package/build/assets/modal-backdrop-RfNCrSpK.js +0 -1
- package/build/assets/path-utils-onx24uF5.js +0 -1
- package/build/assets/root-DmjpFpTu.js +0 -2
- package/build/assets/root-layout-DejMsKhy.js +0 -2
- package/build/assets/settings-modal-DJ4kGzUx.js +0 -1
- package/build/assets/use-create-conversation-Bszyp13O.js +0 -1
- package/build/assets/use-is-authed-dw2026rR.js +0 -1
- package/build/assets/use-is-creating-conversation-DX2qSlfL.js +0 -1
- package/build/assets/use-llm-profiles-C861aFAq.js +0 -1
- package/build/assets/use-runtime-is-ready-Do2h_hRl.js +0 -1
- package/build/assets/use-save-settings-DkAOEfD9.js +0 -1
- package/build/assets/vendor~home~mcp~automations-list-CZSK-lT2.js +0 -1
- package/build/assets/vendor~root-layout~home~conversation-panel~conversation-B5WNMnt4.js +0 -1
- /package/build/assets/{automation-XDPAjiZi.js → automation-DJ_3GeXD.js} +0 -0
- /package/build/assets/{browser-store-DAsixKdU.js → browser-store-JRrcGdlk.js} +0 -0
- /package/build/assets/{check-CYxAHs85.js → check-CZhEL6rP.js} +0 -0
- /package/build/assets/{chevron-down-Bnmd5iG-.js → chevron-down-KhWYEjeW.js} +0 -0
- /package/build/assets/{color-themes-B9pm9c-R.js → color-themes-0biOprdo.js} +0 -0
- /package/build/assets/{command-store-CE1weJy8.js → command-store-UzKGSUC2.js} +0 -0
- /package/build/assets/{files-tab-store-m0ARqX_E.js → files-tab-store-DLU28g8C.js} +0 -0
- /package/build/assets/{iconBase-DE30Zj_-.js → iconBase-BVhFI-0E.js} +0 -0
- /package/build/assets/{map-provider-BJ_8KZKU.js → map-provider-C3Z5Dx2J.js} +0 -0
- /package/build/assets/{sdk-settings-field-metadata-DQiaIBie.js → sdk-settings-field-metadata-C6KMD-jZ.js} +0 -0
- /package/build/assets/{settings-like-page-layout-classes-D7YjdTd0.js → settings-like-page-layout-classes-DNg2vKSM.js} +0 -0
- /package/build/assets/{use-breakpoint-DF_RiQ6s.js → use-breakpoint-DpxHDmuH.js} +0 -0
- /package/build/assets/{use-event-store-BomO7ywK.js → use-event-store-Cxqc45Sw.js} +0 -0
- /package/build/assets/{vendor~browser-DisFGEp9.js → vendor~browser-BDNLFng6.js} +0 -0
- /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-w-I2sY6c.js → vendor~conversation-panel~conversation~alert-banner-D_hRW_zc.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~g56ukk6u-DsSvIDZQ.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~h07fzaqi-D15MEcqi.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~hkqzh1hb-BZ0HXuHD.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~j8sdb9mk-OFpe9fX_.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~zm51vy4j-BClAMeFe.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~lpdshwee-BPuuVEqr.js} +0 -0
- /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CG96FCly.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CXivI4Ym.js} +0 -0
- /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CyZ-3lDQ.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Dr3Ow7Ms.js} +0 -0
- /package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~i4kjfqhl-CbAhtEMv.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~i4kjfqhl-B1TKKuuH.js} +0 -0
- /package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-CLlsvdNP.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-Fa-nXZ4M.js} +0 -0
- /package/build/assets/{vendor~terminal-DZaJIY8A.js → vendor~terminal-0ObOedYm.js} +0 -0
- /package/build/assets/{vscode-url-helper-Cwy1A62q.js → vscode-url-helper-BMq8JBhB.js} +0 -0
|
@@ -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(`../../node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs`),r=require(`../../node_modules/@openhands/typescript-client/dist/client/file-client.cjs`),i=require(`../../node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs`),a=require(`../../node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs`),o=require(`../../node_modules/uuid/dist/v4.cjs`),s=require(`../../utils/websocket-url.cjs`),c=require(`../agent-server-client-options.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(`../conversation-metadata-store.cjs`),
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../agent-server-config.cjs`),t=require(`../backend-registry/active-store.cjs`),n=require(`../../node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs`),r=require(`../../node_modules/@openhands/typescript-client/dist/client/file-client.cjs`),i=require(`../../node_modules/@openhands/typescript-client/dist/client/profiles-client.cjs`),a=require(`../../node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs`),o=require(`../../node_modules/uuid/dist/v4.cjs`),s=require(`../../utils/websocket-url.cjs`),c=require(`../agent-server-client-options.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(e,r,i){let a=t.getActiveBackend().backend,o=i?.conversationUrl??null,u=i?.sessionApiKey??null;if(a.kind===`cloud`){if(!o||!u){let[t]=await p.batchGetCloudConversations([e]);o=t?.conversation_url?.trim()??null,u=t?.session_api_key?.trim()??null}if(!o||!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:s.buildHttpBaseUrl(o),path:`/api/conversations/${e}/events`,body:{...r,run:!0},authMode:`session-api-key`,sessionApiKey:u}),r}return await new n.ConversationClient(c.getAgentServerClientOptions({conversationUrl:o,sessionApiKey:u})).sendEvent(e,r,{run:!0}),r}static async createConversation(r,i,a,s,l,u,g,_){if(t.getActiveBackend().backend.kind===`cloud`)return p.createCloudAppConversation({initial_message:r?{role:`user`,content:[{type:`text`,text:r}]}:null,title:i??null,selected_repository:s?.selected_repository??null,selected_branch:s?.selected_branch??null,git_provider:s?.git_provider??null,plugins:a??null,parent_conversation_id:u??null,agent_type:g,sandbox_id:_??null});let v=await m.default.getSettings(),y=o.default(),b=await h.buildStartConversationRequestWithEncryptedSettings({settings:v,query:r,conversationInstructions:i,plugins:a,conversationId:y,workingDir:await d.resolveAbsoluteAgentServerPath(l??e.buildConversationWorkingDir(y))}),x=await new n.ConversationClient(c.getAgentServerClientOptions()).createConversation(b),S=t.getEffectiveLocalBackend();if(!S)throw new c.NoBackendAvailableError;return(s?.selected_repository||l)&&f.setStoredConversationMetadata(x.id,{selected_repository:s?.selected_repository??null,selected_branch:s?.selected_branch??null,git_provider:s?.git_provider??null,selected_workspace:l??null}),{id:x.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:x.id,agent_server_url:S.host,request:{initial_message:b.initial_message,plugins:a??null},created_at:x.created_at,updated_at:x.updated_at}}static async getStartTask(e){return t.getActiveBackend().backend.kind===`cloud`?p.getCloudAppConversationStartTask(e):null}static async getVSCodeUrl(e,t,n){let r=await this.resolveConversationWorkingDir(e);return{vscode_url:await new a.VSCodeClient(c.getAgentServerClientOptions({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async resolveConversationWorkingDir(t){let[n]=await this.batchGetAppConversations([t]);return n?.workspace?.working_dir??e.getAgentServerWorkingDir()}static async batchGetAppConversations(e){return e.length===0?[]:t.getActiveBackend().backend.kind===`cloud`?p.batchGetCloudConversations(e):M(await new n.ConversationClient(c.getAgentServerClientOptions()).getConversations(e)).map(e=>h.toAppConversation(e))}static async updateConversationPublicFlag(e,n){if(t.getActiveBackend().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return p.updateCloudConversationPublicFlag(e,n)}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(t.getActiveBackend().backend.kind===`cloud`)return p.readCloudConversationFile(e,A(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let i=await this.resolveConversationWorkingDir(e),a=A(n??`${i}/.agents_tmp/PLAN.md`,i);return new r.FileClient(c.getAgentServerClientOptions()).downloadTextFile(a)}static async downloadConversation(e){return t.getActiveBackend().backend.kind===`cloud`?p.downloadCloudConversation(e):new r.FileClient(c.getAgentServerClientOptions()).downloadTrajectory(e)}static async getHooks(e){return h.emptyHooksResponse()}static async getRuntimeConversation(e,r,i){let a=t.getActiveBackend().backend,o=a.kind===`cloud`&&r?await l.callCloudProxy({backend:a,method:`GET`,hostOverride:s.buildHttpBaseUrl(r),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:i}):await new n.ConversationClient(c.getAgentServerClientOptions({conversationUrl:r,sessionApiKey:i})).getConversation(e),u=j(o),d=y(o)?o.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(e=20,r){return t.getActiveBackend().backend.kind===`cloud`?p.searchCloudConversations(e,r):h.toConversationPage(N(await new n.ConversationClient(c.getAgentServerClientOptions()).searchConversations({limit:e,page_id:r,sort_order:u.ConversationSortOrder.UPDATED_AT_DESC})))}static async deleteConversation(e){t.getActiveBackend().backend.kind===`cloud`?await p.deleteCloudConversation(e):await new n.ConversationClient(c.getAgentServerClientOptions()).deleteConversation(e),f.removeStoredConversationMetadata(e)}static async updateConversationTitle(e,t){await new n.ConversationClient(c.getAgentServerClientOptions()).updateConversation(e,{title:t});let[r]=await this.batchGetAppConversations([e]);return I(r,e)}static async switchProfile(e,r){if(t.getActiveBackend().backend.kind===`cloud`)throw Error(`LLM profile switching is only supported for local agent-server backends.`);if(!e){await new i.ProfilesClient(c.getAgentServerClientOptions()).activateProfile(r);return}let a=c.getAgentServerClientOptions(),s=new n.ConversationClient(a),l=await new i.ProfilesClient(a).getProfile(r,{exposeSecrets:`encrypted`}),u=typeof l.config.model==`string`?l.config.model:``;if(!u)throw Error(`Profile '${r}' has no model.`);await s.switchLLM(e,{...l.config,model:u,usage_id:`profile:${r}:${o.default()}`})}static async switchAcpModel(e,r){if(t.getActiveBackend().backend.kind===`cloud`)throw Error(`ACP model switching is only supported for local agent-server backends.`);await new n.ConversationClient(c.getAgentServerClientOptions()).switchAcpModel(e,r)}};exports.default=L;
|
|
2
2
|
//# sourceMappingURL=agent-server-conversation-service.api.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-server-conversation-service.api.cjs","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n} from \"../conversation-metadata-store\";\nimport type {\n GetHooksResponse,\n PluginSpec,\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n MetricsSnapshot,\n RuntimeConversationInfo,\n SendMessageRequest,\n SendMessageResponse,\n} from \"./agent-server-conversation-service.types\";\n\nconst DEFAULT_CONVERSATION_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst INVALID_CONVERSATION_RESPONSE_MESSAGE =\n \"Unable to load conversations because the selected agent server returned \" +\n \"data this UI does not understand. Check the backend URL/session key and \" +\n \"update the agent server if needed.\";\nfunction invalidConversationResponse(): Error {\n return new Error(INVALID_CONVERSATION_RESPONSE_MESSAGE);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === \"number\" ? value : null;\n}\n\nfunction numberOrZero(value: unknown): number {\n return typeof value === \"number\" ? value : 0;\n}\n\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readTimestamp(\n item: Record<string, unknown>,\n snakeKey: \"created_at\" | \"updated_at\",\n camelKey: \"createdAt\" | \"updatedAt\",\n): string {\n const value = item[snakeKey] ?? item[camelKey];\n return typeof value === \"string\" && value.trim()\n ? value\n : DEFAULT_CONVERSATION_TIMESTAMP;\n}\n\nfunction normalizeTokenUsage(\n value: unknown,\n): NonNullable<MetricsSnapshot[\"accumulated_token_usage\"]> | null {\n if (!isRecord(value)) return null;\n\n return {\n prompt_tokens: numberOrZero(value.prompt_tokens),\n completion_tokens: numberOrZero(value.completion_tokens),\n cache_read_tokens: numberOrZero(value.cache_read_tokens),\n cache_write_tokens: numberOrZero(value.cache_write_tokens),\n context_window: numberOrZero(value.context_window),\n per_turn_token: numberOrZero(value.per_turn_token),\n };\n}\n\nfunction normalizeMetrics(value: unknown): MetricsSnapshot | null {\n if (!isRecord(value)) return null;\n\n return {\n accumulated_cost: numberOrNull(value.accumulated_cost),\n max_budget_per_task: numberOrNull(value.max_budget_per_task),\n accumulated_token_usage: normalizeTokenUsage(value.accumulated_token_usage),\n };\n}\n\nfunction normalizeAgent(value: unknown): DirectConversationInfo[\"agent\"] {\n if (!isRecord(value)) return null;\n const llm = isRecord(value.llm)\n ? { model: stringOrNull(value.llm.model) }\n : null;\n // ``kind`` is the SDK's pydantic discriminator (``\"Agent\"`` vs ``\"ACPAgent\"``);\n // ``toAppConversation`` reads it to derive ``agent_kind``. ``acp_model`` is\n // the Canvas-configured model on the ACPAgent — preserved so the conversation\n // adapter and the conversation chip can fall back to it when the SDK runtime\n // model fields aren't populated. Preserving these here makes the wire path\n // agree with the unit-test path that builds ``DirectConversationInfo``\n // directly (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction normalizeAbsolutePath(path: string): string | null {\n if (!path.startsWith(\"/\")) return null;\n\n const segments: string[] = [];\n for (const segment of path.split(\"/\")) {\n if (segment && segment !== \".\") {\n if (segment === \"..\") {\n if (!segments.length) return null;\n segments.pop();\n } else {\n segments.push(segment);\n }\n }\n }\n\n return `/${segments.join(\"/\")}`;\n}\n\nfunction requirePathInsideDirectory(path: string, directory: string): string {\n const normalizedPath = normalizeAbsolutePath(path);\n const normalizedDirectory = normalizeAbsolutePath(directory);\n\n if (\n !normalizedPath ||\n !normalizedDirectory ||\n (normalizedPath !== normalizedDirectory &&\n !normalizedPath.startsWith(`${normalizedDirectory}/`))\n ) {\n throw new Error(\"Conversation file path must stay inside the workspace\");\n }\n\n return normalizedPath;\n}\n\nfunction requireDirectConversationInfo(item: unknown): DirectConversationInfo {\n if (!isRecord(item) || typeof item.id !== \"string\" || !item.id.trim()) {\n throw invalidConversationResponse();\n }\n\n return {\n id: item.id.trim(),\n title: stringOrNull(item.title),\n created_at: readTimestamp(item, \"created_at\", \"createdAt\"),\n updated_at: readTimestamp(item, \"updated_at\", \"updatedAt\"),\n execution_status: stringOrNull(item.execution_status),\n sandbox_status: stringOrNull(item.sandbox_status),\n metrics: normalizeMetrics(item.metrics),\n agent: normalizeAgent(item.agent),\n workspace: normalizeWorkspace(item.workspace),\n tags: normalizeTags(item.tags),\n // SDK-runtime ACP model fields (populated when the agent-server supports\n // ``ConversationInfo.current_model_*``). Consumed by the conversation\n // adapter to drive the per-card chip's model text. Older agent-servers\n // omit these — adapter handles ``undefined`` / ``null`` gracefully.\n current_model_id: stringOrNull(item.current_model_id),\n current_model_name: stringOrNull(item.current_model_name),\n };\n}\n\nfunction requireDirectConversationItems(\n items: unknown,\n): DirectConversationInfo[] {\n if (!Array.isArray(items)) {\n throw invalidConversationResponse();\n }\n return items.map(requireDirectConversationInfo);\n}\n\nfunction requireConversationSearchPage(page: unknown): {\n items: DirectConversationInfo[];\n next_page_id: string | null;\n} {\n if (Array.isArray(page)) {\n return {\n items: requireDirectConversationItems(page),\n next_page_id: null,\n };\n }\n\n if (!isRecord(page)) {\n throw invalidConversationResponse();\n }\n\n return {\n items: requireDirectConversationItems(page.items),\n next_page_id:\n typeof page.next_page_id === \"string\" ? page.next_page_id : null,\n };\n}\n\nconst RUNTIME_STATUSES = new Set<string>([\n \"idle\",\n \"running\",\n \"paused\",\n \"waiting_for_confirmation\",\n \"finished\",\n \"error\",\n \"stuck\",\n]);\n\nfunction toRuntimeStatus(\n status: DirectConversationInfo[\"execution_status\"],\n): RuntimeConversationInfo[\"status\"] {\n const nextStatus = status ?? \"idle\";\n return (\n RUNTIME_STATUSES.has(nextStatus) ? nextStatus : \"idle\"\n ) as RuntimeConversationInfo[\"status\"];\n}\n\nfunction requireAppConversation(\n conversation: AppConversation | null | undefined,\n conversationId: string,\n): AppConversation {\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} was not found`);\n }\n return conversation;\n}\n\nclass AgentServerConversationService {\n static async sendMessage(\n conversationId: string,\n message: SendMessageRequest,\n runtime?: ConversationRuntimeContext | null,\n ): Promise<SendMessageResponse> {\n const active = getActiveBackend().backend;\n let conversationUrl = runtime?.conversationUrl ?? null;\n let sessionApiKey = runtime?.sessionApiKey ?? null;\n\n if (active.kind === \"cloud\") {\n if (!conversationUrl || !sessionApiKey) {\n const [conversation] = await batchGetCloudConversations([\n conversationId,\n ]);\n conversationUrl = conversation?.conversation_url?.trim() ?? null;\n sessionApiKey = conversation?.session_api_key?.trim() ?? null;\n }\n\n if (!conversationUrl || !sessionApiKey) {\n throw new Error(\n \"Conversation sandbox is still starting. Wait for it to finish, then try again.\",\n );\n }\n\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/events`,\n body: { ...message, run: true },\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n\n return message;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).sendEvent(conversationId, message, {\n run: true,\n });\n\n return message;\n }\n\n static async createConversation(\n initialUserMsg?: string,\n conversationInstructions?: string,\n plugins?: PluginSpec[],\n metadata?: ConversationMetadata | null,\n workingDirOverride?: string,\n parentConversationId?: string,\n agentType?: \"default\" | \"plan\",\n sandboxId?: string,\n ): Promise<AppConversationStartTask> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const settings = await SettingsService.getSettings();\n const conversationId = uuidv4();\n const workingDir =\n workingDirOverride ?? buildConversationWorkingDir(conversationId);\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n workingDir,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n const active = getActiveBackend().backend;\n\n type RawRuntime = DirectConversationInfo & {\n stats?: RuntimeConversationInfo[\"stats\"];\n };\n\n // Cloud mode: route through the cloud-proxy to the runtime sandbox at\n // the conversation's runtime URL — same pattern as getVSCodeUrl. Local\n // mode forwards conversationUrl so the host explicitly resolves to the\n // conversation's runtime instead of falling back to the active backend.\n const response =\n active.kind === \"cloud\" && conversationUrl\n ? await callCloudProxy<RawRuntime>({\n backend: active,\n method: \"GET\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}`,\n authMode: \"session-api-key\",\n sessionApiKey,\n })\n : await new ConversationClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getConversation<RawRuntime>(conversationId);\n const data = requireDirectConversationInfo(response);\n const stats = isRecord(response) ? response.stats : null;\n\n return {\n id: data.id,\n title: data.title?.trim()\n ? data.title\n : getDefaultConversationTitle(data.id),\n metrics: normalizeMetrics(data.metrics),\n created_at: data.created_at,\n updated_at: data.updated_at,\n status: toRuntimeStatus(data.execution_status),\n stats: isRecord(stats) ? stats : { usage_to_metrics: {} },\n };\n }\n\n static async searchConversations(\n limit: number = 20,\n pageId?: string,\n ): Promise<AppConversationPage> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return searchCloudConversations(limit, pageId);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).searchConversations({\n limit,\n page_id: pageId,\n sort_order: ConversationSortOrder.UPDATED_AT_DESC,\n });\n\n return toConversationPage(requireConversationSearchPage(data));\n }\n\n static async deleteConversation(conversationId: string): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n await deleteCloudConversation(conversationId);\n } else {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).deleteConversation(conversationId);\n }\n removeStoredConversationMetadata(conversationId);\n }\n\n static async updateConversationTitle(\n conversationId: string,\n title: string,\n ): Promise<AppConversation> {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).updateConversation(conversationId, {\n title,\n });\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"LLM profile switching is only supported for local agent-server backends.\",\n );\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * Only valid once an ACP session exists (after the first message); the\n * agent-server returns 409 before then — the home/no-session default is\n * persisted via Settings instead (see ``use-switch-acp-model``).\n */\n static async switchAcpModel(\n conversationId: string,\n model: string,\n ): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"ACP model switching is only supported for local agent-server backends.\",\n );\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":"8hCAkEA,IAAM,EAAiC,2BACjC,EACJ,qLAGF,SAAS,GAAqC,CAC5C,OAAW,MAAM,EAAsC,CAGzD,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,EAAM,CAG7E,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,KAG7C,SAAS,EAAa,EAAwB,CAC5C,OAAO,OAAO,GAAU,SAAW,EAAQ,EAG7C,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ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+
{"version":3,"file":"agent-server-conversation-service.api.cjs","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport { resolveAbsoluteAgentServerPath } from \"../agent-server-home\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n} from \"../conversation-metadata-store\";\nimport type {\n GetHooksResponse,\n PluginSpec,\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n MetricsSnapshot,\n RuntimeConversationInfo,\n SendMessageRequest,\n SendMessageResponse,\n} from \"./agent-server-conversation-service.types\";\n\nconst DEFAULT_CONVERSATION_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst INVALID_CONVERSATION_RESPONSE_MESSAGE =\n \"Unable to load conversations because the selected agent server returned \" +\n \"data this UI does not understand. Check the backend URL/session key and \" +\n \"update the agent server if needed.\";\nfunction invalidConversationResponse(): Error {\n return new Error(INVALID_CONVERSATION_RESPONSE_MESSAGE);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === \"number\" ? value : null;\n}\n\nfunction numberOrZero(value: unknown): number {\n return typeof value === \"number\" ? value : 0;\n}\n\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readTimestamp(\n item: Record<string, unknown>,\n snakeKey: \"created_at\" | \"updated_at\",\n camelKey: \"createdAt\" | \"updatedAt\",\n): string {\n const value = item[snakeKey] ?? item[camelKey];\n return typeof value === \"string\" && value.trim()\n ? value\n : DEFAULT_CONVERSATION_TIMESTAMP;\n}\n\nfunction normalizeTokenUsage(\n value: unknown,\n): NonNullable<MetricsSnapshot[\"accumulated_token_usage\"]> | null {\n if (!isRecord(value)) return null;\n\n return {\n prompt_tokens: numberOrZero(value.prompt_tokens),\n completion_tokens: numberOrZero(value.completion_tokens),\n cache_read_tokens: numberOrZero(value.cache_read_tokens),\n cache_write_tokens: numberOrZero(value.cache_write_tokens),\n context_window: numberOrZero(value.context_window),\n per_turn_token: numberOrZero(value.per_turn_token),\n };\n}\n\nfunction normalizeMetrics(value: unknown): MetricsSnapshot | null {\n if (!isRecord(value)) return null;\n\n return {\n accumulated_cost: numberOrNull(value.accumulated_cost),\n max_budget_per_task: numberOrNull(value.max_budget_per_task),\n accumulated_token_usage: normalizeTokenUsage(value.accumulated_token_usage),\n };\n}\n\nfunction normalizeAgent(value: unknown): DirectConversationInfo[\"agent\"] {\n if (!isRecord(value)) return null;\n const llm = isRecord(value.llm)\n ? { model: stringOrNull(value.llm.model) }\n : null;\n // ``kind`` is the SDK's pydantic discriminator (``\"Agent\"`` vs ``\"ACPAgent\"``);\n // ``toAppConversation`` reads it to derive ``agent_kind``. ``acp_model`` is\n // the Canvas-configured model on the ACPAgent — preserved so the conversation\n // adapter and the conversation chip can fall back to it when the SDK runtime\n // model fields aren't populated. Preserving these here makes the wire path\n // agree with the unit-test path that builds ``DirectConversationInfo``\n // directly (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction normalizeAbsolutePath(path: string): string | null {\n if (!path.startsWith(\"/\")) return null;\n\n const segments: string[] = [];\n for (const segment of path.split(\"/\")) {\n if (segment && segment !== \".\") {\n if (segment === \"..\") {\n if (!segments.length) return null;\n segments.pop();\n } else {\n segments.push(segment);\n }\n }\n }\n\n return `/${segments.join(\"/\")}`;\n}\n\nfunction requirePathInsideDirectory(path: string, directory: string): string {\n const normalizedPath = normalizeAbsolutePath(path);\n const normalizedDirectory = normalizeAbsolutePath(directory);\n\n if (\n !normalizedPath ||\n !normalizedDirectory ||\n (normalizedPath !== normalizedDirectory &&\n !normalizedPath.startsWith(`${normalizedDirectory}/`))\n ) {\n throw new Error(\"Conversation file path must stay inside the workspace\");\n }\n\n return normalizedPath;\n}\n\nfunction requireDirectConversationInfo(item: unknown): DirectConversationInfo {\n if (!isRecord(item) || typeof item.id !== \"string\" || !item.id.trim()) {\n throw invalidConversationResponse();\n }\n\n return {\n id: item.id.trim(),\n title: stringOrNull(item.title),\n created_at: readTimestamp(item, \"created_at\", \"createdAt\"),\n updated_at: readTimestamp(item, \"updated_at\", \"updatedAt\"),\n execution_status: stringOrNull(item.execution_status),\n sandbox_status: stringOrNull(item.sandbox_status),\n metrics: normalizeMetrics(item.metrics),\n agent: normalizeAgent(item.agent),\n workspace: normalizeWorkspace(item.workspace),\n tags: normalizeTags(item.tags),\n // SDK-runtime ACP model fields (populated when the agent-server supports\n // ``ConversationInfo.current_model_*``). Consumed by the conversation\n // adapter to drive the per-card chip's model text. Older agent-servers\n // omit these — adapter handles ``undefined`` / ``null`` gracefully.\n current_model_id: stringOrNull(item.current_model_id),\n current_model_name: stringOrNull(item.current_model_name),\n };\n}\n\nfunction requireDirectConversationItems(\n items: unknown,\n): DirectConversationInfo[] {\n if (!Array.isArray(items)) {\n throw invalidConversationResponse();\n }\n return items.map(requireDirectConversationInfo);\n}\n\nfunction requireConversationSearchPage(page: unknown): {\n items: DirectConversationInfo[];\n next_page_id: string | null;\n} {\n if (Array.isArray(page)) {\n return {\n items: requireDirectConversationItems(page),\n next_page_id: null,\n };\n }\n\n if (!isRecord(page)) {\n throw invalidConversationResponse();\n }\n\n return {\n items: requireDirectConversationItems(page.items),\n next_page_id:\n typeof page.next_page_id === \"string\" ? page.next_page_id : null,\n };\n}\n\nconst RUNTIME_STATUSES = new Set<string>([\n \"idle\",\n \"running\",\n \"paused\",\n \"waiting_for_confirmation\",\n \"finished\",\n \"error\",\n \"stuck\",\n]);\n\nfunction toRuntimeStatus(\n status: DirectConversationInfo[\"execution_status\"],\n): RuntimeConversationInfo[\"status\"] {\n const nextStatus = status ?? \"idle\";\n return (\n RUNTIME_STATUSES.has(nextStatus) ? nextStatus : \"idle\"\n ) as RuntimeConversationInfo[\"status\"];\n}\n\nfunction requireAppConversation(\n conversation: AppConversation | null | undefined,\n conversationId: string,\n): AppConversation {\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} was not found`);\n }\n return conversation;\n}\n\nclass AgentServerConversationService {\n static async sendMessage(\n conversationId: string,\n message: SendMessageRequest,\n runtime?: ConversationRuntimeContext | null,\n ): Promise<SendMessageResponse> {\n const active = getActiveBackend().backend;\n let conversationUrl = runtime?.conversationUrl ?? null;\n let sessionApiKey = runtime?.sessionApiKey ?? null;\n\n if (active.kind === \"cloud\") {\n if (!conversationUrl || !sessionApiKey) {\n const [conversation] = await batchGetCloudConversations([\n conversationId,\n ]);\n conversationUrl = conversation?.conversation_url?.trim() ?? null;\n sessionApiKey = conversation?.session_api_key?.trim() ?? null;\n }\n\n if (!conversationUrl || !sessionApiKey) {\n throw new Error(\n \"Conversation sandbox is still starting. Wait for it to finish, then try again.\",\n );\n }\n\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/events`,\n body: { ...message, run: true },\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n\n return message;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).sendEvent(conversationId, message, {\n run: true,\n });\n\n return message;\n }\n\n static async createConversation(\n initialUserMsg?: string,\n conversationInstructions?: string,\n plugins?: PluginSpec[],\n metadata?: ConversationMetadata | null,\n workingDirOverride?: string,\n parentConversationId?: string,\n agentType?: \"default\" | \"plan\",\n sandboxId?: string,\n ): Promise<AppConversationStartTask> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const settings = await SettingsService.getSettings();\n const conversationId = uuidv4();\n // @spec WUP-001 — Send an absolute working_dir to the agent-server.\n // The default is `workspace/project/<hex>` (relative); without\n // resolving it here, `/api/file/upload` later prepends `/` and writes\n // to `/workspace/...` (read-only on macOS and fresh containers). When\n // the user picks an explicit workspace, `workingDirOverride` is\n // already absolute (it comes from `search_subdirs`).\n const workingDir = await resolveAbsoluteAgentServerPath(\n workingDirOverride ?? buildConversationWorkingDir(conversationId),\n );\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n workingDir,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n const active = getActiveBackend().backend;\n\n type RawRuntime = DirectConversationInfo & {\n stats?: RuntimeConversationInfo[\"stats\"];\n };\n\n // Cloud mode: route through the cloud-proxy to the runtime sandbox at\n // the conversation's runtime URL — same pattern as getVSCodeUrl. Local\n // mode forwards conversationUrl so the host explicitly resolves to the\n // conversation's runtime instead of falling back to the active backend.\n const response =\n active.kind === \"cloud\" && conversationUrl\n ? await callCloudProxy<RawRuntime>({\n backend: active,\n method: \"GET\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}`,\n authMode: \"session-api-key\",\n sessionApiKey,\n })\n : await new ConversationClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getConversation<RawRuntime>(conversationId);\n const data = requireDirectConversationInfo(response);\n const stats = isRecord(response) ? response.stats : null;\n\n return {\n id: data.id,\n title: data.title?.trim()\n ? data.title\n : getDefaultConversationTitle(data.id),\n metrics: normalizeMetrics(data.metrics),\n created_at: data.created_at,\n updated_at: data.updated_at,\n status: toRuntimeStatus(data.execution_status),\n stats: isRecord(stats) ? stats : { usage_to_metrics: {} },\n };\n }\n\n static async searchConversations(\n limit: number = 20,\n pageId?: string,\n ): Promise<AppConversationPage> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return searchCloudConversations(limit, pageId);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).searchConversations({\n limit,\n page_id: pageId,\n sort_order: ConversationSortOrder.UPDATED_AT_DESC,\n });\n\n return toConversationPage(requireConversationSearchPage(data));\n }\n\n static async deleteConversation(conversationId: string): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n await deleteCloudConversation(conversationId);\n } else {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).deleteConversation(conversationId);\n }\n removeStoredConversationMetadata(conversationId);\n }\n\n static async updateConversationTitle(\n conversationId: string,\n title: string,\n ): Promise<AppConversation> {\n await new ConversationClient(\n getAgentServerClientOptions(),\n ).updateConversation(conversationId, {\n title,\n });\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"LLM profile switching is only supported for local agent-server backends.\",\n );\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * Only valid once an ACP session exists (after the first message); the\n * agent-server returns 409 before then — the home/no-session default is\n * persisted via Settings instead (see ``use-switch-acp-model``).\n */\n static async switchAcpModel(\n conversationId: string,\n model: string,\n ): Promise<void> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"ACP model switching is only supported for local agent-server backends.\",\n );\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":"okCAmEA,IAAM,EAAiC,2BACjC,EACJ,qLAGF,SAAS,GAAqC,CAC5C,OAAW,MAAM,EAAsC,CAGzD,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,EAAM,CAG7E,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,KAG7C,SAAS,EAAa,EAAwB,CAC5C,OAAO,OAAO,GAAU,SAAW,EAAQ,EAG7C,SAAS,EAAa,EAA+B,CACnD,OAAO,OAAO,GAAU,SAAW,EAAQ,KAG7C,SAAS,EACP,EACA,EACA,EACQ,CACR,IAAM,EAAQ,EAAK,IAAa,EAAK,GACrC,OAAO,OAAO,GAAU,UAAY,EAAM,MAAM,CAC5C,EACA,EAGN,SAAS,EACP,EACgE,CAGhE,OAFK,EAAS,EAAM,CAEb,CACL,cAAe,EAAa,EAAM,cAAc,CAChD,kBAAmB,EAAa,EAAM,kBAAkB,CACxD,kBAAmB,EAAa,EAAM,kBAAkB,CACxD,mBAAoB,EAAa,EAAM,mBAAmB,CAC1D,eAAgB,EAAa,EAAM,eAAe,CAClD,eAAgB,EAAa,EAAM,eAAe,CACnD,CAT4B,KAY/B,SAAS,EAAiB,EAAwC,CAGhE,OAFK,EAAS,EAAM,CAEb,CACL,iBAAkB,EAAa,EAAM,iBAAiB,CACtD,oBAAqB,EAAa,EAAM,oBAAoB,CAC5D,wBAAyB,EAAoB,EAAM,wBAAwB,CAC5E,CAN4B,KAS/B,SAAS,EAAe,EAAiD,CACvE,GAAI,CAAC,EAAS,EAAM,CAAE,OAAO,KAC7B,IAAM,EAAM,EAAS,EAAM,IAAI,CAC3B,CAA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F,IAAM,EAAgB,EAAA,6BAA6B,CAC7C,EAAqB,IAAI,EAAA,mBAAmB,EAAc,CAC1D,EAAU,MAAM,IAAI,EAAA,eAAe,EAAc,CAAC,WACtD,EACA,CAAE,cAAe,YAAa,CAC/B,CACK,EACJ,OAAO,EAAQ,OAAO,OAAU,SAAW,EAAQ,OAAO,MAAQ,GACpE,GAAI,CAAC,EAAO,MAAU,MAAM,YAAY,EAAY,iBAAiB,CACrE,MAAM,EAAmB,UAAU,EAAgB,CACjD,GAAG,EAAQ,OACX,QAEA,SAAU,WAAW,EAAY,GAAG,EAAA,SAAQ,GAC7C,CAAc,CAcjB,aAAa,eACX,EACA,EACe,CACf,GAAI,EAAA,kBAAkB,CAAC,QAAQ,OAAS,QACtC,MAAU,MACR,yEACD,CAGH,MAAM,IAAI,EAAA,mBAAmB,EAAA,6BAA6B,CAAC,CAAC,eAC1D,EACA,EACD"}
|
|
@@ -10,67 +10,68 @@ import { NoBackendAvailableError as u, getAgentServerClientOptions as d } from "
|
|
|
10
10
|
import { callCloudProxy as f } from "../cloud/proxy.js";
|
|
11
11
|
import { ConversationSortOrder as p } from "../../node_modules/@openhands/typescript-client/dist/models/conversation.js";
|
|
12
12
|
import "../../node_modules/@openhands/typescript-client/dist/index.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import T from "../
|
|
16
|
-
import
|
|
13
|
+
import { resolveAbsoluteAgentServerPath as m } from "../agent-server-home.js";
|
|
14
|
+
import { getStoredConversationMetadata as h, removeStoredConversationMetadata as g, setStoredConversationMetadata as _ } from "../conversation-metadata-store.js";
|
|
15
|
+
import { batchGetCloudConversations as v, createCloudAppConversation as y, deleteCloudConversation as b, downloadCloudConversation as x, getCloudAppConversationStartTask as S, readCloudConversationFile as C, searchCloudConversations as w, updateCloudConversationPublicFlag as T } from "../cloud/conversation-service.api.js";
|
|
16
|
+
import E from "../settings-service/settings-service.api.js";
|
|
17
|
+
import { buildStartConversationRequestWithEncryptedSettings as D, emptyHooksResponse as O, getDefaultConversationTitle as k, toAppConversation as A, toConversationPage as j } from "../agent-server-adapter.js";
|
|
17
18
|
//#region src/api/conversation-service/agent-server-conversation-service.api.ts
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
return Error(
|
|
19
|
+
var M = "1970-01-01T00:00:00.000Z", N = "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.";
|
|
20
|
+
function P() {
|
|
21
|
+
return Error(N);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function F(e) {
|
|
23
24
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function I(e) {
|
|
26
27
|
return typeof e == "number" ? e : null;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function L(e) {
|
|
29
30
|
return typeof e == "number" ? e : 0;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function R(e) {
|
|
32
33
|
return typeof e == "string" ? e : null;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function z(e, t, n) {
|
|
35
36
|
let r = e[t] ?? e[n];
|
|
36
|
-
return typeof r == "string" && r.trim() ? r :
|
|
37
|
-
}
|
|
38
|
-
function z(e) {
|
|
39
|
-
return P(e) ? {
|
|
40
|
-
prompt_tokens: I(e.prompt_tokens),
|
|
41
|
-
completion_tokens: I(e.completion_tokens),
|
|
42
|
-
cache_read_tokens: I(e.cache_read_tokens),
|
|
43
|
-
cache_write_tokens: I(e.cache_write_tokens),
|
|
44
|
-
context_window: I(e.context_window),
|
|
45
|
-
per_turn_token: I(e.per_turn_token)
|
|
46
|
-
} : null;
|
|
37
|
+
return typeof r == "string" && r.trim() ? r : M;
|
|
47
38
|
}
|
|
48
39
|
function B(e) {
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
return F(e) ? {
|
|
41
|
+
prompt_tokens: L(e.prompt_tokens),
|
|
42
|
+
completion_tokens: L(e.completion_tokens),
|
|
43
|
+
cache_read_tokens: L(e.cache_read_tokens),
|
|
44
|
+
cache_write_tokens: L(e.cache_write_tokens),
|
|
45
|
+
context_window: L(e.context_window),
|
|
46
|
+
per_turn_token: L(e.per_turn_token)
|
|
53
47
|
} : null;
|
|
54
48
|
}
|
|
55
49
|
function V(e) {
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
return F(e) ? {
|
|
51
|
+
accumulated_cost: I(e.accumulated_cost),
|
|
52
|
+
max_budget_per_task: I(e.max_budget_per_task),
|
|
53
|
+
accumulated_token_usage: B(e.accumulated_token_usage)
|
|
54
|
+
} : null;
|
|
55
|
+
}
|
|
56
|
+
function H(e) {
|
|
57
|
+
if (!F(e)) return null;
|
|
58
|
+
let t = F(e.llm) ? { model: R(e.llm.model) } : null;
|
|
58
59
|
return {
|
|
59
|
-
kind:
|
|
60
|
-
acp_model:
|
|
60
|
+
kind: R(e.kind),
|
|
61
|
+
acp_model: R(e.acp_model),
|
|
61
62
|
llm: t
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
function H(e) {
|
|
65
|
-
return P(e) ? { working_dir: L(e.working_dir) } : null;
|
|
66
|
-
}
|
|
67
65
|
function U(e) {
|
|
68
|
-
|
|
66
|
+
return F(e) ? { working_dir: R(e.working_dir) } : null;
|
|
67
|
+
}
|
|
68
|
+
function W(e) {
|
|
69
|
+
if (!F(e)) return null;
|
|
69
70
|
let t = {};
|
|
70
71
|
for (let [n, r] of Object.entries(e)) typeof r == "string" && (t[n] = r);
|
|
71
72
|
return t;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function G(e) {
|
|
74
75
|
if (!e.startsWith("/")) return null;
|
|
75
76
|
let t = [];
|
|
76
77
|
for (let n of e.split("/")) if (n && n !== ".") if (n === "..") {
|
|
@@ -79,44 +80,44 @@ function W(e) {
|
|
|
79
80
|
} else t.push(n);
|
|
80
81
|
return `/${t.join("/")}`;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
-
let n =
|
|
83
|
+
function K(e, t) {
|
|
84
|
+
let n = G(e), r = G(t);
|
|
84
85
|
if (!n || !r || n !== r && !n.startsWith(`${r}/`)) throw Error("Conversation file path must stay inside the workspace");
|
|
85
86
|
return n;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
-
if (!
|
|
88
|
+
function q(e) {
|
|
89
|
+
if (!F(e) || typeof e.id != "string" || !e.id.trim()) throw P();
|
|
89
90
|
return {
|
|
90
91
|
id: e.id.trim(),
|
|
91
|
-
title:
|
|
92
|
-
created_at:
|
|
93
|
-
updated_at:
|
|
94
|
-
execution_status:
|
|
95
|
-
sandbox_status:
|
|
96
|
-
metrics:
|
|
97
|
-
agent:
|
|
98
|
-
workspace:
|
|
99
|
-
tags:
|
|
100
|
-
current_model_id:
|
|
101
|
-
current_model_name:
|
|
92
|
+
title: R(e.title),
|
|
93
|
+
created_at: z(e, "created_at", "createdAt"),
|
|
94
|
+
updated_at: z(e, "updated_at", "updatedAt"),
|
|
95
|
+
execution_status: R(e.execution_status),
|
|
96
|
+
sandbox_status: R(e.sandbox_status),
|
|
97
|
+
metrics: V(e.metrics),
|
|
98
|
+
agent: H(e.agent),
|
|
99
|
+
workspace: U(e.workspace),
|
|
100
|
+
tags: W(e.tags),
|
|
101
|
+
current_model_id: R(e.current_model_id),
|
|
102
|
+
current_model_name: R(e.current_model_name)
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
|
-
function q(e) {
|
|
105
|
-
if (!Array.isArray(e)) throw N();
|
|
106
|
-
return e.map(K);
|
|
107
|
-
}
|
|
108
105
|
function J(e) {
|
|
106
|
+
if (!Array.isArray(e)) throw P();
|
|
107
|
+
return e.map(q);
|
|
108
|
+
}
|
|
109
|
+
function Y(e) {
|
|
109
110
|
if (Array.isArray(e)) return {
|
|
110
|
-
items:
|
|
111
|
+
items: J(e),
|
|
111
112
|
next_page_id: null
|
|
112
113
|
};
|
|
113
|
-
if (!
|
|
114
|
+
if (!F(e)) throw P();
|
|
114
115
|
return {
|
|
115
|
-
items:
|
|
116
|
+
items: J(e.items),
|
|
116
117
|
next_page_id: typeof e.next_page_id == "string" ? e.next_page_id : null
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
|
-
var
|
|
120
|
+
var X = new Set([
|
|
120
121
|
"idle",
|
|
121
122
|
"running",
|
|
122
123
|
"paused",
|
|
@@ -125,20 +126,20 @@ var Y = new Set([
|
|
|
125
126
|
"error",
|
|
126
127
|
"stuck"
|
|
127
128
|
]);
|
|
128
|
-
function
|
|
129
|
+
function Z(e) {
|
|
129
130
|
let t = e ?? "idle";
|
|
130
|
-
return
|
|
131
|
+
return X.has(t) ? t : "idle";
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function Q(e, t) {
|
|
133
134
|
if (!e) throw Error(`Conversation ${t} was not found`);
|
|
134
135
|
return e;
|
|
135
136
|
}
|
|
136
|
-
var
|
|
137
|
+
var $ = class {
|
|
137
138
|
static async sendMessage(e, t, r) {
|
|
138
139
|
let a = n().backend, o = r?.conversationUrl ?? null, s = r?.sessionApiKey ?? null;
|
|
139
140
|
if (a.kind === "cloud") {
|
|
140
141
|
if (!o || !s) {
|
|
141
|
-
let [t] = await
|
|
142
|
+
let [t] = await v([e]);
|
|
142
143
|
o = t?.conversation_url?.trim() ?? null, s = t?.session_api_key?.trim() ?? null;
|
|
143
144
|
}
|
|
144
145
|
if (!o || !s) throw Error("Conversation sandbox is still starting. Wait for it to finish, then try again.");
|
|
@@ -160,8 +161,8 @@ var Q = class {
|
|
|
160
161
|
sessionApiKey: s
|
|
161
162
|
})).sendEvent(e, t, { run: !0 }), t;
|
|
162
163
|
}
|
|
163
|
-
static async createConversation(t, a, o, s, l, f, p,
|
|
164
|
-
if (n().backend.kind === "cloud") return
|
|
164
|
+
static async createConversation(t, a, o, s, l, f, p, h) {
|
|
165
|
+
if (n().backend.kind === "cloud") return y({
|
|
165
166
|
initial_message: t ? {
|
|
166
167
|
role: "user",
|
|
167
168
|
content: [{
|
|
@@ -176,39 +177,39 @@ var Q = class {
|
|
|
176
177
|
plugins: o ?? null,
|
|
177
178
|
parent_conversation_id: f ?? null,
|
|
178
179
|
agent_type: p,
|
|
179
|
-
sandbox_id:
|
|
180
|
+
sandbox_id: h ?? null
|
|
180
181
|
});
|
|
181
|
-
let
|
|
182
|
-
settings:
|
|
182
|
+
let g = await E.getSettings(), v = c(), b = await D({
|
|
183
|
+
settings: g,
|
|
183
184
|
query: t,
|
|
184
185
|
conversationInstructions: a,
|
|
185
186
|
plugins: o,
|
|
186
|
-
conversationId:
|
|
187
|
-
workingDir: l ?? e(
|
|
188
|
-
}),
|
|
189
|
-
if (!
|
|
190
|
-
return (s?.selected_repository || l) &&
|
|
187
|
+
conversationId: v,
|
|
188
|
+
workingDir: await m(l ?? e(v))
|
|
189
|
+
}), x = await new i(d()).createConversation(b), S = r();
|
|
190
|
+
if (!S) throw new u();
|
|
191
|
+
return (s?.selected_repository || l) && _(x.id, {
|
|
191
192
|
selected_repository: s?.selected_repository ?? null,
|
|
192
193
|
selected_branch: s?.selected_branch ?? null,
|
|
193
194
|
git_provider: s?.git_provider ?? null,
|
|
194
195
|
selected_workspace: l ?? null
|
|
195
196
|
}), {
|
|
196
|
-
id:
|
|
197
|
+
id: x.id,
|
|
197
198
|
created_by_user_id: null,
|
|
198
199
|
status: "READY",
|
|
199
200
|
detail: null,
|
|
200
|
-
app_conversation_id:
|
|
201
|
-
agent_server_url:
|
|
201
|
+
app_conversation_id: x.id,
|
|
202
|
+
agent_server_url: S.host,
|
|
202
203
|
request: {
|
|
203
|
-
initial_message:
|
|
204
|
+
initial_message: b.initial_message,
|
|
204
205
|
plugins: o ?? null
|
|
205
206
|
},
|
|
206
|
-
created_at:
|
|
207
|
-
updated_at:
|
|
207
|
+
created_at: x.created_at,
|
|
208
|
+
updated_at: x.updated_at
|
|
208
209
|
};
|
|
209
210
|
}
|
|
210
211
|
static async getStartTask(e) {
|
|
211
|
-
return n().backend.kind === "cloud" ?
|
|
212
|
+
return n().backend.kind === "cloud" ? S(e) : null;
|
|
212
213
|
}
|
|
213
214
|
static async getVSCodeUrl(e, t, n) {
|
|
214
215
|
let r = await this.resolveConversationWorkingDir(e);
|
|
@@ -225,32 +226,32 @@ var Q = class {
|
|
|
225
226
|
return n?.workspace?.working_dir ?? t();
|
|
226
227
|
}
|
|
227
228
|
static async batchGetAppConversations(e) {
|
|
228
|
-
return e.length === 0 ? [] : n().backend.kind === "cloud" ?
|
|
229
|
+
return e.length === 0 ? [] : n().backend.kind === "cloud" ? v(e) : J(await new i(d()).getConversations(e)).map((e) => A(e));
|
|
229
230
|
}
|
|
230
231
|
static async updateConversationPublicFlag(e, t) {
|
|
231
232
|
if (n().backend.kind !== "cloud") throw Error("Public sharing requires a cloud backend.");
|
|
232
|
-
return
|
|
233
|
+
return T(e, t);
|
|
233
234
|
}
|
|
234
235
|
static async updateConversationRepository(e, t, n, r) {
|
|
235
|
-
t ?
|
|
236
|
-
...
|
|
236
|
+
t ? _(e, {
|
|
237
|
+
...h(e) ?? {},
|
|
237
238
|
selected_repository: t,
|
|
238
239
|
selected_branch: n ?? null,
|
|
239
240
|
git_provider: r ?? null
|
|
240
|
-
}) :
|
|
241
|
+
}) : g(e);
|
|
241
242
|
let [i] = await this.batchGetAppConversations([e]);
|
|
242
|
-
return
|
|
243
|
+
return Q(i, e);
|
|
243
244
|
}
|
|
244
245
|
static async readConversationFile(e, t) {
|
|
245
|
-
if (n().backend.kind === "cloud") return
|
|
246
|
-
let r = await this.resolveConversationWorkingDir(e), i =
|
|
246
|
+
if (n().backend.kind === "cloud") return C(e, K(t ?? "/workspace/project/.agents_tmp/PLAN.md", "/workspace/project"));
|
|
247
|
+
let r = await this.resolveConversationWorkingDir(e), i = K(t ?? `${r}/.agents_tmp/PLAN.md`, r);
|
|
247
248
|
return new a(d()).downloadTextFile(i);
|
|
248
249
|
}
|
|
249
250
|
static async downloadConversation(e) {
|
|
250
|
-
return n().backend.kind === "cloud" ?
|
|
251
|
+
return n().backend.kind === "cloud" ? x(e) : new a(d()).downloadTrajectory(e);
|
|
251
252
|
}
|
|
252
253
|
static async getHooks(e) {
|
|
253
|
-
return
|
|
254
|
+
return O();
|
|
254
255
|
}
|
|
255
256
|
static async getRuntimeConversation(e, t, r) {
|
|
256
257
|
let a = n().backend, o = a.kind === "cloud" && t ? await f({
|
|
@@ -263,31 +264,31 @@ var Q = class {
|
|
|
263
264
|
}) : await new i(d({
|
|
264
265
|
conversationUrl: t,
|
|
265
266
|
sessionApiKey: r
|
|
266
|
-
})).getConversation(e), s =
|
|
267
|
+
})).getConversation(e), s = q(o), c = F(o) ? o.stats : null;
|
|
267
268
|
return {
|
|
268
269
|
id: s.id,
|
|
269
|
-
title: s.title?.trim() ? s.title :
|
|
270
|
-
metrics:
|
|
270
|
+
title: s.title?.trim() ? s.title : k(s.id),
|
|
271
|
+
metrics: V(s.metrics),
|
|
271
272
|
created_at: s.created_at,
|
|
272
273
|
updated_at: s.updated_at,
|
|
273
|
-
status:
|
|
274
|
-
stats:
|
|
274
|
+
status: Z(s.execution_status),
|
|
275
|
+
stats: F(c) ? c : { usage_to_metrics: {} }
|
|
275
276
|
};
|
|
276
277
|
}
|
|
277
278
|
static async searchConversations(e = 20, t) {
|
|
278
|
-
return n().backend.kind === "cloud" ?
|
|
279
|
+
return n().backend.kind === "cloud" ? w(e, t) : j(Y(await new i(d()).searchConversations({
|
|
279
280
|
limit: e,
|
|
280
281
|
page_id: t,
|
|
281
282
|
sort_order: p.UPDATED_AT_DESC
|
|
282
283
|
})));
|
|
283
284
|
}
|
|
284
285
|
static async deleteConversation(e) {
|
|
285
|
-
n().backend.kind === "cloud" ? await
|
|
286
|
+
n().backend.kind === "cloud" ? await b(e) : await new i(d()).deleteConversation(e), g(e);
|
|
286
287
|
}
|
|
287
288
|
static async updateConversationTitle(e, t) {
|
|
288
289
|
await new i(d()).updateConversation(e, { title: t });
|
|
289
290
|
let [n] = await this.batchGetAppConversations([e]);
|
|
290
|
-
return
|
|
291
|
+
return Q(n, e);
|
|
291
292
|
}
|
|
292
293
|
static async switchProfile(e, t) {
|
|
293
294
|
if (n().backend.kind === "cloud") throw Error("LLM profile switching is only supported for local agent-server backends.");
|
|
@@ -309,6 +310,6 @@ var Q = class {
|
|
|
309
310
|
}
|
|
310
311
|
};
|
|
311
312
|
//#endregion
|
|
312
|
-
export {
|
|
313
|
+
export { $ as default };
|
|
313
314
|
|
|
314
315
|
//# sourceMappingURL=agent-server-conversation-service.api.js.map
|