@openhands/agent-canvas 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -12
- package/README.windows.md +4 -2
- package/build/assets/{Trans-Ch-OVWEA.js → Trans-DqF_OEZB.js} +1 -1
- package/build/assets/{acp-providers-Sy2LKyMa.js → acp-providers-BQwoUBpe.js} +1 -1
- package/build/assets/active-backend-context-BCXRv5pm.js +1 -0
- package/build/assets/{add-backend-modal-Bgy8anoR.js → add-backend-modal-BKHzq5no.js} +1 -1
- package/build/assets/{agent-profiles-settings-3mmXljZX.js → agent-profiles-settings-CEp5CIz8.js} +1 -1
- package/build/assets/agent-server-compatibility-D6DSanlx.js +1 -0
- package/build/assets/agent-server-conversation-service.api-cylugfDz.js +41 -0
- package/build/assets/{agent-settings-B-W10B4E.js → agent-settings-C-tann3x.js} +2 -2
- package/build/assets/agent-settings-DGUKNSnU.js +1 -0
- package/build/assets/{alert-banner-Bpf2NQJq.js → alert-banner-Dd4woGbm.js} +1 -1
- package/build/assets/api-key-entry-screen-Bll_CkuQ.js +1 -0
- package/build/assets/app-settings-BpViWwpC.js +1 -0
- package/build/assets/automation-detail-Z9dN2f5l.js +2 -0
- package/build/assets/automation-export-D5uL0Tf8.js +2 -0
- package/build/assets/automations-list-BMOWcqzZ.js +1 -0
- package/build/assets/{back-nav-button-CUS2mi-U.js → back-nav-button-ZUDTMOTB.js} +1 -1
- package/build/assets/backend-form-modal-DhBT8P4g.js +1 -0
- package/build/assets/{backend-synced-settings-badge-D9hZx05w.js → backend-synced-settings-badge-Db_REKVw.js} +1 -1
- package/build/assets/{base-modal-BuF2f0YL.js → base-modal-Cb0C6m0Q.js} +1 -1
- package/build/assets/{bot-D7eUAuSB.js → bot-C-EA6685.js} +1 -1
- package/build/assets/{brand-button-vMVuyDXu.js → brand-button-2Tp3aXk1.js} +1 -1
- package/build/assets/{browser-BifzWIBd.js → browser-QYLVr1kS.js} +2 -2
- package/build/assets/browser-store-BGXOGo-R.js +1 -0
- package/build/assets/{browser-tab-CkkqJnqw.js → browser-tab-BTTP1OE2.js} +1 -1
- package/build/assets/canvas-ui-BhxjoA1f.js +1 -0
- package/build/assets/{chat-send-button-B_jc5z5C.js → chat-send-button-BZHG2hAW.js} +1 -1
- package/build/assets/check-TbOEtHKj.js +1 -0
- package/build/assets/{chevron-down-CI8A6tet.js → chevron-down-D7IvFMBM.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-C5YxjxvI.js → circle-plus-check-toggle-QQJKUnF6.js} +1 -1
- package/build/assets/client-source-Biqarhgr.js +1 -0
- package/build/assets/cloud-funnel-analytics-D-27T5Ao.js +1 -0
- package/build/assets/{combobox-caret-DoObzqf4.js → combobox-caret-A5jMVHgE.js} +1 -1
- package/build/assets/{command-menu-D-JV3Wqm.js → command-menu-BMVEme4H.js} +1 -1
- package/build/assets/{command-store-D8J5LMW1.js → command-store-jrWX_CcW.js} +1 -1
- package/build/assets/condenser-settings-CIa6eyB4.js +1 -0
- package/build/assets/{confirmation-modal-BGLu6XJN.js → confirmation-modal-4n_944zq.js} +1 -1
- package/build/assets/{context-menu-list-item-BD5_EaKN.js → context-menu-list-item-DvfFic5I.js} +1 -1
- package/build/assets/conversation-CHnEXGRM.js +1 -0
- package/build/assets/conversation-D4o4dG2t.js +89 -0
- package/build/assets/conversation-panel-11FjLCId.js +1 -0
- package/build/assets/conversation-service.api-0JG_fF9d.js +1 -0
- package/build/assets/conversation-state-store-JiUQp02U.js +1 -0
- package/build/assets/{conversation-store-LptbOvKa.js → conversation-store-BCSpLuEf.js} +1 -1
- package/build/assets/{conversation-tab-empty-state-B2dDYEwf.js → conversation-tab-empty-state-BUhKVwoi.js} +1 -1
- package/build/assets/{copy-3JCw_XFB.js → copy-D1YGjP-C.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-CaR52OnA.js → copy-to-clipboard-button-Dp4Q_hXi.js} +1 -1
- package/build/assets/declaration-BGsHjPEW.js +1 -0
- package/build/assets/{device-verify-Dj6I4Iqe.js → device-verify-CM086oKs.js} +1 -1
- package/build/assets/{dropdown-classes-DJSXeLqc.js → dropdown-classes-DZq0BQjb.js} +1 -1
- package/build/assets/{ellipsis-button-C5Z-tPFp.js → ellipsis-button-TPJdyxnK.js} +1 -1
- package/build/assets/{entry.client-2_3ePAm0.js → entry.client-DypYHsYm.js} +2 -2
- package/build/assets/{enum-filter-dropdown-DXbVwiNZ.js → enum-filter-dropdown-CW_mBg0e.js} +1 -1
- package/build/assets/{environment-switch-overlay-DZQfRGTx.js → environment-switch-overlay-6laJch-9.js} +1 -1
- package/build/assets/{extensions-hub-CLjmOGqS.js → extensions-hub-BJFbFfKS.js} +1 -1
- package/build/assets/{extensions-navigation-B5MeUiMq.js → extensions-navigation-DqSl7CJw.js} +1 -1
- package/build/assets/{external-link-D2zJjE9G.js → external-link-lhdITPqq.js} +1 -1
- package/build/assets/files-tab-c316dKAq.js +1 -0
- package/build/assets/{files-tab-store-DJsPxYdg.js → files-tab-store-tfCav6bB.js} +1 -1
- package/build/assets/{form-control-classes-ChpNBe9n.js → form-control-classes-CvUaw8_L.js} +1 -1
- package/build/assets/format-time-delta-DhDbkD7V.js +1 -0
- package/build/assets/git-provider-icon-DUb2pEos.js +1 -0
- package/build/assets/home-BQ-DC06B.js +1 -0
- package/build/assets/home-D7ds4Jyw.js +1 -0
- package/build/assets/index-home-BRFDWs_4.js +1 -0
- package/build/assets/install-server-modal-CvHvzZj3.js +1 -0
- package/build/assets/{launch-V_3Rp7WS.js → launch-A47TK2Me.js} +1 -1
- package/build/assets/lesson-plan-DSf95kQ2.js +4 -0
- package/build/assets/{list-todo-BfH6yYUK.js → list-todo-CAtvkzcy.js} +1 -1
- package/build/assets/llm-not-configured-banner-B7DR8SPs.js +27 -0
- package/build/assets/llm-settings-Ch4ZbW3c.js +1 -0
- package/build/assets/llm-settings-Cvi7q4ox.js +1 -0
- package/build/assets/llm-subscription-service-Cz1yBBvE.js +1 -0
- package/build/assets/loader-circle-CsAsfLIs.js +1 -0
- package/build/assets/{loading-spinner-BLdswi6q.js → loading-spinner-Txxx1I1p.js} +1 -1
- package/build/assets/manage-backends-modal-DAVhNUCe.js +1 -0
- package/build/assets/manifest-958c741a.js +1 -0
- package/build/assets/{markdown-renderer-DMT7Zkpd.js → markdown-renderer-B6cJJ_MN.js} +1 -1
- package/build/assets/{mcp-BQufNPZ6.js → mcp-BwssgMpg.js} +2 -2
- package/build/assets/{messages-BnJCqnFf.js → messages-D8MeG2ZQ.js} +26 -26
- package/build/assets/{modal-body-DouOE5KH.js → modal-body-CDZdZ-eT.js} +1 -1
- package/build/assets/{modal-classes-Cf-4tbHz.js → modal-classes-B4oit_4c.js} +1 -1
- package/build/assets/{modal-close-button-B6CfxxJj.js → modal-close-button-DQElFMPo.js} +1 -1
- package/build/assets/model-selector-BxTbbKub.js +1 -0
- package/build/assets/{navigation-link-D8hfwvxI.js → navigation-link-imH6S7h2.js} +1 -1
- package/build/assets/onboarding-CyicadGt.js +1 -0
- package/build/assets/onboarding-modal-DQwihcTz.js +1 -0
- package/build/assets/option-service.api-DAkg_F7p.js +1 -0
- package/build/assets/organization-service.api-QknzKDh3.js +1 -0
- package/build/assets/package-Dk_VtWJ4.js +1 -0
- package/build/assets/path-utils-BECGet7G.js +1 -0
- package/build/assets/{pencil-Dj2XjKmI.js → pencil-CWhApFIT.js} +1 -1
- package/build/assets/{plan-components-CcCBmCzW.js → plan-components-CgPHWz3E.js} +1 -1
- package/build/assets/{planner-tab-Dhyqcqmb.js → planner-tab-DPKHmMAX.js} +1 -1
- package/build/assets/plugins-management-service-DuTTxquo.js +1 -0
- package/build/assets/profiles-service.api-D6jvZOWu.js +1 -0
- package/build/assets/providers-B8pxQK8x.js +1 -0
- package/build/assets/proxy-CuhhyjdX.js +1 -0
- package/build/assets/{recommended-automations-launcher-CTcGTl4d.js → recommended-automations-launcher-DA6DWS7V.js} +1 -1
- package/build/assets/{refresh-cw-DM82EIyx.js → refresh-cw-B9B7-vsy.js} +1 -1
- package/build/assets/root-BhP6bTBB.js +2 -0
- package/build/assets/root-CYWeTrWE.css +1 -0
- package/build/assets/root-layout-oBaHHW4s.js +2 -0
- package/build/assets/{runtime-waiting-state-BsXLElvN.js → runtime-waiting-state-DeD9G7yJ.js} +1 -1
- package/build/assets/schema-field-BOLdL_U7.js +1 -0
- package/build/assets/sdk-section-page-ZIltERxf.js +1 -0
- package/build/assets/{sdk-settings-schema-Cv7M9eSe.js → sdk-settings-schema-Ba_Pa9uf.js} +1 -1
- package/build/assets/search-dIQ09UY2.js +1 -0
- package/build/assets/secrets-service-50DElFny.js +1 -0
- package/build/assets/{secrets-settings-Cx6yJlyb.js → secrets-settings-Digl7JLe.js} +1 -1
- package/build/assets/{segmented-toggle-DyQqPhoD.js → segmented-toggle-C1-ZVyr5.js} +1 -1
- package/build/assets/settings-BfgLHsgd.js +1 -0
- package/build/assets/{settings-dropdown-input-BjunGXJb.js → settings-dropdown-input-BD5C9fBn.js} +1 -1
- package/build/assets/{settings-index-D6sxWSRk.js → settings-index-CODBijya.js} +1 -1
- package/build/assets/{settings-input-bD6npsDm.js → settings-input-CzNOq-Pj.js} +1 -1
- package/build/assets/{settings-list-classes-Dp_OgzN0.js → settings-list-classes-CuxH9ZoR.js} +1 -1
- package/build/assets/settings-modal-BcSWpKI0.js +1 -0
- package/build/assets/settings-service.api-Bsu1PvYO.js +1 -0
- package/build/assets/{settings-switch-5cuxl8Dc.js → settings-switch-DqmHAfWJ.js} +1 -1
- package/build/assets/{settings-utils-BMdG65By.js → settings-utils-B1lBErvV.js} +1 -1
- package/build/assets/shared-conversation-CDskdmrb.js +1 -0
- package/build/assets/{sidebar-layout-DuzJMMw-.js → sidebar-layout-Cn6eQaEI.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-VvvX32iF.js → sidebar-mobile-menu-toggle-DmCmZgq1.js} +1 -1
- package/build/assets/{sidebar-nav-link-5AlTT5-j.js → sidebar-nav-link-DMc8AIe7.js} +1 -1
- package/build/assets/{sidebar-store-CZuE8AH5.js → sidebar-store-DXWSCFpa.js} +1 -1
- package/build/assets/{skill-card-pill-row-eTIkE4nz.js → skill-card-pill-row-DOIWjiMF.js} +1 -1
- package/build/assets/skills-plugins-DLgINYuY.js +1 -0
- package/build/assets/{skills-settings-BUv04tSc.js → skills-settings-DPiCWalR.js} +2 -2
- package/build/assets/{square-chevron-right-Czw3FFWc.js → square-chevron-right-DE-JN-2Z.js} +1 -1
- package/build/assets/{styled-tooltip-CgX2oRaK.js → styled-tooltip-CvsjHuIf.js} +1 -1
- package/build/assets/{suspense-BO1Tl_Vf.js → suspense-DmZ3MSSh.js} +1 -1
- package/build/assets/{task-list-tab-0k9PhuqO.js → task-list-tab-CuhcDycu.js} +1 -1
- package/build/assets/telemetry-DHiTRl5_.js +2 -0
- package/build/assets/{terminal-B61WrJdS.js → terminal-CVqF-tCD.js} +1 -1
- package/build/assets/{toggle-switch-2j5wwR85.js → toggle-switch-CS0ClOy2.js} +1 -1
- package/build/assets/{trash-2-Be_7y3Mn.js → trash-2-BU6BlW4i.js} +1 -1
- package/build/assets/{typography-D8mHDeNG.js → typography-CQn9wyEX.js} +1 -1
- package/build/assets/use-acp-credential-form-LlfZO_DD.js +1 -0
- package/build/assets/{use-activate-agent-profile-20v1xU0H.js → use-activate-agent-profile-DpQjsXM0.js} +1 -1
- package/build/assets/{use-active-agent-profile-BkJN7Xsy.js → use-active-agent-profile-Gw_uJujV.js} +1 -1
- package/build/assets/{use-active-conversation-DOZVSVtU.js → use-active-conversation-B0sttISF.js} +1 -1
- package/build/assets/use-agent-profiles-LHZEK0Gg.js +1 -0
- package/build/assets/{use-agent-state-DHZO1obC.js → use-agent-state-C5uA0bRj.js} +1 -1
- package/build/assets/use-backends-health-DKt1SmiU.js +1 -0
- package/build/assets/{use-can-manage-org-profiles-C-OhWVBS.js → use-can-manage-org-profiles-BAtqsbCi.js} +1 -1
- package/build/assets/use-cloud-current-user-id-C8m1oBy4.js +1 -0
- package/build/assets/use-config-CXy4vD0H.js +1 -0
- package/build/assets/use-create-conversation-CWQGNQ9J.js +1 -0
- package/build/assets/{use-create-secret-D0HCOZFu.js → use-create-secret-BIrsX3OB.js} +1 -1
- package/build/assets/{use-event-store-DjgU4wfO.js → use-event-store-CsD17BKu.js} +1 -1
- package/build/assets/{use-handle-plan-click-DyRASKMC.js → use-handle-plan-click-DEuO7Byo.js} +1 -1
- package/build/assets/use-is-authed-Dvbpiu3B.js +1 -0
- package/build/assets/{use-launch-skill-in-chat-BnoDgvAy.js → use-launch-skill-in-chat-CdHOoQGM.js} +1 -1
- package/build/assets/use-llm-profiles-DQpQxVOD.js +1 -0
- package/build/assets/use-plugins-marketplace-Bkk07W_M.js +1 -0
- package/build/assets/use-runtime-is-ready-D4pkGT6E.js +1 -0
- package/build/assets/use-save-agent-profile-BxEsjnW0.js +1 -0
- package/build/assets/{use-save-settings-BGlSfuYn.js → use-save-settings-ioSUMqbE.js} +1 -1
- package/build/assets/use-settings-DNJC4gqu.js +1 -0
- package/build/assets/use-settings-nav-items-BUsrDbVR.js +16 -0
- package/build/assets/use-skills-BsmKm23M.js +1 -0
- package/build/assets/{use-task-list-AVBLbbcR.js → use-task-list-rs7Xbzl8.js} +1 -1
- package/build/assets/{use-tracking-BIXzagSI.js → use-tracking-poxQHMwR.js} +1 -1
- package/build/assets/{use-user-conversation-zpx7I18x.js → use-user-conversation-B337kUKB.js} +1 -1
- package/build/assets/{useMutation-DrCAVg5w.js → useMutation-u8UgRgDK.js} +1 -1
- package/build/assets/{useMutationState-D8QN0ZCy.js → useMutationState-OnAsCLA_.js} +1 -1
- package/build/assets/{useQueries-DClgUTc7.js → useQueries-BpIlT8Mt.js} +1 -1
- package/build/assets/{useQuery-CRBP8vIS.js → useQuery-D5pEZbY0.js} +1 -1
- package/build/assets/{useTranslation-CDRCKC9-.js → useTranslation-Cbf5AGg_.js} +1 -1
- package/build/assets/{utils-D3U3rlqr.js → utils-DB9LsAzA.js} +1 -1
- package/build/assets/{vendor~browser-Cvg7jXCP.js → vendor~browser-5Njjw1Cl.js} +1 -1
- package/build/assets/{vendor~browser-tab-Di0kh5Zw.js → vendor~browser-tab-Xn94EtUo.js} +1 -1
- package/build/assets/{vendor~entry.client-9tWQ_Ugw.js → vendor~entry.client-DDuH4--y.js} +1 -1
- package/build/assets/{vendor~entry.client-D6BtSOtn.js → vendor~entry.client-DQGrNspu.js} +1 -1
- package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-BIieS_OD.js +2 -0
- package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~iztiaf2o-rqo6vRFz.js +185 -0
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ljq5gbus-B2XD4bi2.js} +1 -1
- package/build/assets/{vendor~files-tab-B02k3xvx.js → vendor~files-tab-CiC3-lGh.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation-CYMF9JYB.js → vendor~index-home~home~conversation-panel~conversation-ChmYLVgz.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9UMeuPV6.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B8XNNEQZ.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CnJRLn5s.js} +1 -1
- package/build/assets/vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DWteoTyr.js +2 -0
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D7EUmQ8Y.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Dc5nKwLO.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD0GaRGa.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-tlf6AnDe.js} +1 -1
- package/build/assets/{vendor~launch-CHXA9cJu.js → vendor~launch-28DK5Rsl.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js → vendor~root-layout~conversation-panel~conversation-8tIsyrPj.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-_TdZcNMD.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-lYNG9C1U.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation-Cn2jwSga.js → vendor~root-layout~index-home~home~conversation-panel~conversation-Zhq6xAxR.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js → vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation~aler~gfu7qdtz-B81b08bw.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~ftka0fnu-jpyLM1Nn.js} +2 -2
- package/build/assets/{verification-settings-D576N2xa.js → verification-settings-HRgEM-_3.js} +1 -1
- package/build/assets/x-ZE4iplpF.js +1 -0
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +9 -0
- package/build/locales/ca/openhands.json +9 -0
- package/build/locales/de/openhands.json +9 -0
- package/build/locales/en/openhands.json +9 -0
- package/build/locales/es/openhands.json +9 -0
- package/build/locales/fr/openhands.json +9 -0
- package/build/locales/it/openhands.json +9 -0
- package/build/locales/ja/openhands.json +9 -0
- package/build/locales/ko-KR/openhands.json +9 -0
- package/build/locales/no/openhands.json +9 -0
- package/build/locales/pt/openhands.json +9 -0
- package/build/locales/tr/openhands.json +9 -0
- package/build/locales/uk/openhands.json +9 -0
- package/build/locales/zh-CN/openhands.json +9 -0
- package/build/locales/zh-TW/openhands.json +9 -0
- package/config/defaults.json +5 -4
- package/dist/api/agent-server-adapter.cjs +3 -3
- package/dist/api/agent-server-adapter.cjs.map +1 -1
- package/dist/api/agent-server-adapter.d.ts +9 -1
- package/dist/api/agent-server-adapter.js +105 -102
- package/dist/api/agent-server-adapter.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 +3 -0
- package/dist/api/agent-server-config.js +45 -23
- package/dist/api/agent-server-config.js.map +1 -1
- package/dist/api/backend-registry/auth.cjs +1 -1
- package/dist/api/backend-registry/auth.cjs.map +1 -1
- package/dist/api/backend-registry/auth.js +1 -1
- package/dist/api/backend-registry/auth.js.map +1 -1
- package/dist/api/backend-registry/default-backend.cjs +1 -1
- package/dist/api/backend-registry/default-backend.cjs.map +1 -1
- package/dist/api/backend-registry/default-backend.d.ts +3 -0
- package/dist/api/backend-registry/default-backend.js +22 -10
- package/dist/api/backend-registry/default-backend.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 +38 -33
- package/dist/api/backend-registry/storage.js.map +1 -1
- package/dist/api/backend-registry/types.d.ts +2 -0
- package/dist/api/canvas-ui-client-tool.cjs +38 -0
- package/dist/api/canvas-ui-client-tool.cjs.map +1 -0
- package/dist/api/canvas-ui-client-tool.d.ts +14 -0
- package/dist/api/canvas-ui-client-tool.js +47 -0
- package/dist/api/canvas-ui-client-tool.js.map +1 -0
- package/dist/api/client-source.cjs +2 -0
- package/dist/api/client-source.cjs.map +1 -0
- package/dist/api/client-source.d.ts +9 -0
- package/dist/api/client-source.js +10 -0
- package/dist/api/client-source.js.map +1 -0
- package/dist/api/cloud/client.cjs +2 -0
- package/dist/api/cloud/client.cjs.map +1 -0
- package/dist/api/cloud/client.d.ts +4 -0
- package/dist/api/cloud/client.js +38 -0
- package/dist/api/cloud/client.js.map +1 -0
- package/dist/api/cloud/conversation-service.api.cjs +1 -1
- package/dist/api/cloud/conversation-service.api.cjs.map +1 -1
- package/dist/api/cloud/conversation-service.api.js +33 -31
- package/dist/api/cloud/conversation-service.api.js.map +1 -1
- package/dist/api/cloud/organization-service.api.cjs +1 -1
- package/dist/api/cloud/organization-service.api.cjs.map +1 -1
- package/dist/api/cloud/organization-service.api.js +11 -10
- package/dist/api/cloud/organization-service.api.js.map +1 -1
- package/dist/api/cloud/proxy.cjs +1 -1
- package/dist/api/cloud/proxy.cjs.map +1 -1
- package/dist/api/cloud/proxy.d.ts +2 -40
- package/dist/api/cloud/proxy.js +14 -39
- package/dist/api/cloud/proxy.js.map +1 -1
- package/dist/api/conversation-metadata-store.cjs +1 -1
- package/dist/api/conversation-metadata-store.cjs.map +1 -1
- package/dist/api/conversation-metadata-store.d.ts +2 -9
- package/dist/api/conversation-metadata-store.js +13 -9
- package/dist/api/conversation-metadata-store.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 +2 -1
- package/dist/api/conversation-service/agent-server-conversation-service.api.js +98 -88
- package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
- package/dist/api/conversation-service/agent-server-conversation-service.types.d.ts +5 -0
- package/dist/api/device-flow-client.cjs +1 -1
- package/dist/api/device-flow-client.cjs.map +1 -1
- package/dist/api/device-flow-client.d.ts +4 -58
- package/dist/api/device-flow-client.js +8 -98
- package/dist/api/device-flow-client.js.map +1 -1
- package/dist/api/git-service/agent-server-git-service.api.cjs +1 -1
- package/dist/api/git-service/agent-server-git-service.api.cjs.map +1 -1
- package/dist/api/git-service/agent-server-git-service.api.d.ts +10 -2
- package/dist/api/git-service/agent-server-git-service.api.js +107 -40
- package/dist/api/git-service/agent-server-git-service.api.js.map +1 -1
- package/dist/api/open-hands.types.d.ts +11 -0
- package/dist/api/secrets-service.cjs +1 -1
- package/dist/api/secrets-service.cjs.map +1 -1
- package/dist/api/secrets-service.js +15 -14
- package/dist/api/secrets-service.js.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.cjs +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.js +73 -64
- package/dist/components/conversation-events/chat/event-content-helpers/get-event-content.js.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-observation-content.cjs +2 -2
- package/dist/components/conversation-events/chat/event-content-helpers/get-observation-content.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-observation-content.js +2 -0
- package/dist/components/conversation-events/chat/event-content-helpers/get-observation-content.js.map +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +4 -2
- package/dist/components/features/backends/backend-form-modal.js +202 -188
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/backends/backend-row.cjs +1 -1
- package/dist/components/features/backends/backend-row.cjs.map +1 -1
- package/dist/components/features/backends/backend-row.js +2 -1
- package/dist/components/features/backends/backend-row.js.map +1 -1
- package/dist/components/features/backends/backend-selector.cjs +1 -1
- package/dist/components/features/backends/backend-selector.cjs.map +1 -1
- package/dist/components/features/backends/backend-selector.js +51 -51
- package/dist/components/features/backends/backend-selector.js.map +1 -1
- package/dist/components/features/backends/device-flow-auth.cjs +1 -1
- package/dist/components/features/backends/device-flow-auth.cjs.map +1 -1
- package/dist/components/features/backends/device-flow-auth.d.ts +4 -1
- package/dist/components/features/backends/device-flow-auth.js +38 -38
- package/dist/components/features/backends/device-flow-auth.js.map +1 -1
- package/dist/components/features/chat/chat-interface.cjs +2 -2
- package/dist/components/features/chat/chat-interface.cjs.map +1 -1
- package/dist/components/features/chat/chat-interface.js +173 -165
- package/dist/components/features/chat/chat-interface.js.map +1 -1
- package/dist/components/features/chat/components/chat-input-actions.cjs +1 -1
- package/dist/components/features/chat/components/chat-input-actions.cjs.map +1 -1
- package/dist/components/features/chat/components/chat-input-actions.d.ts +2 -1
- package/dist/components/features/chat/components/chat-input-actions.js +44 -43
- package/dist/components/features/chat/components/chat-input-actions.js.map +1 -1
- package/dist/components/features/chat/components/chat-input-container.cjs +1 -1
- package/dist/components/features/chat/components/chat-input-container.cjs.map +1 -1
- package/dist/components/features/chat/components/chat-input-container.d.ts +2 -1
- package/dist/components/features/chat/components/chat-input-container.js +20 -19
- package/dist/components/features/chat/components/chat-input-container.js.map +1 -1
- package/dist/components/features/chat/components/chat-input-profile-picker.cjs +1 -1
- package/dist/components/features/chat/components/chat-input-profile-picker.cjs.map +1 -1
- package/dist/components/features/chat/components/chat-input-profile-picker.js +44 -32
- package/dist/components/features/chat/components/chat-input-profile-picker.js.map +1 -1
- package/dist/components/features/chat/components/resolve-picker-kind.cjs +1 -1
- package/dist/components/features/chat/components/resolve-picker-kind.cjs.map +1 -1
- package/dist/components/features/chat/components/resolve-picker-kind.d.ts +10 -22
- package/dist/components/features/chat/components/resolve-picker-kind.js +6 -3
- package/dist/components/features/chat/components/resolve-picker-kind.js.map +1 -1
- package/dist/components/features/chat/custom-chat-input.cjs +1 -1
- package/dist/components/features/chat/custom-chat-input.cjs.map +1 -1
- package/dist/components/features/chat/custom-chat-input.d.ts +2 -1
- package/dist/components/features/chat/custom-chat-input.js +52 -51
- package/dist/components/features/chat/custom-chat-input.js.map +1 -1
- package/dist/components/features/chat/interactive-chat-box.cjs +1 -1
- package/dist/components/features/chat/interactive-chat-box.cjs.map +1 -1
- package/dist/components/features/chat/interactive-chat-box.d.ts +2 -1
- package/dist/components/features/chat/interactive-chat-box.js +9 -8
- package/dist/components/features/chat/interactive-chat-box.js.map +1 -1
- package/dist/components/features/diff-viewer/commit-list.cjs +2 -0
- package/dist/components/features/diff-viewer/commit-list.cjs.map +1 -0
- package/dist/components/features/diff-viewer/commit-list.d.ts +13 -0
- package/dist/components/features/diff-viewer/commit-list.js +27 -0
- package/dist/components/features/diff-viewer/commit-list.js.map +1 -0
- package/dist/components/features/diff-viewer/commit-row.cjs +2 -0
- package/dist/components/features/diff-viewer/commit-row.cjs.map +1 -0
- package/dist/components/features/diff-viewer/commit-row.d.ts +14 -0
- package/dist/components/features/diff-viewer/commit-row.js +59 -0
- package/dist/components/features/diff-viewer/commit-row.js.map +1 -0
- package/dist/components/features/diff-viewer/file-diff-viewer.cjs +1 -1
- package/dist/components/features/diff-viewer/file-diff-viewer.cjs.map +1 -1
- package/dist/components/features/diff-viewer/file-diff-viewer.d.ts +7 -1
- package/dist/components/features/diff-viewer/file-diff-viewer.js +40 -39
- package/dist/components/features/diff-viewer/file-diff-viewer.js.map +1 -1
- package/dist/components/features/plugins/plugin-detail-modal.d.ts +2 -1
- package/dist/components/shared/modals/settings/settings-modal.cjs +1 -1
- package/dist/components/shared/modals/settings/settings-modal.cjs.map +1 -1
- package/dist/components/shared/modals/settings/settings-modal.js +23 -22
- package/dist/components/shared/modals/settings/settings-modal.js.map +1 -1
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +5 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/constants/acp-providers.cjs.map +1 -1
- package/dist/constants/acp-providers.d.ts +1 -1
- package/dist/constants/acp-providers.js.map +1 -1
- package/dist/constants/canvas-ui.cjs +2 -0
- package/dist/constants/canvas-ui.cjs.map +1 -0
- package/dist/constants/canvas-ui.d.ts +8 -0
- package/dist/constants/canvas-ui.js +6 -0
- package/dist/constants/canvas-ui.js.map +1 -0
- package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
- package/dist/contexts/conversation-websocket-context.js.map +1 -1
- package/dist/hooks/mutation/use-create-conversation.cjs +1 -1
- package/dist/hooks/mutation/use-create-conversation.cjs.map +1 -1
- package/dist/hooks/mutation/use-create-conversation.d.ts +2 -1
- package/dist/hooks/mutation/use-create-conversation.js +52 -52
- package/dist/hooks/mutation/use-create-conversation.js.map +1 -1
- package/dist/hooks/query/query-keys.cjs +1 -1
- package/dist/hooks/query/query-keys.cjs.map +1 -1
- package/dist/hooks/query/query-keys.d.ts +2 -0
- package/dist/hooks/query/query-keys.js +4 -1
- package/dist/hooks/query/query-keys.js.map +1 -1
- package/dist/hooks/query/use-backends-health.cjs +1 -1
- package/dist/hooks/query/use-backends-health.cjs.map +1 -1
- package/dist/hooks/query/use-backends-health.js +50 -48
- package/dist/hooks/query/use-backends-health.js.map +1 -1
- package/dist/hooks/query/use-cloud-organizations.cjs +1 -1
- package/dist/hooks/query/use-cloud-organizations.cjs.map +1 -1
- package/dist/hooks/query/use-cloud-organizations.d.ts +1 -0
- package/dist/hooks/query/use-cloud-organizations.js +5 -2
- package/dist/hooks/query/use-cloud-organizations.js.map +1 -1
- package/dist/hooks/query/use-commit-changes.cjs +2 -0
- package/dist/hooks/query/use-commit-changes.cjs.map +1 -0
- package/dist/hooks/query/use-commit-changes.d.ts +5 -0
- package/dist/hooks/query/use-commit-changes.js +34 -0
- package/dist/hooks/query/use-commit-changes.js.map +1 -0
- package/dist/hooks/query/use-task-polling.cjs +1 -1
- package/dist/hooks/query/use-task-polling.cjs.map +1 -1
- package/dist/hooks/query/use-task-polling.d.ts +3 -2
- package/dist/hooks/query/use-task-polling.js +53 -40
- package/dist/hooks/query/use-task-polling.js.map +1 -1
- package/dist/hooks/query/use-unified-git-commits.cjs +2 -0
- package/dist/hooks/query/use-unified-git-commits.cjs.map +1 -0
- package/dist/hooks/query/use-unified-git-commits.d.ts +10 -0
- package/dist/hooks/query/use-unified-git-commits.js +41 -0
- package/dist/hooks/query/use-unified-git-commits.js.map +1 -0
- package/dist/hooks/query/use-unified-git-diff.cjs +1 -1
- package/dist/hooks/query/use-unified-git-diff.cjs.map +1 -1
- package/dist/hooks/query/use-unified-git-diff.d.ts +5 -0
- package/dist/hooks/query/use-unified-git-diff.js +11 -4
- package/dist/hooks/query/use-unified-git-diff.js.map +1 -1
- package/dist/hooks/use-acp-model-context.cjs +1 -1
- package/dist/hooks/use-acp-model-context.cjs.map +1 -1
- package/dist/hooks/use-acp-model-context.d.ts +4 -1
- package/dist/hooks/use-acp-model-context.js +9 -8
- package/dist/hooks/use-acp-model-context.js.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.js +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.js.map +1 -1
- package/dist/hooks/use-chat-input-model-state.cjs.map +1 -1
- package/dist/hooks/use-chat-input-model-state.d.ts +2 -1
- package/dist/hooks/use-chat-input-model-state.js.map +1 -1
- package/dist/hooks/use-chat-input-profile-state.cjs +1 -1
- package/dist/hooks/use-chat-input-profile-state.cjs.map +1 -1
- package/dist/hooks/use-chat-input-profile-state.d.ts +1 -10
- package/dist/hooks/use-chat-input-profile-state.js +42 -15
- package/dist/hooks/use-chat-input-profile-state.js.map +1 -1
- package/dist/hooks/use-device-flow.cjs +1 -1
- package/dist/hooks/use-device-flow.cjs.map +1 -1
- package/dist/hooks/use-device-flow.d.ts +4 -1
- package/dist/hooks/use-device-flow.js +42 -40
- package/dist/hooks/use-device-flow.js.map +1 -1
- package/dist/hooks/use-tracking.cjs.map +1 -1
- package/dist/hooks/use-tracking.d.ts +2 -1
- package/dist/hooks/use-tracking.js.map +1 -1
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +9 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +19 -18
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/translation.cjs +2 -2
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +153 -0
- package/dist/i18n/translation.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +32 -32
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/locales/ar/openhands.json +9 -0
- package/dist/locales/ca/openhands.json +9 -0
- package/dist/locales/de/openhands.json +9 -0
- package/dist/locales/en/openhands.json +9 -0
- package/dist/locales/es/openhands.json +9 -0
- package/dist/locales/fr/openhands.json +9 -0
- package/dist/locales/it/openhands.json +9 -0
- package/dist/locales/ja/openhands.json +9 -0
- package/dist/locales/ko-KR/openhands.json +9 -0
- package/dist/locales/no/openhands.json +9 -0
- package/dist/locales/pt/openhands.json +9 -0
- package/dist/locales/tr/openhands.json +9 -0
- package/dist/locales/uk/openhands.json +9 -0
- package/dist/locales/zh-CN/openhands.json +9 -0
- package/dist/locales/zh-TW/openhands.json +9 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/cloud-client.cjs +2 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/cloud-client.cjs.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/cloud-client.js +351 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/cloud-client.js.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/device-flow-client.cjs +2 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/device-flow-client.cjs.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/device-flow-client.js +106 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/device-flow-client.js.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs +2 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js +69 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/clients.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/clients.js +3 -0
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js +18 -2
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.js.map +1 -1
- package/dist/node_modules/axios/index.cjs +1 -1
- package/dist/node_modules/axios/index.js +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/dist/routes/app-settings.cjs +1 -1
- package/dist/routes/app-settings.cjs.map +1 -1
- package/dist/routes/app-settings.js +67 -66
- package/dist/routes/app-settings.js.map +1 -1
- package/dist/routes/commits-tab.cjs +2 -0
- package/dist/routes/commits-tab.cjs.map +1 -0
- package/dist/routes/commits-tab.d.ts +8 -0
- package/dist/routes/commits-tab.js +45 -0
- package/dist/routes/commits-tab.js.map +1 -0
- package/dist/routes/files-tab.cjs +1 -1
- package/dist/routes/files-tab.cjs.map +1 -1
- package/dist/routes/files-tab.js +148 -127
- package/dist/routes/files-tab.js.map +1 -1
- package/dist/services/cloud-funnel-analytics.cjs +2 -0
- package/dist/services/cloud-funnel-analytics.cjs.map +1 -0
- package/dist/services/cloud-funnel-analytics.d.ts +12 -0
- package/dist/services/cloud-funnel-analytics.js +53 -0
- package/dist/services/cloud-funnel-analytics.js.map +1 -0
- package/dist/services/telemetry.cjs +1 -1
- package/dist/services/telemetry.cjs.map +1 -1
- package/dist/services/telemetry.js +49 -47
- package/dist/services/telemetry.js.map +1 -1
- package/dist/types/agent-server/core/base/action.d.ts +5 -4
- package/dist/types/agent-server/core/base/base.d.ts +3 -2
- package/dist/types/agent-server/core/base/observation.d.ts +1 -1
- package/dist/types/agent-server/type-guards.cjs +1 -1
- package/dist/types/agent-server/type-guards.cjs.map +1 -1
- package/dist/types/agent-server/type-guards.d.ts +3 -5
- package/dist/types/agent-server/type-guards.js +2 -1
- package/dist/types/agent-server/type-guards.js.map +1 -1
- package/dist/types/automation.d.ts +5 -0
- package/dist/utils/api-error-message.d.ts +11 -0
- package/dist/utils/automation-timeout.d.ts +19 -0
- package/dist/utils/base-path.cjs +2 -0
- package/dist/utils/base-path.cjs.map +1 -0
- package/dist/utils/base-path.d.ts +2 -0
- package/dist/utils/base-path.js +23 -0
- package/dist/utils/base-path.js.map +1 -0
- package/package.json +2 -2
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/dev-safe.mjs +7 -8
- package/scripts/dev-static.mjs +3 -0
- package/scripts/dev-with-automation.mjs +3 -0
- package/scripts/docker-build.mjs +4 -0
- package/scripts/static-server.mjs +93 -7
- package/tools/canvas_ui_tool.py +14 -8
- package/build/assets/active-backend-context-hxq31W25.js +0 -1
- package/build/assets/agent-server-client-options-DVLRd9sw.js +0 -1
- package/build/assets/agent-server-conversation-service.api-CuSdr4Qb.js +0 -5
- package/build/assets/agent-settings-D_yOy8XB.js +0 -1
- package/build/assets/api-key-entry-screen-Dl0qVYi4.js +0 -1
- package/build/assets/app-settings-yVizGXox.js +0 -1
- package/build/assets/automation-detail-dvJfLs5u.js +0 -2
- package/build/assets/automation-export-BPcgLqPD.js +0 -2
- package/build/assets/automations-list-CUXogTe0.js +0 -1
- package/build/assets/backend-form-modal-CQJGmItq.js +0 -1
- package/build/assets/browser-store-BI6uklCG.js +0 -1
- package/build/assets/check-Bvi71siz.js +0 -1
- package/build/assets/condenser-settings-Ca8fYZ_Z.js +0 -1
- package/build/assets/conversation-9NBSRoR9.js +0 -1
- package/build/assets/conversation-BXg6Oti2.js +0 -89
- package/build/assets/conversation-panel-CZri9Rup.js +0 -1
- package/build/assets/conversation-service.api-DPBQvTKD.js +0 -1
- package/build/assets/conversation-state-store-B2Bp32XI.js +0 -1
- package/build/assets/declaration-gq8V5eTU.js +0 -1
- package/build/assets/files-tab-UVoray88.js +0 -1
- package/build/assets/git-provider-icon-o6hdnJUB.js +0 -1
- package/build/assets/home-D1IHvGTN.js +0 -1
- package/build/assets/index-redirect-CUUJiNki.js +0 -1
- package/build/assets/install-server-modal-BbuQaA2w.js +0 -1
- package/build/assets/lesson-plan-jC0HBoe6.js +0 -4
- package/build/assets/llm-not-configured-banner-DoARbcdL.js +0 -27
- package/build/assets/llm-settings-4JMLV8mq.js +0 -1
- package/build/assets/llm-settings-D91gMw3U.js +0 -1
- package/build/assets/llm-subscription-service-CKyaV24y.js +0 -1
- package/build/assets/loader-circle-BEykUKYG.js +0 -1
- package/build/assets/manage-backends-modal-DkWAMSle.js +0 -1
- package/build/assets/manifest-aa5c29f6.js +0 -1
- package/build/assets/model-selector-BfqpMkSJ.js +0 -1
- package/build/assets/mouse-pointer-click-PdEQPL6v.js +0 -1
- package/build/assets/onboarding-Bu-HN1ze.js +0 -1
- package/build/assets/onboarding-modal-CZgjs5Bx.js +0 -1
- package/build/assets/option-service.api-BrZ5q87N.js +0 -1
- package/build/assets/organization-service.api-Bk4pCGU1.js +0 -1
- package/build/assets/path-utils-CSmuZoix.js +0 -1
- package/build/assets/plugins-management-service-BRBLxvUl.js +0 -1
- package/build/assets/profiles-service.api-BMXQ9pZC.js +0 -1
- package/build/assets/providers-BpO967xS.js +0 -1
- package/build/assets/proxy-BgJLtxu7.js +0 -1
- package/build/assets/root-BM5WgQ4_.js +0 -2
- package/build/assets/root-V8fkplMy.css +0 -1
- package/build/assets/root-layout-BdoyoobY.js +0 -2
- package/build/assets/schema-field-BSHrUMme.js +0 -1
- package/build/assets/sdk-section-page-t82gsOqa.js +0 -1
- package/build/assets/search-4DHskuhE.js +0 -1
- package/build/assets/secrets-service-B2GqPV0N.js +0 -1
- package/build/assets/settings-DmPLkgq0.js +0 -1
- package/build/assets/settings-modal-CwrZKrTq.js +0 -1
- package/build/assets/settings-service.api-Ce-ub11I.js +0 -1
- package/build/assets/shared-conversation-BDREQPnE.js +0 -1
- package/build/assets/skills-plugins-2Y44YHbO.js +0 -1
- package/build/assets/use-acp-credential-form-MzZM6D7D.js +0 -1
- package/build/assets/use-agent-profiles-DwZxnwO5.js +0 -1
- package/build/assets/use-backends-health-CRHzuvxO.js +0 -1
- package/build/assets/use-cloud-current-user-id-utFreJ0i.js +0 -1
- package/build/assets/use-config-mJrtZHP1.js +0 -1
- package/build/assets/use-create-conversation-DdqsP78F.js +0 -1
- package/build/assets/use-is-authed-B6M0mcGL.js +0 -1
- package/build/assets/use-llm-profiles-RC-PkpBl.js +0 -1
- package/build/assets/use-plugins-marketplace-FHlbeQ4c.js +0 -1
- package/build/assets/use-runtime-is-ready-RKj2WmEh.js +0 -1
- package/build/assets/use-save-agent-profile-tvDP15mh.js +0 -1
- package/build/assets/use-settings-CH5LzXD8.js +0 -1
- package/build/assets/use-settings-nav-items-Dwktv8wo.js +0 -16
- package/build/assets/use-skills-CSzSL6HG.js +0 -1
- package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js +0 -10
- package/build/assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js +0 -177
- package/build/assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CqXiHwjU.js +0 -2
- package/build/assets/x-Cb0WAtak.js +0 -1
- /package/build/assets/{__vite-browser-external-4xJsU2-u.js → __vite-browser-external-DU-Cb_sT.js} +0 -0
- /package/build/assets/{automation-BU8zu-FP.js → automation-BVEmGghX.js} +0 -0
- /package/build/assets/{checkmark-h7udgXMM.js → checkmark-DhcMGwtO.js} +0 -0
- /package/build/assets/{close-p3Op5lxI.js → close-DO5Rq_CS.js} +0 -0
- /package/build/assets/{code-tag-DYlAhEQY.js → code-tag-BvjtzUsr.js} +0 -0
- /package/build/assets/{color-themes-DPBzNtVg.js → color-themes-bVMmJJG6.js} +0 -0
- /package/build/assets/{common-Dh7OqABE.js → common-CxbUL3nR.js} +0 -0
- /package/build/assets/{conversation-local-storage-F6zVMM--.js → conversation-local-storage-B31voBg7.js} +0 -0
- /package/build/assets/{copy-BLmGeJcd.js → copy-DLUw2us-.js} +0 -0
- /package/build/assets/{createLucideIcon-CVAsW2Yo.js → createLucideIcon-D4Tak8A1.js} +0 -0
- /package/build/assets/{dist-CodhvuAP.js → dist-Dj01FXbZ.js} +0 -0
- /package/build/assets/{environment-switch-store-DkjlKWzN.js → environment-switch-store-D9hB9PvY.js} +0 -0
- /package/build/assets/{extension-module-card-classes-9V3J9J_b.js → extension-module-card-classes-BlO4w702.js} +0 -0
- /package/build/assets/{folder-mMWFvaw0.js → folder-ynxP2EIL.js} +0 -0
- /package/build/assets/{get-language-from-path-CPNnuVhI.js → get-language-from-path-rWEQrOGU.js} +0 -0
- /package/build/assets/{git-status-mapper-BI8FyUVp.js → git-status-mapper-C3rfzUex.js} +0 -0
- /package/build/assets/{handle-capture-consent-CPMXU29K.js → handle-capture-consent-DDnXMC9Y.js} +0 -0
- /package/build/assets/{iconBase-DaTRRUjy.js → iconBase-CuvxAQZ5.js} +0 -0
- /package/build/assets/{link-external-DfKQroKX.js → link-external-BVDiJfZt.js} +0 -0
- /package/build/assets/{llm-subscription-DtsX5Lhg.js → llm-subscription-BkdHwtQe.js} +0 -0
- /package/build/assets/{map-provider-BM2SJarp.js → map-provider-XSFHmdDs.js} +0 -0
- /package/build/assets/{middleware-DYHYNAnP.js → middleware-CWYDMVuG.js} +0 -0
- /package/build/assets/{modal-backdrop-zVwfOJZr.js → modal-backdrop-Dsmzgr5s.js} +0 -0
- /package/build/assets/{navigation-context-DPs2G0X8.js → navigation-context-SjzfpygH.js} +0 -0
- /package/build/assets/{objectWithoutPropertiesLoose-BgYIAs2y.js → objectWithoutPropertiesLoose-CQwg6tC0.js} +0 -0
- /package/build/assets/{openhands-logo-bcNw5bkY.js → openhands-logo-C-gDp1wr.js} +0 -0
- /package/build/assets/{react-DPDgL6du.js → react-ao3tWj6K.js} +0 -0
- /package/build/assets/{search-BsjCEFNf.js → search-pb4UKTfK.js} +0 -0
- /package/build/assets/{settings-mQUckT0g.js → settings-DksoDv5z.js} +0 -0
- /package/build/assets/{settings-gear-MXCyZW0x.js → settings-gear-D_HVvE5L.js} +0 -0
- /package/build/assets/{settings-like-page-layout-classes-DENKlZpD.js → settings-like-page-layout-classes-DLrsPCaI.js} +0 -0
- /package/build/assets/{settings-section-header-context-COMOIaxV.js → settings-section-header-context-C2MUIG88.js} +0 -0
- /package/build/assets/{skills-9cDZONKh.js → skills-CH4xgIh-.js} +0 -0
- /package/build/assets/{switch-skeleton-DqQwalyu.js → switch-skeleton-BpSOvZ-n.js} +0 -0
- /package/build/assets/{terminal-BuLtIrb9.js → terminal-Dokfkxn0.js} +0 -0
- /package/build/assets/{u-check-circle-BqoIxNz_.js → u-check-circle-DPWVO-9N.js} +0 -0
- /package/build/assets/{u-check-circle-half-LiwZkuFe.js → u-check-circle-half-BGNAAjOW.js} +0 -0
- /package/build/assets/{u-edit-DJ90xc8Z.js → u-edit-BIskOoEG.js} +0 -0
- /package/build/assets/{use-breakpoint-B-O0lQ84.js → use-breakpoint-OjLm94cF.js} +0 -0
- /package/build/assets/{use-click-outside-element-Bf4Omzot.js → use-click-outside-element-Jpt2WWd7.js} +0 -0
- /package/build/assets/{use-onboarding-completion-C_Swglzp.js → use-onboarding-completion-DkRpDTsD.js} +0 -0
- /package/build/assets/{v4-DbCkTSoU.js → v4-DPgam_jW.js} +0 -0
- /package/build/assets/{vendor~browser-Dqd33JyP.js → vendor~browser-BvEKaLBz.js} +0 -0
- /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js → vendor~conversation-panel~conversation~alert-banner-CznX01nZ.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g9hift2g-DmmpG9SI.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js} +0 -0
- /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTzw2x50.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BuL5kjfS.js} +0 -0
- /package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js → vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~j2jlu22h-DUYl8gbZ.js} +0 -0
- /package/build/assets/{vendor~root-layout~home~mcp~automations-list~onboarding-modal-CXyYYvYh.js → vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-pIgQDxTc.js} +0 -0
- /package/build/assets/{vendor~terminal-aeP3PnKf.js → vendor~terminal-jAaNQWS9.js} +0 -0
- /package/build/assets/{x-mark-Batp6gXa.js → x-mark-C5przfXl.js} +0 -0
|
@@ -11,69 +11,77 @@ import d from "../../node_modules/uuid/dist/v4.js";
|
|
|
11
11
|
import { callCloudProxy as f } from "../cloud/proxy.js";
|
|
12
12
|
import { ConversationSortOrder as p } from "../../node_modules/@openhands/typescript-client/dist/models/conversation.js";
|
|
13
13
|
import "../../node_modules/@openhands/typescript-client/dist/index.js";
|
|
14
|
-
import { resolveAbsoluteAgentServerPath as
|
|
15
|
-
import
|
|
16
|
-
import { getStoredConversationMetadata as
|
|
17
|
-
import { batchGetCloudConversations as
|
|
18
|
-
import
|
|
19
|
-
import { assertSubscriptionAuthReady as
|
|
14
|
+
import { resolveAbsoluteAgentServerPath as ee } from "../agent-server-home.js";
|
|
15
|
+
import m from "../profiles-service/profiles-service.api.js";
|
|
16
|
+
import { getStoredConversationMetadata as h, removeStoredConversationMetadata as g, setStoredConversationMetadata as _ } from "../conversation-metadata-store.js";
|
|
17
|
+
import { batchGetCloudConversations as v, createCloudAppConversation as y, deleteCloudConversation as b, downloadCloudConversation as x, getCloudAppConversationStartTask as S, readCloudConversationFile as C, searchCloudConversations as w, updateCloudConversationPublicFlag as T } from "../cloud/conversation-service.api.js";
|
|
18
|
+
import E from "../settings-service/settings-service.api.js";
|
|
19
|
+
import { assertSubscriptionAuthReady as D, buildStartConversationRequestWithEncryptedSettings as O, emptyHooksResponse as k, getDefaultConversationTitle as A, toAppConversation as j, toConversationPage as M } from "../agent-server-adapter.js";
|
|
20
20
|
//#region src/api/conversation-service/agent-server-conversation-service.api.ts
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
return Error(
|
|
21
|
+
var N = "1970-01-01T00:00:00.000Z", P = "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.";
|
|
22
|
+
function F() {
|
|
23
|
+
return Error(P);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function I(e) {
|
|
26
26
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function L(e) {
|
|
29
29
|
return typeof e == "number" ? e : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function R(e) {
|
|
32
32
|
return typeof e == "number" ? e : 0;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function z(e) {
|
|
35
35
|
return typeof e == "string" ? e : null;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function B(e, t, n) {
|
|
38
38
|
let r = e[t] ?? e[n];
|
|
39
|
-
return typeof r == "string" && r.trim() ? r :
|
|
39
|
+
return typeof r == "string" && r.trim() ? r : N;
|
|
40
40
|
}
|
|
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:
|
|
41
|
+
function V(e) {
|
|
42
|
+
return I(e) ? {
|
|
43
|
+
prompt_tokens: R(e.prompt_tokens),
|
|
44
|
+
completion_tokens: R(e.completion_tokens),
|
|
45
|
+
cache_read_tokens: R(e.cache_read_tokens),
|
|
46
|
+
cache_write_tokens: R(e.cache_write_tokens),
|
|
47
|
+
context_window: R(e.context_window),
|
|
48
|
+
per_turn_token: R(e.per_turn_token)
|
|
49
49
|
} : null;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
53
|
-
accumulated_cost:
|
|
54
|
-
max_budget_per_task:
|
|
55
|
-
accumulated_token_usage:
|
|
51
|
+
function H(e) {
|
|
52
|
+
return I(e) ? {
|
|
53
|
+
accumulated_cost: L(e.accumulated_cost),
|
|
54
|
+
max_budget_per_task: L(e.max_budget_per_task),
|
|
55
|
+
accumulated_token_usage: V(e.accumulated_token_usage)
|
|
56
56
|
} : null;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
if (!
|
|
60
|
-
let t =
|
|
58
|
+
function U(e) {
|
|
59
|
+
if (!I(e)) return null;
|
|
60
|
+
let t = I(e.llm) ? { model: z(e.llm.model) } : null;
|
|
61
61
|
return {
|
|
62
|
-
kind:
|
|
63
|
-
acp_server:
|
|
64
|
-
acp_model:
|
|
62
|
+
kind: z(e.kind),
|
|
63
|
+
acp_server: z(e.acp_server),
|
|
64
|
+
acp_model: z(e.acp_model),
|
|
65
65
|
llm: t
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
68
|
+
function W(e) {
|
|
69
|
+
return I(e) ? { working_dir: z(e.working_dir) } : null;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
if (!
|
|
71
|
+
function G(e) {
|
|
72
|
+
if (!I(e)) return null;
|
|
73
73
|
let t = {};
|
|
74
74
|
for (let [n, r] of Object.entries(e)) typeof r == "string" && (t[n] = r);
|
|
75
75
|
return t;
|
|
76
76
|
}
|
|
77
|
+
function K(e) {
|
|
78
|
+
if (!I(e)) return null;
|
|
79
|
+
let { agent_profile_id: t, revision: n } = e;
|
|
80
|
+
return typeof t != "string" || typeof n != "number" ? null : {
|
|
81
|
+
agent_profile_id: t,
|
|
82
|
+
revision: n
|
|
83
|
+
};
|
|
84
|
+
}
|
|
77
85
|
function q(e) {
|
|
78
86
|
if (!e.startsWith("/")) return null;
|
|
79
87
|
let t = [];
|
|
@@ -89,24 +97,25 @@ function J(e, t) {
|
|
|
89
97
|
return n;
|
|
90
98
|
}
|
|
91
99
|
function Y(e) {
|
|
92
|
-
if (!
|
|
100
|
+
if (!I(e) || typeof e.id != "string" || !e.id.trim()) throw F();
|
|
93
101
|
return {
|
|
94
102
|
id: e.id.trim(),
|
|
95
|
-
title:
|
|
96
|
-
created_at:
|
|
97
|
-
updated_at:
|
|
98
|
-
execution_status:
|
|
99
|
-
sandbox_status:
|
|
100
|
-
metrics:
|
|
101
|
-
agent:
|
|
102
|
-
workspace:
|
|
103
|
-
tags:
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
title: z(e.title),
|
|
104
|
+
created_at: B(e, "created_at", "createdAt"),
|
|
105
|
+
updated_at: B(e, "updated_at", "updatedAt"),
|
|
106
|
+
execution_status: z(e.execution_status),
|
|
107
|
+
sandbox_status: z(e.sandbox_status),
|
|
108
|
+
metrics: H(e.metrics),
|
|
109
|
+
agent: U(e.agent),
|
|
110
|
+
workspace: W(e.workspace),
|
|
111
|
+
tags: G(e.tags),
|
|
112
|
+
launched_agent_profile: K(e.launched_agent_profile),
|
|
113
|
+
current_model_id: z(e.current_model_id),
|
|
114
|
+
current_model_name: z(e.current_model_name)
|
|
106
115
|
};
|
|
107
116
|
}
|
|
108
117
|
function X(e) {
|
|
109
|
-
if (!Array.isArray(e)) throw
|
|
118
|
+
if (!Array.isArray(e)) throw F();
|
|
110
119
|
return e.map(Y);
|
|
111
120
|
}
|
|
112
121
|
function Z(e) {
|
|
@@ -114,7 +123,7 @@ function Z(e) {
|
|
|
114
123
|
items: X(e),
|
|
115
124
|
next_page_id: null
|
|
116
125
|
};
|
|
117
|
-
if (!
|
|
126
|
+
if (!I(e)) throw F();
|
|
118
127
|
return {
|
|
119
128
|
items: X(e.items),
|
|
120
129
|
next_page_id: typeof e.next_page_id == "string" ? e.next_page_id : null
|
|
@@ -129,7 +138,7 @@ var Q = new Set([
|
|
|
129
138
|
"error",
|
|
130
139
|
"stuck"
|
|
131
140
|
]);
|
|
132
|
-
function
|
|
141
|
+
function te(e) {
|
|
133
142
|
let t = e ?? "idle";
|
|
134
143
|
return Q.has(t) ? t : "idle";
|
|
135
144
|
}
|
|
@@ -137,12 +146,12 @@ function $(e, t) {
|
|
|
137
146
|
if (!e) throw Error(`Conversation ${t} was not found`);
|
|
138
147
|
return e;
|
|
139
148
|
}
|
|
140
|
-
var
|
|
149
|
+
var ne = class {
|
|
141
150
|
static async sendMessage(t, n, r) {
|
|
142
151
|
let a = s().backend, o = r?.conversationUrl ?? null, c = r?.sessionApiKey ?? null;
|
|
143
152
|
if (a.kind === "cloud") {
|
|
144
153
|
if (!o || !c) {
|
|
145
|
-
let [e] = await
|
|
154
|
+
let [e] = await v([t]);
|
|
146
155
|
o = e?.conversation_url?.trim() ?? null, c = e?.session_api_key?.trim() ?? null;
|
|
147
156
|
}
|
|
148
157
|
if (!o || !c) throw Error("Conversation sandbox is still starting. Wait for it to finish, then try again.");
|
|
@@ -164,8 +173,8 @@ var te = class {
|
|
|
164
173
|
sessionApiKey: c
|
|
165
174
|
})).sendEvent(t, n, { run: !0 }), n;
|
|
166
175
|
}
|
|
167
|
-
static async createConversation(t, n, r, i, o, f, p, h, g,
|
|
168
|
-
if (s().backend.kind === "cloud") return
|
|
176
|
+
static async createConversation(t, n, r, i, o, f, p, m, h, g, v) {
|
|
177
|
+
if (s().backend.kind === "cloud") return y({
|
|
169
178
|
initial_message: t ? {
|
|
170
179
|
role: "user",
|
|
171
180
|
content: [{
|
|
@@ -179,22 +188,23 @@ var te = class {
|
|
|
179
188
|
git_provider: i?.git_provider ?? null,
|
|
180
189
|
plugins: r ?? null,
|
|
181
190
|
parent_conversation_id: p ?? null,
|
|
182
|
-
agent_type:
|
|
183
|
-
sandbox_id:
|
|
184
|
-
agent_profile_id:
|
|
191
|
+
agent_type: m,
|
|
192
|
+
sandbox_id: h ?? null,
|
|
193
|
+
agent_profile_id: g ?? null
|
|
185
194
|
});
|
|
186
|
-
let
|
|
187
|
-
settings:
|
|
195
|
+
let b = await E.getSettings(), x = d(), S = await ee(o ?? a(x)), C = f ?? (o ? "local_repo" : "new_worktree"), w = await O({
|
|
196
|
+
settings: b,
|
|
188
197
|
query: t,
|
|
189
198
|
conversationInstructions: n,
|
|
190
199
|
plugins: r,
|
|
191
200
|
conversationId: x,
|
|
192
201
|
workingDir: S,
|
|
193
202
|
worktree: C === "new_worktree",
|
|
194
|
-
agentProfileId:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
agentProfileId: g,
|
|
204
|
+
agentProfileKind: v
|
|
205
|
+
}), T = await new e(u()).createConversation(w), D = c();
|
|
206
|
+
if (!D) throw new l();
|
|
207
|
+
return (i?.selected_repository || o) && _(T.id, {
|
|
198
208
|
selected_repository: i?.selected_repository ?? null,
|
|
199
209
|
selected_branch: i?.selected_branch ?? null,
|
|
200
210
|
git_provider: i?.git_provider ?? null,
|
|
@@ -206,7 +216,7 @@ var te = class {
|
|
|
206
216
|
status: "READY",
|
|
207
217
|
detail: null,
|
|
208
218
|
app_conversation_id: T.id,
|
|
209
|
-
agent_server_url:
|
|
219
|
+
agent_server_url: D.host,
|
|
210
220
|
request: {
|
|
211
221
|
initial_message: w.initial_message,
|
|
212
222
|
plugins: r ?? null
|
|
@@ -216,7 +226,7 @@ var te = class {
|
|
|
216
226
|
};
|
|
217
227
|
}
|
|
218
228
|
static async getStartTask(e) {
|
|
219
|
-
return s().backend.kind === "cloud" ?
|
|
229
|
+
return s().backend.kind === "cloud" ? S(e) : null;
|
|
220
230
|
}
|
|
221
231
|
static async getVSCodeUrl(e, t, n) {
|
|
222
232
|
let i = await this.resolveConversationWorkingDir(e);
|
|
@@ -233,32 +243,32 @@ var te = class {
|
|
|
233
243
|
return t?.workspace?.working_dir ?? o();
|
|
234
244
|
}
|
|
235
245
|
static async batchGetAppConversations(t) {
|
|
236
|
-
return t.length === 0 ? [] : s().backend.kind === "cloud" ?
|
|
246
|
+
return t.length === 0 ? [] : s().backend.kind === "cloud" ? v(t) : X(await new e(u()).getConversations(t)).map((e) => j(e));
|
|
237
247
|
}
|
|
238
248
|
static async updateConversationPublicFlag(e, t) {
|
|
239
249
|
if (s().backend.kind !== "cloud") throw Error("Public sharing requires a cloud backend.");
|
|
240
|
-
return
|
|
250
|
+
return T(e, t);
|
|
241
251
|
}
|
|
242
252
|
static async updateConversationRepository(e, t, n, r) {
|
|
243
|
-
t ?
|
|
244
|
-
...
|
|
253
|
+
t ? _(e, {
|
|
254
|
+
...h(e) ?? {},
|
|
245
255
|
selected_repository: t,
|
|
246
256
|
selected_branch: n ?? null,
|
|
247
257
|
git_provider: r ?? null
|
|
248
|
-
}) :
|
|
258
|
+
}) : g(e);
|
|
249
259
|
let [i] = await this.batchGetAppConversations([e]);
|
|
250
260
|
return $(i, e);
|
|
251
261
|
}
|
|
252
262
|
static async readConversationFile(e, n) {
|
|
253
|
-
if (s().backend.kind === "cloud") return
|
|
263
|
+
if (s().backend.kind === "cloud") return C(e, J(n ?? "/workspace/project/.agents_tmp/PLAN.md", "/workspace/project"));
|
|
254
264
|
let r = await this.resolveConversationWorkingDir(e), i = J(n ?? `${r}/.agents_tmp/PLAN.md`, r);
|
|
255
265
|
return new t(u()).downloadTextFile(i);
|
|
256
266
|
}
|
|
257
267
|
static async downloadConversation(e) {
|
|
258
|
-
return s().backend.kind === "cloud" ?
|
|
268
|
+
return s().backend.kind === "cloud" ? x(e) : new t(u()).downloadTrajectory(e);
|
|
259
269
|
}
|
|
260
270
|
static async getHooks(e) {
|
|
261
|
-
return
|
|
271
|
+
return k();
|
|
262
272
|
}
|
|
263
273
|
static async getRuntimeConversation(t, n, r) {
|
|
264
274
|
let a = s().backend, o = a.kind === "cloud" && n ? await f({
|
|
@@ -271,26 +281,26 @@ var te = class {
|
|
|
271
281
|
}) : await new e(u({
|
|
272
282
|
conversationUrl: n,
|
|
273
283
|
sessionApiKey: r
|
|
274
|
-
})).getConversation(t), c = Y(o), l =
|
|
284
|
+
})).getConversation(t), c = Y(o), l = I(o) ? o.stats : null;
|
|
275
285
|
return {
|
|
276
286
|
id: c.id,
|
|
277
|
-
title: c.title?.trim() ? c.title :
|
|
278
|
-
metrics:
|
|
287
|
+
title: c.title?.trim() ? c.title : A(c.id),
|
|
288
|
+
metrics: H(c.metrics),
|
|
279
289
|
created_at: c.created_at,
|
|
280
290
|
updated_at: c.updated_at,
|
|
281
|
-
status:
|
|
282
|
-
stats:
|
|
291
|
+
status: te(c.execution_status),
|
|
292
|
+
stats: I(l) ? l : { usage_to_metrics: {} }
|
|
283
293
|
};
|
|
284
294
|
}
|
|
285
295
|
static async searchConversations(t = 20, n) {
|
|
286
|
-
return s().backend.kind === "cloud" ?
|
|
296
|
+
return s().backend.kind === "cloud" ? w(t, n) : M(Z(await new e(u()).searchConversations({
|
|
287
297
|
limit: t,
|
|
288
298
|
page_id: n,
|
|
289
299
|
sort_order: p.UPDATED_AT_DESC
|
|
290
300
|
})));
|
|
291
301
|
}
|
|
292
302
|
static async deleteConversation(t) {
|
|
293
|
-
s().backend.kind === "cloud" ? await
|
|
303
|
+
s().backend.kind === "cloud" ? await b(t) : await new e(u()).deleteConversation(t), g(t);
|
|
294
304
|
}
|
|
295
305
|
static async updateConversationTitle(t, n) {
|
|
296
306
|
await new e(u()).updateConversation(t, { title: n });
|
|
@@ -302,8 +312,8 @@ var te = class {
|
|
|
302
312
|
let i = await new e(u()).forkConversation(t, {
|
|
303
313
|
from_event_id: n,
|
|
304
314
|
...r ? { title: r } : {}
|
|
305
|
-
}), a =
|
|
306
|
-
return a &&
|
|
315
|
+
}), a = h(t);
|
|
316
|
+
return a && _(i.id, a), i;
|
|
307
317
|
}
|
|
308
318
|
static async getEventParentId(t, n) {
|
|
309
319
|
return (await new e(u()).getEvent(t, n)).parent_id ?? void 0;
|
|
@@ -312,7 +322,7 @@ var te = class {
|
|
|
312
322
|
let { backend: i } = s();
|
|
313
323
|
if (i.kind === "cloud") {
|
|
314
324
|
if (!t) {
|
|
315
|
-
await
|
|
325
|
+
await m.activateProfile(r);
|
|
316
326
|
return;
|
|
317
327
|
}
|
|
318
328
|
await f({
|
|
@@ -329,7 +339,7 @@ var te = class {
|
|
|
329
339
|
}
|
|
330
340
|
let a = u(), o = new e(a), c = await new n(a).getProfile(r, { exposeSecrets: "encrypted" }), l = typeof c.config.model == "string" ? c.config.model : "";
|
|
331
341
|
if (!l) throw Error(`Profile '${r}' has no model.`);
|
|
332
|
-
await
|
|
342
|
+
await D({ llm: c.config }), await o.switchLLM(t, {
|
|
333
343
|
...c.config,
|
|
334
344
|
model: l,
|
|
335
345
|
stream: !0,
|
|
@@ -351,6 +361,6 @@ var te = class {
|
|
|
351
361
|
}
|
|
352
362
|
};
|
|
353
363
|
//#endregion
|
|
354
|
-
export {
|
|
364
|
+
export { ne as default };
|
|
355
365
|
|
|
356
366
|
//# sourceMappingURL=agent-server-conversation-service.api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-server-conversation-service.api.js","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type ForkConversationRequest,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport { resolveAbsoluteAgentServerPath } from \"../agent-server-home\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport ProfilesService from \"../profiles-service/profiles-service.api\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n assertSubscriptionAuthReady,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n type WorkspaceMode,\n} from \"../conversation-metadata-store\";\nimport 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_server`` is\n // the ACP provider identity (``ACPAgent.acp_server``, SDK #3692) — required so\n // the adapter can source the chip + in-conversation model list from the agent\n // when the ``acpserver`` tag is absent (a profile launch doesn't stamp it,\n // #1571). ``acp_model`` is the Canvas-configured model — preserved so the chip\n // can fall back to it when the SDK runtime model fields aren't populated.\n // Preserving these makes the wire path agree with the unit-test path that\n // builds ``DirectConversationInfo`` directly\n // (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_server: stringOrNull(value.acp_server),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction 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 workspaceMode?: WorkspaceMode,\n parentConversationId?: string,\n agentType?: \"default\" | \"plan\",\n sandboxId?: string,\n // Launch from a saved AgentProfile (resolved server-side) instead of the\n // current encrypted agent_settings (#3727). Supported on both local and the\n // cloud app-server (OpenHands #15060): local threads it through the\n // encrypted-settings builder; cloud sends it as a flat request field.\n agentProfileId?: string,\n ): Promise<AppConversationStartTask> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n // When launching from a profile, send `agent_profile_id`; the backend\n // resolves it to agent_settings server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n agent_profile_id: agentProfileId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const settings = await SettingsService.getSettings();\n const conversationId = uuidv4();\n // @spec WUP-001 — Send an absolute working_dir to the agent-server.\n // The default is `workspace/project/<hex>` (relative); without\n // resolving it here, `/api/file/upload` later prepends `/` and writes\n // to `/workspace/...` (read-only on macOS and fresh containers). When\n // the user picks an explicit workspace, `workingDirOverride` is\n // already absolute (it comes from `search_subdirs`).\n const workingDir = await resolveAbsoluteAgentServerPath(\n workingDirOverride ?? buildConversationWorkingDir(conversationId),\n );\n const resolvedWorkspaceMode =\n workspaceMode ?? (workingDirOverride ? \"local_repo\" : \"new_worktree\");\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n workingDir,\n worktree: resolvedWorkspaceMode === \"new_worktree\",\n agentProfileId,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n workspace_mode: resolvedWorkspaceMode,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n 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 * Forks a conversation, copying event history up to and including\n * `fromEventId`. Local agent-server only; needs agent-server >= 1.31.0 for\n * `from_event_id` (older backends copy the whole conversation).\n */\n static async forkConversation(\n sourceConversationId: string,\n fromEventId: string,\n title?: string,\n ): Promise<DirectConversationInfo> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"Branching a conversation isn't supported on the cloud backend yet.\",\n );\n }\n\n // `from_event_id` is accepted by `/fork` but not yet typed in\n // ForkConversationRequest (through client 1.32.0); the client forwards the\n // body verbatim, so cast to carry it. A title also suppresses the backend\n // auto-title, so the \"(branch)\" marker sticks.\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).forkConversation<DirectConversationInfo>(sourceConversationId, {\n from_event_id: fromEventId,\n ...(title ? { title } : {}),\n } as ForkConversationRequest & { from_event_id: string });\n\n // Carry over the source's client-side metadata (repo/branch/workspace/\n // profile/plugins) so the fork hydrates its chat-page badges the same way.\n const sourceMetadata = getStoredConversationMetadata(sourceConversationId);\n if (sourceMetadata) {\n setStoredConversationMetadata(data.id, sourceMetadata);\n }\n\n return data;\n }\n\n /**\n * Returns an event's `parent_id` (the fork point for branching *before* it),\n * or undefined at the root. Uses the single-event endpoint because the events\n * *search* API omits `parent_id`.\n */\n static async getEventParentId(\n conversationId: string,\n eventId: string,\n ): Promise<string | undefined> {\n const event = (await new ConversationClient(\n getAgentServerClientOptions(),\n ).getEvent(conversationId, eventId)) as { parent_id?: string | null };\n return event.parent_id ?? undefined;\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n *\n * Cloud backends route to the app-server's per-conversation\n * `/switch_profile`, which owns the profiles and resolves the swap\n * server-side (base_url/api_key fixups, usage_id derivation, then the\n * agent-server's switch_llm) — so the client only forwards the profile name,\n * mirroring {@link switchAcpModel}.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n\n if (backend.kind === \"cloud\") {\n // No conversation (home page): activate globally so the next\n // conversation starts with it. ProfilesService routes to the cloud\n // activate endpoint.\n if (!conversationId) {\n await ProfilesService.activateProfile(profileName);\n return;\n }\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_profile`,\n body: { profile_name: profileName },\n });\n return;\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await assertSubscriptionAuthReady({ llm: profile.config });\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Keep streaming on after a switch (parity with conversation start);\n // the profile config would otherwise default it to stream=False.\n stream: true,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * 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 const { backend } = getActiveBackend();\n if (backend.kind === \"cloud\") {\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_acp_model`,\n body: { model },\n });\n return;\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuEA,IAAM,IAAiC,4BACjC,IACJ;AAGF,SAAS,IAAqC;AAC5C,QAAW,MAAM,EAAsC;;AAGzD,SAAS,EAAS,GAAkD;AAClE,QAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,EAAM;;AAG7E,SAAS,EAAa,GAA+B;AACnD,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EAAa,GAAwB;AAC5C,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EAAa,GAA+B;AACnD,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EACP,GACA,GACA,GACQ;CACR,IAAM,IAAQ,EAAK,MAAa,EAAK;AACrC,QAA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;AAErE,EADA,MAAM,EAA4B,EAAE,KAAK,EAAQ,QAAQ,CAAC,EAC1D,MAAM,EAAmB,UAAU,GAAgB;GACjD,GAAG,EAAQ;GACX;GAGA,QAAQ;GAER,UAAU,WAAW,EAAY,GAAG,GAAQ;GAC7C,CAAc;;CAcjB,aAAa,eACX,GACA,GACe;EACf,IAAM,EAAE,eAAY,GAAkB;AACtC,MAAI,EAAQ,SAAS,SAAS;AAC5B,SAAM,EAAe;IACnB;IACA,QAAQ;IACR,MAAM,6BAA6B,EAAe;IAClD,MAAM,EAAE,UAAO;IAChB,CAAC;AACF;;AAGF,QAAM,IAAI,EAAmB,GAA6B,CAAC,CAAC,eAC1D,GACA,EACD"}
|
|
1
|
+
{"version":3,"file":"agent-server-conversation-service.api.js","names":[],"sources":["../../../src/api/conversation-service/agent-server-conversation-service.api.ts"],"sourcesContent":["import {\n ConversationSortOrder,\n type ForkConversationRequest,\n type LLMConfig,\n} from \"@openhands/typescript-client\";\nimport {\n ConversationClient,\n FileClient,\n ProfilesClient,\n VSCodeClient,\n} from \"@openhands/typescript-client/clients\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { AgentKind, Provider } from \"#/types/settings\";\nimport type { ConversationRuntimeContext } from \"#/api/conversation-file-upload.api\";\nimport { buildHttpBaseUrl } from \"#/utils/websocket-url\";\nimport {\n buildConversationWorkingDir,\n getAgentServerWorkingDir,\n} from \"../agent-server-config\";\nimport { resolveAbsoluteAgentServerPath } from \"../agent-server-home\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n} from \"../backend-registry/active-store\";\nimport { callCloudProxy } from \"../cloud/proxy\";\nimport ProfilesService from \"../profiles-service/profiles-service.api\";\nimport {\n batchGetCloudConversations,\n createCloudAppConversation,\n deleteCloudConversation,\n downloadCloudConversation,\n getCloudAppConversationStartTask,\n readCloudConversationFile,\n searchCloudConversations,\n updateCloudConversationPublicFlag,\n} from \"../cloud/conversation-service.api\";\nimport {\n DirectConversationInfo,\n assertSubscriptionAuthReady,\n buildStartConversationRequestWithEncryptedSettings,\n emptyHooksResponse,\n getDefaultConversationTitle,\n toAppConversation,\n toConversationPage,\n} from \"../agent-server-adapter\";\nimport { GetVSCodeUrlResponse } from \"../open-hands.types\";\nimport {\n getAgentServerClientOptions,\n NoBackendAvailableError,\n} from \"../agent-server-client-options\";\nimport SettingsService from \"../settings-service/settings-service.api\";\nimport {\n ConversationMetadata,\n getStoredConversationMetadata,\n removeStoredConversationMetadata,\n setStoredConversationMetadata,\n type WorkspaceMode,\n} from \"../conversation-metadata-store\";\nimport 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_server`` is\n // the ACP provider identity (``ACPAgent.acp_server``, SDK #3692) — required so\n // the adapter can source the chip + in-conversation model list from the agent\n // when the ``acpserver`` tag is absent (a profile launch doesn't stamp it,\n // #1571). ``acp_model`` is the Canvas-configured model — preserved so the chip\n // can fall back to it when the SDK runtime model fields aren't populated.\n // Preserving these makes the wire path agree with the unit-test path that\n // builds ``DirectConversationInfo`` directly\n // (e.g. ``__tests__/api/agent-server-adapter.test.ts``).\n return {\n kind: stringOrNull(value.kind),\n acp_server: stringOrNull(value.acp_server),\n acp_model: stringOrNull(value.acp_model),\n llm,\n };\n}\n\nfunction normalizeWorkspace(\n value: unknown,\n): DirectConversationInfo[\"workspace\"] {\n if (!isRecord(value)) return null;\n return { working_dir: stringOrNull(value.working_dir) };\n}\n\n/**\n * Accept the agent-server's ``tags: Record[str, str]`` payload defensively:\n * the wire shape is guaranteed by the server-side validator (keys\n * ``^[a-z0-9]+$``, string values), but a non-conforming response (older\n * server, raw API write, future schema drift) must never crash the parser\n * — Canvas only consumes ``acpserver`` and falls back to a generic chip\n * for anything it doesn't recognize. Drop entries whose value isn't a\n * plain string; return ``null`` when the wire field is absent or not an\n * object so consumers can use ``info.tags?.[KEY] ?? null`` uniformly.\n */\nfunction normalizeTags(value: unknown): Record<string, string> | null {\n if (!isRecord(value)) return null;\n const tags: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry === \"string\") {\n tags[key] = entry;\n }\n }\n return tags;\n}\n\nfunction normalizeLaunchedAgentProfile(\n value: unknown,\n): DirectConversationInfo[\"launched_agent_profile\"] {\n if (!isRecord(value)) return null;\n const { agent_profile_id: agentProfileId, revision } = value;\n if (typeof agentProfileId !== \"string\" || typeof revision !== \"number\") {\n return null;\n }\n return { agent_profile_id: agentProfileId, revision };\n}\n\nfunction normalizeAbsolutePath(path: string): string | null {\n if (!path.startsWith(\"/\")) return null;\n\n const segments: string[] = [];\n for (const segment of path.split(\"/\")) {\n if (segment && segment !== \".\") {\n if (segment === \"..\") {\n if (!segments.length) return null;\n segments.pop();\n } else {\n segments.push(segment);\n }\n }\n }\n\n return `/${segments.join(\"/\")}`;\n}\n\nfunction requirePathInsideDirectory(path: string, directory: string): string {\n const normalizedPath = normalizeAbsolutePath(path);\n const normalizedDirectory = normalizeAbsolutePath(directory);\n\n if (\n !normalizedPath ||\n !normalizedDirectory ||\n (normalizedPath !== normalizedDirectory &&\n !normalizedPath.startsWith(`${normalizedDirectory}/`))\n ) {\n throw new Error(\"Conversation file path must stay inside the workspace\");\n }\n\n return normalizedPath;\n}\n\nfunction requireDirectConversationInfo(item: unknown): DirectConversationInfo {\n if (!isRecord(item) || typeof item.id !== \"string\" || !item.id.trim()) {\n throw invalidConversationResponse();\n }\n\n return {\n id: item.id.trim(),\n title: stringOrNull(item.title),\n created_at: readTimestamp(item, \"created_at\", \"createdAt\"),\n updated_at: readTimestamp(item, \"updated_at\", \"updatedAt\"),\n execution_status: stringOrNull(item.execution_status),\n sandbox_status: stringOrNull(item.sandbox_status),\n metrics: normalizeMetrics(item.metrics),\n agent: normalizeAgent(item.agent),\n workspace: normalizeWorkspace(item.workspace),\n tags: normalizeTags(item.tags),\n launched_agent_profile: normalizeLaunchedAgentProfile(\n item.launched_agent_profile,\n ),\n // SDK-runtime ACP model fields (populated when the agent-server supports\n // ``ConversationInfo.current_model_*``). Consumed by the conversation\n // adapter to drive the per-card chip's model text. Older agent-servers\n // omit these — adapter handles ``undefined`` / ``null`` gracefully.\n current_model_id: stringOrNull(item.current_model_id),\n current_model_name: stringOrNull(item.current_model_name),\n };\n}\n\nfunction requireDirectConversationItems(\n items: unknown,\n): DirectConversationInfo[] {\n if (!Array.isArray(items)) {\n throw invalidConversationResponse();\n }\n return items.map(requireDirectConversationInfo);\n}\n\nfunction requireConversationSearchPage(page: unknown): {\n items: DirectConversationInfo[];\n next_page_id: string | null;\n} {\n if (Array.isArray(page)) {\n return {\n items: requireDirectConversationItems(page),\n next_page_id: null,\n };\n }\n\n if (!isRecord(page)) {\n throw invalidConversationResponse();\n }\n\n return {\n items: requireDirectConversationItems(page.items),\n next_page_id:\n typeof page.next_page_id === \"string\" ? page.next_page_id : null,\n };\n}\n\nconst RUNTIME_STATUSES = new Set<string>([\n \"idle\",\n \"running\",\n \"paused\",\n \"waiting_for_confirmation\",\n \"finished\",\n \"error\",\n \"stuck\",\n]);\n\nfunction toRuntimeStatus(\n status: DirectConversationInfo[\"execution_status\"],\n): RuntimeConversationInfo[\"status\"] {\n const nextStatus = status ?? \"idle\";\n return (\n RUNTIME_STATUSES.has(nextStatus) ? nextStatus : \"idle\"\n ) as RuntimeConversationInfo[\"status\"];\n}\n\nfunction requireAppConversation(\n conversation: AppConversation | null | undefined,\n conversationId: string,\n): AppConversation {\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} was not found`);\n }\n return conversation;\n}\n\nclass AgentServerConversationService {\n static async sendMessage(\n conversationId: string,\n message: SendMessageRequest,\n runtime?: ConversationRuntimeContext | null,\n ): Promise<SendMessageResponse> {\n const active = getActiveBackend().backend;\n let conversationUrl = runtime?.conversationUrl ?? null;\n let sessionApiKey = runtime?.sessionApiKey ?? null;\n\n if (active.kind === \"cloud\") {\n if (!conversationUrl || !sessionApiKey) {\n const [conversation] = await batchGetCloudConversations([\n conversationId,\n ]);\n conversationUrl = conversation?.conversation_url?.trim() ?? null;\n sessionApiKey = conversation?.session_api_key?.trim() ?? null;\n }\n\n if (!conversationUrl || !sessionApiKey) {\n throw new Error(\n \"Conversation sandbox is still starting. Wait for it to finish, then try again.\",\n );\n }\n\n await callCloudProxy({\n backend: active,\n method: \"POST\",\n hostOverride: buildHttpBaseUrl(conversationUrl),\n path: `/api/conversations/${conversationId}/events`,\n body: { ...message, run: true },\n authMode: \"session-api-key\",\n sessionApiKey,\n });\n\n return message;\n }\n\n await new ConversationClient(\n getAgentServerClientOptions({ conversationUrl, sessionApiKey }),\n ).sendEvent(conversationId, message, {\n run: true,\n });\n\n return message;\n }\n\n static async createConversation(\n initialUserMsg?: string,\n conversationInstructions?: string,\n plugins?: PluginSpec[],\n metadata?: ConversationMetadata | null,\n workingDirOverride?: string,\n workspaceMode?: WorkspaceMode,\n parentConversationId?: string,\n agentType?: \"default\" | \"plan\",\n sandboxId?: string,\n // Launch from a saved AgentProfile (resolved server-side) instead of the\n // current encrypted agent_settings (#3727). Supported on both local and the\n // cloud app-server (OpenHands #15060): local threads it through the\n // encrypted-settings builder; cloud sends it as a flat request field.\n agentProfileId?: string,\n agentProfileKind?: AgentKind,\n ): Promise<AppConversationStartTask> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud path mirrors OpenHands' frontend: build a flat\n // AppConversationStartRequest, POST /api/v1/app-conversations\n // (returns a WORKING task), and let the conversation route's\n // useTaskPolling drive it to READY. NO encrypted-settings\n // round-trip — the cloud backend holds secrets server-side.\n // When launching from a profile, send `agent_profile_id`; the backend\n // resolves it to agent_settings server-side.\n const request: AppConversationStartRequest = {\n initial_message: initialUserMsg\n ? {\n role: \"user\",\n content: [{ type: \"text\", text: initialUserMsg }],\n }\n : null,\n title: conversationInstructions ?? null,\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n plugins: plugins ?? null,\n parent_conversation_id: parentConversationId ?? null,\n agent_type: agentType,\n sandbox_id: sandboxId ?? null,\n agent_profile_id: agentProfileId ?? null,\n };\n return createCloudAppConversation(request);\n }\n\n const settings = await SettingsService.getSettings();\n const conversationId = uuidv4();\n // @spec WUP-001 — Send an absolute working_dir to the agent-server.\n // The default is `workspace/project/<hex>` (relative); without\n // resolving it here, `/api/file/upload` later prepends `/` and writes\n // to `/workspace/...` (read-only on macOS and fresh containers). When\n // the user picks an explicit workspace, `workingDirOverride` is\n // already absolute (it comes from `search_subdirs`).\n const workingDir = await resolveAbsoluteAgentServerPath(\n workingDirOverride ?? buildConversationWorkingDir(conversationId),\n );\n const resolvedWorkspaceMode =\n workspaceMode ?? (workingDirOverride ? \"local_repo\" : \"new_worktree\");\n\n // Use encrypted settings to avoid exposing secrets in the browser\n const payload = await buildStartConversationRequestWithEncryptedSettings({\n settings,\n query: initialUserMsg,\n conversationInstructions,\n plugins,\n conversationId,\n workingDir,\n worktree: resolvedWorkspaceMode === \"new_worktree\",\n agentProfileId,\n agentProfileKind,\n });\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).createConversation<DirectConversationInfo>(payload);\n const localBackend = getEffectiveLocalBackend();\n if (!localBackend) throw new NoBackendAvailableError();\n\n if (metadata?.selected_repository || workingDirOverride) {\n // The agent-server runtime has no concept of selected repo/branch/\n // workspace, so persist the home-page selection client-side.\n // `toAppConversation` reads the repo/branch fields back to hydrate\n // the chat-page badges; `useHasAttachedSource` reads\n // `selected_workspace` to default the Files tab to Diff mode when\n // the user explicitly attached a local workspace.\n setStoredConversationMetadata(data.id, {\n selected_repository: metadata?.selected_repository ?? null,\n selected_branch: metadata?.selected_branch ?? null,\n git_provider: metadata?.git_provider ?? null,\n selected_workspace: workingDirOverride ?? null,\n workspace_mode: resolvedWorkspaceMode,\n });\n }\n\n return {\n id: data.id,\n created_by_user_id: null,\n status: \"READY\",\n detail: null,\n app_conversation_id: data.id,\n agent_server_url: localBackend.host,\n request: {\n initial_message: payload.initial_message as\n | AppConversationStartRequest[\"initial_message\"]\n | undefined,\n plugins: plugins ?? null,\n },\n created_at: data.created_at,\n updated_at: data.updated_at,\n };\n }\n\n static async getStartTask(\n taskId: string,\n ): Promise<AppConversationStartTask | null> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return getCloudAppConversationStartTask(taskId);\n }\n // Local agent-server creates conversations synchronously — every\n // local \"task\" is already READY when createConversation returns, so\n // there's nothing to poll for.\n return null;\n }\n\n static async getVSCodeUrl(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<GetVSCodeUrlResponse> {\n // Local-only path. Cloud conversations read the VSCode URL straight\n // from the cloud-computed `sandbox.exposed_urls` (see\n // `useUnifiedVSCodeUrl` + `useCloudSandbox`); the runtime's own\n // `/api/vscode/url` only knows its internal `localhost:8001`, which\n // the user's browser can't reach.\n const workspaceDir =\n await this.resolveConversationWorkingDir(conversationId);\n // Local mode: the typescript-client targets the local agent-server\n // directly via the conversationUrl override.\n const vscodeUrl = await new VSCodeClient(\n getAgentServerClientOptions({\n conversationUrl,\n sessionApiKey,\n }),\n ).getUrl({\n baseUrl:\n typeof window !== \"undefined\" ? window.location.origin : undefined,\n workspaceDir,\n });\n\n return { vscode_url: vscodeUrl };\n }\n\n static async resolveConversationWorkingDir(\n conversationId: string,\n ): Promise<string> {\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();\n }\n\n static async batchGetAppConversations(\n ids: string[],\n ): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n\n if (getActiveBackend().backend.kind === \"cloud\") {\n return batchGetCloudConversations(ids);\n }\n\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).getConversations<DirectConversationInfo>(ids);\n\n return requireDirectConversationItems(data).map((item) =>\n toAppConversation(item),\n );\n }\n\n static async updateConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n ): Promise<AppConversation> {\n if (getActiveBackend().backend.kind !== \"cloud\") {\n throw new Error(\"Public sharing requires a cloud backend.\");\n }\n return updateCloudConversationPublicFlag(conversationId, isPublic);\n }\n\n static async updateConversationRepository(\n conversationId: string,\n repository: string | null,\n branch?: string | null,\n gitProvider?: string | null,\n ): Promise<AppConversation> {\n if (repository) {\n const existing = getStoredConversationMetadata(conversationId);\n setStoredConversationMetadata(conversationId, {\n ...(existing ?? {}),\n selected_repository: repository,\n selected_branch: branch ?? null,\n git_provider: (gitProvider as Provider | null | undefined) ?? null,\n });\n } else {\n removeStoredConversationMetadata(conversationId);\n }\n const [conversation] = await this.batchGetAppConversations([\n conversationId,\n ]);\n return requireAppConversation(conversation, conversationId);\n }\n\n static async readConversationFile(\n conversationId: string,\n filePath?: string,\n ): Promise<string> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n // Cloud exposes a per-conversation file endpoint; the sandbox\n // working dir is fixed (`/workspace/project`), so PLAN.md lives at\n // a known absolute path. Mirrors OpenHands' readConversationFile.\n const path = requirePathInsideDirectory(\n filePath ?? \"/workspace/project/.agents_tmp/PLAN.md\",\n \"/workspace/project\",\n );\n return readCloudConversationFile(conversationId, path);\n }\n\n const workingDir = await this.resolveConversationWorkingDir(conversationId);\n const path = requirePathInsideDirectory(\n filePath ?? `${workingDir}/.agents_tmp/PLAN.md`,\n workingDir,\n );\n return new FileClient(getAgentServerClientOptions()).downloadTextFile(path);\n }\n\n static async downloadConversation(conversationId: string): Promise<Blob> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n return downloadCloudConversation(conversationId);\n }\n\n return new FileClient(getAgentServerClientOptions()).downloadTrajectory(\n conversationId,\n );\n }\n\n static async getHooks(conversationId: string): Promise<GetHooksResponse> {\n if (!conversationId) {\n return emptyHooksResponse();\n }\n return emptyHooksResponse();\n }\n\n static async getRuntimeConversation(\n conversationId: string,\n conversationUrl: string | null | undefined,\n sessionApiKey?: string | null,\n ): Promise<RuntimeConversationInfo> {\n 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 * Forks a conversation, copying event history up to and including\n * `fromEventId`. Local agent-server only; needs agent-server >= 1.31.0 for\n * `from_event_id` (older backends copy the whole conversation).\n */\n static async forkConversation(\n sourceConversationId: string,\n fromEventId: string,\n title?: string,\n ): Promise<DirectConversationInfo> {\n if (getActiveBackend().backend.kind === \"cloud\") {\n throw new Error(\n \"Branching a conversation isn't supported on the cloud backend yet.\",\n );\n }\n\n // `from_event_id` is accepted by `/fork` but not yet typed in\n // ForkConversationRequest (through client 1.32.0); the client forwards the\n // body verbatim, so cast to carry it. A title also suppresses the backend\n // auto-title, so the \"(branch)\" marker sticks.\n const data = await new ConversationClient(\n getAgentServerClientOptions(),\n ).forkConversation<DirectConversationInfo>(sourceConversationId, {\n from_event_id: fromEventId,\n ...(title ? { title } : {}),\n } as ForkConversationRequest & { from_event_id: string });\n\n // Carry over the source's client-side metadata (repo/branch/workspace/\n // profile/plugins) so the fork hydrates its chat-page badges the same way.\n const sourceMetadata = getStoredConversationMetadata(sourceConversationId);\n if (sourceMetadata) {\n setStoredConversationMetadata(data.id, sourceMetadata);\n }\n\n return data;\n }\n\n /**\n * Returns an event's `parent_id` (the fork point for branching *before* it),\n * or undefined at the root. Uses the single-event endpoint because the events\n * *search* API omits `parent_id`.\n */\n static async getEventParentId(\n conversationId: string,\n eventId: string,\n ): Promise<string | undefined> {\n const event = (await new ConversationClient(\n getAgentServerClientOptions(),\n ).getEvent(conversationId, eventId)) as { parent_id?: string | null };\n return event.parent_id ?? undefined;\n }\n\n /**\n * Switches the LLM profile for the running conversation when one is open\n * (POST /switch_profile — per-conversation swap, doesn't change the user's\n * default profile). When called without a conversationId (home page),\n * falls back to POST /activate so the next conversation created picks up\n * the chosen profile.\n *\n * The per-conversation endpoint accepts only the profile name, so the UI does\n * not need to fetch or forward profile secrets. That keeps switching working\n * even when the agent server has no OH_SECRET_KEY for encrypted secret export.\n *\n * Cloud backends route to the app-server's per-conversation\n * `/switch_profile`, which owns the profiles and resolves the swap\n * server-side (base_url/api_key fixups, usage_id derivation, then the\n * agent-server's switch_llm) — so the client only forwards the profile name,\n * mirroring {@link switchAcpModel}.\n */\n static async switchProfile(\n conversationId: string | null,\n profileName: string,\n ): Promise<void> {\n const { backend } = getActiveBackend();\n\n if (backend.kind === \"cloud\") {\n // No conversation (home page): activate globally so the next\n // conversation starts with it. ProfilesService routes to the cloud\n // activate endpoint.\n if (!conversationId) {\n await ProfilesService.activateProfile(profileName);\n return;\n }\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_profile`,\n body: { profile_name: profileName },\n });\n return;\n }\n\n if (!conversationId) {\n await new ProfilesClient(getAgentServerClientOptions()).activateProfile(\n profileName,\n );\n return;\n }\n\n const clientOptions = getAgentServerClientOptions();\n const conversationClient = new ConversationClient(clientOptions);\n const profile = await new ProfilesClient(clientOptions).getProfile(\n profileName,\n { exposeSecrets: \"encrypted\" },\n );\n const model =\n typeof profile.config.model === \"string\" ? profile.config.model : \"\";\n if (!model) throw new Error(`Profile '${profileName}' has no model.`);\n await assertSubscriptionAuthReady({ llm: profile.config });\n await conversationClient.switchLLM(conversationId, {\n ...profile.config,\n model,\n // Keep streaming on after a switch (parity with conversation start);\n // the profile config would otherwise default it to stream=False.\n stream: true,\n // Avoid stale first-write-wins entries in the backend LLM registry.\n usage_id: `profile:${profileName}:${uuidv4()}`,\n } as LLMConfig);\n }\n\n /**\n * Switches the model of a running ACP conversation in place (POST\n * /switch_acp_model — the ACP analog of {@link switchProfile}'s /switch_profile).\n * The agent-server calls the ACP wrapper's ``session/set_model`` on the live\n * session, preserving context. Mirrors {@link switchProfile}'s\n * local-backend-only guard and per-conversation ConversationClient call.\n *\n * 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 const { backend } = getActiveBackend();\n if (backend.kind === \"cloud\") {\n await callCloudProxy({\n backend,\n method: \"POST\",\n path: `/api/v1/app-conversations/${conversationId}/switch_acp_model`,\n body: { model },\n });\n return;\n }\n\n await new ConversationClient(getAgentServerClientOptions()).switchAcpModel(\n conversationId,\n model,\n );\n }\n}\n\nexport default AgentServerConversationService;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuEA,IAAM,IAAiC,4BACjC,IACJ;AAGF,SAAS,IAAqC;AAC5C,QAAW,MAAM,EAAsC;;AAGzD,SAAS,EAAS,GAAkD;AAClE,QAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,EAAM;;AAG7E,SAAS,EAAa,GAA+B;AACnD,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EAAa,GAAwB;AAC5C,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EAAa,GAA+B;AACnD,QAAO,OAAO,KAAU,WAAW,IAAQ;;AAG7C,SAAS,EACP,GACA,GACA,GACQ;CACR,IAAM,IAAQ,EAAK,MAAa,EAAK;AACrC,QAAO,OAAO,KAAU,YAAY,EAAM,MAAM,GAC5C,IACA;;AAGN,SAAS,EACP,GACgE;AAGhE,QAFK,EAAS,EAAM,GAEb;EACL,eAAe,EAAa,EAAM,cAAc;EAChD,mBAAmB,EAAa,EAAM,kBAAkB;EACxD,mBAAmB,EAAa,EAAM,kBAAkB;EACxD,oBAAoB,EAAa,EAAM,mBAAmB;EAC1D,gBAAgB,EAAa,EAAM,eAAe;EAClD,gBAAgB,EAAa,EAAM,eAAe;EACnD,GAT4B;;AAY/B,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AAgB;GACjD,GAAG,EAAQ;GACX;GAGA,QAAQ;GAER,UAAU,WAAW,EAAY,GAAG,GAAQ;GAC7C,CAAc;;CAcjB,aAAa,eACX,GACA,GACe;EACf,IAAM,EAAE,eAAY,GAAkB;AACtC,MAAI,EAAQ,SAAS,SAAS;AAC5B,SAAM,EAAe;IACnB;IACA,QAAQ;IACR,MAAM,6BAA6B,EAAe;IAClD,MAAM,EAAE,UAAO;IAChB,CAAC;AACF;;AAGF,QAAM,IAAI,EAAmB,GAA6B,CAAC,CAAC,eAC1D,GACA,EACD"}
|
|
@@ -82,6 +82,10 @@ export interface AppConversationStartTaskPage {
|
|
|
82
82
|
export interface ConversationWorkspace {
|
|
83
83
|
working_dir: string | null;
|
|
84
84
|
}
|
|
85
|
+
export interface LaunchedAgentProfile {
|
|
86
|
+
agent_profile_id: string;
|
|
87
|
+
revision: number;
|
|
88
|
+
}
|
|
85
89
|
export interface AppConversation {
|
|
86
90
|
id: string;
|
|
87
91
|
created_by_user_id: string | null;
|
|
@@ -100,6 +104,7 @@ export interface AppConversation {
|
|
|
100
104
|
* carry the ACP subprocess model for display).
|
|
101
105
|
*/
|
|
102
106
|
agent_kind?: "openhands" | "acp" | null;
|
|
107
|
+
launched_agent_profile?: LaunchedAgentProfile | null;
|
|
103
108
|
/**
|
|
104
109
|
* For ACP conversations, the registry key of the ACP CLI server the
|
|
105
110
|
* conversation was launched against (e.g. ``"claude-code"``, ``"codex"``,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../node_modules/@openhands/typescript-client/dist/client/device-flow-client.cjs`),t=require(`./client-source.cjs`);function n(n){return e.startDeviceFlow(n,{headers:t.AGENT_CANVAS_CLIENT_HEADERS})}function r(n,r,i){return e.pollForToken(n,r,{...i,headers:t.AGENT_CANVAS_CLIENT_HEADERS})}exports.pollForToken=r,exports.startDeviceFlow=n;
|
|
2
2
|
//# sourceMappingURL=device-flow-client.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-flow-client.cjs","names":[],"sources":["../../src/api/device-flow-client.ts"],"sourcesContent":["/**\n * OAuth 2.0 Device Flow client implementation (RFC 8628).\n *\n * Used for one-click authentication with cloud backends.\n * The flow allows users to authenticate in their browser while the\n * application polls for the resulting API key.\n *\n * Device flow requests go directly to the configured OpenHands Cloud host.\n */\n\nexport class DeviceFlowError extends Error {\n constructor(\n message: string,\n public readonly code?: string,\n ) {\n super(message);\n this.name = \"DeviceFlowError\";\n }\n}\n\nexport interface DeviceAuthorizationResponse {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete: string;\n expires_in: number;\n interval: number;\n}\n\nexport interface DeviceTokenResponse {\n access_token: string;\n token_type: string;\n expires_in?: number;\n}\n\ninterface DeviceTokenErrorResponse {\n error: string;\n error_description?: string;\n interval?: number;\n}\n\nconst DEFAULT_TIMEOUT_MS = 600_000; // 10 minutes\nconst MAX_INTERVAL_MS = 30_000; // 30 seconds max polling interval\n\n/**\n * Check if a host is a known OpenHands Cloud domain.\n * Uses hostname extraction to prevent substring matching attacks.\n */\nexport function isOpenHandsCloudHost(host: string): boolean {\n try {\n // Extract hostname from URL or treat as hostname if no protocol\n const trimmed = host.trim().toLowerCase();\n const withProtocol = /^https?:\\/\\//i.test(trimmed)\n ? trimmed\n : `https://${trimmed}`;\n const url = new URL(withProtocol);\n const hostname = url.hostname;\n\n // Check if hostname ends with known domains (exact suffix match)\n return (\n hostname.endsWith(\".all-hands.dev\") ||\n hostname === \"all-hands.dev\" ||\n hostname.endsWith(\".openhands.dev\") ||\n hostname === \"openhands.dev\"\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Make a direct request to the OpenHands Cloud device-flow endpoint.\n */\nasync function makeCloudRequest(\n upstreamHost: string,\n method: \"GET\" | \"POST\",\n path: string,\n body?: unknown,\n contentType?: string,\n signal?: AbortSignal,\n): Promise<Response> {\n const requestBody =\n body === undefined\n ? undefined\n : typeof body === \"string\" ||\n body instanceof Blob ||\n body instanceof FormData ||\n body instanceof URLSearchParams\n ? body\n : JSON.stringify(body);\n\n const response = await fetch(`${upstreamHost.replace(/\\/+$/, \"\")}${path}`, {\n method,\n headers: {\n ...(contentType ? { \"Content-Type\": contentType } : {}),\n },\n body: requestBody,\n signal,\n });\n\n return response;\n}\n\n/**\n * Start the OAuth 2.0 Device Flow by requesting a device code.\n * Requests are sent directly to the cloud host.\n *\n * @param host - The cloud backend host URL (e.g., \"https://app.all-hands.dev\")\n * @returns DeviceAuthorizationResponse with device_code, user_code, verification URLs, etc.\n * @throws DeviceFlowError if the request fails\n */\nexport async function startDeviceFlow(\n host: string,\n): Promise<DeviceAuthorizationResponse> {\n const normalizedHost = host.replace(/\\/+$/, \"\");\n\n try {\n const response = await makeCloudRequest(\n normalizedHost,\n \"POST\",\n \"/oauth/device/authorize\",\n {},\n \"application/json\",\n );\n\n if (!response.ok) {\n // Avoid exposing sensitive server error details\n throw new DeviceFlowError(\n `Failed to start device flow: Server returned ${response.status}`,\n );\n }\n\n const data = await response.json();\n\n // Validate required fields per RFC 8628 Section 3.2\n // verification_uri_complete is OPTIONAL per RFC\n if (!data.device_code || !data.user_code || !data.verification_uri) {\n throw new DeviceFlowError(\n \"Invalid response from device authorization endpoint: missing required fields\",\n );\n }\n\n // Build verification_uri_complete if not provided (optional per RFC)\n const verificationUriComplete =\n data.verification_uri_complete ??\n `${data.verification_uri}?user_code=${encodeURIComponent(data.user_code)}`;\n\n return {\n device_code: data.device_code,\n user_code: data.user_code,\n verification_uri: data.verification_uri,\n verification_uri_complete: verificationUriComplete,\n expires_in: data.expires_in ?? 600,\n interval: data.interval ?? 5,\n };\n } catch (error) {\n if (error instanceof DeviceFlowError) {\n throw error;\n }\n throw new DeviceFlowError(\n `Failed to start device flow: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n}\n\nexport interface PollOptions {\n /** Polling interval in seconds (from device authorization response) */\n interval: number;\n /** Maximum time to wait for authorization in milliseconds */\n timeout?: number;\n /** Abort signal to cancel polling */\n signal?: AbortSignal;\n}\n\n/**\n * Poll for the API key after user authorization.\n * Requests are sent directly to the cloud host.\n *\n * @param host - The cloud backend host URL\n * @param deviceCode - The device code from startDeviceFlow\n * @param options - Polling options including interval, timeout, and abort signal\n * @returns DeviceTokenResponse containing the access_token (API key)\n * @throws DeviceFlowError if polling fails, user denies access, or timeout expires\n */\nexport async function pollForToken(\n host: string,\n deviceCode: string,\n options: PollOptions,\n): Promise<DeviceTokenResponse> {\n const normalizedHost = host.replace(/\\/+$/, \"\");\n const timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;\n let interval = Math.max(1, options.interval) * 1000; // At least 1 second\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n // Check if cancelled\n if (options.signal?.aborted) {\n throw new DeviceFlowError(\"Authorization cancelled\", \"cancelled\");\n }\n\n try {\n // RFC 8628 Section 3.4 requires grant_type parameter\n const tokenRequestBody = new URLSearchParams({\n grant_type: \"urn:ietf:params:oauth:grant-type:device_code\",\n device_code: deviceCode,\n }).toString();\n\n const response = await makeCloudRequest(\n normalizedHost,\n \"POST\",\n \"/oauth/device/token\",\n tokenRequestBody,\n \"application/x-www-form-urlencoded\",\n options.signal,\n );\n\n if (response.ok) {\n const data = await response.json();\n if (!data.access_token) {\n throw new DeviceFlowError(\n \"Invalid token response: missing access_token\",\n );\n }\n return {\n access_token: data.access_token,\n token_type: data.token_type ?? \"Bearer\",\n expires_in: data.expires_in,\n };\n }\n\n // Handle error responses\n let errorData: DeviceTokenErrorResponse;\n try {\n errorData = await response.json();\n } catch {\n throw new DeviceFlowError(\n `Unexpected response from server: ${response.status}`,\n );\n }\n\n const { error, error_description } = errorData;\n\n switch (error) {\n case \"authorization_pending\":\n // User hasn't finished yet; continue polling\n break;\n\n case \"slow_down\":\n // Server asks us to poll less frequently\n // RFC 8628 Section 3.5: \"the client MUST increase its polling interval by 5 seconds\"\n // Validate server-provided interval to prevent DoS (must be number, finite, positive)\n if (\n typeof errorData.interval === \"number\" &&\n isFinite(errorData.interval) &&\n errorData.interval > 0\n ) {\n interval = Math.max(1, Math.min(errorData.interval, 30)) * 1000;\n } else {\n // RFC 8628 mandates incrementing by 5 seconds\n interval = Math.min(interval + 5000, MAX_INTERVAL_MS);\n }\n break;\n\n case \"expired_token\":\n throw new DeviceFlowError(\n \"Device code has expired. Please try again.\",\n \"expired_token\",\n );\n\n case \"access_denied\":\n throw new DeviceFlowError(\n \"Authorization request was denied.\",\n \"access_denied\",\n );\n\n default:\n throw new DeviceFlowError(\n `Authorization error: ${error}${error_description ? ` - ${error_description}` : \"\"}`,\n error,\n );\n }\n } catch (error) {\n // DeviceFlowError means a definitive error (denied, expired, etc.) - rethrow\n if (error instanceof DeviceFlowError) {\n throw error;\n }\n // User cancelled - rethrow\n if (error instanceof DOMException && error.name === \"AbortError\") {\n throw new DeviceFlowError(\"Authorization cancelled\", \"cancelled\");\n }\n // Network errors during polling should continue until timeout, not fail immediately\n // Brief network hiccups shouldn't abort 10-minute flows\n console.warn(\"Network error during polling, retrying:\", error);\n }\n\n // Wait before next poll (wrap in try-catch for consistent abort handling)\n try {\n await sleep(interval, options.signal);\n } catch (error) {\n if (error instanceof DOMException && error.name === \"AbortError\") {\n throw new DeviceFlowError(\"Authorization cancelled\", \"cancelled\");\n }\n throw error;\n }\n }\n\n throw new DeviceFlowError(\n \"Timeout waiting for authorization. Please try again.\",\n \"timeout\",\n );\n}\n\n/**\n * Sleep for a given duration, respecting an optional abort signal.\n */\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n return;\n }\n\n const timeoutId = setTimeout(resolve, ms);\n\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timeoutId);\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n },\n { once: true },\n );\n });\n}\n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6CACA,gBACD,CAEH,IAAK,gBACH,MAAM,IAAI,EACR,oCACA,gBACD,CAEH,QACE,MAAM,IAAI,EACR,wBAAwB,IAAQ,EAAoB,MAAM,IAAsB,KAChF,EACD,QAEE,EAAO,CAEd,GAAI,aAAiB,EACnB,MAAM,EAGR,GAAI,aAAiB,cAAgB,EAAM,OAAS,aAClD,MAAM,IAAI,EAAgB,0BAA2B,YAAY,CAInE,QAAQ,KAAK,0CAA2C,EAAM,CAIhE,GAAI,CACF,MAAM,EAAM,EAAU,EAAQ,OAAO,OAC9B,EAAO,CAId,MAHI,aAAiB,cAAgB,EAAM,OAAS,aAC5C,IAAI,EAAgB,0BAA2B,YAAY,CAE7D,GAIV,MAAM,IAAI,EACR,uDACA,UACD,CAMH,SAAS,EAAM,EAAY,EAAqC,CAC9D,OAAO,IAAI,SAAS,EAAS,IAAW,CACtC,GAAI,GAAQ,QAAS,CACnB,EAAO,IAAI,aAAa,UAAW,aAAa,CAAC,CACjD,OAGF,IAAM,EAAY,WAAW,EAAS,EAAG,CAEzC,GAAQ,iBACN,YACM,CACJ,aAAa,EAAU,CACvB,EAAO,IAAI,aAAa,UAAW,aAAa,CAAC,EAEnD,CAAE,KAAM,GAAM,CACf,EACD"}
|
|
1
|
+
{"version":3,"file":"device-flow-client.cjs","names":[],"sources":["../../src/api/device-flow-client.ts"],"sourcesContent":["import {\n pollForToken as sdkPollForToken,\n startDeviceFlow as sdkStartDeviceFlow,\n} from \"@openhands/typescript-client/client/device-flow-client\";\nimport type {\n DeviceAuthorizationResponse,\n DeviceTokenResponse,\n PollDeviceTokenOptions,\n} from \"@openhands/typescript-client/client/device-flow-client\";\nimport { AGENT_CANVAS_CLIENT_HEADERS } from \"./client-source\";\n\nexport {\n DeviceFlowError,\n isOpenHandsCloudHost,\n} from \"@openhands/typescript-client/client/device-flow-client\";\n\nexport function startDeviceFlow(\n host: string,\n): Promise<DeviceAuthorizationResponse> {\n return sdkStartDeviceFlow(host, { headers: AGENT_CANVAS_CLIENT_HEADERS });\n}\n\nexport function pollForToken(\n host: string,\n deviceCode: string,\n options: PollDeviceTokenOptions,\n): Promise<DeviceTokenResponse> {\n return sdkPollForToken(host, deviceCode, {\n ...options,\n headers: AGENT_CANVAS_CLIENT_HEADERS,\n });\n}\n\nexport type {\n DeviceAuthorizationResponse,\n DeviceTokenResponse,\n PollDeviceTokenOptions as PollOptions,\n} from \"@openhands/typescript-client/client/device-flow-client\";\n"],"mappings":"iLAgBA,SAAgB,EACd,EACsC,CACtC,OAAO,EAAA,gBAAmB,EAAM,CAAE,QAAS,EAAA,4BAA6B,CAAC,CAG3E,SAAgB,EACd,EACA,EACA,EAC8B,CAC9B,OAAO,EAAA,aAAgB,EAAM,EAAY,CACvC,GAAG,EACH,QAAS,EAAA,4BACV,CAAC"}
|