@openhands/agent-canvas 1.0.0-alpha.8 → 1.0.0-beta.1
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 +17 -6
- package/bin/agent-canvas.mjs +22 -2
- package/build/assets/{QueryClientProvider-B7kl84Kj.js → QueryClientProvider-CkGuhXg-.js} +1 -1
- package/build/assets/{Trans-1j65oy9O.js → Trans-Cvm_-SMi.js} +1 -1
- package/build/assets/acp-providers-CbiRekh9.js +1 -0
- package/build/assets/{acp-route-guard-CQTmeJwM.js → acp-route-guard-B2yoBZ_4.js} +1 -1
- package/build/assets/{active-backend-context-TVbjnvmP.js → active-backend-context-cCM1vYYZ.js} +1 -1
- package/build/assets/add-backend-modal-DIUQzMPa.js +1 -0
- package/build/assets/agent-server-client-options-Bc5ZorQZ.js +1 -0
- package/build/assets/agent-server-compatibility-BlkUsrX2.js +1 -0
- package/build/assets/agent-server-conversation-service.api-DFvqqEDo.js +5 -0
- package/build/assets/{agent-settings-B247S9G3.js → agent-settings-CnGSCmK8.js} +1 -1
- package/build/assets/{alert-banner-BWoqueRw.js → alert-banner-DtzAX654.js} +1 -1
- package/build/assets/{analytics-consent-form-modal-C7sXfxRh.js → analytics-consent-form-modal-CHZ3I37v.js} +1 -1
- package/build/assets/api-key-entry-screen-B2gynaCp.js +1 -0
- package/build/assets/{app-settings-BVeSaty9.js → app-settings-Db9ITeJH.js} +1 -1
- package/build/assets/{automation-detail-g5-RZ0da.js → automation-detail-Di7EOIZD.js} +1 -1
- package/build/assets/{automations-list-DHoq_0MM.js → automations-list-IsIWdDiw.js} +1 -1
- package/build/assets/backend-form-modal-Dnk33xA_.js +1 -0
- package/build/assets/{backend-synced-settings-badge-nAfiUWvM.js → backend-synced-settings-badge-Dc6c7GT4.js} +1 -1
- package/build/assets/{base-modal-CQRvRHu1.js → base-modal-_dYTw1ri.js} +1 -1
- package/build/assets/{brand-button-C2nEKopC.js → brand-button-Br7f0kZJ.js} +1 -1
- package/build/assets/browser-D810xUYt.js +5 -0
- package/build/assets/browser-store-Couc4S5D.js +1 -0
- package/build/assets/browser-tab-B-aIqXRl.js +1 -0
- package/build/assets/{checkmark-BJJrZUF8.js → checkmark-DL7acQA7.js} +1 -1
- package/build/assets/{chevron-left-small-CSh-sE9L.js → chevron-left-small-CVWf8TI6.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-qs8Va1cC.js → circle-plus-check-toggle-P7ZZToV4.js} +1 -1
- package/build/assets/{clock-ZR4Kn-_Y.js → clock-BRjCgHTc.js} +1 -1
- package/build/assets/{close-BdmyeRqS.js → close-B5LROHR3.js} +1 -1
- package/build/assets/{combobox-caret-B53O9Hsq.js → combobox-caret-to1O8irE.js} +1 -1
- package/build/assets/{condenser-settings-A35V3yng.js → condenser-settings-wnEKhBof.js} +1 -1
- package/build/assets/{confirmation-modal-C9-La0h3.js → confirmation-modal-Dau3w_sa.js} +1 -1
- package/build/assets/{context-menu-list-item-Buu9nc0q.js → context-menu-list-item-CWNFpuiC.js} +1 -1
- package/build/assets/conversation-HlncOV7n.js +19 -0
- package/build/assets/conversation-MtnkpqA9.js +1 -0
- package/build/assets/conversation-panel-DxnM6tRe.js +1 -0
- package/build/assets/{conversation-service.api-C8pYCyV6.js → conversation-service.api-nb5W1PqR.js} +1 -1
- package/build/assets/{conversation-tab-empty-state-D8dNvo-V.js → conversation-tab-empty-state-DyssnnWa.js} +1 -1
- package/build/assets/conversation-websocket-context-C8_PkGLi.js +3 -0
- package/build/assets/{copy-C7Ti2d8C.js → copy-DYgmUdIw.js} +1 -1
- package/build/assets/{custom-toast-handlers-BOc3qeQ7.js → custom-toast-handlers-C-SZFmto.js} +1 -1
- package/build/assets/declaration-BNMqORFE.js +1 -0
- package/build/assets/{device-verify-CMusn8nX.js → device-verify-DqDlphsG.js} +1 -1
- package/build/assets/{dist-DZHSA2e6.js → dist-C6t0EXL7.js} +1 -1
- package/build/assets/{edit-automation-modal-Dnjxbjn7.js → edit-automation-modal-BGzR3nfZ.js} +1 -1
- package/build/assets/{ellipsis-button-ugUATsNo.js → ellipsis-button-ZyLMPURn.js} +1 -1
- package/build/assets/{entry.client-D9uR9Blz.js → entry.client-1VMHpktY.js} +2 -2
- package/build/assets/{enum-filter-dropdown-1vpOGySB.js → enum-filter-dropdown-CEgCdu4A.js} +1 -1
- package/build/assets/{environment-switch-overlay-CTCTQikP.js → environment-switch-overlay-XL8yCGP6.js} +1 -1
- package/build/assets/{extensions-hub-BSUseHVF.js → extensions-hub-C651jsVh.js} +1 -1
- package/build/assets/{extensions-navigation-CT1kc1u_.js → extensions-navigation-BYR8Giqq.js} +1 -1
- package/build/assets/files-tab-BhnLgimi.js +1 -0
- package/build/assets/{folder-0WSMImNX.js → folder-ZZJVGgd7.js} +1 -1
- package/build/assets/git-control-bar-branch-button-M34A5_vX.js +27 -0
- package/build/assets/{git-provider-icon-DYE9n7fs.js → git-provider-icon-D5dCNy-k.js} +1 -1
- package/build/assets/home-CYQv7yc_.js +1 -0
- package/build/assets/{i18n-DjAGhTis.js → i18n-CTohRuoO.js} +1 -1
- package/build/assets/install-server-modal-f31_CLrW.js +1 -0
- package/build/assets/{launch-hZ0ifhcV.js → launch-DHEUYn2A.js} +1 -1
- package/build/assets/{lesson-plan-DRYG5SLI.js → lesson-plan-dH5Bj0pN.js} +1 -1
- package/build/assets/{link-external-Df8J52xI.js → link-external-D2POYx4c.js} +1 -1
- package/build/assets/{llm-client-ChQzg4wX.js → llm-client-DaH1TuyR.js} +1 -1
- package/build/assets/llm-settings-Bql-vydt.js +1 -0
- package/build/assets/llm-settings-C_tal6Ds.js +1 -0
- package/build/assets/{loading-spinner-C04FGh14.js → loading-spinner-BPtYORNK.js} +1 -1
- package/build/assets/{manage-backends-modal-rYeyGx7j.js → manage-backends-modal-l7RkKfwX.js} +1 -1
- package/build/assets/{manage-workspaces-modal-C5EuW8m1.js → manage-workspaces-modal-DhKF_8z3.js} +1 -1
- package/build/assets/manifest-9fee01b9.js +1 -0
- package/build/assets/{markdown-renderer-CEX4Becj.js → markdown-renderer-DMzf2i4x.js} +1 -1
- package/build/assets/mcp-D2onbwVk.js +9 -0
- package/build/assets/{messages-T2ewVkbp.js → messages-BMzyOW2V.js} +1 -1
- package/build/assets/{modal-backdrop-DTYGVmOR.js → modal-backdrop-BAbgYsqB.js} +1 -1
- package/build/assets/{modal-body-YElmM1dV.js → modal-body-BI6Ru2Qr.js} +1 -1
- package/build/assets/{modal-close-button-C_GpQt9F.js → modal-close-button-t1Gh3qmL.js} +1 -1
- package/build/assets/{model-selector-DeMmw-Xa.js → model-selector-SM9IUz-q.js} +1 -1
- package/build/assets/{mutation-Cz7N4XAo.js → mutation-D0OogFCz.js} +1 -1
- package/build/assets/{navigation-context-DeIPtGPp.js → navigation-context-D0YWpT8d.js} +1 -1
- package/build/assets/{navigation-link-C9JD4PYD.js → navigation-link-Cn7KP3c5.js} +1 -1
- package/build/assets/{openhands-logo-CI5Fhn1W.js → openhands-logo-CnrF6LKb.js} +1 -1
- package/build/assets/{option-service.api-DsI1UW7N.js → option-service.api-KvY_mZMY.js} +1 -1
- package/build/assets/{organization-service.api-COwMPFg5.js → organization-service.api-DzYTHTYC.js} +1 -1
- package/build/assets/{path-utils-CqJboYxo.js → path-utils-YohAYyMv.js} +1 -1
- package/build/assets/{plan-components-DEjMuDDG.js → plan-components-atxXCF0R.js} +1 -1
- package/build/assets/{planner-tab-BrntFmb1.js → planner-tab-CFc-hV07.js} +1 -1
- package/build/assets/{profiles-client-BGkKEV9j.js → profiles-client-D6IkTJof.js} +1 -1
- package/build/assets/{providers-DXvCAN_u.js → providers-Bx6EfrzZ.js} +1 -1
- package/build/assets/{proxy-CurRmrqf.js → proxy-CxydCnis.js} +1 -1
- package/build/assets/{query-client-config-Ba7qAAoO.js → query-client-config-B7u9asM0.js} +1 -1
- package/build/assets/{recommended-automations-launcher-BI9NhG8Y.js → recommended-automations-launcher-sgvfU62c.js} +3 -3
- package/build/assets/root-BXWU99D-.js +2 -0
- package/build/assets/{root-layout-BLjAEgle.js → root-layout-DVepR4To.js} +2 -2
- package/build/assets/sdk-section-page-DOIKvwSL.js +1 -0
- package/build/assets/{sdk-settings-schema-QBYH-ONX.js → sdk-settings-schema-DsUf9wu1.js} +1 -1
- package/build/assets/{search-Cq_cFrDt.js → search-27Owlc3A.js} +1 -1
- package/build/assets/{secrets-service-Bwd5DeUs.js → secrets-service-BsnKFc2x.js} +1 -1
- package/build/assets/secrets-settings-Bz_UohPJ.js +1 -0
- package/build/assets/{server-client-C3mC8Hl3.js → server-client-DyAQ3NZ_.js} +1 -1
- package/build/assets/{settings-D7E2U5tK.js → settings-BYkVX7vW.js} +1 -1
- package/build/assets/{settings-client-CwjfwoiB.js → settings-client-C73C7IgV.js} +1 -1
- package/build/assets/{settings-dropdown-input-VwAXNrOb.js → settings-dropdown-input-BJYvGdg-.js} +1 -1
- package/build/assets/{settings-gear-BJwWR1ej.js → settings-gear-C77PgE_O.js} +1 -1
- package/build/assets/{settings-index-J-3BNR0W.js → settings-index-Dz0BmdJD.js} +1 -1
- package/build/assets/{settings-input-DBywAnA7.js → settings-input-Bn7F5C75.js} +1 -1
- package/build/assets/{settings-list-classes-BOS092DR.js → settings-list-classes-Bf80tWtc.js} +1 -1
- package/build/assets/{settings-modal-B8vgWDTe.js → settings-modal-Brzgh5Yw.js} +1 -1
- package/build/assets/{settings-section-header-context-32x6WTyL.js → settings-section-header-context-BgZe5YkE.js} +1 -1
- package/build/assets/{settings-service.api-FvJGK45W.js → settings-service.api-CZ3uWx4v.js} +1 -1
- package/build/assets/{settings-switch-DTKmHC8F.js → settings-switch-BeIKrWms.js} +1 -1
- package/build/assets/{shared-conversation-a0QV8o99.js → shared-conversation-DChOdb0t.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-DTUNI1WQ.js → sidebar-mobile-menu-toggle-BWuf4PRH.js} +1 -1
- package/build/assets/{sidebar-nav-link-CnWoZcwc.js → sidebar-nav-link-BGjiJq-4.js} +1 -1
- package/build/assets/{skill-card-pill-row-tZ599jli.js → skill-card-pill-row-DF1axQCG.js} +1 -1
- package/build/assets/{skills-ZyAO5dyK.js → skills-ChIKZPK4.js} +1 -1
- package/build/assets/{skills-plugins-BSRz041I.js → skills-plugins-CcI_19lM.js} +1 -1
- package/build/assets/{skills-settings-DOnMn9q1.js → skills-settings-DlA5hlXw.js} +1 -1
- package/build/assets/{status-CsatcFbK.js → status-hp6M6E7E.js} +1 -1
- package/build/assets/{styled-tooltip-CS3mB_1X.js → styled-tooltip-CBzrri6o.js} +1 -1
- package/build/assets/{switch-skeleton-C-CfhYYV.js → switch-skeleton-DnC9wLp7.js} +1 -1
- package/build/assets/{task-list-tab-Day9nhRT.js → task-list-tab-DUJn1sgz.js} +1 -1
- package/build/assets/{terminal-ro4SNjUU.js → terminal-CRf9S0Z2.js} +1 -1
- package/build/assets/{terminal-LNa-iU5c.js → terminal-RmuaSdhJ.js} +1 -1
- package/build/assets/{toggle-switch-k-IZCDbt.js → toggle-switch-Pvyp2RAN.js} +1 -1
- package/build/assets/{typography-vVUMoNUg.js → typography-gpuWmrQO.js} +1 -1
- package/build/assets/{u-check-circle-DplbarS5.js → u-check-circle-IUIfACQQ.js} +1 -1
- package/build/assets/{u-check-circle-half-yDuiSZHC.js → u-check-circle-half-C1YxB6py.js} +1 -1
- package/build/assets/{u-circuit-C9tYkpeK.js → u-circuit-BmVikJHu.js} +1 -1
- package/build/assets/{u-edit-KAUlufD8.js → u-edit-CFvXHqZk.js} +1 -1
- package/build/assets/use-active-conversation-Db3IWSPK.js +1 -0
- package/build/assets/{use-agent-settings-schema-Bvp5UzV8.js → use-agent-settings-schema-33Un7UF2.js} +1 -1
- package/build/assets/{use-agent-state-DE5dlEXJ.js → use-agent-state-Bn8vS5sY.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-DWVar4st.js → use-cloud-current-user-id-CvkXFnTT.js} +1 -1
- package/build/assets/use-config-Co1O8-Ey.js +1 -0
- package/build/assets/{use-create-conversation-DW7AGgLA.js → use-create-conversation-CKS3EAHu.js} +1 -1
- package/build/assets/{use-event-store-CQZCcVz-.js → use-event-store-BT_gV3ut.js} +1 -1
- package/build/assets/use-get-secrets-DuhdIA59.js +1 -0
- package/build/assets/{use-handle-plan-click-DpgEQDAV.js → use-handle-plan-click-C9zJpK8A.js} +1 -1
- package/build/assets/use-is-authed-BggE5wPj.js +1 -0
- package/build/assets/{use-is-creating-conversation-DhDeeWfA.js → use-is-creating-conversation-BZ5hB_Bg.js} +1 -1
- package/build/assets/{use-launch-skill-in-chat-DVGPFrbI.js → use-launch-skill-in-chat-fNN_xGZG.js} +1 -1
- package/build/assets/{use-llm-profiles-D3-KXwQ0.js → use-llm-profiles-DDOol3gK.js} +1 -1
- package/build/assets/use-runtime-is-ready-CQCE3xZC.js +1 -0
- package/build/assets/{use-save-settings-CEEKSTWG.js → use-save-settings-VUrj_QNG.js} +1 -1
- package/build/assets/{use-settings-DQ7Oo1Hj.js → use-settings-DQIZmIov.js} +1 -1
- package/build/assets/{use-settings-nav-items-YmrXrjn9.js → use-settings-nav-items-1ZvovKSr.js} +1 -1
- package/build/assets/use-skills-DAMLFjKU.js +1 -0
- package/build/assets/{use-task-list-Bs90uF2N.js → use-task-list-CLJbuJgM.js} +1 -1
- package/build/assets/use-unified-vscode-url-sZt29HrC.js +1 -0
- package/build/assets/use-user-conversation-DfgEB6RW.js +1 -0
- package/build/assets/{useMutation-B4OUESdw.js → useMutation-DqrumCWD.js} +1 -1
- package/build/assets/{useTranslation-CpIcQBq6.js → useTranslation-DCOdSSMl.js} +1 -1
- package/build/assets/{utils-D-HX7JCe.js → utils-i18rdUj2.js} +1 -1
- package/build/assets/v4-CNn21NXa.js +1 -0
- package/build/assets/{vendor~browser-Dr71AdrG.js → vendor~browser-BNjNhjFU.js} +1 -1
- package/build/assets/{vendor~browser-tab-BiVxfjJo.js → vendor~browser-tab-BgwV1mxF.js} +1 -1
- package/build/assets/{vendor~conversation-panel~conversation-BlCIz9XQ.js → vendor~conversation-panel~conversation-a9SyrrhV.js} +1 -1
- package/build/assets/{vendor~files-tab-DtLR-QD9.js → vendor~files-tab-BGKayPiK.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Ds9quNZ9.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-smY2r837.js} +1 -1
- package/build/assets/{vendor~home~mcp~automations-list-C5PoHCy6.js → vendor~home~mcp~automations-list-Ccy2I0KU.js} +1 -1
- package/build/assets/{vendor~home~mcp~automations-list-BUBGGGYz.js → vendor~home~mcp~automations-list-DoPfwaXj.js} +1 -1
- package/build/assets/{vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-CGlZoBKa.js → vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-DbfELDJu.js} +2 -2
- package/build/assets/{vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-DE11mPxp.js → vendor~home~mcp~llm-settings~agent-settings~condenser-settings~verification-settings~app-se~ocm3mykx-Z3nsiNNq.js} +1 -1
- package/build/assets/{vendor~launch-Dg--Ssk6.js → vendor~launch-vdeRTWFu.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-DrXgiSCq.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-DW31UyBp.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-8b8V5bfO.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-BkQGKpye.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-Dy7L6fMG.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-DzIXV3Ui.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~k776hupu-D40EXhZx.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~k776hupu-Bbs7UJ5U.js} +2 -2
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-CHrEOFl6.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BP1SKG0F.js → vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-d2oallMa.js} +1 -1
- package/build/assets/{vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~kyz9p27j-CyUbhpbm.js → vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-CDXvdvb2.js} +1 -1
- package/build/assets/{verification-settings-BtlTiHP8.js → verification-settings-CsbvQcYS.js} +1 -1
- package/build/assets/{vscode-tab-C0ShhiSU.js → vscode-tab-Zb-QbTuV.js} +1 -1
- package/build/assets/{waiting-for-runtime-message-DWPl_Yby.js → waiting-for-runtime-message-CntjExbU.js} +1 -1
- package/build/assets/{x-mark-CWI0f9yI.js → x-mark-CrpjscNc.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +7 -0
- package/build/locales/ca/openhands.json +7 -0
- package/build/locales/de/openhands.json +7 -0
- package/build/locales/en/openhands.json +7 -0
- package/build/locales/es/openhands.json +7 -0
- package/build/locales/fr/openhands.json +7 -0
- package/build/locales/it/openhands.json +7 -0
- package/build/locales/ja/openhands.json +7 -0
- package/build/locales/ko-KR/openhands.json +7 -0
- package/build/locales/no/openhands.json +7 -0
- package/build/locales/pt/openhands.json +7 -0
- package/build/locales/tr/openhands.json +7 -0
- package/build/locales/uk/openhands.json +7 -0
- package/build/locales/zh-CN/openhands.json +7 -0
- package/build/locales/zh-TW/openhands.json +7 -0
- package/config/defaults.json +0 -4
- package/dist/api/agent-server-adapter.cjs +1 -1
- package/dist/api/agent-server-adapter.cjs.map +1 -1
- package/dist/api/agent-server-adapter.js +2 -1
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/api/agent-server-compatibility.cjs +1 -1
- package/dist/api/agent-server-compatibility.cjs.map +1 -1
- package/dist/api/agent-server-compatibility.d.ts +16 -0
- package/dist/api/agent-server-compatibility.js +31 -20
- package/dist/api/agent-server-compatibility.js.map +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 +45 -0
- package/dist/api/agent-server-config.js +49 -21
- package/dist/api/agent-server-config.js.map +1 -1
- package/dist/api/backend-registry/storage.cjs +1 -1
- package/dist/api/backend-registry/storage.cjs.map +1 -1
- package/dist/api/backend-registry/storage.js +34 -32
- package/dist/api/backend-registry/storage.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.d.ts +5 -4
- package/dist/api/conversation-service/agent-server-conversation-service.api.js +70 -76
- package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
- package/dist/api/skills-service.cjs +1 -1
- package/dist/api/skills-service.cjs.map +1 -1
- package/dist/api/skills-service.d.ts +1 -1
- package/dist/api/skills-service.js +2 -2
- package/dist/api/skills-service.js.map +1 -1
- package/dist/components/features/backends/api-key-entry-screen.d.ts +10 -0
- 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 +23 -2
- package/dist/components/features/backends/backend-form-modal.js +185 -173
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/browser/browser.cjs +1 -1
- package/dist/components/features/browser/browser.cjs.map +1 -1
- package/dist/components/features/browser/browser.js +10 -16
- package/dist/components/features/browser/browser.js.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.js +1 -1
- package/dist/components/features/conversation-panel/skills-modal.js.map +1 -1
- package/dist/components/features/mcp-page/install-server-modal.cjs +1 -1
- package/dist/components/features/mcp-page/install-server-modal.cjs.map +1 -1
- package/dist/components/features/mcp-page/install-server-modal.js +123 -116
- package/dist/components/features/mcp-page/install-server-modal.js.map +1 -1
- package/dist/components/features/mcp-page/installed-server-card.cjs +1 -1
- package/dist/components/features/mcp-page/installed-server-card.cjs.map +1 -1
- package/dist/components/features/mcp-page/installed-server-card.js +40 -40
- package/dist/components/features/mcp-page/installed-server-card.js.map +1 -1
- package/dist/components/features/mcp-page/marketplace-card.cjs +1 -1
- package/dist/components/features/mcp-page/marketplace-card.cjs.map +1 -1
- package/dist/components/features/mcp-page/marketplace-card.js +2 -3
- package/dist/components/features/mcp-page/marketplace-card.js.map +1 -1
- package/dist/components/features/mcp-page/marketplace-section.cjs +1 -1
- package/dist/components/features/mcp-page/marketplace-section.cjs.map +1 -1
- package/dist/components/features/mcp-page/marketplace-section.js +21 -21
- package/dist/components/features/mcp-page/marketplace-section.js.map +1 -1
- package/dist/components/features/onboarding/steps/setup-acp-secrets-step.d.ts +27 -0
- 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 +2 -0
- 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 +10 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js +87 -84
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js.map +1 -1
- package/dist/constants/acp-providers.cjs +1 -1
- package/dist/constants/acp-providers.cjs.map +1 -1
- package/dist/constants/acp-providers.d.ts +25 -0
- package/dist/constants/acp-providers.js +1 -0
- package/dist/constants/acp-providers.js.map +1 -1
- package/dist/contexts/conversation-websocket-context.cjs +3 -3
- package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
- package/dist/contexts/conversation-websocket-context.js +177 -165
- package/dist/contexts/conversation-websocket-context.js.map +1 -1
- package/dist/hooks/chat/use-model-interceptor.cjs.map +1 -1
- package/dist/hooks/chat/use-model-interceptor.js.map +1 -1
- package/dist/hooks/chat/use-slash-command.cjs +1 -1
- package/dist/hooks/chat/use-slash-command.cjs.map +1 -1
- package/dist/hooks/chat/use-slash-command.js +1 -1
- package/dist/hooks/chat/use-slash-command.js.map +1 -1
- package/dist/hooks/mutation/use-switch-llm-profile.cjs.map +1 -1
- package/dist/hooks/mutation/use-switch-llm-profile.d.ts +1 -1
- package/dist/hooks/mutation/use-switch-llm-profile.js.map +1 -1
- package/dist/hooks/query/use-config.cjs +1 -1
- package/dist/hooks/query/use-config.cjs.map +1 -1
- package/dist/hooks/query/use-config.js +10 -10
- package/dist/hooks/query/use-config.js.map +1 -1
- package/dist/hooks/query/use-conversation-skills.cjs +2 -0
- package/dist/hooks/query/use-conversation-skills.cjs.map +1 -0
- package/dist/hooks/query/use-conversation-skills.d.ts +7 -0
- package/dist/hooks/query/use-conversation-skills.js +8 -0
- package/dist/hooks/query/use-conversation-skills.js.map +1 -0
- package/dist/hooks/query/use-local-git-info.cjs +3 -3
- package/dist/hooks/query/use-local-git-info.cjs.map +1 -1
- package/dist/hooks/query/use-local-git-info.js +24 -25
- package/dist/hooks/query/use-local-git-info.js.map +1 -1
- package/dist/hooks/query/use-skills.cjs +1 -1
- package/dist/hooks/query/use-skills.cjs.map +1 -1
- package/dist/hooks/query/use-skills.d.ts +6 -1
- package/dist/hooks/query/use-skills.js +3 -3
- package/dist/hooks/query/use-skills.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 +7 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +2 -2
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +119 -0
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +7 -0
- package/dist/locales/ca/openhands.json +7 -0
- package/dist/locales/de/openhands.json +7 -0
- package/dist/locales/en/openhands.json +7 -0
- package/dist/locales/es/openhands.json +7 -0
- package/dist/locales/fr/openhands.json +7 -0
- package/dist/locales/it/openhands.json +7 -0
- package/dist/locales/ja/openhands.json +7 -0
- package/dist/locales/ko-KR/openhands.json +7 -0
- package/dist/locales/no/openhands.json +7 -0
- package/dist/locales/pt/openhands.json +7 -0
- package/dist/locales/tr/openhands.json +7 -0
- package/dist/locales/uk/openhands.json +7 -0
- package/dist/locales/zh-CN/openhands.json +7 -0
- package/dist/locales/zh-TW/openhands.json +7 -0
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/dist/routes/conversation.cjs +1 -1
- package/dist/routes/conversation.cjs.map +1 -1
- package/dist/routes/conversation.js +61 -63
- package/dist/routes/conversation.js.map +1 -1
- package/dist/routes/mcp.cjs +1 -1
- package/dist/routes/mcp.cjs.map +1 -1
- package/dist/routes/mcp.js +64 -64
- package/dist/routes/mcp.js.map +1 -1
- package/dist/stores/browser-store.cjs +1 -1
- package/dist/stores/browser-store.cjs.map +1 -1
- package/dist/stores/browser-store.js +1 -1
- package/dist/stores/browser-store.js.map +1 -1
- package/dist/stores/use-event-store.cjs +1 -1
- package/dist/stores/use-event-store.cjs.map +1 -1
- package/dist/stores/use-event-store.d.ts +22 -0
- package/dist/stores/use-event-store.js +9 -1
- package/dist/stores/use-event-store.js.map +1 -1
- package/dist/ui/context-menu.d.ts +1 -1
- package/dist/ui/help-link.d.ts +1 -1
- package/dist/utils/mcp-marketplace-utils.cjs +1 -1
- package/dist/utils/mcp-marketplace-utils.cjs.map +1 -1
- package/dist/utils/mcp-marketplace-utils.d.ts +13 -22
- package/dist/utils/mcp-marketplace-utils.js +46 -28
- package/dist/utils/mcp-marketplace-utils.js.map +1 -1
- package/dist/utils/sdk-settings-schema.cjs +1 -1
- package/dist/utils/sdk-settings-schema.cjs.map +1 -1
- package/dist/utils/sdk-settings-schema.d.ts +1 -0
- package/dist/utils/sdk-settings-schema.js +1 -1
- package/dist/utils/sdk-settings-schema.js.map +1 -1
- package/package.json +3 -3
- package/scripts/dev-safe.mjs +94 -57
- package/scripts/dev-static.mjs +2 -3
- package/scripts/dev-with-automation.mjs +98 -67
- package/scripts/static-server.mjs +77 -35
- package/tools/canvas_ui_tool.py +4 -0
- package/build/assets/acp-providers-DauuOsW9.js +0 -1
- package/build/assets/add-backend-modal-KMmPQNZU.js +0 -1
- package/build/assets/agent-server-client-options-DT2GP6VJ.js +0 -1
- package/build/assets/agent-server-compatibility-2aOx5iWd.js +0 -1
- package/build/assets/agent-server-conversation-service.api-DSl9G5UR.js +0 -5
- package/build/assets/backend-form-modal-K6IMCr3p.js +0 -1
- package/build/assets/browser-DKG63inJ.js +0 -5
- package/build/assets/browser-store-C3AqxAO7.js +0 -1
- package/build/assets/browser-tab-B_BuTvrO.js +0 -1
- package/build/assets/conversation-BD5WemJI.js +0 -19
- package/build/assets/conversation-C47K62n8.js +0 -1
- package/build/assets/conversation-panel-Dn-S56Gk.js +0 -1
- package/build/assets/conversation-websocket-context-Ywrxd_9p.js +0 -3
- package/build/assets/declaration-D378OjpZ.js +0 -1
- package/build/assets/files-tab-B3A1NDlZ.js +0 -1
- package/build/assets/git-control-bar-branch-button-CcIpmyfM.js +0 -27
- package/build/assets/home-dIzxi5Dd.js +0 -1
- package/build/assets/install-server-modal-z5VaHeXd.js +0 -1
- package/build/assets/llm-settings-2036m7Wt.js +0 -1
- package/build/assets/llm-settings-CcHqGOYL.js +0 -1
- package/build/assets/manifest-97e839da.js +0 -1
- package/build/assets/mcp-C06YssEI.js +0 -9
- package/build/assets/root-BS1Td78t.js +0 -2
- package/build/assets/sdk-section-page-CJW0G04-.js +0 -1
- package/build/assets/secrets-settings-MLXqOtX2.js +0 -1
- package/build/assets/use-active-conversation-D15D9GgR.js +0 -1
- package/build/assets/use-config-BSu_53GL.js +0 -1
- package/build/assets/use-conversation-id-DajhCn2A.js +0 -1
- package/build/assets/use-is-authed-hXC8vxgT.js +0 -1
- package/build/assets/use-runtime-is-ready-XFbT16BD.js +0 -1
- package/build/assets/use-skills-Xe0vjPMt.js +0 -1
- package/build/assets/use-unified-vscode-url-BOsIOd-b.js +0 -1
- package/build/assets/use-user-conversation-Mc0mQgkl.js +0 -1
- /package/build/assets/{automation-XLxhq3I8.js → automation-IdgZq6ZK.js} +0 -0
- /package/build/assets/{common-SMkEaBSr.js → common-DR1t-EeP.js} +0 -0
- /package/build/assets/{conversation-state-store-Bc0slAjL.js → conversation-state-store-u5jepov0.js} +0 -0
- /package/build/assets/{dist-yMQV8IUk.js → dist-BxBP7tFD.js} +0 -0
- /package/build/assets/{git-status-mapper-BI8FyUVp.js → git-status-mapper-DnL9OC8_.js} +0 -0
- /package/build/assets/{handle-capture-consent-BfZATzpI.js → handle-capture-consent-3XrjZ8wi.js} +0 -0
- /package/build/assets/{iconBase-C7N9pPOs.js → iconBase-DE30Zj_-.js} +0 -0
- /package/build/assets/{settings-D5am1n6X.js → settings-D_H-qsRm.js} +0 -0
- /package/build/assets/{settings-like-page-layout-classes-Bn-M9oOa.js → settings-like-page-layout-classes-I0BDBEoq.js} +0 -0
- /package/build/assets/{settings-utils-BsvSU3OM.js → settings-utils-B6Nl07io.js} +0 -0
- /package/build/assets/{sidebar-store-cOeaKmIm.js → sidebar-store-Uy3v0AOV.js} +0 -0
- /package/build/assets/{use-breakpoint-B86yKT9n.js → use-breakpoint-DbJ6FkQ-.js} +0 -0
- /package/build/assets/{use-click-outside-element-835W9pC6.js → use-click-outside-element-DffgWWoZ.js} +0 -0
- /package/build/assets/{vendor~browser-BpdPBhgZ.js → vendor~browser-DDiZgqD3.js} +0 -0
- /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-Df7_G0zR.js → vendor~conversation-panel~conversation~alert-banner-DbvX3OcM.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~b4cctr4k-B7YVdv1X.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~g56ukk6u-DsSvIDZQ.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i9dbt75i-CI82Did1.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~hkqzh1hb-BZ0HXuHD.js} +0 -0
- /package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~pfbaerbd-zhv9fooy.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js} +0 -0
- /package/build/assets/{vendor~terminal-BUxzHKcC.js → vendor~terminal-DUrOWGFE.js} +0 -0
- /package/build/assets/{vscode-url-helper-jesbpos5.js → vscode-url-helper-Cwy1A62q.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(`../cloud/proxy.cjs`),l=require(`../agent-server-client-options.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`),f=require(`../cloud/conversation-service.api.cjs`),p=require(`../settings-service/settings-service.api.cjs`),m=require(`../agent-server-adapter.cjs`);var h=`1970-01-01T00:00:00.000Z`,g=`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
|
|
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(`../cloud/proxy.cjs`),l=require(`../agent-server-client-options.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`),f=require(`../cloud/conversation-service.api.cjs`),p=require(`../settings-service/settings-service.api.cjs`),m=require(`../agent-server-adapter.cjs`);var h=`1970-01-01T00:00:00.000Z`,g=`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 _(){return Error(g)}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){return typeof e==`number`?e:null}function b(e){return typeof e==`number`?e:0}function x(e){return typeof e==`string`?e:null}function S(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:h}function C(e){return v(e)?{prompt_tokens:b(e.prompt_tokens),completion_tokens:b(e.completion_tokens),cache_read_tokens:b(e.cache_read_tokens),cache_write_tokens:b(e.cache_write_tokens),context_window:b(e.context_window),per_turn_token:b(e.per_turn_token)}:null}function w(e){return v(e)?{accumulated_cost:y(e.accumulated_cost),max_budget_per_task:y(e.max_budget_per_task),accumulated_token_usage:C(e.accumulated_token_usage)}:null}function T(e){if(!v(e))return null;let t=v(e.llm)?{model:x(e.llm.model)}:null;return{kind:x(e.kind),acp_model:x(e.acp_model),llm:t}}function E(e){return v(e)?{working_dir:x(e.working_dir)}:null}function D(e){if(!v(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function O(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 k(e,t){let n=O(e),r=O(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function A(e){if(!v(e)||typeof e.id!=`string`||!e.id.trim())throw _();return{id:e.id.trim(),title:x(e.title),created_at:S(e,`created_at`,`createdAt`),updated_at:S(e,`updated_at`,`updatedAt`),execution_status:x(e.execution_status),sandbox_status:x(e.sandbox_status),metrics:w(e.metrics),agent:T(e.agent),workspace:E(e.workspace),tags:D(e.tags),current_model_id:x(e.current_model_id),current_model_name:x(e.current_model_name)}}function j(e){if(!Array.isArray(e))throw _();return e.map(A)}function M(e){if(Array.isArray(e))return{items:j(e),next_page_id:null};if(!v(e))throw _();return{items:j(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var N=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function P(e){let t=e??`idle`;return N.has(t)?t:`idle`}function F(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var I=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 f.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 c.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(l.getAgentServerClientOptions({conversationUrl:o,sessionApiKey:u})).sendEvent(e,r,{run:!0}),r}static async createConversation(r,i,a,s,c,u,h,g){if(t.getActiveBackend().backend.kind===`cloud`)return f.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:h,sandbox_id:g??null});let _=await p.default.getSettings(),v=o.default(),y=await m.buildStartConversationRequestWithEncryptedSettings({settings:_,query:r,conversationInstructions:i,plugins:a,conversationId:v,workingDir:c??e.buildConversationWorkingDir(v)}),b=await new n.ConversationClient(l.getAgentServerClientOptions()).createConversation(y);return(s?.selected_repository||c)&&d.setStoredConversationMetadata(b.id,{selected_repository:s?.selected_repository??null,selected_branch:s?.selected_branch??null,git_provider:s?.git_provider??null,selected_workspace:c??null}),{id:b.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:b.id,agent_server_url:t.getEffectiveLocalBackend().host,request:{initial_message:y.initial_message,plugins:a??null},created_at:b.created_at,updated_at:b.updated_at}}static async getStartTask(e){return t.getActiveBackend().backend.kind===`cloud`?f.getCloudAppConversationStartTask(e):null}static async getVSCodeUrl(e,t,n){let r=await this.resolveConversationWorkingDir(e);return{vscode_url:await new a.VSCodeClient(l.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`?f.batchGetCloudConversations(e):j(await new n.ConversationClient(l.getAgentServerClientOptions()).getConversations(e)).map(e=>m.toAppConversation(e))}static async updateConversationPublicFlag(e,n){if(t.getActiveBackend().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return f.updateCloudConversationPublicFlag(e,n)}static async updateConversationRepository(e,t,n,r){t?d.setStoredConversationMetadata(e,{...d.getStoredConversationMetadata(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):d.removeStoredConversationMetadata(e);let[i]=await this.batchGetAppConversations([e]);return F(i,e)}static async readConversationFile(e,n){if(t.getActiveBackend().backend.kind===`cloud`)return f.readCloudConversationFile(e,k(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let i=await this.resolveConversationWorkingDir(e),a=k(n??`${i}/.agents_tmp/PLAN.md`,i);return new r.FileClient(l.getAgentServerClientOptions()).downloadTextFile(a)}static async downloadConversation(e){return t.getActiveBackend().backend.kind===`cloud`?f.downloadCloudConversation(e):new r.FileClient(l.getAgentServerClientOptions()).downloadTrajectory(e)}static async getHooks(e){return m.emptyHooksResponse()}static async getRuntimeConversation(e,r,i){let a=t.getActiveBackend().backend,o=a.kind===`cloud`&&r?await c.callCloudProxy({backend:a,method:`GET`,hostOverride:s.buildHttpBaseUrl(r),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:i}):await new n.ConversationClient(l.getAgentServerClientOptions({conversationUrl:r,sessionApiKey:i})).getConversation(e),u=A(o),d=v(o)?o.stats:null;return{id:u.id,title:u.title?.trim()?u.title:m.getDefaultConversationTitle(u.id),metrics:w(u.metrics),created_at:u.created_at,updated_at:u.updated_at,status:P(u.execution_status),stats:v(d)?d:{usage_to_metrics:{}}}}static async searchConversations(e=20,r){return t.getActiveBackend().backend.kind===`cloud`?f.searchCloudConversations(e,r):m.toConversationPage(M(await new n.ConversationClient(l.getAgentServerClientOptions()).searchConversations({limit:e,page_id:r,sort_order:u.ConversationSortOrder.UPDATED_AT_DESC})))}static async deleteConversation(e){t.getActiveBackend().backend.kind===`cloud`?await f.deleteCloudConversation(e):await new n.ConversationClient(l.getAgentServerClientOptions()).deleteConversation(e),d.removeStoredConversationMetadata(e)}static async updateConversationTitle(e,t){await new n.ConversationClient(l.getAgentServerClientOptions()).updateConversation(e,{title:t});let[r]=await this.batchGetAppConversations([e]);return F(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(l.getAgentServerClientOptions()).activateProfile(r);return}await new n.ConversationClient(l.getAgentServerClientOptions()).switchProfile(e,r)}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(l.getAgentServerClientOptions()).switchAcpModel(e,r)}};exports.default=I;
|
|
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 { getAgentServerClientOptions } 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.\";\nconst INVALID_PROFILE_CONFIG_MESSAGE =\n \"Unable to switch LLM profiles because the selected agent server returned \" +\n \"profile data this UI does not understand. Check the backend URL/session \" +\n \"key and update the agent server if needed.\";\n\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 isLLMConfig(value: unknown): value is LLMConfig {\n return isRecord(value) && typeof value.model === \"string\";\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\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: getEffectiveLocalBackend().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_llm — 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 /switch_llm body needs the LLM config, which we fetch with encrypted\n * secrets — same flow as conversation-start.\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 const profilesClient = new ProfilesClient(getAgentServerClientOptions());\n\n if (!conversationId) {\n await profilesClient.activateProfile(profileName);\n return;\n }\n\n const profile = await profilesClient.getProfile(profileName, {\n exposeSecrets: \"encrypted\",\n });\n if (!isLLMConfig(profile.config)) {\n throw new Error(INVALID_PROFILE_CONFIG_MESSAGE);\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchLLM(\n conversationId,\n profile.config,\n );\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_llm).\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":"8hCA+DA,IAAM,EAAiC,2BACjC,EACJ,qLAGI,EACJ,8LAIF,SAAS,GAAqC,CAC5C,OAAW,MAAM,EAAsC,CAGzD,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,EAAM,CAG7E,SAAS,EAAY,EAAoC,CACvD,OAAO,EAAS,EAAM,EAAI,OAAO,EAAM,OAAU,SAGnD,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,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AK,yBAAyB,CACzD,EACD,CAAC,CACF,OAAO,EAAuB,EAAc,EAAe,CAa7D,aAAa,cACX,EACA,EACe,CACf,GAAI,EAAA,kBAAkB,CAAC,QAAQ,OAAS,QACtC,MAAU,MACR,2EACD,CAGH,IAAM,EAAiB,IAAI,EAAA,eAAe,EAAA,6BAA6B,CAAC,CAExE,GAAI,CAAC,EAAgB,CACnB,MAAM,EAAe,gBAAgB,EAAY,CACjD,OAGF,IAAM,EAAU,MAAM,EAAe,WAAW,EAAa,CAC3D,cAAe,YAChB,CAAC,CACF,GAAI,CAAC,EAAY,EAAQ,OAAO,CAC9B,MAAU,MAAM,EAA+B,CAGjD,MAAM,IAAI,EAAA,mBAAmB,EAAA,6BAA6B,CAAC,CAAC,UAC1D,EACA,EAAQ,OACT,CAcH,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"}
|
|
1
|
+
{"version":3,"file":"agent-server-conversation-service.api.cjs","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import { ConversationSortOrder } 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 { getAgentServerClientOptions } 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\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: getEffectiveLocalBackend().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 await new ConversationClient(getAgentServerClientOptions()).switchProfile(\n conversationId,\n profileName,\n );\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":"8hCA4DA,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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AI,EAAA,mBAAmB,EAAA,6BAA6B,CAAC,CAAC,cAC1D,EACA,EACD,CAcH,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"}
|
|
@@ -20,18 +20,19 @@ declare class AgentServerConversationService {
|
|
|
20
20
|
static updateConversationTitle(conversationId: string, title: string): Promise<AppConversation>;
|
|
21
21
|
/**
|
|
22
22
|
* Switches the LLM profile for the running conversation when one is open
|
|
23
|
-
* (POST /
|
|
23
|
+
* (POST /switch_profile — per-conversation swap, doesn't change the user's
|
|
24
24
|
* default profile). When called without a conversationId (home page),
|
|
25
25
|
* falls back to POST /activate so the next conversation created picks up
|
|
26
26
|
* the chosen profile.
|
|
27
27
|
*
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
28
|
+
* The per-conversation endpoint accepts only the profile name, so the UI does
|
|
29
|
+
* not need to fetch or forward profile secrets. That keeps switching working
|
|
30
|
+
* even when the agent server has no OH_SECRET_KEY for encrypted secret export.
|
|
30
31
|
*/
|
|
31
32
|
static switchProfile(conversationId: string | null, profileName: string): Promise<void>;
|
|
32
33
|
/**
|
|
33
34
|
* Switches the model of a running ACP conversation in place (POST
|
|
34
|
-
* /switch_acp_model — the ACP analog of {@link switchProfile}'s /
|
|
35
|
+
* /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).
|
|
35
36
|
* The agent-server calls the ACP wrapper's ``session/set_model`` on the live
|
|
36
37
|
* session, preserving context. Mirrors {@link switchProfile}'s
|
|
37
38
|
* local-backend-only guard and per-conversation ConversationClient call.
|
|
@@ -15,65 +15,62 @@ import { batchGetCloudConversations as g, createCloudAppConversation as _, delet
|
|
|
15
15
|
import w from "../settings-service/settings-service.api.js";
|
|
16
16
|
import { buildStartConversationRequestWithEncryptedSettings as T, emptyHooksResponse as E, getDefaultConversationTitle as D, toAppConversation as O, toConversationPage as k } from "../agent-server-adapter.js";
|
|
17
17
|
//#region src/api/conversation-service/agent-server-conversation-service.api.ts
|
|
18
|
-
var A = "1970-01-01T00:00:00.000Z", j = "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."
|
|
19
|
-
function
|
|
18
|
+
var A = "1970-01-01T00:00:00.000Z", j = "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.";
|
|
19
|
+
function M() {
|
|
20
20
|
return Error(j);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function N(e) {
|
|
23
23
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return P(e) && typeof e.model == "string";
|
|
27
|
-
}
|
|
28
|
-
function I(e) {
|
|
25
|
+
function P(e) {
|
|
29
26
|
return typeof e == "number" ? e : null;
|
|
30
27
|
}
|
|
31
|
-
function
|
|
28
|
+
function F(e) {
|
|
32
29
|
return typeof e == "number" ? e : 0;
|
|
33
30
|
}
|
|
34
|
-
function
|
|
31
|
+
function I(e) {
|
|
35
32
|
return typeof e == "string" ? e : null;
|
|
36
33
|
}
|
|
37
|
-
function
|
|
34
|
+
function L(e, t, n) {
|
|
38
35
|
let r = e[t] ?? e[n];
|
|
39
36
|
return typeof r == "string" && r.trim() ? r : A;
|
|
40
37
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
43
|
-
prompt_tokens:
|
|
44
|
-
completion_tokens:
|
|
45
|
-
cache_read_tokens:
|
|
46
|
-
cache_write_tokens:
|
|
47
|
-
context_window:
|
|
48
|
-
per_turn_token:
|
|
38
|
+
function R(e) {
|
|
39
|
+
return N(e) ? {
|
|
40
|
+
prompt_tokens: F(e.prompt_tokens),
|
|
41
|
+
completion_tokens: F(e.completion_tokens),
|
|
42
|
+
cache_read_tokens: F(e.cache_read_tokens),
|
|
43
|
+
cache_write_tokens: F(e.cache_write_tokens),
|
|
44
|
+
context_window: F(e.context_window),
|
|
45
|
+
per_turn_token: F(e.per_turn_token)
|
|
49
46
|
} : null;
|
|
50
47
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
53
|
-
accumulated_cost:
|
|
54
|
-
max_budget_per_task:
|
|
55
|
-
accumulated_token_usage:
|
|
48
|
+
function z(e) {
|
|
49
|
+
return N(e) ? {
|
|
50
|
+
accumulated_cost: P(e.accumulated_cost),
|
|
51
|
+
max_budget_per_task: P(e.max_budget_per_task),
|
|
52
|
+
accumulated_token_usage: R(e.accumulated_token_usage)
|
|
56
53
|
} : null;
|
|
57
54
|
}
|
|
58
|
-
function
|
|
59
|
-
if (!
|
|
60
|
-
let t =
|
|
55
|
+
function B(e) {
|
|
56
|
+
if (!N(e)) return null;
|
|
57
|
+
let t = N(e.llm) ? { model: I(e.llm.model) } : null;
|
|
61
58
|
return {
|
|
62
|
-
kind:
|
|
63
|
-
acp_model:
|
|
59
|
+
kind: I(e.kind),
|
|
60
|
+
acp_model: I(e.acp_model),
|
|
64
61
|
llm: t
|
|
65
62
|
};
|
|
66
63
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
64
|
+
function V(e) {
|
|
65
|
+
return N(e) ? { working_dir: I(e.working_dir) } : null;
|
|
69
66
|
}
|
|
70
|
-
function
|
|
71
|
-
if (!
|
|
67
|
+
function H(e) {
|
|
68
|
+
if (!N(e)) return null;
|
|
72
69
|
let t = {};
|
|
73
70
|
for (let [n, r] of Object.entries(e)) typeof r == "string" && (t[n] = r);
|
|
74
71
|
return t;
|
|
75
72
|
}
|
|
76
|
-
function
|
|
73
|
+
function U(e) {
|
|
77
74
|
if (!e.startsWith("/")) return null;
|
|
78
75
|
let t = [];
|
|
79
76
|
for (let n of e.split("/")) if (n && n !== ".") if (n === "..") {
|
|
@@ -82,44 +79,44 @@ function G(e) {
|
|
|
82
79
|
} else t.push(n);
|
|
83
80
|
return `/${t.join("/")}`;
|
|
84
81
|
}
|
|
85
|
-
function
|
|
86
|
-
let n =
|
|
82
|
+
function W(e, t) {
|
|
83
|
+
let n = U(e), r = U(t);
|
|
87
84
|
if (!n || !r || n !== r && !n.startsWith(`${r}/`)) throw Error("Conversation file path must stay inside the workspace");
|
|
88
85
|
return n;
|
|
89
86
|
}
|
|
90
|
-
function
|
|
91
|
-
if (!
|
|
87
|
+
function G(e) {
|
|
88
|
+
if (!N(e) || typeof e.id != "string" || !e.id.trim()) throw M();
|
|
92
89
|
return {
|
|
93
90
|
id: e.id.trim(),
|
|
94
|
-
title:
|
|
95
|
-
created_at:
|
|
96
|
-
updated_at:
|
|
97
|
-
execution_status:
|
|
98
|
-
sandbox_status:
|
|
99
|
-
metrics:
|
|
100
|
-
agent:
|
|
101
|
-
workspace:
|
|
102
|
-
tags:
|
|
103
|
-
current_model_id:
|
|
104
|
-
current_model_name:
|
|
91
|
+
title: I(e.title),
|
|
92
|
+
created_at: L(e, "created_at", "createdAt"),
|
|
93
|
+
updated_at: L(e, "updated_at", "updatedAt"),
|
|
94
|
+
execution_status: I(e.execution_status),
|
|
95
|
+
sandbox_status: I(e.sandbox_status),
|
|
96
|
+
metrics: z(e.metrics),
|
|
97
|
+
agent: B(e.agent),
|
|
98
|
+
workspace: V(e.workspace),
|
|
99
|
+
tags: H(e.tags),
|
|
100
|
+
current_model_id: I(e.current_model_id),
|
|
101
|
+
current_model_name: I(e.current_model_name)
|
|
105
102
|
};
|
|
106
103
|
}
|
|
107
|
-
function
|
|
108
|
-
if (!Array.isArray(e)) throw
|
|
109
|
-
return e.map(
|
|
104
|
+
function K(e) {
|
|
105
|
+
if (!Array.isArray(e)) throw M();
|
|
106
|
+
return e.map(G);
|
|
110
107
|
}
|
|
111
|
-
function
|
|
108
|
+
function q(e) {
|
|
112
109
|
if (Array.isArray(e)) return {
|
|
113
|
-
items:
|
|
110
|
+
items: K(e),
|
|
114
111
|
next_page_id: null
|
|
115
112
|
};
|
|
116
|
-
if (!
|
|
113
|
+
if (!N(e)) throw M();
|
|
117
114
|
return {
|
|
118
|
-
items:
|
|
115
|
+
items: K(e.items),
|
|
119
116
|
next_page_id: typeof e.next_page_id == "string" ? e.next_page_id : null
|
|
120
117
|
};
|
|
121
118
|
}
|
|
122
|
-
var
|
|
119
|
+
var J = new Set([
|
|
123
120
|
"idle",
|
|
124
121
|
"running",
|
|
125
122
|
"paused",
|
|
@@ -128,15 +125,15 @@ var X = new Set([
|
|
|
128
125
|
"error",
|
|
129
126
|
"stuck"
|
|
130
127
|
]);
|
|
131
|
-
function
|
|
128
|
+
function Y(e) {
|
|
132
129
|
let t = e ?? "idle";
|
|
133
|
-
return
|
|
130
|
+
return J.has(t) ? t : "idle";
|
|
134
131
|
}
|
|
135
|
-
function
|
|
132
|
+
function X(e, t) {
|
|
136
133
|
if (!e) throw Error(`Conversation ${t} was not found`);
|
|
137
134
|
return e;
|
|
138
135
|
}
|
|
139
|
-
var
|
|
136
|
+
var Z = class {
|
|
140
137
|
static async sendMessage(e, t, r) {
|
|
141
138
|
let a = n().backend, o = r?.conversationUrl ?? null, s = r?.sessionApiKey ?? null;
|
|
142
139
|
if (a.kind === "cloud") {
|
|
@@ -227,7 +224,7 @@ var $ = class {
|
|
|
227
224
|
return n?.workspace?.working_dir ?? t();
|
|
228
225
|
}
|
|
229
226
|
static async batchGetAppConversations(e) {
|
|
230
|
-
return e.length === 0 ? [] : n().backend.kind === "cloud" ? g(e) :
|
|
227
|
+
return e.length === 0 ? [] : n().backend.kind === "cloud" ? g(e) : K(await new i(d()).getConversations(e)).map((e) => O(e));
|
|
231
228
|
}
|
|
232
229
|
static async updateConversationPublicFlag(e, t) {
|
|
233
230
|
if (n().backend.kind !== "cloud") throw Error("Public sharing requires a cloud backend.");
|
|
@@ -241,11 +238,11 @@ var $ = class {
|
|
|
241
238
|
git_provider: r ?? null
|
|
242
239
|
}) : m(e);
|
|
243
240
|
let [i] = await this.batchGetAppConversations([e]);
|
|
244
|
-
return
|
|
241
|
+
return X(i, e);
|
|
245
242
|
}
|
|
246
243
|
static async readConversationFile(e, t) {
|
|
247
|
-
if (n().backend.kind === "cloud") return x(e,
|
|
248
|
-
let r = await this.resolveConversationWorkingDir(e), i =
|
|
244
|
+
if (n().backend.kind === "cloud") return x(e, W(t ?? "/workspace/project/.agents_tmp/PLAN.md", "/workspace/project"));
|
|
245
|
+
let r = await this.resolveConversationWorkingDir(e), i = W(t ?? `${r}/.agents_tmp/PLAN.md`, r);
|
|
249
246
|
return new a(d()).downloadTextFile(i);
|
|
250
247
|
}
|
|
251
248
|
static async downloadConversation(e) {
|
|
@@ -265,19 +262,19 @@ var $ = class {
|
|
|
265
262
|
}) : await new i(d({
|
|
266
263
|
conversationUrl: t,
|
|
267
264
|
sessionApiKey: r
|
|
268
|
-
})).getConversation(e), s =
|
|
265
|
+
})).getConversation(e), s = G(o), c = N(o) ? o.stats : null;
|
|
269
266
|
return {
|
|
270
267
|
id: s.id,
|
|
271
268
|
title: s.title?.trim() ? s.title : D(s.id),
|
|
272
|
-
metrics:
|
|
269
|
+
metrics: z(s.metrics),
|
|
273
270
|
created_at: s.created_at,
|
|
274
271
|
updated_at: s.updated_at,
|
|
275
|
-
status:
|
|
276
|
-
stats:
|
|
272
|
+
status: Y(s.execution_status),
|
|
273
|
+
stats: N(c) ? c : { usage_to_metrics: {} }
|
|
277
274
|
};
|
|
278
275
|
}
|
|
279
276
|
static async searchConversations(e = 20, t) {
|
|
280
|
-
return n().backend.kind === "cloud" ? S(e, t) : k(
|
|
277
|
+
return n().backend.kind === "cloud" ? S(e, t) : k(q(await new i(d()).searchConversations({
|
|
281
278
|
limit: e,
|
|
282
279
|
page_id: t,
|
|
283
280
|
sort_order: f.UPDATED_AT_DESC
|
|
@@ -289,18 +286,15 @@ var $ = class {
|
|
|
289
286
|
static async updateConversationTitle(e, t) {
|
|
290
287
|
await new i(d()).updateConversation(e, { title: t });
|
|
291
288
|
let [n] = await this.batchGetAppConversations([e]);
|
|
292
|
-
return
|
|
289
|
+
return X(n, e);
|
|
293
290
|
}
|
|
294
291
|
static async switchProfile(e, t) {
|
|
295
292
|
if (n().backend.kind === "cloud") throw Error("LLM profile switching is only supported for local agent-server backends.");
|
|
296
|
-
let r = new o(d());
|
|
297
293
|
if (!e) {
|
|
298
|
-
await
|
|
294
|
+
await new o(d()).activateProfile(t);
|
|
299
295
|
return;
|
|
300
296
|
}
|
|
301
|
-
|
|
302
|
-
if (!F(a.config)) throw Error(M);
|
|
303
|
-
await new i(d()).switchLLM(e, a.config);
|
|
297
|
+
await new i(d()).switchProfile(e, t);
|
|
304
298
|
}
|
|
305
299
|
static async switchAcpModel(e, t) {
|
|
306
300
|
if (n().backend.kind === "cloud") throw Error("ACP model switching is only supported for local agent-server backends.");
|
|
@@ -308,6 +302,6 @@ var $ = class {
|
|
|
308
302
|
}
|
|
309
303
|
};
|
|
310
304
|
//#endregion
|
|
311
|
-
export {
|
|
305
|
+
export { Z as default };
|
|
312
306
|
|
|
313
307
|
//# sourceMappingURL=agent-server-conversation-service.api.js.map
|