@openhands/agent-canvas 1.15.0 → 1.16.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 +15 -1
- package/README.windows.md +2 -2
- package/build/assets/{acp-providers-BKvmTf82.js → acp-providers-CX3Lh9gj.js} +1 -1
- package/build/assets/active-backend-context-CrHTlgvN.js +2 -0
- package/build/assets/{agent-context-settings-D3PjSTU1.js → agent-context-settings-DSZlXrLj.js} +1 -1
- package/build/assets/{agent-profiles-settings-D4cY5U2T.js → agent-profiles-settings-Dzgb7G9z.js} +1 -1
- package/build/assets/agent-server-conversation-service.api-tnqNjbpE.js +86 -0
- package/build/assets/agent-settings-DLtsqaOs.js +2 -0
- package/build/assets/agent-settings-fFvR-XC2.js +1 -0
- package/build/assets/alert-banner-HP6mX-Vr.js +1 -0
- package/build/assets/{api-error-message-BJyfWp6p.js → api-error-message-B-XdSk3b.js} +1 -1
- package/build/assets/api-key-entry-screen-qTzrmJcr.js +1 -0
- package/build/assets/{app-settings-CbHqzQus.js → app-settings-dbnneVaV.js} +1 -1
- package/build/assets/automation-detail-BmwlCUAB.js +3 -0
- package/build/assets/{automation-export-BRopEHMu.js → automation-export-D3a3of4G.js} +1 -1
- package/build/assets/{automation-git-sync-CzyS4cn1.js → automation-git-sync-CprN5DcU.js} +1 -1
- package/build/assets/automation-setup-route-C40kXjMY.js +1 -0
- package/build/assets/{automation-templates-C_0FZgLG.js → automation-templates-BRppNh99.js} +1 -1
- package/build/assets/automations-list-DuNcRawl.js +1 -0
- package/build/assets/{back-nav-button-Dm9tIjVf.js → back-nav-button-Cjl_hoxq.js} +1 -1
- package/build/assets/backend-form-modal-lhGwzXFI.js +1 -0
- package/build/assets/{backend-synced-settings-badge-3fOwg6Bd.js → backend-synced-settings-badge-DPkz30BE.js} +1 -1
- package/build/assets/{badge-D4SqUCsR.js → badge-BU3S0VtE.js} +1 -1
- package/build/assets/{base-modal-C7_BDl_U.js → base-modal-D_L0oEbG.js} +1 -1
- package/build/assets/{bot-C-0Wu7vQ.js → bot-dMYHVfYM.js} +1 -1
- package/build/assets/{brand-button-Dxv6PDeN.js → brand-button-BAfk4wGP.js} +1 -1
- package/build/assets/browser-DSAo0tz1.js +46 -0
- package/build/assets/{browser-tab-BAl4ckJE.js → browser-tab-C9vy56R5.js} +1 -1
- package/build/assets/canvas-extension-page-dx1gFrfW.js +1 -0
- package/build/assets/canvas-extensions-8A-XhpgP.js +1 -0
- package/build/assets/canvas-extensions-runtime-2_x5Ezmi.js +1 -0
- package/build/assets/{chat-send-button-DWwR2cgI.js → chat-send-button-MUQqCZCS.js} +1 -1
- package/build/assets/check-CS0vmpQQ.js +1 -0
- package/build/assets/chevron-down-e1QBpjVy.js +1 -0
- package/build/assets/chevron-right-ZG4R5G4Q.js +1 -0
- package/build/assets/circle-check-DzWLNsbE.js +1 -0
- package/build/assets/{circle-plus-check-toggle-CBh_qomE.js → circle-plus-check-toggle-BO_kFZt3.js} +1 -1
- package/build/assets/{cloud-funnel-analytics-287iIERo.js → cloud-funnel-analytics-CztBCCPp.js} +1 -1
- package/build/assets/{cog-C4rrw-ZK.js → cog-D-MPQW6G.js} +1 -1
- package/build/assets/command-menu--UIlGL72.js +1 -0
- package/build/assets/{commits-tab-DZtJgaDM.js → commits-tab-AnZwLvh-.js} +1 -1
- package/build/assets/{condenser-settings-BcNmYR4s.js → condenser-settings-DmEOje-7.js} +1 -1
- package/build/assets/{confirmation-modal-Bk4JRcCM.js → confirmation-modal-Dv1ktp8K.js} +1 -1
- package/build/assets/{context-menu-list-item-lVYETtY5.js → context-menu-list-item-I86vKcmM.js} +1 -1
- package/build/assets/conversation-BbGrAO4Z.js +93 -0
- package/build/assets/conversation-mYT6NAoj.js +1 -0
- package/build/assets/conversation-panel-mYT6NAoj.js +1 -0
- package/build/assets/conversation-state-store-B0ImPLHO.js +1 -0
- package/build/assets/{conversation-tab-empty-state-HJtkmHZj.js → conversation-tab-empty-state-FIbh_lc8.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-Cjkswvnj.js → copy-to-clipboard-button-Ca8iSkkA.js} +1 -1
- package/build/assets/{device-verify-EZhHhBT7.js → device-verify-Bhn2e_Ye.js} +1 -1
- package/build/assets/{dropdown-classes-DJe-E6MC.js → dropdown-classes-Bc1djN0-.js} +1 -1
- package/build/assets/{edit-automation-modal-D-urtv8n.js → edit-automation-modal-DadGbJ2u.js} +1 -1
- package/build/assets/empty-state-BoGVDecT.js +1 -0
- package/build/assets/{entry.client-C7Bi2tkU.js → entry.client-CqyPPjOq.js} +2 -2
- package/build/assets/{enum-filter-dropdown-DliX_Lo0.js → enum-filter-dropdown-Bgca129f.js} +1 -1
- package/build/assets/{environment-switch-overlay-CEKrFiMw.js → environment-switch-overlay-BmBRT7gv.js} +1 -1
- package/build/assets/{error-state-BALXiBNy.js → error-state-Body8Ngd.js} +1 -1
- package/build/assets/extensions-hub-CcDqq_vR.js +1 -0
- package/build/assets/extensions-navigation-Cr4yzYk4.js +1 -0
- package/build/assets/{external-link-DFpYunfj.js → external-link-DKUlnCQV.js} +1 -1
- package/build/assets/files-tab-D4o2VyE_.js +1 -0
- package/build/assets/{form-control-classes-CGw40z5h.js → form-control-classes-Bkh5FGrD.js} +1 -1
- package/build/assets/format-model-name-CasAP3nd.js +1 -0
- package/build/assets/get-git-path-ChKDVHZp.js +1 -0
- package/build/assets/{git-repo-dropdown-ai8qaNkD.js → git-repo-dropdown-4ROKl2cB.js} +1 -1
- package/build/assets/git-repo-dropdown-BkqzkMmM.js +1 -0
- package/build/assets/{highlighted-source-view-C3sxykQi.js → highlighted-source-view-BFRxGT_Q.js} +1 -1
- package/build/assets/home-ChpSuepX.js +1 -0
- package/build/assets/home-DIsB440S.js +1 -0
- package/build/assets/home-automation-run-tooltip-BVNDWjAH.js +1 -0
- package/build/assets/home-store-CY9Ej0ux.js +1 -0
- package/build/assets/index-home-BdlrFIif.js +1 -0
- package/build/assets/info-B6RQawoW.js +1 -0
- package/build/assets/install-server-modal-Dpy89p4g.js +1 -0
- package/build/assets/kebab-menu-item-content-D8hSNGmm.js +1 -0
- package/build/assets/{key-Cn5za3rg.js → key-BmVyxs-2.js} +1 -1
- package/build/assets/{launch-C1ieiOGe.js → launch-IrTDEFCs.js} +1 -1
- package/build/assets/list-filter-DsEK7NFC.js +1 -0
- package/build/assets/{list-todo-Cuu-STFc.js → list-todo-apgLVjMw.js} +1 -1
- package/build/assets/llm-not-configured-banner-CIFABh3K.js +27 -0
- package/build/assets/llm-settings-B9juXhIa.js +1 -0
- package/build/assets/llm-settings-De1d5dfr.js +1 -0
- package/build/assets/llm-subscription-service-BpJ0ouQo.js +1 -0
- package/build/assets/loader-circle-CC1au6hc.js +1 -0
- package/build/assets/{loading-spinner-0L3ZTToZ.js → loading-spinner-BY9N3pOe.js} +1 -1
- package/build/assets/manage-backends-modal-BrPV3oB-.js +1 -0
- package/build/assets/manifest-80fb1c29.js +1 -0
- package/build/assets/{manifest-subpage-layout-BGhiUQbA.js → manifest-subpage-layout-CAOYzrYp.js} +1 -1
- package/build/assets/{map-provider-B9LTm23I.js → map-provider-Cu3Zgumb.js} +1 -1
- package/build/assets/markdown-renderer-BzTlxI8x.js +8 -0
- package/build/assets/{mcp-CKbR4Vft.js → mcp-BTs_SXfZ.js} +1 -1
- package/build/assets/{mcp-marketplace-utils-C13fFccR.js → mcp-marketplace-utils-AIBzzHTO.js} +1 -1
- package/build/assets/{mcp-page-Bm4K2NQq.js → mcp-page-BEBYqH_K.js} +2 -2
- package/build/assets/messages-DKV9cRc2.js +41 -0
- package/build/assets/{modal-body-CMOc2tLl.js → modal-body-BxZjsju9.js} +1 -1
- package/build/assets/{modal-classes-BAb4Y_BG.js → modal-classes-C8eycCwG.js} +1 -1
- package/build/assets/{modal-close-button-CkJ0Ktjj.js → modal-close-button-DDzdRvCs.js} +1 -1
- package/build/assets/{mouse-pointer-click-CsgRs_-r.js → mouse-pointer-click-Co2uyaPA.js} +1 -1
- package/build/assets/onboarding-DV_OXoeP.js +1 -0
- package/build/assets/onboarding-modal-rkyBYkeQ.js +1 -0
- package/build/assets/{organization-service.api-C8XpQ0pM.js → organization-service.api-DrYNkEN_.js} +1 -1
- package/build/assets/{pencil-Clh1Wjvh.js → pencil-47jAZH_V.js} +1 -1
- package/build/assets/pin-By41Vl5J.js +1 -0
- package/build/assets/{planner-tab-DQvDU3ap.js → planner-tab-C9uZmhme.js} +1 -1
- package/build/assets/{plug-BuQhHSSG.js → plug-CG5HFcNG.js} +1 -1
- package/build/assets/plugins-management-service-BMJgC3Ga.js +1 -0
- package/build/assets/plus-C7Slq-0I.js +1 -0
- package/build/assets/profiles-service.api-ChoKrL0l.js +1 -0
- package/build/assets/providers-BhMcY5nv.js +1 -0
- package/build/assets/proxy-9Fe1v5na.js +1 -0
- package/build/assets/{puzzle-A9pGxxai.js → puzzle-JM_QaRm0.js} +1 -1
- package/build/assets/recommended-automations-launcher-6ABrI9Cy.js +1 -0
- package/build/assets/{refresh-cw-Bh69DyYO.js → refresh-cw-3q3Frrii.js} +1 -1
- package/build/assets/root-Dc8YmC9F.js +2 -0
- package/build/assets/root-VDaypvK4.css +1 -0
- package/build/assets/root-layout-CXkhSPYh.js +2 -0
- package/build/assets/schema-field-D-y9-LDb.js +1 -0
- package/build/assets/{sdk-section-page-HTffvm7Q.js → sdk-section-page-BlFiizlG.js} +1 -1
- package/build/assets/{secret-form-HTUbYw5o.js → secret-form-BB7the8W.js} +1 -1
- package/build/assets/secrets-service-ByZVENbp.js +1 -0
- package/build/assets/{secrets-settings-BizaTEr1.js → secrets-settings-B_GpxKW2.js} +1 -1
- package/build/assets/{settings-BlmrkwRi.js → settings-C0EWuBtA.js} +1 -1
- package/build/assets/settings-CKqk8ZnH.js +1 -0
- package/build/assets/{settings-dropdown-input-tM0A0ipy.js → settings-dropdown-input-BcwylHs2.js} +1 -1
- package/build/assets/{settings-index-CKq0b0Vg.js → settings-index-5w5UW2K3.js} +1 -1
- package/build/assets/{settings-input-C03KUoSC.js → settings-input-Db-1g8Ql.js} +1 -1
- package/build/assets/{settings-list-classes-BJ0g8rWj.js → settings-list-classes-BzeSZbF2.js} +1 -1
- package/build/assets/{settings-modal-AzEF1QPP.js → settings-modal-DfJ3tcJQ.js} +1 -1
- package/build/assets/settings-service.api-DJ1r62Zr.js +1 -0
- package/build/assets/{settings-switch-CQE0EGC-.js → settings-switch-CS-dJDmA.js} +1 -1
- package/build/assets/{settings-utils-ClYOkbbI.js → settings-utils-UYpEdPuD.js} +1 -1
- package/build/assets/shared-conversation-CA5ISEDy.js +1 -0
- package/build/assets/{shield-check-CFDViW82.js → shield-check-D2aCRd16.js} +1 -1
- package/build/assets/{sidebar-layout-D3hE08wK.js → sidebar-layout-D6fS8-Gl.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-BOtyJHwE.js → sidebar-mobile-menu-toggle-C_fb0Jki.js} +1 -1
- package/build/assets/sidebar-nav-link-DQQcMf1A.js +1 -0
- package/build/assets/{sidebar-onboarding-checklist-storage-3qYflszY.js → sidebar-onboarding-checklist-storage-BBkeI6Bp.js} +1 -1
- package/build/assets/sidebar-store-DGqHkVLw.js +1 -0
- package/build/assets/{skill-card-pill-row-CFxjoqxn.js → skill-card-pill-row-B27-xyig.js} +1 -1
- package/build/assets/skill-enablement-DXeaImBz.js +1 -0
- package/build/assets/skill-filter-w__3UCEE.js +2 -0
- package/build/assets/{skill-icon-badge-CPQJ6A-I.js → skill-icon-badge-RQkq8wvl.js} +1 -1
- package/build/assets/skill-scope-B42H-XOc.js +1 -0
- package/build/assets/skills-plugins-tgF8EiXC.js +1 -0
- package/build/assets/skills-settings-BgJ9PaOe.js +1 -0
- package/build/assets/{styled-tooltip-Dl06rkpY.js → styled-tooltip-C4jf5Fv9.js} +1 -1
- package/build/assets/{task-list-tab-04GNQuii.js → task-list-tab-C5zcaktH.js} +1 -1
- package/build/assets/{terminal-Cj0iHIW7.js → terminal-CNElN42a.js} +2 -2
- package/build/assets/{toggle-switch-Fd_QGz0r.js → toggle-switch-ChOLXv2n.js} +1 -1
- package/build/assets/{trash-2-Dl8_RGz0.js → trash-2-D7K26eDO.js} +1 -1
- package/build/assets/{trash-_RMt7Ayc.js → trash-D-HYiVYM.js} +1 -1
- package/build/assets/{triangle-alert-SM-q4NU_.js → triangle-alert-CtdXWHUI.js} +1 -1
- package/build/assets/{typography-SgFy466J.js → typography-v1KN0tzi.js} +1 -1
- package/build/assets/usage-tab-CVDffLPt.js +1 -0
- package/build/assets/use-acp-credential-form-XIQmpX6M.js +1 -0
- package/build/assets/{use-activate-agent-profile-B2NS8nA5.js → use-activate-agent-profile-BLfmvDiG.js} +1 -1
- package/build/assets/use-agent-profiles-Bd9Bvvp1.js +1 -0
- package/build/assets/{use-automation-health-BxXdzZMP.js → use-automation-health-E6NZi9rb.js} +1 -1
- package/build/assets/{use-automations-zYb0dUny.js → use-automations-xijQKIl9.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-BWMahtUh.js → use-can-manage-org-profiles-CrJP5262.js} +1 -1
- package/build/assets/use-canvas-extensions-Bi693ujJ.js +1 -0
- package/build/assets/{use-cloud-current-user-id-CPHMDG-C.js → use-cloud-current-user-id-CDfAHpPX.js} +1 -1
- package/build/assets/use-config-A9QovgXO.js +1 -0
- package/build/assets/{use-create-conversation-DwN5vv2f.js → use-create-conversation-Dx3l7mFZ.js} +1 -1
- package/build/assets/use-create-secret-B9cUFWRG.js +1 -0
- package/build/assets/{use-get-secrets-BT4ihRwj.js → use-get-secrets-K3jmk-LH.js} +1 -1
- package/build/assets/use-is-authed-nTBcM7dE.js +1 -0
- package/build/assets/use-llm-configured-BV9nZ1_j.js +1 -0
- package/build/assets/use-llm-profiles-BO-P4Oyo.js +1 -0
- package/build/assets/use-manifest-capabilities-Cw_flwEz.js +1 -0
- package/build/assets/use-onboarding-completion-D8U7k4Qb.js +1 -0
- package/build/assets/use-pinned-home-route-CckOZrmb.js +1 -0
- package/build/assets/use-plugins-marketplace-7i94Zu3Z.js +1 -0
- package/build/assets/use-save-agent-profile-BUjSsDXK.js +1 -0
- package/build/assets/{use-save-settings-CUZW6yXP.js → use-save-settings-DYqkKv7T.js} +1 -1
- package/build/assets/{use-settings-C5VhGpqd.js → use-settings-DSXLbvBl.js} +1 -1
- package/build/assets/{use-settings-nav-items-DHaUu1Dg.js → use-settings-nav-items-CwRw-CmX.js} +1 -1
- package/build/assets/use-tracking-D53y3TH9.js +3 -0
- package/build/assets/{use-user-conversation-DT0_QCnL.js → use-user-conversation-B9Gebw_g.js} +1 -1
- package/build/assets/{useInfiniteQuery-CgeUQPfs.js → useInfiniteQuery-C926xzY4.js} +1 -1
- package/build/assets/{useMutation-DFnzkf6f.js → useMutation-B-qc391N.js} +1 -1
- package/build/assets/{useQueries-BhbrGEf1.js → useQueries-DlbhlH9I.js} +1 -1
- package/build/assets/{useQuery-BXWbZBZl.js → useQuery-BSTgq1rl.js} +1 -1
- package/build/assets/utils-CN5ZfZy1.js +1 -0
- package/build/assets/{vendor~conversation-panel~conversation-CTvDDiXg.js → vendor~conversation-panel~conversation-C8Fn4XOf.js} +1 -1
- package/build/assets/{vendor~entry.client-BFE7Llz9.js → vendor~entry.client-CoCfUXUF.js} +1 -1
- package/build/assets/{vendor~entry.client-BaKt_PIp.js → vendor~entry.client-DA2izTjq.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~kepq2zme-ZixYGy6E.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-DqZDXfg2.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation-BTyukeM-.js → vendor~index-home~home~conversation-panel~conversation-hWywRBaR.js} +1 -1
- package/build/assets/{vendor~root-layout-BlUaZ18v.js → vendor~root-layout-C9Ju9DQg.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation-BYAWJwQX.js → vendor~root-layout~conversation-panel~conversation-BMbMgaGu.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~skills-settings~automations-list~shared-~bovqqk8e-CHaLEBVR.js → vendor~root-layout~conversation-panel~conversation~skills-settings~automations-list~shared-~bovqqk8e-BWir3rJs.js} +1 -1
- package/build/assets/vendor~root-layout~index-home~home~conversation-panel~conversation-j5MFqfSy.js +1 -0
- package/build/assets/vendor~root-layout~index-home~home~conversation-panel~conversation~mcp~automations-list~aut~ibfbmr9f-cDuKr-WD.js +1 -0
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~iw7io29p-Dz-MAyNb.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~iyia17eu-Chf7vmKB.js} +1 -1
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hjcjabwg-Dtu7BpYk.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~nj1hli3r-DP9wmsjo.js} +2 -2
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-DonTKfQD.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-CUmIwQCN.js} +117 -13
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~jz4f6vo2-BgxDvUcf.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~jz4f6vo2-C7HiY4Ae.js} +42 -3
- package/build/assets/{verification-settings-Bj6bo097.js → verification-settings-gw_q6vkL.js} +1 -1
- package/build/assets/{wrench-hi7Q13dF.js → wrench-CUEI1krB.js} +1 -1
- package/build/assets/{x-DkgltWa0.js → x-DJdhbdmt.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +32 -16
- package/build/locales/ca/openhands.json +32 -16
- package/build/locales/de/openhands.json +32 -16
- package/build/locales/en/openhands.json +32 -16
- package/build/locales/es/openhands.json +32 -16
- package/build/locales/fr/openhands.json +32 -16
- package/build/locales/it/openhands.json +32 -16
- package/build/locales/ja/openhands.json +32 -16
- package/build/locales/ko-KR/openhands.json +32 -16
- package/build/locales/no/openhands.json +32 -16
- package/build/locales/pt/openhands.json +32 -16
- package/build/locales/tr/openhands.json +32 -16
- package/build/locales/uk/openhands.json +32 -16
- package/build/locales/zh-CN/openhands.json +32 -16
- package/build/locales/zh-TW/openhands.json +32 -16
- package/config/defaults.json +9 -5
- package/dist/api/agent-profiles-service/profile-field-support.d.ts +26 -0
- 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.js +118 -116
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/api/agent-server-compatibility.cjs +1 -1
- package/dist/api/agent-server-compatibility.cjs.map +1 -1
- package/dist/api/agent-server-compatibility.d.ts +21 -0
- package/dist/api/agent-server-compatibility.js +52 -38
- package/dist/api/agent-server-compatibility.js.map +1 -1
- package/dist/api/agent-server-config.cjs +1 -1
- package/dist/api/agent-server-config.cjs.map +1 -1
- package/dist/api/agent-server-config.d.ts +26 -0
- package/dist/api/agent-server-config.js +18 -5
- package/dist/api/agent-server-config.js.map +1 -1
- package/dist/api/canvas-extensions-service.cjs +1 -0
- package/dist/api/canvas-extensions-service.d.ts +22 -0
- package/dist/api/canvas-extensions-service.js +4 -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.d.ts +6 -0
- package/dist/api/cloud/conversation-service.api.js +14 -6
- package/dist/api/cloud/conversation-service.api.js.map +1 -1
- package/dist/api/conversation-file-upload.api.cjs +1 -1
- package/dist/api/conversation-file-upload.api.js +10 -10
- 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 +11 -0
- package/dist/api/conversation-service/agent-server-conversation-service.api.js +129 -118
- package/dist/api/conversation-service/agent-server-conversation-service.api.js.map +1 -1
- package/dist/api/event-service/event-service.api.cjs +1 -1
- package/dist/api/event-service/event-service.api.js +12 -12
- package/dist/api/git-service/agent-server-git-service.api.cjs +1 -1
- package/dist/api/git-service/agent-server-git-service.api.js +8 -8
- package/dist/api/runtime-service/agent-server-runtime-service.cjs +1 -1
- package/dist/api/runtime-service/agent-server-runtime-service.js +8 -8
- package/dist/api/settings-service/settings-service.api.cjs +1 -1
- package/dist/api/settings-service/settings-service.api.cjs.map +1 -1
- package/dist/api/settings-service/settings-service.api.d.ts +3 -2
- package/dist/api/settings-service/settings-service.api.js +2 -1
- package/dist/api/settings-service/settings-service.api.js.map +1 -1
- package/dist/components/conversation-events/chat/event-message-components/event-group.cjs +1 -1
- package/dist/components/conversation-events/chat/event-message-components/event-group.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-message-components/event-group.js +40 -36
- package/dist/components/conversation-events/chat/event-message-components/event-group.js.map +1 -1
- package/dist/components/features/automations/automation-card.cjs +1 -1
- package/dist/components/features/automations/automation-card.cjs.map +1 -1
- package/dist/components/features/automations/automation-card.js +114 -104
- package/dist/components/features/automations/automation-card.js.map +1 -1
- package/dist/components/features/automations/detail/run-phase.cjs +2 -0
- package/dist/components/features/automations/detail/run-phase.cjs.map +1 -0
- package/dist/components/features/automations/detail/run-phase.d.ts +89 -0
- package/dist/components/features/automations/detail/run-phase.js +72 -0
- package/dist/components/features/automations/detail/run-phase.js.map +1 -0
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.js +5 -11
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/canvas-extensions/add-canvas-extension-modal.d.ts +6 -0
- package/dist/components/features/canvas-extensions/canvas-extension-card.d.ts +9 -0
- package/dist/components/features/canvas-extensions/canvas-extensions-runtime.cjs +2 -0
- package/dist/components/features/canvas-extensions/canvas-extensions-runtime.cjs.map +1 -0
- package/dist/components/features/canvas-extensions/canvas-extensions-runtime.d.ts +23 -0
- package/dist/components/features/canvas-extensions/canvas-extensions-runtime.js +19 -0
- package/dist/components/features/canvas-extensions/canvas-extensions-runtime.js.map +1 -0
- 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 +171 -168
- package/dist/components/features/chat/chat-interface.js.map +1 -1
- package/dist/components/features/chat/chat-markdown-path-code.cjs +3 -0
- package/dist/components/features/chat/chat-markdown-path-code.cjs.map +1 -0
- package/dist/components/features/chat/chat-markdown-path-code.d.ts +27 -0
- package/dist/components/features/chat/chat-markdown-path-code.js +72 -0
- package/dist/components/features/chat/chat-markdown-path-code.js.map +1 -0
- package/dist/components/features/chat/path-component.cjs +1 -1
- package/dist/components/features/chat/path-component.cjs.map +1 -1
- package/dist/components/features/chat/path-component.d.ts +8 -2
- package/dist/components/features/chat/path-component.js +33 -21
- package/dist/components/features/chat/path-component.js.map +1 -1
- package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.cjs +1 -1
- package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.cjs.map +1 -1
- package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.js +38 -43
- package/dist/components/features/chat/tool-visualizers/file-editor/file-editor.js.map +1 -1
- package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.cjs +1 -1
- package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.cjs.map +1 -1
- package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.d.ts +8 -5
- package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.js +22 -16
- package/dist/components/features/chat/tool-visualizers/primitives/file-path-chip.js.map +1 -1
- package/dist/components/features/chat/user-message-body.cjs +1 -1
- package/dist/components/features/chat/user-message-body.cjs.map +1 -1
- package/dist/components/features/chat/user-message-body.d.ts +4 -0
- package/dist/components/features/chat/user-message-body.js +30 -24
- package/dist/components/features/chat/user-message-body.js.map +1 -1
- package/dist/components/features/conversation/conversation-overview-skills-panel.cjs +1 -1
- package/dist/components/features/conversation/conversation-overview-skills-panel.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-overview-skills-panel.js +63 -81
- package/dist/components/features/conversation/conversation-overview-skills-panel.js.map +1 -1
- package/dist/components/features/conversation/conversation-tabs/conversation-tabs.cjs +1 -1
- package/dist/components/features/conversation/conversation-tabs/conversation-tabs.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-tabs/conversation-tabs.js +50 -50
- package/dist/components/features/conversation/conversation-tabs/conversation-tabs.js.map +1 -1
- package/dist/components/features/conversation/conversation-tabs/drawer-vscode-link.cjs +1 -1
- package/dist/components/features/conversation/conversation-tabs/drawer-vscode-link.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-tabs/drawer-vscode-link.d.ts +1 -1
- package/dist/components/features/conversation/conversation-tabs/drawer-vscode-link.js +3 -3
- package/dist/components/features/conversation/conversation-tabs/drawer-vscode-link.js.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs +1 -1
- package/dist/components/features/conversation-panel/skills-modal.cjs.map +1 -1
- package/dist/components/features/conversation-panel/skills-modal.js +29 -28
- package/dist/components/features/conversation-panel/skills-modal.js.map +1 -1
- package/dist/components/features/files-tab/file-content-viewer.cjs +1 -1
- package/dist/components/features/files-tab/file-content-viewer.js +5 -5
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.cjs +1 -1
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.cjs.map +1 -1
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.js +51 -29
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.js.map +1 -1
- package/dist/components/features/onboarding/onboarding-host.d.ts +3 -4
- package/dist/components/features/onboarding/steps/setup-llm-step.d.ts +5 -9
- package/dist/components/features/settings/acp-auth-status-banner.d.ts +23 -6
- package/dist/components/features/settings/llm-profiles/llm-settings-local-view.cjs +1 -1
- package/dist/components/features/settings/llm-profiles/llm-settings-local-view.js +1 -0
- package/dist/components/features/settings/llm-profiles/provider-connection-modal.cjs +1 -1
- package/dist/components/features/settings/llm-profiles/provider-connection-modal.js +3 -0
- package/dist/components/features/settings/sdk-settings/field-help.cjs +1 -1
- package/dist/components/features/settings/sdk-settings/field-help.cjs.map +1 -1
- package/dist/components/features/settings/sdk-settings/field-help.d.ts +1 -1
- package/dist/components/features/settings/sdk-settings/field-help.js +1 -1
- package/dist/components/features/settings/sdk-settings/field-help.js.map +1 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.cjs +1 -1
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js +6 -6
- package/dist/components/features/settings/sdk-settings/sdk-section-page.js.map +1 -1
- package/dist/components/features/sidebar/sidebar-nav-link.cjs +1 -1
- package/dist/components/features/sidebar/sidebar-nav-link.cjs.map +1 -1
- package/dist/components/features/sidebar/sidebar-nav-link.d.ts +10 -1
- package/dist/components/features/sidebar/sidebar-nav-link.js +54 -36
- package/dist/components/features/sidebar/sidebar-nav-link.js.map +1 -1
- package/dist/components/features/sidebar/sidebar-rail-body.cjs +1 -1
- package/dist/components/features/sidebar/sidebar-rail-body.cjs.map +1 -1
- package/dist/components/features/sidebar/sidebar-rail-body.js +143 -120
- package/dist/components/features/sidebar/sidebar-rail-body.js.map +1 -1
- package/dist/components/features/sidebar/sidebar.cjs +1 -1
- package/dist/components/features/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/features/sidebar/sidebar.js +1 -1
- package/dist/components/features/sidebar/sidebar.js.map +1 -1
- package/dist/components/features/skills/build-skill-pills.cjs +1 -1
- package/dist/components/features/skills/build-skill-pills.cjs.map +1 -1
- package/dist/components/features/skills/build-skill-pills.js +60 -52
- package/dist/components/features/skills/build-skill-pills.js.map +1 -1
- package/dist/components/features/skills/extensions-navigation.cjs +1 -1
- package/dist/components/features/skills/extensions-navigation.cjs.map +1 -1
- package/dist/components/features/skills/extensions-navigation.js +54 -43
- package/dist/components/features/skills/extensions-navigation.js.map +1 -1
- package/dist/components/features/skills/skill-filter.cjs +1 -1
- package/dist/components/features/skills/skill-filter.cjs.map +1 -1
- package/dist/components/features/skills/skill-filter.d.ts +8 -3
- package/dist/components/features/skills/skill-filter.js +69 -52
- package/dist/components/features/skills/skill-filter.js.map +1 -1
- package/dist/components/shared/modals/settings/settings-form.cjs +1 -1
- package/dist/components/shared/modals/settings/settings-form.js +8 -8
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +9 -5
- package/dist/config/defaults.js.map +1 -1
- package/dist/contexts/conversation-websocket-context.cjs +3 -3
- package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
- package/dist/contexts/conversation-websocket-context.js +5 -5
- package/dist/extensions/canvas-extension-module-loader.d.ts +11 -0
- package/dist/hooks/mutation/use-manage-canvas-extensions.d.ts +12 -0
- package/dist/hooks/query/concurrency-limiter.cjs +2 -0
- package/dist/hooks/query/concurrency-limiter.cjs.map +1 -0
- package/dist/hooks/query/concurrency-limiter.d.ts +22 -0
- package/dist/hooks/query/concurrency-limiter.js +29 -0
- package/dist/hooks/query/concurrency-limiter.js.map +1 -0
- package/dist/hooks/query/query-keys.cjs.map +1 -1
- package/dist/hooks/query/query-keys.d.ts +4 -0
- package/dist/hooks/query/query-keys.js.map +1 -1
- package/dist/hooks/query/use-active-conversation.cjs +1 -1
- package/dist/hooks/query/use-active-conversation.js +4 -4
- package/dist/hooks/query/use-automations.cjs.map +1 -1
- package/dist/hooks/query/use-automations.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.d.ts +1 -1
- package/dist/hooks/query/use-backends-health.js +50 -64
- package/dist/hooks/query/use-backends-health.js.map +1 -1
- package/dist/hooks/query/use-canvas-extensions.cjs +1 -0
- package/dist/hooks/query/use-canvas-extensions.d.ts +5 -0
- package/dist/hooks/query/use-canvas-extensions.js +3 -0
- package/dist/hooks/query/use-commit-changes.cjs +1 -1
- package/dist/hooks/query/use-commit-changes.js +4 -4
- package/dist/hooks/query/use-latest-automation-runs.cjs +1 -1
- package/dist/hooks/query/use-latest-automation-runs.js +1 -0
- package/dist/hooks/query/use-paginated-conversations.cjs +1 -1
- package/dist/hooks/query/use-paginated-conversations.cjs.map +1 -1
- package/dist/hooks/query/use-paginated-conversations.js +19 -16
- package/dist/hooks/query/use-paginated-conversations.js.map +1 -1
- package/dist/hooks/query/use-search-providers.cjs +1 -1
- package/dist/hooks/query/use-search-providers.cjs.map +1 -1
- package/dist/hooks/query/use-search-providers.js +17 -10
- package/dist/hooks/query/use-search-providers.js.map +1 -1
- package/dist/hooks/query/use-unified-get-git-changes.cjs +1 -1
- package/dist/hooks/query/use-unified-get-git-changes.js +4 -4
- package/dist/hooks/query/use-unified-git-commits.cjs +1 -1
- package/dist/hooks/query/use-unified-git-commits.js +4 -4
- package/dist/hooks/query/use-unified-git-diff.cjs +1 -1
- package/dist/hooks/query/use-unified-git-diff.js +4 -4
- package/dist/hooks/query/use-unified-vscode-url.cjs +1 -1
- package/dist/hooks/query/use-unified-vscode-url.cjs.map +1 -1
- package/dist/hooks/query/use-unified-vscode-url.d.ts +1 -0
- package/dist/hooks/query/use-unified-vscode-url.js +40 -26
- package/dist/hooks/query/use-unified-vscode-url.js.map +1 -1
- package/dist/hooks/query/use-workspace-file-content.cjs +1 -1
- package/dist/hooks/query/use-workspace-file-content.js +5 -5
- package/dist/hooks/query/use-workspace-files.cjs +1 -1
- package/dist/hooks/query/use-workspace-files.js +6 -6
- package/dist/hooks/use-acp-credential-form.d.ts +6 -0
- package/dist/hooks/use-conversation-overview-git-diff-stats.cjs +1 -1
- package/dist/hooks/use-conversation-overview-git-diff-stats.js +4 -4
- package/dist/hooks/use-pinned-home-route.cjs +2 -0
- package/dist/hooks/use-pinned-home-route.cjs.map +1 -0
- package/dist/hooks/use-pinned-home-route.d.ts +33 -0
- package/dist/hooks/use-pinned-home-route.js +34 -0
- package/dist/hooks/use-pinned-home-route.js.map +1 -0
- package/dist/hooks/use-skill-enablement.cjs +2 -0
- package/dist/hooks/use-skill-enablement.cjs.map +1 -0
- package/dist/hooks/use-skill-enablement.d.ts +14 -0
- package/dist/hooks/use-skill-enablement.js +80 -0
- package/dist/hooks/use-skill-enablement.js.map +1 -0
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +29 -13
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +3 -3
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +538 -266
- package/dist/i18n/translation.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -14
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/locales/ar/openhands.json +32 -16
- package/dist/locales/ca/openhands.json +32 -16
- package/dist/locales/de/openhands.json +32 -16
- package/dist/locales/en/openhands.json +32 -16
- package/dist/locales/es/openhands.json +32 -16
- package/dist/locales/fr/openhands.json +32 -16
- package/dist/locales/it/openhands.json +32 -16
- package/dist/locales/ja/openhands.json +32 -16
- package/dist/locales/ko-KR/openhands.json +32 -16
- package/dist/locales/no/openhands.json +32 -16
- package/dist/locales/pt/openhands.json +32 -16
- package/dist/locales/tr/openhands.json +32 -16
- package/dist/locales/uk/openhands.json +32 -16
- package/dist/locales/zh-CN/openhands.json +32 -16
- package/dist/locales/zh-TW/openhands.json +32 -16
- package/dist/manifests/automation-interface.cjs +1 -1
- package/dist/manifests/automation-interface.cjs.map +1 -1
- package/dist/manifests/automation-interface.d.ts +6 -0
- package/dist/manifests/automation-interface.js +11 -8
- package/dist/manifests/automation-interface.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/bundle-index.cjs +45 -4
- package/dist/node_modules/@openhands/extensions/automations/bundle-index.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/bundle-index.js +1 -1
- package/dist/node_modules/@openhands/extensions/automations/bundle-index.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.js +5 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.js +5 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.js +5 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-repo-monitor/manifest.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-repo-monitor/manifest.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-repo-monitor/manifest.js +5 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/github-repo-monitor/manifest.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-bitbucket-pr/manifest.cjs +9 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-bitbucket-pr/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-bitbucket-pr/manifest.js +21 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-bitbucket-pr/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-gitlab-mr/manifest.cjs +9 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-gitlab-mr/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-gitlab-mr/manifest.js +21 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/jira-issue-to-gitlab-mr/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-bitbucket-pr/manifest.cjs +9 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-bitbucket-pr/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-bitbucket-pr/manifest.js +21 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-bitbucket-pr/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-github-pr/manifest.cjs +9 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-github-pr/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-github-pr/manifest.js +21 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-github-pr/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-gitlab-mr/manifest.cjs +9 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-gitlab-mr/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-gitlab-mr/manifest.js +21 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/linear-issue-to-gitlab-mr/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/news-digest/manifest.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/news-digest/manifest.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/news-digest/manifest.js +5 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/news-digest/manifest.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog/qa-changes/manifest.cjs +30 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/qa-changes/manifest.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/qa-changes/manifest.js +65 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog/qa-changes/manifest.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/automations/catalog-index.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog-index.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/automations/catalog-index.js +21 -9
- package/dist/node_modules/@openhands/extensions/automations/catalog-index.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.js +2 -2
- package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/gitlab.cjs +2 -0
- package/dist/node_modules/@openhands/extensions/integrations/catalog/gitlab.cjs.map +1 -0
- package/dist/node_modules/@openhands/extensions/integrations/catalog/gitlab.js +40 -0
- package/dist/node_modules/@openhands/extensions/integrations/catalog/gitlab.js.map +1 -0
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.js +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js +74 -72
- package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/skills/index.cjs +42 -3
- package/dist/node_modules/@openhands/extensions/skills/index.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/skills/index.js +22 -3
- package/dist/node_modules/@openhands/extensions/skills/index.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-conversation.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-conversation.js +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-state.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-state.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-state.js +8 -7
- package/dist/node_modules/@openhands/typescript-client/dist/conversation/remote-state.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/index.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/index.js +2 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/blocks.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/blocks.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/blocks.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/blocks.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panels-top-left.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panels-top-left.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panels-top-left.js +23 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panels-top-left.js.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/dist/routes/agent-settings.d.ts +10 -0
- package/dist/routes/app-settings.cjs +1 -1
- package/dist/routes/app-settings.cjs.map +1 -1
- package/dist/routes/app-settings.js +7 -7
- package/dist/routes/files-tab.cjs +1 -1
- package/dist/routes/files-tab.cjs.map +1 -1
- package/dist/routes/files-tab.js +14 -14
- package/dist/routes/files-tab.js.map +1 -1
- package/dist/routes/llm-settings.cjs +1 -1
- package/dist/routes/llm-settings.cjs.map +1 -1
- package/dist/routes/llm-settings.js +122 -114
- package/dist/routes/llm-settings.js.map +1 -1
- package/dist/services/canvas-ui.cjs +1 -1
- package/dist/services/canvas-ui.cjs.map +1 -1
- package/dist/services/canvas-ui.d.ts +5 -0
- package/dist/services/canvas-ui.js +24 -10
- package/dist/services/canvas-ui.js.map +1 -1
- package/dist/services/settings.cjs +1 -1
- package/dist/services/settings.cjs.map +1 -1
- package/dist/services/settings.js +3 -2
- package/dist/services/settings.js.map +1 -1
- package/dist/types/automation.cjs.map +1 -1
- package/dist/types/automation.d.ts +20 -0
- package/dist/types/automation.js.map +1 -1
- package/dist/types/canvas-extension.cjs +2 -0
- package/dist/types/canvas-extension.cjs.map +1 -0
- package/dist/types/canvas-extension.d.ts +77 -0
- package/dist/types/canvas-extension.js +6 -0
- package/dist/types/canvas-extension.js.map +1 -0
- package/dist/types/settings.d.ts +7 -0
- package/dist/ui/help-link.cjs +1 -1
- package/dist/ui/help-link.cjs.map +1 -1
- package/dist/ui/help-link.d.ts +6 -1
- package/dist/ui/help-link.js +32 -18
- package/dist/ui/help-link.js.map +1 -1
- package/dist/utils/acp-auth-display.d.ts +35 -0
- package/dist/utils/cache-utils.cjs +1 -1
- package/dist/utils/cache-utils.js +5 -5
- package/dist/utils/format-model-name.cjs +1 -1
- package/dist/utils/format-model-name.cjs.map +1 -1
- package/dist/utils/format-model-name.d.ts +7 -3
- package/dist/utils/format-model-name.js +6 -11
- package/dist/utils/format-model-name.js.map +1 -1
- package/dist/utils/format-relative-time.cjs +1 -1
- package/dist/utils/format-relative-time.cjs.map +1 -1
- package/dist/utils/format-relative-time.d.ts +7 -0
- package/dist/utils/format-relative-time.js +7 -2
- package/dist/utils/format-relative-time.js.map +1 -1
- package/dist/utils/path-utils.cjs +1 -1
- package/dist/utils/path-utils.cjs.map +1 -1
- package/dist/utils/path-utils.d.ts +15 -3
- package/dist/utils/path-utils.js +29 -3
- package/dist/utils/path-utils.js.map +1 -1
- package/dist/utils/skill-enablement.cjs +2 -0
- package/dist/utils/skill-enablement.cjs.map +1 -0
- package/dist/utils/skill-enablement.d.ts +51 -0
- package/dist/utils/skill-enablement.js +31 -0
- package/dist/utils/skill-enablement.js.map +1 -0
- package/dist/utils/vscode-origin.cjs +2 -0
- package/dist/utils/vscode-origin.cjs.map +1 -0
- package/dist/utils/vscode-origin.d.ts +55 -0
- package/dist/utils/vscode-origin.js +27 -0
- package/dist/utils/vscode-origin.js.map +1 -0
- package/dist/utils/workspace-mode.d.ts +4 -0
- package/package.json +3 -3
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/check-translation-completeness.cjs +1 -0
- package/scripts/dev-extra-backend.mjs +28 -9
- package/scripts/dev-safe.mjs +81 -8
- package/scripts/dev-static.mjs +35 -37
- package/scripts/dev-with-automation.mjs +82 -1
- package/scripts/ingress.mjs +27 -1
- package/scripts/static-server.mjs +74 -1
- package/tools/canvas_ui_tool.py +19 -0
- package/build/assets/active-backend-context-DKFSMbn3.js +0 -2
- package/build/assets/agent-server-conversation-service.api-DozDKIW_.js +0 -86
- package/build/assets/agent-settings-351vXWc9.js +0 -2
- package/build/assets/agent-settings-Ce7BDZ6I.js +0 -1
- package/build/assets/alert-banner-Kyy1YWZU.js +0 -1
- package/build/assets/api-key-entry-screen-INIxqAMs.js +0 -1
- package/build/assets/automation-detail-DXDhUwPq.js +0 -3
- package/build/assets/automation-setup-route-FRr05f_g.js +0 -1
- package/build/assets/automations-list-CERuQWE6.js +0 -1
- package/build/assets/backend-form-modal-DK78-jn1.js +0 -1
- package/build/assets/browser-11etCQ04.js +0 -7
- package/build/assets/check-Cf2YoT90.js +0 -1
- package/build/assets/chevron-down-C3OQ-ehx.js +0 -1
- package/build/assets/chevron-right-CN1uUiJ1.js +0 -1
- package/build/assets/circle-check-g5yeGMd-.js +0 -1
- package/build/assets/command-menu-BZQ8S3Ke.js +0 -1
- package/build/assets/conversation-CchMzpGl.js +0 -1
- package/build/assets/conversation-Dpzftz57.js +0 -93
- package/build/assets/conversation-panel-CchMzpGl.js +0 -1
- package/build/assets/conversation-state-store-a9d2fxRc.js +0 -1
- package/build/assets/empty-state-CvaVahVr.js +0 -1
- package/build/assets/extensions-hub-CFduxBnk.js +0 -1
- package/build/assets/extensions-navigation-BeC224yX.js +0 -1
- package/build/assets/files-tab-CL3J9b3p.js +0 -1
- package/build/assets/format-model-name-BNPKVsIq.js +0 -1
- package/build/assets/get-git-path-DlAJa_i6.js +0 -1
- package/build/assets/git-repo-dropdown-DGMEhz7d.js +0 -1
- package/build/assets/home-BCGlNJCA.js +0 -1
- package/build/assets/home-DB1pRqTC.js +0 -1
- package/build/assets/home-automation-run-tooltip-CooFQRIG.js +0 -1
- package/build/assets/home-store-Dl1dPE58.js +0 -1
- package/build/assets/index-home-DB1pRqTC.js +0 -1
- package/build/assets/info-uYSVzX86.js +0 -1
- package/build/assets/install-server-modal-BbJdhzet.js +0 -1
- package/build/assets/kebab-menu-item-content-BYokkRHi.js +0 -1
- package/build/assets/list-filter-OFkpRrmi.js +0 -1
- package/build/assets/llm-not-configured-banner-BqqYnJ1t.js +0 -27
- package/build/assets/llm-settings-CnDbbmVW.js +0 -1
- package/build/assets/llm-settings-S8Yjg__1.js +0 -1
- package/build/assets/llm-subscription-service-BpPfzW4x.js +0 -1
- package/build/assets/loader-circle-nvrwthvj.js +0 -1
- package/build/assets/manage-backends-modal-BCUPswyl.js +0 -1
- package/build/assets/manifest-58597dde.js +0 -1
- package/build/assets/markdown-renderer-Cb2sBWtV.js +0 -8
- package/build/assets/messages-BTN5thLe.js +0 -40
- package/build/assets/onboarding-Cx_kaiD1.js +0 -1
- package/build/assets/onboarding-modal-vMwn7ihv.js +0 -1
- package/build/assets/plugins-management-service-BjYeF0b0.js +0 -1
- package/build/assets/plus-CEKne-Yp.js +0 -1
- package/build/assets/profiles-service.api-QB-T_u-g.js +0 -1
- package/build/assets/providers-FfSZ5TXP.js +0 -1
- package/build/assets/proxy-tcFL2yTQ.js +0 -1
- package/build/assets/recommended-automations-launcher-Bw8uC4V6.js +0 -1
- package/build/assets/root-BLeQfBEq.css +0 -1
- package/build/assets/root-ZKKYPR1Z.js +0 -2
- package/build/assets/root-layout-luJoE9IG.js +0 -2
- package/build/assets/schema-field-Csw5fhtN.js +0 -1
- package/build/assets/secrets-service-BTor9uAU.js +0 -1
- package/build/assets/settings-DcNPxz0v.js +0 -1
- package/build/assets/settings-service.api-B2agVfjL.js +0 -1
- package/build/assets/shared-conversation-B55pCyBG.js +0 -1
- package/build/assets/sidebar-nav-link-CPzhyHQg.js +0 -1
- package/build/assets/sidebar-store-DtpU7zaI.js +0 -1
- package/build/assets/skill-filter-CWZ5kjcg.js +0 -2
- package/build/assets/skill-scope-CV1dkAbW.js +0 -1
- package/build/assets/skills-plugins-DGHULTq6.js +0 -1
- package/build/assets/skills-settings-CM1lFv3e.js +0 -1
- package/build/assets/usage-tab-BcfWV6db.js +0 -1
- package/build/assets/use-acp-credential-form-BsSW5NHG.js +0 -1
- package/build/assets/use-agent-profiles-DWBPC0Si.js +0 -1
- package/build/assets/use-config-Bft35DOK.js +0 -1
- package/build/assets/use-create-secret-BSxJMxHp.js +0 -1
- package/build/assets/use-is-authed-CFGkY3-Z.js +0 -1
- package/build/assets/use-llm-configured-BI6obxsc.js +0 -1
- package/build/assets/use-llm-profiles-djGAhTWL.js +0 -1
- package/build/assets/use-manifest-capabilities-3z0-1G59.js +0 -1
- package/build/assets/use-onboarding-completion-BXpyUSsJ.js +0 -1
- package/build/assets/use-plugins-marketplace-DI4_pK56.js +0 -1
- package/build/assets/use-save-agent-profile-DdBSTdpN.js +0 -1
- package/build/assets/use-tracking-D5t9otIF.js +0 -3
- package/build/assets/utils-DaCIEEQP.js +0 -1
- package/build/assets/vendor~index-home~home~conversation-panel~conversation~alert-banner-B3qC_oj8.js +0 -1
- package/build/assets/vendor~root-layout~index-home~home~conversation-panel~conversation~mcp~automations-list~aut~ibfbmr9f-B2OLKL7N.js +0 -1
- package/dist/components/features/tips/random-tip.d.ts +0 -2
- package/dist/utils/tips.d.ts +0 -7
- package/dist/utils/workspace-relative-path.cjs +0 -2
- package/dist/utils/workspace-relative-path.cjs.map +0 -1
- package/dist/utils/workspace-relative-path.d.ts +0 -10
- package/dist/utils/workspace-relative-path.js +0 -22
- package/dist/utils/workspace-relative-path.js.map +0 -1
- /package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ew3u153i-rfV8mQ9m.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ew9ih1s8-rfV8mQ9m.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ox0jfsa0-cHFhpUBq.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-server-compatibility.js","names":[],"sources":["../../src/api/agent-server-compatibility.ts"],"sourcesContent":["import {\n ServerClient,\n SettingsClient,\n} from \"@openhands/typescript-client/clients\";\nimport type { ServerInfo as BaseServerInfo } from \"@openhands/typescript-client\";\nimport { getAgentServerClientOptions } from \"#/api/agent-server-client-options\";\nimport { isAuthRequired } from \"#/api/agent-server-config\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n isNoBackend,\n} from \"#/api/backend-registry/active-store\";\nimport defaults from \"../../config/defaults.json\";\n\nconst AGENT_SERVER_INFO_TIMEOUT_MS = 5000;\nconst UNKNOWN_AGENT_SERVER_VERSION = \"unknown\";\n\nexport const MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION =\n defaults.compatibility.minimumAgentServer;\nexport const AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE =\n \"AGENT_SERVER_UNSUPPORTED_VERSION\";\nexport const AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE =\n \"AGENT_SERVER_UNKNOWN_VERSION\";\n\nexport interface AgentServerInfo extends BaseServerInfo {\n sdk_version?: string;\n usable_tools?: string[] | null;\n runtime_services?: unknown;\n}\n\nlet cachedAgentServerInfo: AgentServerInfo | null = null;\nlet cachedAgentServerInfoHost: string | null = null;\n\nconst getAdvertisedTools = (serverInfo: AgentServerInfo | null) => {\n if (Array.isArray(serverInfo?.usable_tools)) {\n return serverInfo.usable_tools;\n }\n return null;\n};\n\nexport class AgentServerUnavailableError extends Error {\n readonly details: string | null;\n readonly noBackendConfigured: boolean;\n\n constructor(\n details?: string | null,\n options?: { noBackendConfigured?: boolean },\n ) {\n const noBackendConfigured = options?.noBackendConfigured ?? false;\n super(\n noBackendConfigured\n ? \"No agent server backend is configured yet. Add a backend to get started.\"\n : \"Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.\",\n );\n this.name = \"AgentServerUnavailableError\";\n this.details = details ?? null;\n this.noBackendConfigured = noBackendConfigured;\n }\n}\n\nexport const isAgentServerUnavailableError = (\n error: unknown,\n): error is AgentServerUnavailableError =>\n error instanceof AgentServerUnavailableError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n (error.name === \"AgentServerUnavailableError\" ||\n error.name === \"AgentServerUnsupportedVersionError\" ||\n error.name === \"AgentServerUnknownVersionError\"));\n\nexport class AgentServerUnsupportedVersionError extends AgentServerUnavailableError {\n readonly code = AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE;\n readonly actualVersion: string;\n readonly requiredVersion = MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION;\n\n constructor(actualVersion: string) {\n const message = `Agent Canvas requires agent-server ${MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION} or newer; this backend is running ${actualVersion}. Please upgrade the agent-server backend.`;\n super(message);\n this.name = \"AgentServerUnsupportedVersionError\";\n this.message = message;\n this.actualVersion = actualVersion;\n }\n}\n\nexport class AgentServerUnknownVersionError extends AgentServerUnavailableError {\n readonly code = AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE;\n readonly actualVersion: string | null;\n readonly requiredVersion = MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION;\n\n constructor(actualVersion: string | null) {\n const reported = actualVersion ? ` It reported \"${actualVersion}\".` : \"\";\n const message =\n `Could not determine this backend's agent-server version.${reported} ` +\n `Agent Canvas requires agent-server ${MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION} ` +\n \"or newer, but this backend did not return a valid version from \" +\n \"/server_info. Restart or rebuild the agent-server backend, then try again.\";\n super(message);\n this.name = \"AgentServerUnknownVersionError\";\n this.message = message;\n this.actualVersion = actualVersion;\n }\n}\n\nexport const isAgentServerUnsupportedVersionError = (\n error: unknown,\n): error is AgentServerUnsupportedVersionError =>\n error instanceof AgentServerUnsupportedVersionError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n error.code === AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE);\n\nexport const isAgentServerUnknownVersionError = (\n error: unknown,\n): error is AgentServerUnknownVersionError =>\n error instanceof AgentServerUnknownVersionError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n error.code === AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE);\n\n/**\n * Returns true when the agent-server probe failed with HTTP 401.\n * In public mode this means the stored key is stale (server restarted\n * with a different `LOCAL_BACKEND_API_KEY`). Only meaningful when\n * auth is required — a 401 in local mode is a misconfiguration, not a\n * key-rotation event. Uses {@link isAuthRequired} so both the build-time\n * `VITE_AUTH_REQUIRED` flag and the runtime `window.__AGENT_CANVAS_AUTH_REQUIRED__`\n * injection (used by pre-built static binaries) are honoured.\n */\nexport const isAgentServerAuthError = (error: unknown): boolean =>\n isAuthRequired() && isSdkHttpStatusError(error, 401);\n\nexport function clearCachedAgentServerInfo() {\n cachedAgentServerInfo = null;\n cachedAgentServerInfoHost = null;\n}\n\nexport function getCachedAgentServerInfo(options?: {\n host?: string | null;\n}): AgentServerInfo | null {\n if (options?.host && options.host !== cachedAgentServerInfoHost) {\n return null;\n }\n return cachedAgentServerInfo;\n}\n\nexport function isAgentServerToolAvailable(toolName: string) {\n const availableTools = getAdvertisedTools(cachedAgentServerInfo);\n if (!Array.isArray(availableTools)) {\n return true;\n }\n return availableTools.includes(toolName);\n}\n\nexport function isSdkHttpError(error: unknown) {\n return (\n error instanceof Error &&\n error.name === \"HttpError\" &&\n \"status\" in error &&\n typeof error.status === \"number\"\n );\n}\n\n/**\n * Narrows an SDK HTTP error to a specific status code.\n * Use instead of manually casting `(err as { status: number }).status`.\n */\nexport function isSdkHttpStatusError(error: unknown, status: number): boolean {\n return (\n isSdkHttpError(error) && (error as { status: number }).status === status\n );\n}\n\nfunction normalizeAgentServerInfoVersion(version: unknown): string | null {\n if (typeof version !== \"string\") return null;\n const trimmed = version.trim();\n return trimmed || null;\n}\n\nfunction getRawAgentServerSdkVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n return normalizeAgentServerInfoVersion(serverInfo.sdk_version);\n}\n\nfunction getRawAgentServerVersion(serverInfo: AgentServerInfo): string | null {\n return (\n normalizeAgentServerInfoVersion(serverInfo.version) ??\n getRawAgentServerSdkVersion(serverInfo)\n );\n}\n\nfunction getComparableAgentServerVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version = getRawAgentServerVersion(serverInfo);\n if (!version || version.toLowerCase() === UNKNOWN_AGENT_SERVER_VERSION) {\n return null;\n }\n return version;\n}\n\nexport function getDisplayAgentServerVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version = getComparableAgentServerVersion(serverInfo);\n if (!version || !parseAgentServerVersion(version)) {\n return null;\n }\n return version;\n}\n\nexport function getDisplayAgentServerSdkVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version =\n getRawAgentServerSdkVersion(serverInfo) ??\n getComparableAgentServerVersion(serverInfo);\n if (!version || version.toLowerCase() === UNKNOWN_AGENT_SERVER_VERSION) {\n return null;\n }\n return version;\n}\n\nexport function getCachedAgentServerSdkVersion(\n host?: string | null,\n): string | null {\n if (!cachedAgentServerInfo) return null;\n if (host && getEffectiveLocalBackend()?.host !== host) return null;\n return getDisplayAgentServerSdkVersion(cachedAgentServerInfo);\n}\n\nexport function getCachedAgentServerVersion(\n host?: string | null,\n): string | null {\n if (!cachedAgentServerInfo) return null;\n if (host && getEffectiveLocalBackend()?.host !== host) return null;\n return getDisplayAgentServerVersion(cachedAgentServerInfo);\n}\n\nexport function compareAgentServerVersions(actual: string, required: string) {\n const parsedActual = parseAgentServerVersion(actual);\n const parsedRequired = parseAgentServerVersion(required);\n\n if (!parsedActual || !parsedRequired) {\n return null;\n }\n\n for (const key of [\"major\", \"minor\", \"patch\"] as const) {\n if (parsedActual[key] > parsedRequired[key]) {\n return 1;\n }\n if (parsedActual[key] < parsedRequired[key]) {\n return -1;\n }\n }\n\n if (parsedActual.prerelease && !parsedRequired.prerelease) {\n return -1;\n }\n if (!parsedActual.prerelease && parsedRequired.prerelease) {\n return 1;\n }\n if (parsedActual.prerelease && parsedRequired.prerelease) {\n return parsedActual.prerelease.localeCompare(parsedRequired.prerelease);\n }\n\n return 0;\n}\n\nfunction parseAgentServerVersion(version: string) {\n const trimmed = version.trim().replace(/^v/, \"\");\n const [withoutBuild] = trimmed.split(\"+\");\n const [core, prerelease] = withoutBuild.split(\"-\", 2);\n const parts = core.split(\".\");\n\n if (parts.length !== 3) {\n return null;\n }\n\n const [major, minor, patch] = parts.map((part) => Number(part));\n if (\n ![major, minor, patch].every((part) => Number.isInteger(part) && part >= 0)\n ) {\n return null;\n }\n\n return { major, minor, patch, prerelease };\n}\n\nexport function assertAgentServerVersionIsSupported(\n serverInfo: AgentServerInfo,\n) {\n const actualVersion = getComparableAgentServerVersion(serverInfo);\n if (!actualVersion) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnknownVersionError(\n getRawAgentServerVersion(serverInfo),\n );\n }\n\n const comparison = compareAgentServerVersions(\n actualVersion,\n MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,\n );\n\n if (comparison === null) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnknownVersionError(actualVersion);\n }\n\n if (comparison < 0) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnsupportedVersionError(actualVersion);\n }\n}\n\nexport async function loadAgentServerInfo() {\n // The probe is a *local* agent-server concern — it verifies the runtime\n // hosting the GUI is reachable. It must NEVER run against the active\n // backend when that backend is cloud, because cloud hosts don't\n // expose /api/server_info and would fail with a CORS error besides.\n const local = getEffectiveLocalBackend();\n if (!local) {\n clearCachedAgentServerInfo();\n\n // Empty registry (NO_BACKEND sentinel) — the user has no backend\n // configured at all. Throw so root.tsx shows the manage-backends\n // modal instead of silently rendering a broken home page.\n if (isNoBackend(getActiveBackend().backend)) {\n throw new AgentServerUnavailableError(\"No backend configured\", {\n noBackendConfigured: true,\n });\n }\n\n // Active backend is cloud — no local probe needed.\n return null;\n }\n\n const clientOptions = getAgentServerClientOptions({\n host: local.host,\n sessionApiKey: local.apiKey || null,\n timeout: AGENT_SERVER_INFO_TIMEOUT_MS,\n });\n let serverInfo: AgentServerInfo;\n\n try {\n serverInfo = (await new ServerClient(\n clientOptions,\n ).getServerInfo()) as AgentServerInfo;\n } catch (error) {\n clearCachedAgentServerInfo();\n // Preserve 401 so root.tsx can show the auth screen (public mode).\n // All other HTTP errors (502, 503, etc.) mean the server is unreachable\n // or misconfigured — treat them as unavailable.\n if (isSdkHttpStatusError(error, 401)) {\n throw error;\n }\n\n const details = error instanceof Error ? error.message : null;\n throw new AgentServerUnavailableError(details);\n }\n\n assertAgentServerVersionIsSupported(serverInfo);\n\n // /server_info is unprotected, so a stale session key still gets 200.\n // In public mode, validate the key against a protected endpoint so a\n // server restart with a new LOCAL_BACKEND_API_KEY surfaces immediately\n // instead of letting the app load and fail on every subsequent call.\n if (isAuthRequired()) {\n try {\n await new SettingsClient(clientOptions).getSettings();\n } catch (error) {\n // Only rethrow 401 — that means the stored key is invalid /\n // rotated. Other HTTP errors (403, 5xx) and non-HTTP errors\n // (network, timeout) are swallowed: the server *is* up (we just\n // reached /server_info), so let the app proceed with an\n // unvalidated key rather than blocking the UI.\n // NOTE: If the connection drops between the /server_info and\n // getSettings() probes, the app loads with an unvalidated key and\n // subsequent 401s won't trigger the auth screen (they come from\n // React Query hooks, not this bootstrap path). Acceptable for now\n // since the window is narrow and a page refresh recovers.\n if (isSdkHttpStatusError(error, 401)) {\n throw error;\n }\n\n console.warn(\n \"[agent-server] getSettings() probe failed (non-401):\",\n error,\n );\n }\n }\n\n cachedAgentServerInfo = serverInfo;\n cachedAgentServerInfoHost = clientOptions.host;\n return serverInfo;\n}\n"],"mappings":";;;;;;;;AAcA,IAAM,IAA+B,KAC/B,IAA+B,WAExB,IACX,EAAS,cAAc,oBACZ,IACX,oCACW,IACX,gCAQE,IAAgD,MAChD,IAA2C,MAEzC,KAAsB,MACtB,MAAM,QAAQ,GAAY,YAAY,IACjC,EAAW,eAEb,MAGI,IAAb,cAAiD,MAAM;CACrD;CACA;CAEA,YACE,GACA,GACA;EACA,IAAM,IAAsB,GAAS,uBAAuB;EAQ5D,AAPA,MACE,IACI,6EACA,gHACN,GACA,KAAK,OAAO,+BACZ,KAAK,UAAU,KAAW,MAC1B,KAAK,sBAAsB;CAC7B;AACF,GAEa,KACX,MAEA,aAAiB,KAChB,OAAO,KAAU,cAChB,KACA,UAAU,MACT,EAAM,SAAS,iCACd,EAAM,SAAS,wCACf,EAAM,SAAS,mCAER,IAAb,cAAwD,EAA4B;CAClF,OAAgB;CAChB;CACA,kBAA2B;CAE3B,YAAY,GAAuB;EACjC,IAAM,IAAU,sCAAsC,EAAwC,qCAAqC,EAAc;EAIjJ,AAHA,MAAM,CAAO,GACb,KAAK,OAAO,sCACZ,KAAK,UAAU,GACf,KAAK,gBAAgB;CACvB;AACF,GAEa,IAAb,cAAoD,E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CAAa;AAE9D;AAEA,eAAsB,IAAsB;CAK1C,IAAM,IAAQ,EAAyB;CACvC,IAAI,CAAC,GAAO;EAMV,IALA,EAA2B,GAKvB,EAAY,EAAiB,EAAE,OAAO,GACxC,MAAM,IAAI,EAA4B,yBAAyB,EAC7D,qBAAqB,GACvB,CAAC;EAIH,OAAO;CACT;CAEA,IAAM,IAAgB,EAA4B;EAChD,MAAM,EAAM;EACZ,eAAe,EAAM,UAAU;EAC/B,SAAS;CACX,CAAC,GACG;CAEJ,IAAI;EACF,IAAc,MAAM,IAAI,EACtB,CACF,EAAE,cAAc;CAClB,SAAS,GAAO;EAUd,MATA,EAA2B,GAIvB,EAAqB,GAAO,GAAG,IAC3B,IAIF,IAAI,EADM,aAAiB,QAAQ,EAAM,UAAU,IACZ;CAC/C;CAQA,IANA,EAAoC,CAAU,GAM1C,EAAe,GACjB,IAAI;EACF,MAAM,IAAI,EAAe,CAAa,EAAE,YAAY;CACtD,SAAS,GAAO;EAWd,IAAI,EAAqB,GAAO,GAAG,GACjC,MAAM;EAGR,QAAQ,KACN,wDACA,CACF;CACF;CAKF,OAFA,IAAwB,GACxB,IAA4B,EAAc,MACnC;AACT"}
|
|
1
|
+
{"version":3,"file":"agent-server-compatibility.js","names":[],"sources":["../../src/api/agent-server-compatibility.ts"],"sourcesContent":["import {\n ServerClient,\n SettingsClient,\n} from \"@openhands/typescript-client/clients\";\nimport type { ServerInfo as BaseServerInfo } from \"@openhands/typescript-client\";\nimport { getAgentServerClientOptions } from \"#/api/agent-server-client-options\";\nimport { isAuthRequired } from \"#/api/agent-server-config\";\nimport {\n getActiveBackend,\n getEffectiveLocalBackend,\n isNoBackend,\n} from \"#/api/backend-registry/active-store\";\nimport type { Backend } from \"#/api/backend-registry/types\";\nimport defaults from \"../../config/defaults.json\";\n\nconst AGENT_SERVER_INFO_TIMEOUT_MS = 5000;\nconst UNKNOWN_AGENT_SERVER_VERSION = \"unknown\";\n\nexport const MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION =\n defaults.compatibility.minimumAgentServer;\nexport const AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE =\n \"AGENT_SERVER_UNSUPPORTED_VERSION\";\nexport const AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE =\n \"AGENT_SERVER_UNKNOWN_VERSION\";\n\n/**\n * Sentinel string thrown (as an Error message) when a local backend\n * rejects the configured session API key with HTTP 401.\n * Shared between the backend health probe ({@link validateLocalBackend})\n * and any consumer that needs to detect this specific failure.\n */\nexport const INVALID_BACKEND_API_KEY_ERROR = \"Invalid API key\";\n\nexport interface AgentServerInfo extends BaseServerInfo {\n sdk_version?: string;\n usable_tools?: string[] | null;\n runtime_services?: unknown;\n}\n\nlet cachedAgentServerInfo: AgentServerInfo | null = null;\nlet cachedAgentServerInfoHost: string | null = null;\n\nconst getAdvertisedTools = (serverInfo: AgentServerInfo | null) => {\n if (Array.isArray(serverInfo?.usable_tools)) {\n return serverInfo.usable_tools;\n }\n return null;\n};\n\nexport class AgentServerUnavailableError extends Error {\n readonly details: string | null;\n readonly noBackendConfigured: boolean;\n\n constructor(\n details?: string | null,\n options?: { noBackendConfigured?: boolean },\n ) {\n const noBackendConfigured = options?.noBackendConfigured ?? false;\n super(\n noBackendConfigured\n ? \"No agent server backend is configured yet. Add a backend to get started.\"\n : \"Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.\",\n );\n this.name = \"AgentServerUnavailableError\";\n this.details = details ?? null;\n this.noBackendConfigured = noBackendConfigured;\n }\n}\n\nexport const isAgentServerUnavailableError = (\n error: unknown,\n): error is AgentServerUnavailableError =>\n error instanceof AgentServerUnavailableError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n (error.name === \"AgentServerUnavailableError\" ||\n error.name === \"AgentServerUnsupportedVersionError\" ||\n error.name === \"AgentServerUnknownVersionError\"));\n\nexport class AgentServerUnsupportedVersionError extends AgentServerUnavailableError {\n readonly code = AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE;\n readonly actualVersion: string;\n readonly requiredVersion = MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION;\n\n constructor(actualVersion: string) {\n const message = `Agent Canvas requires agent-server ${MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION} or newer; this backend is running ${actualVersion}. Please upgrade the agent-server backend.`;\n super(message);\n this.name = \"AgentServerUnsupportedVersionError\";\n this.message = message;\n this.actualVersion = actualVersion;\n }\n}\n\nexport class AgentServerUnknownVersionError extends AgentServerUnavailableError {\n readonly code = AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE;\n readonly actualVersion: string | null;\n readonly requiredVersion = MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION;\n\n constructor(actualVersion: string | null) {\n const reported = actualVersion ? ` It reported \"${actualVersion}\".` : \"\";\n const message =\n `Could not determine this backend's agent-server version.${reported} ` +\n `Agent Canvas requires agent-server ${MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION} ` +\n \"or newer, but this backend did not return a valid version from \" +\n \"/server_info. Restart or rebuild the agent-server backend, then try again.\";\n super(message);\n this.name = \"AgentServerUnknownVersionError\";\n this.message = message;\n this.actualVersion = actualVersion;\n }\n}\n\nexport const isAgentServerUnsupportedVersionError = (\n error: unknown,\n): error is AgentServerUnsupportedVersionError =>\n error instanceof AgentServerUnsupportedVersionError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n error.code === AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE);\n\nexport const isAgentServerUnknownVersionError = (\n error: unknown,\n): error is AgentServerUnknownVersionError =>\n error instanceof AgentServerUnknownVersionError ||\n (typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n error.code === AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE);\n\n/**\n * Returns true when the agent-server probe failed with HTTP 401.\n * In public mode this means the stored key is stale (server restarted\n * with a different `LOCAL_BACKEND_API_KEY`). Only meaningful when\n * auth is required — a 401 in local mode is a misconfiguration, not a\n * key-rotation event. Uses {@link isAuthRequired} so both the build-time\n * `VITE_AUTH_REQUIRED` flag and the runtime `window.__AGENT_CANVAS_AUTH_REQUIRED__`\n * injection (used by pre-built static binaries) are honoured.\n */\nexport const isAgentServerAuthError = (error: unknown): boolean =>\n isAuthRequired() && isSdkHttpStatusError(error, 401);\n\nexport function clearCachedAgentServerInfo() {\n cachedAgentServerInfo = null;\n cachedAgentServerInfoHost = null;\n}\n\nexport function getCachedAgentServerInfo(options?: {\n host?: string | null;\n}): AgentServerInfo | null {\n if (options?.host && options.host !== cachedAgentServerInfoHost) {\n return null;\n }\n return cachedAgentServerInfo;\n}\n\nexport function isAgentServerToolAvailable(toolName: string) {\n const availableTools = getAdvertisedTools(cachedAgentServerInfo);\n if (!Array.isArray(availableTools)) {\n return true;\n }\n return availableTools.includes(toolName);\n}\n\nexport function isSdkHttpError(error: unknown) {\n return (\n error instanceof Error &&\n error.name === \"HttpError\" &&\n \"status\" in error &&\n typeof error.status === \"number\"\n );\n}\n\n/**\n * Narrows an SDK HTTP error to a specific status code.\n * Use instead of manually casting `(err as { status: number }).status`.\n */\nexport function isSdkHttpStatusError(error: unknown, status: number): boolean {\n return (\n isSdkHttpError(error) && (error as { status: number }).status === status\n );\n}\n\nfunction normalizeAgentServerInfoVersion(version: unknown): string | null {\n if (typeof version !== \"string\") return null;\n const trimmed = version.trim();\n return trimmed || null;\n}\n\nfunction getRawAgentServerSdkVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n return normalizeAgentServerInfoVersion(serverInfo.sdk_version);\n}\n\nfunction getRawAgentServerVersion(serverInfo: AgentServerInfo): string | null {\n return (\n normalizeAgentServerInfoVersion(serverInfo.version) ??\n getRawAgentServerSdkVersion(serverInfo)\n );\n}\n\nfunction getComparableAgentServerVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version = getRawAgentServerVersion(serverInfo);\n if (!version || version.toLowerCase() === UNKNOWN_AGENT_SERVER_VERSION) {\n return null;\n }\n return version;\n}\n\nexport function getDisplayAgentServerVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version = getComparableAgentServerVersion(serverInfo);\n if (!version || !parseAgentServerVersion(version)) {\n return null;\n }\n return version;\n}\n\nexport function getDisplayAgentServerSdkVersion(\n serverInfo: AgentServerInfo,\n): string | null {\n const version =\n getRawAgentServerSdkVersion(serverInfo) ??\n getComparableAgentServerVersion(serverInfo);\n if (!version || version.toLowerCase() === UNKNOWN_AGENT_SERVER_VERSION) {\n return null;\n }\n return version;\n}\n\nexport function getCachedAgentServerSdkVersion(\n host?: string | null,\n): string | null {\n if (!cachedAgentServerInfo) return null;\n if (host && getEffectiveLocalBackend()?.host !== host) return null;\n return getDisplayAgentServerSdkVersion(cachedAgentServerInfo);\n}\n\nexport function getCachedAgentServerVersion(\n host?: string | null,\n): string | null {\n if (!cachedAgentServerInfo) return null;\n if (host && getEffectiveLocalBackend()?.host !== host) return null;\n return getDisplayAgentServerVersion(cachedAgentServerInfo);\n}\n\nexport function compareAgentServerVersions(actual: string, required: string) {\n const parsedActual = parseAgentServerVersion(actual);\n const parsedRequired = parseAgentServerVersion(required);\n\n if (!parsedActual || !parsedRequired) {\n return null;\n }\n\n for (const key of [\"major\", \"minor\", \"patch\"] as const) {\n if (parsedActual[key] > parsedRequired[key]) {\n return 1;\n }\n if (parsedActual[key] < parsedRequired[key]) {\n return -1;\n }\n }\n\n if (parsedActual.prerelease && !parsedRequired.prerelease) {\n return -1;\n }\n if (!parsedActual.prerelease && parsedRequired.prerelease) {\n return 1;\n }\n if (parsedActual.prerelease && parsedRequired.prerelease) {\n return parsedActual.prerelease.localeCompare(parsedRequired.prerelease);\n }\n\n return 0;\n}\n\nfunction parseAgentServerVersion(version: string) {\n const trimmed = version.trim().replace(/^v/, \"\");\n const [withoutBuild] = trimmed.split(\"+\");\n const [core, prerelease] = withoutBuild.split(\"-\", 2);\n const parts = core.split(\".\");\n\n if (parts.length !== 3) {\n return null;\n }\n\n const [major, minor, patch] = parts.map((part) => Number(part));\n if (\n ![major, minor, patch].every((part) => Number.isInteger(part) && part >= 0)\n ) {\n return null;\n }\n\n return { major, minor, patch, prerelease };\n}\n\nexport function assertAgentServerVersionIsSupported(\n serverInfo: AgentServerInfo,\n) {\n const actualVersion = getComparableAgentServerVersion(serverInfo);\n if (!actualVersion) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnknownVersionError(\n getRawAgentServerVersion(serverInfo),\n );\n }\n\n const comparison = compareAgentServerVersions(\n actualVersion,\n MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,\n );\n\n if (comparison === null) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnknownVersionError(actualVersion);\n }\n\n if (comparison < 0) {\n clearCachedAgentServerInfo();\n throw new AgentServerUnsupportedVersionError(actualVersion);\n }\n}\n\n/**\n * Validates a local agent-server backend with a two-step probe:\n * 1. GET /api/settings — authenticates the configured session API key;\n * a 401 throws an Error with message {@link INVALID_BACKEND_API_KEY_ERROR}.\n * 2. GET /server_info — asserts the server meets the minimum version floor.\n *\n * Returns the display version string reported by the server, or `null` when\n * the server does not report a parseable version. Throws on any failure.\n *\n * Used by both the backend health poller and the backend-form connection test\n * so that auth-check semantics (status codes, error messages) stay in one place.\n */\nexport async function validateLocalBackend(\n backend: Pick<Backend, \"host\" | \"apiKey\">,\n timeout: number,\n): Promise<string | null> {\n const clientOptions = getAgentServerClientOptions({\n host: backend.host,\n sessionApiKey: backend.apiKey || null,\n timeout,\n });\n\n try {\n await new SettingsClient(clientOptions).getSettings();\n const serverInfo = await new ServerClient(clientOptions).getServerInfo();\n assertAgentServerVersionIsSupported(serverInfo);\n return getDisplayAgentServerVersion(serverInfo);\n } catch (error) {\n if (isSdkHttpStatusError(error, 401)) {\n throw new Error(INVALID_BACKEND_API_KEY_ERROR);\n }\n throw error;\n }\n}\n\nexport async function loadAgentServerInfo() {\n // The probe is a *local* agent-server concern — it verifies the runtime\n // hosting the GUI is reachable. It must NEVER run against the active\n // backend when that backend is cloud, because cloud hosts don't\n // expose /api/server_info and would fail with a CORS error besides.\n const local = getEffectiveLocalBackend();\n if (!local) {\n clearCachedAgentServerInfo();\n\n // Empty registry (NO_BACKEND sentinel) — the user has no backend\n // configured at all. Throw so root.tsx shows the manage-backends\n // modal instead of silently rendering a broken home page.\n if (isNoBackend(getActiveBackend().backend)) {\n throw new AgentServerUnavailableError(\"No backend configured\", {\n noBackendConfigured: true,\n });\n }\n\n // Active backend is cloud — no local probe needed.\n return null;\n }\n\n const clientOptions = getAgentServerClientOptions({\n host: local.host,\n sessionApiKey: local.apiKey || null,\n timeout: AGENT_SERVER_INFO_TIMEOUT_MS,\n });\n let serverInfo: AgentServerInfo;\n\n try {\n serverInfo = (await new ServerClient(\n clientOptions,\n ).getServerInfo()) as AgentServerInfo;\n } catch (error) {\n clearCachedAgentServerInfo();\n // Preserve 401 so root.tsx can show the auth screen (public mode).\n // All other HTTP errors (502, 503, etc.) mean the server is unreachable\n // or misconfigured — treat them as unavailable.\n if (isSdkHttpStatusError(error, 401)) {\n throw error;\n }\n\n const details = error instanceof Error ? error.message : null;\n throw new AgentServerUnavailableError(details);\n }\n\n assertAgentServerVersionIsSupported(serverInfo);\n\n // /server_info is unprotected, so a stale session key still gets 200.\n // In public mode, validate the key against a protected endpoint so a\n // server restart with a new LOCAL_BACKEND_API_KEY surfaces immediately\n // instead of letting the app load and fail on every subsequent call.\n if (isAuthRequired()) {\n try {\n await new SettingsClient(clientOptions).getSettings();\n } catch (error) {\n // Only rethrow 401 — that means the stored key is invalid /\n // rotated. Other HTTP errors (403, 5xx) and non-HTTP errors\n // (network, timeout) are swallowed: the server *is* up (we just\n // reached /server_info), so let the app proceed with an\n // unvalidated key rather than blocking the UI.\n // NOTE: If the connection drops between the /server_info and\n // getSettings() probes, the app loads with an unvalidated key and\n // subsequent 401s won't trigger the auth screen (they come from\n // React Query hooks, not this bootstrap path). Acceptable for now\n // since the window is narrow and a page refresh recovers.\n if (isSdkHttpStatusError(error, 401)) {\n throw error;\n }\n\n console.warn(\n \"[agent-server] getSettings() probe failed (non-401):\",\n error,\n );\n }\n }\n\n cachedAgentServerInfo = serverInfo;\n cachedAgentServerInfoHost = clientOptions.host;\n return serverInfo;\n}\n"],"mappings":";;;;;;;;AAeA,IAAM,IAA+B,KAC/B,IAA+B,WAExB,IACX,EAAS,cAAc,oBACZ,IACX,oCACW,IACX,gCAQW,IAAgC,mBAQzC,IAAgD,MAChD,IAA2C,MAEzC,KAAsB,MACtB,MAAM,QAAQ,GAAY,YAAY,IACjC,EAAW,eAEb,MAGI,IAAb,cAAiD,MAAM;CACrD;CACA;CAEA,YACE,GACA,GACA;EACA,IAAM,IAAsB,GAAS,uBAAuB;EAQ5D,AAPA,MACE,IACI,6EACA,gHACN,GACA,KAAK,OAAO,+BACZ,KAAK,UAAU,KAAW,MAC1B,KAAK,sBAAsB;CAC7B;AACF,GAEa,KACX,MAEA,aAAiB,KAChB,OAAO,KAAU,cAChB,KACA,UAAU,MACT,EAAM,SAAS,iCACd,EAAM,SAAS,wCACf,EAAM,SAAS,mCAER,IAAb,cAAwD,EAA4B;CAClF,OAAgB;CAChB;CACA,kBAA2B;CAE3B,YAAY,GAAuB;EACjC,IAAM,IAAU,sCAAsC,EAAwC,qCAAqC,EAAc;EAIjJ,AAHA,MAAM,CAAO,GACb,KAAK,OAAO,sCACZ,KAAK,UAAU,GACf,KAAK,gBAAgB;CACvB;AACF,GAEa,IAAb,cAAoD,EAA4B;CAC9E,OAAgB;CAChB;CACA,kBAA2B;CAE3B,YAAY,GAA8B;EAExC,IAAM,IACJ,2DAFe,IAAgB,iBAAiB,EAAc,MAAM,GAEA,sCAC9B,EAAwC;EAMhF,AAHA,MAAM,CAAO,GACb,KAAK,OAAO,kCACZ,KAAK,UAAU,GACf,KAAK,gBAAgB;CACvB;AACF,GA6Ba,KAA0B,MACrC,EAAe,KAAK,EAAqB,GAAO,GAAG;AAErD,SAAgB,IAA6B;CAE3C,AADA,IAAwB,MACxB,IAA4B;AAC9B;AAEA,SAAgB,EAAyB,GAE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;AAEA,eAAsB,IAAsB;CAK1C,IAAM,IAAQ,EAAyB;CACvC,IAAI,CAAC,GAAO;EAMV,IALA,EAA2B,GAKvB,EAAY,EAAiB,EAAE,OAAO,GACxC,MAAM,IAAI,EAA4B,yBAAyB,EAC7D,qBAAqB,GACvB,CAAC;EAIH,OAAO;CACT;CAEA,IAAM,IAAgB,EAA4B;EAChD,MAAM,EAAM;EACZ,eAAe,EAAM,UAAU;EAC/B,SAAS;CACX,CAAC,GACG;CAEJ,IAAI;EACF,IAAc,MAAM,IAAI,EACtB,CACF,EAAE,cAAc;CAClB,SAAS,GAAO;EAUd,MATA,EAA2B,GAIvB,EAAqB,GAAO,GAAG,IAC3B,IAIF,IAAI,EADM,aAAiB,QAAQ,EAAM,UAAU,IACZ;CAC/C;CAQA,IANA,EAAoC,CAAU,GAM1C,EAAe,GACjB,IAAI;EACF,MAAM,IAAI,EAAe,CAAa,EAAE,YAAY;CACtD,SAAS,GAAO;EAWd,IAAI,EAAqB,GAAO,GAAG,GACjC,MAAM;EAGR,QAAQ,KACN,wDACA,CACF;CACF;CAKF,OAFA,IAAwB,GACxB,IAA4B,EAAc,MACnC;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../_virtual/_rolldown/runtime.cjs");var e=`workspace/project`,t=`__AGENT_CANVAS_LOCK_TO_CLOUD__`,n=`all-hands.dev`,r=`openhands.dev`,i=`app.${n}`,a=r,o=`app.${r}`;function s(e){return e?.trim()||null}function c(e){if(!e)return null;let t=e.trim().replace(/\/$/,``);return t?/^https?:\/\//i.test(t)?t:typeof window<`u`?`${window.location.protocol}//${t}`:`http://${t}`:null}function l(e){if(!e)return null;let t=e.trim().replace(/\/+$/,``);return t?/^https?:\/\//i.test(t)?t:`https://${t}`:null}function u(e){let t=e.toLowerCase();return t===i||t===o?a:t===n?r:t.endsWith(`.${n}`)?`${t.slice(0,-13)}${r}`:t}function d(e){let t=l(e);if(!t)return null;try{let e=new URL(t),n=e.port?`:${e.port}`:``;return`${e.protocol}//${u(e.hostname)}${n}`}catch{return t.toLowerCase()}}function f(){let e=h();return!e||typeof window>`u`||!g(window.location.origin,e)?null:window.location.origin}function p(){return c(void 0)}function m(){let e=s(void 0);if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_SESSION_API_KEY__;if(typeof e==`string`)return s(e)}return null}function h(){let e=l(void 0);if(e)return e;if(typeof window<`u`){let e=window[t];if(typeof e==`string`)return l(e)}return null}function g(e,t){let n=d(e),r=d(t);return!n||!r?!1:n===r}function _(){return f()?`cookie`:`api-key`}function v(){return p()||(typeof window<`u`?window.location.origin:null)}function y(){return m()}function b(){return e}function x(e){return`${
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");var e=`workspace/project`,t=`__AGENT_CANVAS_LOCK_TO_CLOUD__`,n=`all-hands.dev`,r=`openhands.dev`,i=`app.${n}`,a=r,o=`app.${r}`;function s(e){return e?.trim()||null}function c(e){if(!e)return null;let t=e.trim().replace(/\/$/,``);return t?/^https?:\/\//i.test(t)?t:typeof window<`u`?`${window.location.protocol}//${t}`:`http://${t}`:null}function l(e){if(!e)return null;let t=e.trim().replace(/\/+$/,``);return t?/^https?:\/\//i.test(t)?t:`https://${t}`:null}function u(e){let t=e.toLowerCase();return t===i||t===o?a:t===n?r:t.endsWith(`.${n}`)?`${t.slice(0,-13)}${r}`:t}function d(e){let t=l(e);if(!t)return null;try{let e=new URL(t),n=e.port?`:${e.port}`:``;return`${e.protocol}//${u(e.hostname)}${n}`}catch{return t.toLowerCase()}}function f(){let e=h();return!e||typeof window>`u`||!g(window.location.origin,e)?null:window.location.origin}function p(){return c(void 0)}function m(){let e=s(void 0);if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_SESSION_API_KEY__;if(typeof e==`string`)return s(e)}return null}function h(){let e=l(void 0);if(e)return e;if(typeof window<`u`){let e=window[t];if(typeof e==`string`)return l(e)}return null}function g(e,t){let n=d(e),r=d(t);return!n||!r?!1:n===r}function _(){return f()?`cookie`:`api-key`}function v(){return p()||(typeof window<`u`?window.location.origin:null)}function y(){return m()}function b(){return e}function x(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/-/g,``)}`}function S(e){return x(b(),e)}function C(t){return x(e,t)}function w(e){let t=c(v()),n=c(e);return!t||!n?!1:t===n}function T(e,t){return w(t)?S(e):C(e)}function E(){let e=y();return e?{"X-Session-API-Key":e}:{}}function D(){return typeof window<`u`&&window.__AGENT_CANVAS_AUTH_REQUIRED__===!0}exports.DEFAULT_WORKING_DIR=e,exports.buildConversationWorkingDirForBackend=T,exports.getAgentServerBaseUrl=v,exports.getAgentServerHeaders=E,exports.getAgentServerSessionApiKey=y,exports.getAgentServerWorkingDir=b,exports.getCookieAuthCloudHost=f,exports.getLockedCloudAuthMode=_,exports.getLockedCloudHost=h,exports.isAuthRequired=D;
|
|
2
2
|
//# sourceMappingURL=agent-server-config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-server-config.cjs","names":[],"sources":["../../src/api/agent-server-config.ts"],"sourcesContent":["export const DEFAULT_WORKING_DIR = \"workspace/project\";\n\nexport type LockedCloudAuthMode = \"api-key\" | \"cookie\";\n\nexport interface AgentServerFormDefaults {\n baseUrl: string;\n sessionApiKey: string;\n}\n\n// Window-global key the static server injects `--lock-to-cloud` into; kept\n// module-private because only `getLockedCloudHost()` reads it. The static\n// server (`scripts/static-server.mjs`) and its tests reference the literal\n// string directly, not this constant.\nconst LOCK_TO_CLOUD_WINDOW_KEY = \"__AGENT_CANVAS_LOCK_TO_CLOUD__\";\nconst LEGACY_CLOUD_DOMAIN = \"all-hands.dev\";\nconst CURRENT_CLOUD_DOMAIN = \"openhands.dev\";\nconst LEGACY_PRODUCTION_APP_HOST = `app.${LEGACY_CLOUD_DOMAIN}`;\nconst CURRENT_PRODUCTION_APP_HOST = CURRENT_CLOUD_DOMAIN;\nconst PRODUCTION_APP_HOST_ALIAS = `app.${CURRENT_CLOUD_DOMAIN}`;\n\nfunction trimToNull(value?: string | null): string | null {\n return value?.trim() || null;\n}\n\nfunction normalizeBaseUrl(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n if (typeof window !== \"undefined\") {\n return `${window.location.protocol}//${trimmed}`;\n }\n\n return `http://${trimmed}`;\n}\n\nfunction normalizeCloudHost(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n return `https://${trimmed}`;\n}\n\nfunction canonicalizeCloudHostname(hostname: string): string {\n const lower = hostname.toLowerCase();\n if (\n lower === LEGACY_PRODUCTION_APP_HOST ||\n lower === PRODUCTION_APP_HOST_ALIAS\n ) {\n return CURRENT_PRODUCTION_APP_HOST;\n }\n\n if (lower === LEGACY_CLOUD_DOMAIN) return CURRENT_CLOUD_DOMAIN;\n if (lower.endsWith(`.${LEGACY_CLOUD_DOMAIN}`)) {\n return `${lower.slice(0, -LEGACY_CLOUD_DOMAIN.length)}${CURRENT_CLOUD_DOMAIN}`;\n }\n\n return lower;\n}\n\nfunction getCloudHostComparisonKey(value?: string | null): string | null {\n const normalized = normalizeCloudHost(value);\n if (!normalized) return null;\n\n try {\n const url = new URL(normalized);\n const port = url.port ? `:${url.port}` : \"\";\n return `${url.protocol}//${canonicalizeCloudHostname(url.hostname)}${port}`;\n } catch {\n return normalized.toLowerCase();\n }\n}\n\nexport function getCookieAuthCloudHost(): string | null {\n const lockedHost = getLockedCloudHost();\n if (\n !lockedHost ||\n typeof window === \"undefined\" ||\n !isSameCloudHost(window.location.origin, lockedHost)\n ) {\n return null;\n }\n\n return window.location.origin;\n}\n\nfunction getConfiguredBaseUrl(): string | null {\n return normalizeBaseUrl(import.meta.env.VITE_BACKEND_BASE_URL);\n}\n\n/**\n * Return the session API key supplied by the deployment host.\n *\n * Two sources are consulted, in order:\n * 1. `VITE_SESSION_API_KEY` — baked into the bundle at build time (used by\n * `npm run dev` so the dev server has the key without a round-trip).\n * 2. `window.__AGENT_CANVAS_SESSION_API_KEY__` — injected into `index.html`\n * at serve time by `scripts/static-server.mjs --session-api-key <key>`.\n * This is the path used by the published `agent-canvas` binary, where\n * `VITE_SESSION_API_KEY` is empty in the prebuilt bundle and the\n * runtime key is generated when the user launches the CLI.\n *\n * Without the window-global fallback, the published binary cannot construct a\n * default local backend (`makeDefaultLocalBackend()` returns null), the\n * registry is left empty, and the user sees the Manage Backends modal\n * instead of the onboarding flow.\n */\nexport function getBakedSessionApiKey(): string | null {\n const envKey = trimToNull(import.meta.env.VITE_SESSION_API_KEY);\n if (envKey) return envKey;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_SESSION_API_KEY__;\n if (typeof injected === \"string\") {\n return trimToNull(injected);\n }\n }\n\n return null;\n}\n\nexport function getAgentServerFormDefaults(): AgentServerFormDefaults {\n return {\n baseUrl: getAgentServerBaseUrl() ?? \"\",\n sessionApiKey: getAgentServerSessionApiKey() ?? \"\",\n };\n}\n\nexport function getLockedCloudHost(): string | null {\n const envHost = normalizeCloudHost(import.meta.env.VITE_LOCK_TO_CLOUD);\n if (envHost) return envHost;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)[\n LOCK_TO_CLOUD_WINDOW_KEY\n ];\n if (typeof injected === \"string\") {\n return normalizeCloudHost(injected);\n }\n }\n\n return null;\n}\n\n/**\n * Compare a backend host against the locked Cloud host, normalizing\n * trailing slashes, protocol, and case so that e.g.\n * `https://app.all-hands.dev/` matches `https://app.all-hands.dev`.\n *\n * Used by the locked-to-Cloud gates (`root.tsx`,\n * `onboarding-modal.tsx`) to decide whether the active backend is the\n * configured locked Cloud host — a Cloud backend on a *different* host\n * (or a stale Local backend) must not be treated as the locked backend.\n */\nexport function isSameCloudHost(\n host: string | null | undefined,\n lockedHost: string | null | undefined,\n): boolean {\n const a = getCloudHostComparisonKey(host);\n const b = getCloudHostComparisonKey(lockedHost);\n if (!a || !b) return false;\n return a === b;\n}\n\nexport function getLockedCloudAuthMode(): LockedCloudAuthMode {\n return getCookieAuthCloudHost() ? \"cookie\" : \"api-key\";\n}\n\nexport function getAgentServerBaseUrl(): string | null {\n const configuredUrl = getConfiguredBaseUrl();\n if (configuredUrl) return configuredUrl;\n\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n\n return null;\n}\n\nexport function getAgentServerSessionApiKey(): string | null {\n return getBakedSessionApiKey();\n}\n\nexport function getAgentServerWorkingDir(): string {\n const envDir = import.meta.env.VITE_WORKING_DIR?.trim();\n if (envDir) return envDir;\n\n return DEFAULT_WORKING_DIR;\n}\n\nexport function buildConversationWorkingDir(conversationId: string): string {\n const base = getAgentServerWorkingDir().replace(/\\/+$/, \"\");\n const hex = conversationId.replace(/-/g, \"\");\n return `${base}/${hex}`;\n}\n\nexport function getAgentServerHeaders(): Record<string, string> {\n const sessionApiKey = getAgentServerSessionApiKey();\n return sessionApiKey ? { \"X-Session-API-Key\": sessionApiKey } : {};\n}\n\nexport function isAuthRequired(): boolean {\n return (\n import.meta.env.VITE_AUTH_REQUIRED === \"true\" ||\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_AUTH_REQUIRED__ === true)\n );\n}\n\nexport function isAuthRequiredAndMissing(): boolean {\n if (!isAuthRequired()) return false;\n return !getAgentServerSessionApiKey();\n}\n"],"mappings":"6CAAA,IAAa,EAAsB,oBAa7B,EAA2B,iCAC3B,EAAsB,gBACtB,EAAuB,gBACvB,EAA6B,OAAO,IACpC,EAA8B,EAC9B,EAA4B,OAAO,IAEzC,SAAS,EAAW,EAAsC,CACxD,OAAO,GAAO,KAAK,GAAK,IAC1B,CAEA,SAAS,EAAiB,EAAsC,CAC9D,GAAI,CAAC,EAAO,OAAO,KAE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AAO,EAAW,CAAQ,CAE9B,CAEA,OAAO,IACT,CASA,SAAgB,GAAoC,CAClD,IAAM,EAAU,EAAA,IAAA,EAAqD,EACrE,GAAI,EAAS,OAAO,EAEpB,GAAI,OAAO,OAAW,IAAa,CACjC,IAAM,EAAY,OAChB,GAEF,GAAI,OAAO,GAAa,SACtB,OAAO,EAAmB,CAAQ,CAEtC,CAEA,OAAO,IACT,CAYA,SAAgB,EACd,EACA,EACS,CACT,IAAM,EAAI,EAA0B,CAAI,EAClC,EAAI,EAA0B,CAAU,EAE9C,MADI,CAAC,GAAK,CAAC,EAAU,GACd,IAAM,CACf,CAEA,SAAgB,GAA8C,CAC5D,OAAO,EAAuB,EAAI,SAAW,SAC/C,CAEA,SAAgB,GAAuC,CAQrD,OAPsB,EAClB,IAEA,OAAO,OAAW,IACb,OAAO,SAAS,OAGlB,KACT,CAEA,SAAgB,GAA6C,CAC3D,OAAO,EAAsB,CAC/B,CAEA,SAAgB,GAAmC,CAIjD,OAAO,CACT,CAEA,SAAgB,EAA4B,EAAgC,CAG1E,MAAO,GAFM,EAAyB,EAAE,QAAQ,OAAQ,EAE9C,EAAK,GADH,EAAe,QAAQ,KAAM,EACvB,GACpB,CAEA,SAAgB,GAAgD,CAC9D,IAAM,EAAgB,EAA4B,EAClD,OAAO,EAAgB,CAAE,oBAAqB,CAAc,EAAI,CAAC,CACnE,CAEA,SAAgB,GAA0B,CACxC,OAEG,OAAO,OAAW,KAChB,OACE,iCAAmC,EAE5C"}
|
|
1
|
+
{"version":3,"file":"agent-server-config.cjs","names":[],"sources":["../../src/api/agent-server-config.ts"],"sourcesContent":["export const DEFAULT_WORKING_DIR = \"workspace/project\";\n\nexport type LockedCloudAuthMode = \"api-key\" | \"cookie\";\n\nexport interface AgentServerFormDefaults {\n baseUrl: string;\n sessionApiKey: string;\n}\n\n// Window-global key the static server injects `--lock-to-cloud` into; kept\n// module-private because only `getLockedCloudHost()` reads it. The static\n// server (`scripts/static-server.mjs`) and its tests reference the literal\n// string directly, not this constant.\nconst LOCK_TO_CLOUD_WINDOW_KEY = \"__AGENT_CANVAS_LOCK_TO_CLOUD__\";\nconst LEGACY_CLOUD_DOMAIN = \"all-hands.dev\";\nconst CURRENT_CLOUD_DOMAIN = \"openhands.dev\";\nconst LEGACY_PRODUCTION_APP_HOST = `app.${LEGACY_CLOUD_DOMAIN}`;\nconst CURRENT_PRODUCTION_APP_HOST = CURRENT_CLOUD_DOMAIN;\nconst PRODUCTION_APP_HOST_ALIAS = `app.${CURRENT_CLOUD_DOMAIN}`;\n\nfunction trimToNull(value?: string | null): string | null {\n return value?.trim() || null;\n}\n\nfunction normalizeBaseUrl(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n if (typeof window !== \"undefined\") {\n return `${window.location.protocol}//${trimmed}`;\n }\n\n return `http://${trimmed}`;\n}\n\nfunction normalizeCloudHost(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n return `https://${trimmed}`;\n}\n\nfunction canonicalizeCloudHostname(hostname: string): string {\n const lower = hostname.toLowerCase();\n if (\n lower === LEGACY_PRODUCTION_APP_HOST ||\n lower === PRODUCTION_APP_HOST_ALIAS\n ) {\n return CURRENT_PRODUCTION_APP_HOST;\n }\n\n if (lower === LEGACY_CLOUD_DOMAIN) return CURRENT_CLOUD_DOMAIN;\n if (lower.endsWith(`.${LEGACY_CLOUD_DOMAIN}`)) {\n return `${lower.slice(0, -LEGACY_CLOUD_DOMAIN.length)}${CURRENT_CLOUD_DOMAIN}`;\n }\n\n return lower;\n}\n\nfunction getCloudHostComparisonKey(value?: string | null): string | null {\n const normalized = normalizeCloudHost(value);\n if (!normalized) return null;\n\n try {\n const url = new URL(normalized);\n const port = url.port ? `:${url.port}` : \"\";\n return `${url.protocol}//${canonicalizeCloudHostname(url.hostname)}${port}`;\n } catch {\n return normalized.toLowerCase();\n }\n}\n\nexport function getCookieAuthCloudHost(): string | null {\n const lockedHost = getLockedCloudHost();\n if (\n !lockedHost ||\n typeof window === \"undefined\" ||\n !isSameCloudHost(window.location.origin, lockedHost)\n ) {\n return null;\n }\n\n return window.location.origin;\n}\n\nfunction getConfiguredBaseUrl(): string | null {\n return normalizeBaseUrl(import.meta.env.VITE_BACKEND_BASE_URL);\n}\n\n/**\n * Return the session API key supplied by the deployment host.\n *\n * Two sources are consulted, in order:\n * 1. `VITE_SESSION_API_KEY` — baked into the bundle at build time (used by\n * `npm run dev` so the dev server has the key without a round-trip).\n * 2. `window.__AGENT_CANVAS_SESSION_API_KEY__` — injected into `index.html`\n * at serve time by `scripts/static-server.mjs --session-api-key <key>`.\n * This is the path used by the published `agent-canvas` binary, where\n * `VITE_SESSION_API_KEY` is empty in the prebuilt bundle and the\n * runtime key is generated when the user launches the CLI.\n *\n * Without the window-global fallback, the published binary cannot construct a\n * default local backend (`makeDefaultLocalBackend()` returns null), the\n * registry is left empty, and the user sees the Manage Backends modal\n * instead of the onboarding flow.\n */\nexport function getBakedSessionApiKey(): string | null {\n const envKey = trimToNull(import.meta.env.VITE_SESSION_API_KEY);\n if (envKey) return envKey;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_SESSION_API_KEY__;\n if (typeof injected === \"string\") {\n return trimToNull(injected);\n }\n }\n\n return null;\n}\n\nexport function getAgentServerFormDefaults(): AgentServerFormDefaults {\n return {\n baseUrl: getAgentServerBaseUrl() ?? \"\",\n sessionApiKey: getAgentServerSessionApiKey() ?? \"\",\n };\n}\n\nexport function getLockedCloudHost(): string | null {\n const envHost = normalizeCloudHost(import.meta.env.VITE_LOCK_TO_CLOUD);\n if (envHost) return envHost;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)[\n LOCK_TO_CLOUD_WINDOW_KEY\n ];\n if (typeof injected === \"string\") {\n return normalizeCloudHost(injected);\n }\n }\n\n return null;\n}\n\n/**\n * Compare a backend host against the locked Cloud host, normalizing\n * trailing slashes, protocol, and case so that e.g.\n * `https://app.all-hands.dev/` matches `https://app.all-hands.dev`.\n *\n * Used by the locked-to-Cloud gates (`root.tsx`,\n * `onboarding-modal.tsx`) to decide whether the active backend is the\n * configured locked Cloud host — a Cloud backend on a *different* host\n * (or a stale Local backend) must not be treated as the locked backend.\n */\nexport function isSameCloudHost(\n host: string | null | undefined,\n lockedHost: string | null | undefined,\n): boolean {\n const a = getCloudHostComparisonKey(host);\n const b = getCloudHostComparisonKey(lockedHost);\n if (!a || !b) return false;\n return a === b;\n}\n\nexport function getLockedCloudAuthMode(): LockedCloudAuthMode {\n return getCookieAuthCloudHost() ? \"cookie\" : \"api-key\";\n}\n\nexport function getAgentServerBaseUrl(): string | null {\n const configuredUrl = getConfiguredBaseUrl();\n if (configuredUrl) return configuredUrl;\n\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n\n return null;\n}\n\nexport function getAgentServerSessionApiKey(): string | null {\n return getBakedSessionApiKey();\n}\n\nexport function getAgentServerWorkingDir(): string {\n const envDir = import.meta.env.VITE_WORKING_DIR?.trim();\n if (envDir) return envDir;\n\n return DEFAULT_WORKING_DIR;\n}\n\nfunction buildWorkingDir(base: string, conversationId: string): string {\n const trimmed = base.replace(/\\/+$/, \"\");\n const hex = conversationId.replace(/-/g, \"\");\n return `${trimmed}/${hex}`;\n}\n\nexport function buildConversationWorkingDir(conversationId: string): string {\n return buildWorkingDir(getAgentServerWorkingDir(), conversationId);\n}\n\n/**\n * Conversation working dir under the backend-relative default\n * (`workspace/project/<hex>`), deliberately ignoring any baked absolute\n * `VITE_WORKING_DIR`. `resolveAbsoluteAgentServerPath()` anchors this to the\n * active backend's own home via `GET /api/file/home`, so it resolves to a\n * writable path on whichever backend actually runs the conversation.\n */\nexport function buildRelativeConversationWorkingDir(\n conversationId: string,\n): string {\n return buildWorkingDir(DEFAULT_WORKING_DIR, conversationId);\n}\n\n/**\n * Whether `backendHost` is the same host that served this frontend.\n *\n * A launcher-baked `VITE_WORKING_DIR` is an absolute path on the serving\n * host's filesystem, so it is only valid on that exact backend. The seeded\n * `default-local` entry starts life pointing at the served origin, but its\n * `host` is mutable — the user can edit it to a remote backend while its id\n * stays `default-local`. Matching on the host (not the stable id) keeps the\n * real invariant: the baked path is only safe for the host it was baked for.\n */\nexport function isServedOriginHost(\n backendHost: string | null | undefined,\n): boolean {\n const served = normalizeBaseUrl(getAgentServerBaseUrl());\n const candidate = normalizeBaseUrl(backendHost);\n if (!served || !candidate) return false;\n return served === candidate;\n}\n\n/**\n * Base working dir for a new conversation on the backend at `backendHost`.\n * The baked (possibly absolute) default is used only for the served-origin\n * backend; every other backend gets the relative default, anchored to its\n * own home by `resolveAbsoluteAgentServerPath()`.\n */\nexport function buildConversationWorkingDirForBackend(\n conversationId: string,\n backendHost: string | null | undefined,\n): string {\n return isServedOriginHost(backendHost)\n ? buildConversationWorkingDir(conversationId)\n : buildRelativeConversationWorkingDir(conversationId);\n}\n\nexport function getAgentServerHeaders(): Record<string, string> {\n const sessionApiKey = getAgentServerSessionApiKey();\n return sessionApiKey ? { \"X-Session-API-Key\": sessionApiKey } : {};\n}\n\nexport function isAuthRequired(): boolean {\n return (\n import.meta.env.VITE_AUTH_REQUIRED === \"true\" ||\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_AUTH_REQUIRED__ === true)\n );\n}\n\nexport function isAuthRequiredAndMissing(): boolean {\n if (!isAuthRequired()) return false;\n return !getAgentServerSessionApiKey();\n}\n"],"mappings":"6CAAA,IAAa,EAAsB,oBAa7B,EAA2B,iCAC3B,EAAsB,gBACtB,EAAuB,gBACvB,EAA6B,OAAO,IACpC,EAA8B,EAC9B,EAA4B,OAAO,IAEzC,SAAS,EAAW,EAAsC,CACxD,O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CAC9D,IAAM,EAAgB,EAA4B,EAClD,OAAO,EAAgB,CAAE,oBAAqB,CAAc,EAAI,CAAC,CACnE,CAEA,SAAgB,GAA0B,CACxC,OAEG,OAAO,OAAW,KAChB,OACE,iCAAmC,EAE5C"}
|
|
@@ -41,6 +41,32 @@ export declare function getAgentServerBaseUrl(): string | null;
|
|
|
41
41
|
export declare function getAgentServerSessionApiKey(): string | null;
|
|
42
42
|
export declare function getAgentServerWorkingDir(): string;
|
|
43
43
|
export declare function buildConversationWorkingDir(conversationId: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Conversation working dir under the backend-relative default
|
|
46
|
+
* (`workspace/project/<hex>`), deliberately ignoring any baked absolute
|
|
47
|
+
* `VITE_WORKING_DIR`. `resolveAbsoluteAgentServerPath()` anchors this to the
|
|
48
|
+
* active backend's own home via `GET /api/file/home`, so it resolves to a
|
|
49
|
+
* writable path on whichever backend actually runs the conversation.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildRelativeConversationWorkingDir(conversationId: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether `backendHost` is the same host that served this frontend.
|
|
54
|
+
*
|
|
55
|
+
* A launcher-baked `VITE_WORKING_DIR` is an absolute path on the serving
|
|
56
|
+
* host's filesystem, so it is only valid on that exact backend. The seeded
|
|
57
|
+
* `default-local` entry starts life pointing at the served origin, but its
|
|
58
|
+
* `host` is mutable — the user can edit it to a remote backend while its id
|
|
59
|
+
* stays `default-local`. Matching on the host (not the stable id) keeps the
|
|
60
|
+
* real invariant: the baked path is only safe for the host it was baked for.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isServedOriginHost(backendHost: string | null | undefined): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Base working dir for a new conversation on the backend at `backendHost`.
|
|
65
|
+
* The baked (possibly absolute) default is used only for the served-origin
|
|
66
|
+
* backend; every other backend gets the relative default, anchored to its
|
|
67
|
+
* own home by `resolveAbsoluteAgentServerPath()`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildConversationWorkingDirForBackend(conversationId: string, backendHost: string | null | undefined): string;
|
|
44
70
|
export declare function getAgentServerHeaders(): Record<string, string>;
|
|
45
71
|
export declare function isAuthRequired(): boolean;
|
|
46
72
|
export declare function isAuthRequiredAndMissing(): boolean;
|
|
@@ -68,17 +68,30 @@ function y() {
|
|
|
68
68
|
function b() {
|
|
69
69
|
return e;
|
|
70
70
|
}
|
|
71
|
-
function x(e) {
|
|
72
|
-
return `${
|
|
71
|
+
function x(e, t) {
|
|
72
|
+
return `${e.replace(/\/+$/, "")}/${t.replace(/-/g, "")}`;
|
|
73
73
|
}
|
|
74
|
-
function S() {
|
|
74
|
+
function S(e) {
|
|
75
|
+
return x(b(), e);
|
|
76
|
+
}
|
|
77
|
+
function C(t) {
|
|
78
|
+
return x(e, t);
|
|
79
|
+
}
|
|
80
|
+
function w(e) {
|
|
81
|
+
let t = c(v()), n = c(e);
|
|
82
|
+
return !t || !n ? !1 : t === n;
|
|
83
|
+
}
|
|
84
|
+
function T(e, t) {
|
|
85
|
+
return w(t) ? S(e) : C(e);
|
|
86
|
+
}
|
|
87
|
+
function E() {
|
|
75
88
|
let e = y();
|
|
76
89
|
return e ? { "X-Session-API-Key": e } : {};
|
|
77
90
|
}
|
|
78
|
-
function
|
|
91
|
+
function D() {
|
|
79
92
|
return typeof window < "u" && window.__AGENT_CANVAS_AUTH_REQUIRED__ === !0;
|
|
80
93
|
}
|
|
81
94
|
//#endregion
|
|
82
|
-
export { e as DEFAULT_WORKING_DIR,
|
|
95
|
+
export { e as DEFAULT_WORKING_DIR, T as buildConversationWorkingDirForBackend, v as getAgentServerBaseUrl, E as getAgentServerHeaders, y as getAgentServerSessionApiKey, b as getAgentServerWorkingDir, f as getCookieAuthCloudHost, _ as getLockedCloudAuthMode, h as getLockedCloudHost, D as isAuthRequired };
|
|
83
96
|
|
|
84
97
|
//# sourceMappingURL=agent-server-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-server-config.js","names":[],"sources":["../../src/api/agent-server-config.ts"],"sourcesContent":["export const DEFAULT_WORKING_DIR = \"workspace/project\";\n\nexport type LockedCloudAuthMode = \"api-key\" | \"cookie\";\n\nexport interface AgentServerFormDefaults {\n baseUrl: string;\n sessionApiKey: string;\n}\n\n// Window-global key the static server injects `--lock-to-cloud` into; kept\n// module-private because only `getLockedCloudHost()` reads it. The static\n// server (`scripts/static-server.mjs`) and its tests reference the literal\n// string directly, not this constant.\nconst LOCK_TO_CLOUD_WINDOW_KEY = \"__AGENT_CANVAS_LOCK_TO_CLOUD__\";\nconst LEGACY_CLOUD_DOMAIN = \"all-hands.dev\";\nconst CURRENT_CLOUD_DOMAIN = \"openhands.dev\";\nconst LEGACY_PRODUCTION_APP_HOST = `app.${LEGACY_CLOUD_DOMAIN}`;\nconst CURRENT_PRODUCTION_APP_HOST = CURRENT_CLOUD_DOMAIN;\nconst PRODUCTION_APP_HOST_ALIAS = `app.${CURRENT_CLOUD_DOMAIN}`;\n\nfunction trimToNull(value?: string | null): string | null {\n return value?.trim() || null;\n}\n\nfunction normalizeBaseUrl(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n if (typeof window !== \"undefined\") {\n return `${window.location.protocol}//${trimmed}`;\n }\n\n return `http://${trimmed}`;\n}\n\nfunction normalizeCloudHost(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n return `https://${trimmed}`;\n}\n\nfunction canonicalizeCloudHostname(hostname: string): string {\n const lower = hostname.toLowerCase();\n if (\n lower === LEGACY_PRODUCTION_APP_HOST ||\n lower === PRODUCTION_APP_HOST_ALIAS\n ) {\n return CURRENT_PRODUCTION_APP_HOST;\n }\n\n if (lower === LEGACY_CLOUD_DOMAIN) return CURRENT_CLOUD_DOMAIN;\n if (lower.endsWith(`.${LEGACY_CLOUD_DOMAIN}`)) {\n return `${lower.slice(0, -LEGACY_CLOUD_DOMAIN.length)}${CURRENT_CLOUD_DOMAIN}`;\n }\n\n return lower;\n}\n\nfunction getCloudHostComparisonKey(value?: string | null): string | null {\n const normalized = normalizeCloudHost(value);\n if (!normalized) return null;\n\n try {\n const url = new URL(normalized);\n const port = url.port ? `:${url.port}` : \"\";\n return `${url.protocol}//${canonicalizeCloudHostname(url.hostname)}${port}`;\n } catch {\n return normalized.toLowerCase();\n }\n}\n\nexport function getCookieAuthCloudHost(): string | null {\n const lockedHost = getLockedCloudHost();\n if (\n !lockedHost ||\n typeof window === \"undefined\" ||\n !isSameCloudHost(window.location.origin, lockedHost)\n ) {\n return null;\n }\n\n return window.location.origin;\n}\n\nfunction getConfiguredBaseUrl(): string | null {\n return normalizeBaseUrl(import.meta.env.VITE_BACKEND_BASE_URL);\n}\n\n/**\n * Return the session API key supplied by the deployment host.\n *\n * Two sources are consulted, in order:\n * 1. `VITE_SESSION_API_KEY` — baked into the bundle at build time (used by\n * `npm run dev` so the dev server has the key without a round-trip).\n * 2. `window.__AGENT_CANVAS_SESSION_API_KEY__` — injected into `index.html`\n * at serve time by `scripts/static-server.mjs --session-api-key <key>`.\n * This is the path used by the published `agent-canvas` binary, where\n * `VITE_SESSION_API_KEY` is empty in the prebuilt bundle and the\n * runtime key is generated when the user launches the CLI.\n *\n * Without the window-global fallback, the published binary cannot construct a\n * default local backend (`makeDefaultLocalBackend()` returns null), the\n * registry is left empty, and the user sees the Manage Backends modal\n * instead of the onboarding flow.\n */\nexport function getBakedSessionApiKey(): string | null {\n const envKey = trimToNull(import.meta.env.VITE_SESSION_API_KEY);\n if (envKey) return envKey;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_SESSION_API_KEY__;\n if (typeof injected === \"string\") {\n return trimToNull(injected);\n }\n }\n\n return null;\n}\n\nexport function getAgentServerFormDefaults(): AgentServerFormDefaults {\n return {\n baseUrl: getAgentServerBaseUrl() ?? \"\",\n sessionApiKey: getAgentServerSessionApiKey() ?? \"\",\n };\n}\n\nexport function getLockedCloudHost(): string | null {\n const envHost = normalizeCloudHost(import.meta.env.VITE_LOCK_TO_CLOUD);\n if (envHost) return envHost;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)[\n LOCK_TO_CLOUD_WINDOW_KEY\n ];\n if (typeof injected === \"string\") {\n return normalizeCloudHost(injected);\n }\n }\n\n return null;\n}\n\n/**\n * Compare a backend host against the locked Cloud host, normalizing\n * trailing slashes, protocol, and case so that e.g.\n * `https://app.all-hands.dev/` matches `https://app.all-hands.dev`.\n *\n * Used by the locked-to-Cloud gates (`root.tsx`,\n * `onboarding-modal.tsx`) to decide whether the active backend is the\n * configured locked Cloud host — a Cloud backend on a *different* host\n * (or a stale Local backend) must not be treated as the locked backend.\n */\nexport function isSameCloudHost(\n host: string | null | undefined,\n lockedHost: string | null | undefined,\n): boolean {\n const a = getCloudHostComparisonKey(host);\n const b = getCloudHostComparisonKey(lockedHost);\n if (!a || !b) return false;\n return a === b;\n}\n\nexport function getLockedCloudAuthMode(): LockedCloudAuthMode {\n return getCookieAuthCloudHost() ? \"cookie\" : \"api-key\";\n}\n\nexport function getAgentServerBaseUrl(): string | null {\n const configuredUrl = getConfiguredBaseUrl();\n if (configuredUrl) return configuredUrl;\n\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n\n return null;\n}\n\nexport function getAgentServerSessionApiKey(): string | null {\n return getBakedSessionApiKey();\n}\n\nexport function getAgentServerWorkingDir(): string {\n const envDir = import.meta.env.VITE_WORKING_DIR?.trim();\n if (envDir) return envDir;\n\n return DEFAULT_WORKING_DIR;\n}\n\nexport function buildConversationWorkingDir(conversationId: string): string {\n const base = getAgentServerWorkingDir().replace(/\\/+$/, \"\");\n const hex = conversationId.replace(/-/g, \"\");\n return `${base}/${hex}`;\n}\n\nexport function getAgentServerHeaders(): Record<string, string> {\n const sessionApiKey = getAgentServerSessionApiKey();\n return sessionApiKey ? { \"X-Session-API-Key\": sessionApiKey } : {};\n}\n\nexport function isAuthRequired(): boolean {\n return (\n import.meta.env.VITE_AUTH_REQUIRED === \"true\" ||\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_AUTH_REQUIRED__ === true)\n );\n}\n\nexport function isAuthRequiredAndMissing(): boolean {\n if (!isAuthRequired()) return false;\n return !getAgentServerSessionApiKey();\n}\n"],"mappings":";AAAA,IAAa,IAAsB,qBAa7B,IAA2B,kCAC3B,IAAsB,iBACtB,IAAuB,iBACvB,IAA6B,OAAO,KACpC,IAA8B,GAC9B,IAA4B,OAAO;AAEzC,SAAS,EAAW,GAAsC;CACxD,OAAO,GAAO,KAAK,KAAK;AAC1B;AAEA,SAAS,EAAiB,GAAsC;CAC9D,IAAI,CAAC,GAAO,OAAO;CAEnB,IAAM,IAAU,EAAM,KAAK,EAAE,QAAQ,OAAO,EAAE;CAW9C,OAVK,IAED,gBAAgB,KAAK,CAAO,IACvB,IAGL,OAAO,SAAW,MACb,GAAG,OAAO,SAAS,SAAS,IAAI,MAGlC,UAAU,MAVI;AAWvB;AAEA,SAAS,EAAmB,GAAsC;CAChE,IAAI,CAAC,GAAO,OAAO;CAEnB,IAAM,IAAU,EAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;CAO/C,OANK,IAED,gBAAgB,KAAK,CAAO,IACvB,IAGF,WAAW,MANG;AAOvB;AAEA,SAAS,EAA0B,GAA0B;CAC3D,IAAM,IAAQ,EAAS,YAAY;CAanC,OAXE,MAAU,KACV,MAAU,IAEH,IAGL,MAAU,IAA4B,IACtC,EAAM,SAAS,IAAI,GAAqB,IACnC,GAAG,EAAM,MAAM,GAAG,GAA2B,IAAI,MAGnD;AACT;AAEA,SAAS,EAA0B,GAAsC;CACvE,IAAM,IAAa,EAAmB,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OAAO;AACT;AAEA,SAAgB,EAA4B,GAAgC;CAG1E,OAAO,GAFM,EAAyB,EAAE,QAAQ,QAAQ,EAE9C,EAAK,GADH,EAAe,QAAQ,MAAM,EACvB;AACpB;AAEA,SAAgB,IAAgD;CAC9D,IAAM,IAAgB,EAA4B;CAClD,OAAO,IAAgB,EAAE,qBAAqB,EAAc,IAAI,CAAC;AACnE;AAEA,SAAgB,IAA0B;CACxC,OAEG,OAAO,SAAW,OAChB,OACE,mCAAmC;AAE5C"}
|
|
1
|
+
{"version":3,"file":"agent-server-config.js","names":[],"sources":["../../src/api/agent-server-config.ts"],"sourcesContent":["export const DEFAULT_WORKING_DIR = \"workspace/project\";\n\nexport type LockedCloudAuthMode = \"api-key\" | \"cookie\";\n\nexport interface AgentServerFormDefaults {\n baseUrl: string;\n sessionApiKey: string;\n}\n\n// Window-global key the static server injects `--lock-to-cloud` into; kept\n// module-private because only `getLockedCloudHost()` reads it. The static\n// server (`scripts/static-server.mjs`) and its tests reference the literal\n// string directly, not this constant.\nconst LOCK_TO_CLOUD_WINDOW_KEY = \"__AGENT_CANVAS_LOCK_TO_CLOUD__\";\nconst LEGACY_CLOUD_DOMAIN = \"all-hands.dev\";\nconst CURRENT_CLOUD_DOMAIN = \"openhands.dev\";\nconst LEGACY_PRODUCTION_APP_HOST = `app.${LEGACY_CLOUD_DOMAIN}`;\nconst CURRENT_PRODUCTION_APP_HOST = CURRENT_CLOUD_DOMAIN;\nconst PRODUCTION_APP_HOST_ALIAS = `app.${CURRENT_CLOUD_DOMAIN}`;\n\nfunction trimToNull(value?: string | null): string | null {\n return value?.trim() || null;\n}\n\nfunction normalizeBaseUrl(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n if (typeof window !== \"undefined\") {\n return `${window.location.protocol}//${trimmed}`;\n }\n\n return `http://${trimmed}`;\n}\n\nfunction normalizeCloudHost(value?: string | null): string | null {\n if (!value) return null;\n\n const trimmed = value.trim().replace(/\\/+$/, \"\");\n if (!trimmed) return null;\n\n if (/^https?:\\/\\//i.test(trimmed)) {\n return trimmed;\n }\n\n return `https://${trimmed}`;\n}\n\nfunction canonicalizeCloudHostname(hostname: string): string {\n const lower = hostname.toLowerCase();\n if (\n lower === LEGACY_PRODUCTION_APP_HOST ||\n lower === PRODUCTION_APP_HOST_ALIAS\n ) {\n return CURRENT_PRODUCTION_APP_HOST;\n }\n\n if (lower === LEGACY_CLOUD_DOMAIN) return CURRENT_CLOUD_DOMAIN;\n if (lower.endsWith(`.${LEGACY_CLOUD_DOMAIN}`)) {\n return `${lower.slice(0, -LEGACY_CLOUD_DOMAIN.length)}${CURRENT_CLOUD_DOMAIN}`;\n }\n\n return lower;\n}\n\nfunction getCloudHostComparisonKey(value?: string | null): string | null {\n const normalized = normalizeCloudHost(value);\n if (!normalized) return null;\n\n try {\n const url = new URL(normalized);\n const port = url.port ? `:${url.port}` : \"\";\n return `${url.protocol}//${canonicalizeCloudHostname(url.hostname)}${port}`;\n } catch {\n return normalized.toLowerCase();\n }\n}\n\nexport function getCookieAuthCloudHost(): string | null {\n const lockedHost = getLockedCloudHost();\n if (\n !lockedHost ||\n typeof window === \"undefined\" ||\n !isSameCloudHost(window.location.origin, lockedHost)\n ) {\n return null;\n }\n\n return window.location.origin;\n}\n\nfunction getConfiguredBaseUrl(): string | null {\n return normalizeBaseUrl(import.meta.env.VITE_BACKEND_BASE_URL);\n}\n\n/**\n * Return the session API key supplied by the deployment host.\n *\n * Two sources are consulted, in order:\n * 1. `VITE_SESSION_API_KEY` — baked into the bundle at build time (used by\n * `npm run dev` so the dev server has the key without a round-trip).\n * 2. `window.__AGENT_CANVAS_SESSION_API_KEY__` — injected into `index.html`\n * at serve time by `scripts/static-server.mjs --session-api-key <key>`.\n * This is the path used by the published `agent-canvas` binary, where\n * `VITE_SESSION_API_KEY` is empty in the prebuilt bundle and the\n * runtime key is generated when the user launches the CLI.\n *\n * Without the window-global fallback, the published binary cannot construct a\n * default local backend (`makeDefaultLocalBackend()` returns null), the\n * registry is left empty, and the user sees the Manage Backends modal\n * instead of the onboarding flow.\n */\nexport function getBakedSessionApiKey(): string | null {\n const envKey = trimToNull(import.meta.env.VITE_SESSION_API_KEY);\n if (envKey) return envKey;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_SESSION_API_KEY__;\n if (typeof injected === \"string\") {\n return trimToNull(injected);\n }\n }\n\n return null;\n}\n\nexport function getAgentServerFormDefaults(): AgentServerFormDefaults {\n return {\n baseUrl: getAgentServerBaseUrl() ?? \"\",\n sessionApiKey: getAgentServerSessionApiKey() ?? \"\",\n };\n}\n\nexport function getLockedCloudHost(): string | null {\n const envHost = normalizeCloudHost(import.meta.env.VITE_LOCK_TO_CLOUD);\n if (envHost) return envHost;\n\n if (typeof window !== \"undefined\") {\n const injected = (window as unknown as Record<string, unknown>)[\n LOCK_TO_CLOUD_WINDOW_KEY\n ];\n if (typeof injected === \"string\") {\n return normalizeCloudHost(injected);\n }\n }\n\n return null;\n}\n\n/**\n * Compare a backend host against the locked Cloud host, normalizing\n * trailing slashes, protocol, and case so that e.g.\n * `https://app.all-hands.dev/` matches `https://app.all-hands.dev`.\n *\n * Used by the locked-to-Cloud gates (`root.tsx`,\n * `onboarding-modal.tsx`) to decide whether the active backend is the\n * configured locked Cloud host — a Cloud backend on a *different* host\n * (or a stale Local backend) must not be treated as the locked backend.\n */\nexport function isSameCloudHost(\n host: string | null | undefined,\n lockedHost: string | null | undefined,\n): boolean {\n const a = getCloudHostComparisonKey(host);\n const b = getCloudHostComparisonKey(lockedHost);\n if (!a || !b) return false;\n return a === b;\n}\n\nexport function getLockedCloudAuthMode(): LockedCloudAuthMode {\n return getCookieAuthCloudHost() ? \"cookie\" : \"api-key\";\n}\n\nexport function getAgentServerBaseUrl(): string | null {\n const configuredUrl = getConfiguredBaseUrl();\n if (configuredUrl) return configuredUrl;\n\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n\n return null;\n}\n\nexport function getAgentServerSessionApiKey(): string | null {\n return getBakedSessionApiKey();\n}\n\nexport function getAgentServerWorkingDir(): string {\n const envDir = import.meta.env.VITE_WORKING_DIR?.trim();\n if (envDir) return envDir;\n\n return DEFAULT_WORKING_DIR;\n}\n\nfunction buildWorkingDir(base: string, conversationId: string): string {\n const trimmed = base.replace(/\\/+$/, \"\");\n const hex = conversationId.replace(/-/g, \"\");\n return `${trimmed}/${hex}`;\n}\n\nexport function buildConversationWorkingDir(conversationId: string): string {\n return buildWorkingDir(getAgentServerWorkingDir(), conversationId);\n}\n\n/**\n * Conversation working dir under the backend-relative default\n * (`workspace/project/<hex>`), deliberately ignoring any baked absolute\n * `VITE_WORKING_DIR`. `resolveAbsoluteAgentServerPath()` anchors this to the\n * active backend's own home via `GET /api/file/home`, so it resolves to a\n * writable path on whichever backend actually runs the conversation.\n */\nexport function buildRelativeConversationWorkingDir(\n conversationId: string,\n): string {\n return buildWorkingDir(DEFAULT_WORKING_DIR, conversationId);\n}\n\n/**\n * Whether `backendHost` is the same host that served this frontend.\n *\n * A launcher-baked `VITE_WORKING_DIR` is an absolute path on the serving\n * host's filesystem, so it is only valid on that exact backend. The seeded\n * `default-local` entry starts life pointing at the served origin, but its\n * `host` is mutable — the user can edit it to a remote backend while its id\n * stays `default-local`. Matching on the host (not the stable id) keeps the\n * real invariant: the baked path is only safe for the host it was baked for.\n */\nexport function isServedOriginHost(\n backendHost: string | null | undefined,\n): boolean {\n const served = normalizeBaseUrl(getAgentServerBaseUrl());\n const candidate = normalizeBaseUrl(backendHost);\n if (!served || !candidate) return false;\n return served === candidate;\n}\n\n/**\n * Base working dir for a new conversation on the backend at `backendHost`.\n * The baked (possibly absolute) default is used only for the served-origin\n * backend; every other backend gets the relative default, anchored to its\n * own home by `resolveAbsoluteAgentServerPath()`.\n */\nexport function buildConversationWorkingDirForBackend(\n conversationId: string,\n backendHost: string | null | undefined,\n): string {\n return isServedOriginHost(backendHost)\n ? buildConversationWorkingDir(conversationId)\n : buildRelativeConversationWorkingDir(conversationId);\n}\n\nexport function getAgentServerHeaders(): Record<string, string> {\n const sessionApiKey = getAgentServerSessionApiKey();\n return sessionApiKey ? { \"X-Session-API-Key\": sessionApiKey } : {};\n}\n\nexport function isAuthRequired(): boolean {\n return (\n import.meta.env.VITE_AUTH_REQUIRED === \"true\" ||\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<string, unknown>)\n .__AGENT_CANVAS_AUTH_REQUIRED__ === true)\n );\n}\n\nexport function isAuthRequiredAndMissing(): boolean {\n if (!isAuthRequired()) return false;\n return !getAgentServerSessionApiKey();\n}\n"],"mappings":";AAAA,IAAa,IAAsB,qBAa7B,IAA2B,kCAC3B,IAAsB,iBACtB,IAAuB,iBACvB,IAA6B,OAAO,KACpC,IAA8B,GAC9B,IAA4B,OAAO;AAEzC,SAAS,EAAW,GAAsC;CACxD,OAAO,GAAO,KAAK,KAAK;AAC1B;AAEA,SAAS,EAAiB,GAAsC;CAC9D,IAAI,CAAC,GAAO,OAAO;CAEnB,IAAM,IAAU,EAAM,KAAK,EAAE,QAAQ,OAAO,EAAE;CAW9C,OAVK,IAED,gBAAgB,KAAK,CAAO,IACvB,IAGL,OAAO,SAAW,MACb,GAAG,OAAO,SAAS,SAAS,IAAI,MAGlC,UAAU,MAVI;AAWvB;AAEA,SAAS,EAAmB,GAAsC;CAChE,IAAI,CAAC,GAAO,OAAO;CAEnB,IAAM,IAAU,EAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;CAO/C,OANK,IAED,gBAAgB,KAAK,CAAO,IACvB,IAGF,WAAW,MANG;AAOvB;AAEA,SAAS,EAA0B,GAA0B;CAC3D,IAAM,IAAQ,EAAS,YAAY;CAanC,OAXE,MAAU,KACV,MAAU,IAEH,IAGL,MAAU,IAA4B,IACtC,EAAM,SAAS,IAAI,GAAqB,IACnC,GAAG,EAAM,MA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AGlB;AACT;AAEA,SAAgB,IAA6C;CAC3D,OAAO,EAAsB;AAC/B;AAEA,SAAgB,IAAmC;CAIjD,OAAO;AACT;AAEA,SAAS,EAAgB,GAAc,GAAgC;CAGrE,OAAO,GAFS,EAAK,QAAQ,QAAQ,EAE3B,EAAQ,GADN,EAAe,QAAQ,MAAM,EACpB;AACvB;AAEA,SAAgB,EAA4B,GAAgC;CAC1E,OAAO,EAAgB,EAAyB,GAAG,CAAc;AACnE;AASA,SAAgB,EACd,GACQ;CACR,OAAO,EAAgB,GAAqB,CAAc;AAC5D;AAYA,SAAgB,EACd,GACS;CACT,IAAM,IAAS,EAAiB,EAAsB,CAAC,GACjD,IAAY,EAAiB,CAAW;CAE9C,OADI,CAAC,KAAU,CAAC,IAAkB,KAC3B,MAAW;AACpB;AAQA,SAAgB,EACd,GACA,GACQ;CACR,OAAO,EAAmB,CAAW,IACjC,EAA4B,CAAc,IAC1C,EAAoC,CAAc;AACxD;AAEA,SAAgB,IAAgD;CAC9D,IAAM,IAAgB,EAA4B;CAClD,OAAO,IAAgB,EAAE,qBAAqB,EAAc,IAAI,CAAC;AACnE;AAEA,SAAgB,IAA0B;CACxC,OAEG,OAAO,SAAW,OAChB,OACE,mCAAmC;AAE5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs"),require("../node_modules/@openhands/typescript-client/dist/clients.cjs"),require("./backend-registry/active-store.cjs"),require("./agent-server-client-options.cjs"),require("./agent-server-compatibility.cjs");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Backend } from "#/api/backend-registry/types";
|
|
2
|
+
import type { CanvasExtensionAgentServerRequest, InstallCanvasExtensionRequest, InstalledCanvasExtensionInfo } from "#/types/canvas-extension";
|
|
3
|
+
export type CanvasExtensionsUnsupportedReason = "no-backend" | "cloud-backend" | "missing-api";
|
|
4
|
+
export declare class CanvasExtensionsUnsupportedError extends Error {
|
|
5
|
+
readonly reason: CanvasExtensionsUnsupportedReason;
|
|
6
|
+
constructor(reason: CanvasExtensionsUnsupportedReason);
|
|
7
|
+
}
|
|
8
|
+
export declare function isCanvasExtensionsUnsupportedError(error: unknown): error is CanvasExtensionsUnsupportedError;
|
|
9
|
+
declare class CanvasExtensionsService {
|
|
10
|
+
static listInstalled(): Promise<InstalledCanvasExtensionInfo[]>;
|
|
11
|
+
static install(request: InstallCanvasExtensionRequest): Promise<InstalledCanvasExtensionInfo>;
|
|
12
|
+
static setEnabled(name: string, enabled: boolean): Promise<{
|
|
13
|
+
name: string;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
static uninstall(name: string): Promise<{
|
|
17
|
+
message: string;
|
|
18
|
+
}>;
|
|
19
|
+
static fetchBundle(name: string, backend?: Backend): Promise<string>;
|
|
20
|
+
static requestAgentServer<T = unknown>(request: CanvasExtensionAgentServerRequest, backend?: Backend): Promise<T>;
|
|
21
|
+
}
|
|
22
|
+
export default CanvasExtensionsService;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../../_virtual/_rolldown/runtime.cjs");const e=require("../backend-registry/active-store.cjs"),t=require("../client-source.cjs"),n=require("../conversation-metadata-store.cjs"),r=require("./proxy.cjs");function i(e){if(!e?.id)return e;let t=n.getStoredConversationMetadata(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function a(){let t=e.getActiveBackend().backend;if(t.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return t}function o(){let t=e.getActiveBackend().backend;return t.kind===`cloud`?t:e.getRegisteredBackends().find(e=>e.kind===`cloud`&&!!e.apiKey)??null}async function s(e=20,t){let n=a(),o=new URLSearchParams;o.set(`limit`,String(e)),t&&o.set(`page_id`,t),o.set(`sort_order`,`UPDATED_AT_DESC`);let s=await r.callCloudProxy({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${o.toString()}`});return{items:(s?.items??[]).map(e=>i(e)),next_page_id:s?.next_page_id??null}}async function c(e){if(e.length===0)return[];let t=a(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await r.callCloudProxy({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(i)}async function l(e,n){return await r.callCloudProxy({backend:n??a(),method:`POST`,path:`/api/v1/app-conversations`,body:e,headers:t.AGENT_CANVAS_CLIENT_HEADERS})}async function u(e){return r.callCloudProxy({backend:a(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function d(e){await r.callCloudProxy({backend:a(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function f(e,t){return await r.callCloudProxy({backend:a(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function p(e){await r.callCloudProxy({backend:a(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.cjs");const e=require("../backend-registry/active-store.cjs"),t=require("../client-source.cjs"),n=require("../conversation-metadata-store.cjs"),r=require("./proxy.cjs");function i(e){if(!e?.id)return e;let t=n.getStoredConversationMetadata(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function a(){let t=e.getActiveBackend().backend;if(t.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return t}function o(){let t=e.getActiveBackend().backend;return t.kind===`cloud`?t:e.getRegisteredBackends().find(e=>e.kind===`cloud`&&!!e.apiKey)??null}async function s(e=20,t){let n=a(),o=new URLSearchParams;o.set(`limit`,String(e)),t&&o.set(`page_id`,t),o.set(`sort_order`,`UPDATED_AT_DESC`);let s=await r.callCloudProxy({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${o.toString()}`});return{items:(s?.items??[]).map(e=>i(e)),next_page_id:s?.next_page_id??null}}async function c(e){if(e.length===0)return[];let t=a(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await r.callCloudProxy({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(i)}async function l(e,n){return await r.callCloudProxy({backend:n??a(),method:`POST`,path:`/api/v1/app-conversations`,body:e,headers:t.AGENT_CANVAS_CLIENT_HEADERS})}async function u(e){return r.callCloudProxy({backend:a(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function d(e){await r.callCloudProxy({backend:a(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function f(e,t){return await r.callCloudProxy({backend:a(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function p(e,t){return r.callCloudProxy({backend:a(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{title:t}})}async function m(e){await r.callCloudProxy({backend:a(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function h(e){await r.callCloudProxy({backend:a(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function g(e,t){let n=a(),i=new URLSearchParams;return i.append(`file_path`,t),await r.callCloudProxy({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${i.toString()}`})??``}async function _(e,t){let n=a(),i=new URLSearchParams;i.append(`path`,t);let o=await r.callCloudProxy({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/files?${i.toString()}`});return Array.isArray(o)?o:[]}async function v(e,t){let n=t??a(),i=new URLSearchParams;return i.set(`ids`,e),(await r.callCloudProxy({backend:n,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${i.toString()}`}))?.[0]??null}exports.batchGetCloudConversations=c,exports.createCloudAppConversation=l,exports.deleteCloudConversation=d,exports.downloadCloudConversation=u,exports.getCloudAppConversationStartTask=v,exports.listCloudConversationFiles=_,exports.pauseCloudSandbox=m,exports.pickCloudBackendForLaunch=o,exports.readCloudConversationFile=g,exports.resumeCloudSandbox=h,exports.searchCloudConversations=s,exports.updateCloudConversationPublicFlag=f,exports.updateCloudConversationTitle=p;
|
|
2
2
|
//# sourceMappingURL=conversation-service.api.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-service.api.cjs","names":[],"sources":["../../../src/api/cloud/conversation-service.api.ts"],"sourcesContent":["import {\n getActiveBackend,\n getRegisteredBackends,\n} from \"../backend-registry/active-store\";\nimport type { Backend } from \"../backend-registry/types\";\nimport { getStoredConversationMetadata } from \"../conversation-metadata-store\";\nimport type {\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n} from \"../conversation-service/agent-server-conversation-service.types\";\nimport { AGENT_CANVAS_CLIENT_HEADERS } from \"../client-source\";\nimport { callCloudProxy } from \"./proxy\";\n\n/**\n * The cloud backend does not always echo `selected_repository` /\n * `selected_branch` / `git_provider` back from\n * `GET /api/v1/app-conversations` until its own background hydration\n * completes. We persist the selection to local storage at connect time\n * (see `AgentServerConversationService.updateConversationRepository`)\n * and overlay it here so the chat-page git control bar reflects the\n * connection immediately, instead of snapping back to the empty\n * \"Connect Repo\" state on every refetch.\n *\n * Server values take precedence whenever they're populated; the\n * local-storage fallback only fills in fields the server returned as\n * `null`/`undefined`.\n */\nfunction overlayStoredRepoSelection(\n conversation: AppConversation | null,\n): AppConversation | null {\n if (!conversation?.id) return conversation;\n const stored = getStoredConversationMetadata(conversation.id);\n if (!stored) return conversation;\n\n return {\n ...conversation,\n selected_repository:\n conversation.selected_repository ?? stored.selected_repository ?? null,\n selected_branch:\n conversation.selected_branch ?? stored.selected_branch ?? null,\n git_provider: conversation.git_provider ?? stored.git_provider ?? null,\n selected_workspace:\n conversation.selected_workspace ?? stored.selected_workspace ?? null,\n };\n}\n\nfunction getActiveCloudBackend(): Backend {\n const active = getActiveBackend().backend;\n if (active.kind !== \"cloud\") {\n throw new Error(\"Cloud conversations call requires a cloud backend.\");\n }\n return active;\n}\n\n/**\n * Resolve the cloud backend a Cloud conversation should be launched against\n * when the active backend may not be a cloud one. Cloud conversations cannot\n * register client tools, so the typed launch action always runs from a local\n * parent and has to reach a registered-but-inactive cloud backend.\n *\n * Prefers the active backend when it is already cloud, then the first\n * registered cloud backend that carries credentials. Returns `null` when the\n * user has no cloud backend connected, so callers can give the agent\n * corrective guidance instead of failing opaquely.\n *\n * Note: `createCloudClient` only sends `X-Org-Id` for the *active* backend, so\n * a conversation launched against an inactive backend lands in the API key's\n * own organization.\n */\nexport function pickCloudBackendForLaunch(): Backend | null {\n const active = getActiveBackend().backend;\n if (active.kind === \"cloud\") return active;\n return (\n getRegisteredBackends().find(\n (backend) => backend.kind === \"cloud\" && !!backend.apiKey,\n ) ?? null\n );\n}\n\n/**\n * Search the cloud app-conversations list. Mirrors the local\n * `AgentServerConversationService.searchConversations` interface but calls\n * the cloud endpoint `/api/v1/app-conversations/search`.\n */\nexport async function searchCloudConversations(\n limit: number = 20,\n pageId?: string,\n): Promise<AppConversationPage> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"limit\", String(limit));\n if (pageId) params.set(\"page_id\", pageId);\n params.set(\"sort_order\", \"UPDATED_AT_DESC\");\n\n const data = await callCloudProxy<{\n items: AppConversation[];\n next_page_id: string | null;\n }>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/search?${params.toString()}`,\n });\n\n return {\n items: (data?.items ?? []).map(\n (item) => overlayStoredRepoSelection(item) as AppConversation,\n ),\n next_page_id: data?.next_page_id ?? null,\n };\n}\n\n/**\n * Batch-fetch cloud app-conversations by id. Mirrors the local\n * `AgentServerConversationService.batchGetAppConversations` interface.\n */\nexport async function batchGetCloudConversations(\n ids: string[],\n): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n for (const id of ids) params.append(\"ids\", id);\n const data = await callCloudProxy<(AppConversation | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations?${params.toString()}`,\n });\n return (data ?? []).map(overlayStoredRepoSelection);\n}\n\n/**\n * Create a v1 app-conversation on the cloud backend.\n *\n * Mirrors OpenHands' cloud flow: POST /api/v1/app-conversations with the\n * `AppConversationStartRequest` payload, returning a\n * `AppConversationStartTask`. The task is initially WORKING; the caller\n * polls `getCloudAppConversationStartTask` (3s cadence per OpenHands)\n * until status is READY (then `app_conversation_id`, `agent_server_url`,\n * and `session_api_key` are populated) or ERROR.\n *\n * This path does NOT use encrypted-settings round-tripping. Secrets stay\n * server-side on the cloud backend — the only auth carried is the cloud bearer\n * token, and the conversation runtime is\n * provisioned with its own ephemeral session_api_key returned in the\n * task.\n */\nexport async function createCloudAppConversation(\n request: AppConversationStartRequest,\n // Defaults to the active backend. The typed launch action passes an explicit\n // backend because it always runs from a *local* parent conversation.\n backendOverride?: Backend,\n): Promise<AppConversationStartTask> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const data = await callCloudProxy<AppConversationStartTask>({\n backend,\n method: \"POST\",\n path: \"/api/v1/app-conversations\",\n body: request as unknown as Record<string, unknown>,\n headers: AGENT_CANVAS_CLIENT_HEADERS,\n });\n return data;\n}\n\n/**\n * Download a v1 app-conversation as a ZIP from the cloud backend. Mirrors\n * the local `AgentServerConversationService.downloadConversation` interface but\n * calls\n * `GET /api/v1/app-conversations/{id}/download`, which returns\n * `application/zip` with `Content-Disposition` set by the cloud backend.\n */\nexport async function downloadCloudConversation(\n conversationId: string,\n): Promise<Blob> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<Blob>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/download`,\n responseType: \"blob\",\n });\n}\n\n/**\n * Delete a v1 app-conversation on the cloud backend. Mirrors the local\n * `AgentServerConversationService.deleteConversation` interface but calls\n * `DELETE /api/v1/app-conversations/{id}`, which returns a JSON\n * `Success` envelope (discarded here — the caller only needs to know\n * the request didn't error).\n */\nexport async function deleteCloudConversation(\n conversationId: string,\n): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"DELETE\",\n path: `/api/v1/app-conversations/${conversationId}`,\n });\n}\n\n/**\n * Toggle the public-sharing flag on a cloud v1 app-conversation. Mirrors\n * OpenHands' `AgentServerConversationService.updateConversationPublicFlag`:\n * `PATCH /api/v1/app-conversations/{id}` with `{ public }`, returning\n * the updated conversation.\n */\nexport async function updateCloudConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n const data = await callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { public: isPublic },\n });\n return data;\n}\n\n/**\n * Pause the cloud sandbox backing a v1 app-conversation. Mirrors\n * OpenHands' `SandboxService.pauseSandbox`:\n * `POST /api/v1/sandboxes/{sandboxId}/pause` on the cloud backend, which stops\n * the runtime owning the conversation.\n */\nexport async function pauseCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/pause`,\n });\n}\n\n/**\n * Resume a paused cloud sandbox. Mirrors OpenHands' `SandboxService.resumeSandbox`\n * by calling `POST /api/v1/sandboxes/{sandboxId}/resume` on the SaaS.\n *\n * This is the correct endpoint for waking a PAUSED sandbox. It is a\n * lightweight unpause — NOT the same as creating a new start task via\n * `POST /api/v1/app-conversations`, which provisions a fresh conversation\n * and is subject to the 120-second sandbox-start timeout.\n */\nexport async function resumeCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/resume`,\n });\n}\n\n/**\n * Read a file from a cloud conversation's sandbox workspace. Mirrors\n * OpenHands' `AgentServerConversationService.readConversationFile` — hits\n * `GET /api/v1/app-conversations/{id}/file?file_path=...` on the cloud backend\n * and returns the file content as a string.\n */\nexport async function readCloudConversationFile(\n conversationId: string,\n filePath: string,\n): Promise<string> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"file_path\", filePath);\n const data = await callCloudProxy<string>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/file?${params.toString()}`,\n });\n return data ?? \"\";\n}\n\n/**\n * List every file in a cloud conversation's sandbox workspace. Hits\n * `GET /api/v1/app-conversations/{id}/files?path=...` on the cloud backend,\n * which resolves the conversation's runtime and runs a bounded `find`\n * server-side (see enterprise `list_conversation_files`). Unlike the\n * git-changes source, this returns the full tree so the Files tab matches the\n * local-backend experience. Paths come back relative to `path`.\n */\nexport async function listCloudConversationFiles(\n conversationId: string,\n path: string,\n): Promise<string[]> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"path\", path);\n const data = await callCloudProxy<string[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/files?${params.toString()}`,\n });\n return Array.isArray(data) ? data : [];\n}\n\n/**\n * Fetch a single v1 app-conversation start task. Mirrors OpenHands'\n * `AgentServerConversationService.getStartTask` — uses the batch search endpoint\n * with a single id and unwraps the first result.\n */\nexport async function getCloudAppConversationStartTask(\n taskId: string,\n backendOverride?: Backend,\n): Promise<AppConversationStartTask | null> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"ids\", taskId);\n const data = await callCloudProxy<(AppConversationStartTask | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/start-tasks?${params.toString()}`,\n });\n return data?.[0] ?? null;\n}\n"],"mappings":"mNA6BA,SAAS,EACP,EACwB,CACxB,GAAI,CAAC,GAAc,GAAI,OAAO,EAC9B,IAAM,EAAS,EAAA,8BAA8B,EAAa,EAAE,EAG5D,OAFK,EAEE,CACL,GAAG,EACH,oBACE,EAAa,qBAAuB,EAAO,qBAAuB,KACpE,gBACE,EAAa,iBAAmB,EAAO,iBAAmB,KAC5D,aAAc,E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C0C,CAC1C,IAAM,EAAU,GAAmB,EAAsB,EACnD,EAAS,IAAI,gBAOnB,OANA,EAAO,IAAI,MAAO,CAAM,GAMjB,MALY,EAAA,eAAoD,CACrE,UACA,OAAQ,MACR,KAAM,yCAAyC,EAAO,SAAS,GACjE,CAAC,KACa,IAAM,IACtB"}
|
|
1
|
+
{"version":3,"file":"conversation-service.api.cjs","names":[],"sources":["../../../src/api/cloud/conversation-service.api.ts"],"sourcesContent":["import {\n getActiveBackend,\n getRegisteredBackends,\n} from \"../backend-registry/active-store\";\nimport type { Backend } from \"../backend-registry/types\";\nimport { getStoredConversationMetadata } from \"../conversation-metadata-store\";\nimport type {\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n} from \"../conversation-service/agent-server-conversation-service.types\";\nimport { AGENT_CANVAS_CLIENT_HEADERS } from \"../client-source\";\nimport { callCloudProxy } from \"./proxy\";\n\n/**\n * The cloud backend does not always echo `selected_repository` /\n * `selected_branch` / `git_provider` back from\n * `GET /api/v1/app-conversations` until its own background hydration\n * completes. We persist the selection to local storage at connect time\n * (see `AgentServerConversationService.updateConversationRepository`)\n * and overlay it here so the chat-page git control bar reflects the\n * connection immediately, instead of snapping back to the empty\n * \"Connect Repo\" state on every refetch.\n *\n * Server values take precedence whenever they're populated; the\n * local-storage fallback only fills in fields the server returned as\n * `null`/`undefined`.\n */\nfunction overlayStoredRepoSelection(\n conversation: AppConversation | null,\n): AppConversation | null {\n if (!conversation?.id) return conversation;\n const stored = getStoredConversationMetadata(conversation.id);\n if (!stored) return conversation;\n\n return {\n ...conversation,\n selected_repository:\n conversation.selected_repository ?? stored.selected_repository ?? null,\n selected_branch:\n conversation.selected_branch ?? stored.selected_branch ?? null,\n git_provider: conversation.git_provider ?? stored.git_provider ?? null,\n selected_workspace:\n conversation.selected_workspace ?? stored.selected_workspace ?? null,\n };\n}\n\nfunction getActiveCloudBackend(): Backend {\n const active = getActiveBackend().backend;\n if (active.kind !== \"cloud\") {\n throw new Error(\"Cloud conversations call requires a cloud backend.\");\n }\n return active;\n}\n\n/**\n * Resolve the cloud backend a Cloud conversation should be launched against\n * when the active backend may not be a cloud one. Cloud conversations cannot\n * register client tools, so the typed launch action always runs from a local\n * parent and has to reach a registered-but-inactive cloud backend.\n *\n * Prefers the active backend when it is already cloud, then the first\n * registered cloud backend that carries credentials. Returns `null` when the\n * user has no cloud backend connected, so callers can give the agent\n * corrective guidance instead of failing opaquely.\n *\n * Note: `createCloudClient` only sends `X-Org-Id` for the *active* backend, so\n * a conversation launched against an inactive backend lands in the API key's\n * own organization.\n */\nexport function pickCloudBackendForLaunch(): Backend | null {\n const active = getActiveBackend().backend;\n if (active.kind === \"cloud\") return active;\n return (\n getRegisteredBackends().find(\n (backend) => backend.kind === \"cloud\" && !!backend.apiKey,\n ) ?? null\n );\n}\n\n/**\n * Search the cloud app-conversations list. Mirrors the local\n * `AgentServerConversationService.searchConversations` interface but calls\n * the cloud endpoint `/api/v1/app-conversations/search`.\n */\nexport async function searchCloudConversations(\n limit: number = 20,\n pageId?: string,\n): Promise<AppConversationPage> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"limit\", String(limit));\n if (pageId) params.set(\"page_id\", pageId);\n params.set(\"sort_order\", \"UPDATED_AT_DESC\");\n\n const data = await callCloudProxy<{\n items: AppConversation[];\n next_page_id: string | null;\n }>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/search?${params.toString()}`,\n });\n\n return {\n items: (data?.items ?? []).map(\n (item) => overlayStoredRepoSelection(item) as AppConversation,\n ),\n next_page_id: data?.next_page_id ?? null,\n };\n}\n\n/**\n * Batch-fetch cloud app-conversations by id. Mirrors the local\n * `AgentServerConversationService.batchGetAppConversations` interface.\n */\nexport async function batchGetCloudConversations(\n ids: string[],\n): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n for (const id of ids) params.append(\"ids\", id);\n const data = await callCloudProxy<(AppConversation | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations?${params.toString()}`,\n });\n return (data ?? []).map(overlayStoredRepoSelection);\n}\n\n/**\n * Create a v1 app-conversation on the cloud backend.\n *\n * Mirrors OpenHands' cloud flow: POST /api/v1/app-conversations with the\n * `AppConversationStartRequest` payload, returning a\n * `AppConversationStartTask`. The task is initially WORKING; the caller\n * polls `getCloudAppConversationStartTask` (3s cadence per OpenHands)\n * until status is READY (then `app_conversation_id`, `agent_server_url`,\n * and `session_api_key` are populated) or ERROR.\n *\n * This path does NOT use encrypted-settings round-tripping. Secrets stay\n * server-side on the cloud backend — the only auth carried is the cloud bearer\n * token, and the conversation runtime is\n * provisioned with its own ephemeral session_api_key returned in the\n * task.\n */\nexport async function createCloudAppConversation(\n request: AppConversationStartRequest,\n // Defaults to the active backend. The typed launch action passes an explicit\n // backend because it always runs from a *local* parent conversation.\n backendOverride?: Backend,\n): Promise<AppConversationStartTask> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const data = await callCloudProxy<AppConversationStartTask>({\n backend,\n method: \"POST\",\n path: \"/api/v1/app-conversations\",\n body: request as unknown as Record<string, unknown>,\n headers: AGENT_CANVAS_CLIENT_HEADERS,\n });\n return data;\n}\n\n/**\n * Download a v1 app-conversation as a ZIP from the cloud backend. Mirrors\n * the local `AgentServerConversationService.downloadConversation` interface but\n * calls\n * `GET /api/v1/app-conversations/{id}/download`, which returns\n * `application/zip` with `Content-Disposition` set by the cloud backend.\n */\nexport async function downloadCloudConversation(\n conversationId: string,\n): Promise<Blob> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<Blob>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/download`,\n responseType: \"blob\",\n });\n}\n\n/**\n * Delete a v1 app-conversation on the cloud backend. Mirrors the local\n * `AgentServerConversationService.deleteConversation` interface but calls\n * `DELETE /api/v1/app-conversations/{id}`, which returns a JSON\n * `Success` envelope (discarded here — the caller only needs to know\n * the request didn't error).\n */\nexport async function deleteCloudConversation(\n conversationId: string,\n): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"DELETE\",\n path: `/api/v1/app-conversations/${conversationId}`,\n });\n}\n\n/**\n * Toggle the public-sharing flag on a cloud v1 app-conversation. Mirrors\n * OpenHands' `AgentServerConversationService.updateConversationPublicFlag`:\n * `PATCH /api/v1/app-conversations/{id}` with `{ public }`, returning\n * the updated conversation.\n */\nexport async function updateCloudConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n const data = await callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { public: isPublic },\n });\n return data;\n}\n\n/**\n * Rename a cloud v1 app-conversation. The title belongs to the Cloud\n * app-conversation resource, so updating a runtime Agent Server would not\n * persist it in the Cloud conversation list.\n */\nexport async function updateCloudConversationTitle(\n conversationId: string,\n title: string,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { title },\n });\n}\n\n/**\n * Pause the cloud sandbox backing a v1 app-conversation. Mirrors\n * OpenHands' `SandboxService.pauseSandbox`:\n * `POST /api/v1/sandboxes/{sandboxId}/pause` on the cloud backend, which stops\n * the runtime owning the conversation.\n */\nexport async function pauseCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/pause`,\n });\n}\n\n/**\n * Resume a paused cloud sandbox. Mirrors OpenHands' `SandboxService.resumeSandbox`\n * by calling `POST /api/v1/sandboxes/{sandboxId}/resume` on the SaaS.\n *\n * This is the correct endpoint for waking a PAUSED sandbox. It is a\n * lightweight unpause — NOT the same as creating a new start task via\n * `POST /api/v1/app-conversations`, which provisions a fresh conversation\n * and is subject to the 120-second sandbox-start timeout.\n */\nexport async function resumeCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/resume`,\n });\n}\n\n/**\n * Read a file from a cloud conversation's sandbox workspace. Mirrors\n * OpenHands' `AgentServerConversationService.readConversationFile` — hits\n * `GET /api/v1/app-conversations/{id}/file?file_path=...` on the cloud backend\n * and returns the file content as a string.\n */\nexport async function readCloudConversationFile(\n conversationId: string,\n filePath: string,\n): Promise<string> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"file_path\", filePath);\n const data = await callCloudProxy<string>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/file?${params.toString()}`,\n });\n return data ?? \"\";\n}\n\n/**\n * List every file in a cloud conversation's sandbox workspace. Hits\n * `GET /api/v1/app-conversations/{id}/files?path=...` on the cloud backend,\n * which resolves the conversation's runtime and runs a bounded `find`\n * server-side (see enterprise `list_conversation_files`). Unlike the\n * git-changes source, this returns the full tree so the Files tab matches the\n * local-backend experience. Paths come back relative to `path`.\n */\nexport async function listCloudConversationFiles(\n conversationId: string,\n path: string,\n): Promise<string[]> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"path\", path);\n const data = await callCloudProxy<string[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/files?${params.toString()}`,\n });\n return Array.isArray(data) ? data : [];\n}\n\n/**\n * Fetch a single v1 app-conversation start task. Mirrors OpenHands'\n * `AgentServerConversationService.getStartTask` — uses the batch search endpoint\n * with a single id and unwraps the first result.\n */\nexport async function getCloudAppConversationStartTask(\n taskId: string,\n backendOverride?: Backend,\n): Promise<AppConversationStartTask | null> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"ids\", taskId);\n const data = await callCloudProxy<(AppConversationStartTask | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/start-tasks?${params.toString()}`,\n });\n return data?.[0] ?? null;\n}\n"],"mappings":"mNA6BA,SAAS,EACP,EACwB,CACxB,GAAI,CAAC,GAAc,GAAI,OAAO,EAC9B,IAAM,EAAS,EAAA,8BAA8B,EAAa,EAAE,EAG5D,OAFK,EAEE,CACL,GAAG,EACH,oBACE,EAAa,qBAAuB,EAAO,qBAAuB,KACpE,gBACE,EAAa,iBAAmB,EAAO,iBAAmB,KAC5D,aAAc,EAAa,cAAgB,EAAO,cAAgB,KAClE,mBACE,EAAa,oBAAsB,EAAO,oBAAsB,IACpE,EAXoB,CAYtB,CAEA,SAAS,GAAiC,CACxC,IAAM,EAAS,EAAA,iBAAiB,EAAE,QAClC,GAAI,EAAO,OAAS,QAClB,MAAU,MAAM,oDAAoD,EAEtE,OAAO,CACT,CAiBA,SAAgB,GAA4C,CAC1D,IAAM,EAAS,EAAA,iBAAiB,EAAE,QAElC,OADI,EAAO,OAAS,QAAgB,EAElC,EAAA,sBAAsB,EAAE,KACrB,GAAY,EAAQ,OAAS,SAAW,CAAC,CAAC,EAAQ,MACrD,GAAK,IAET,CAOA,eAAsB,EACpB,EAAgB,GAChB,EAC8B,CAC9B,IAAM,EAAU,EAAsB,EAChC,EAAS,IAAI,gBACnB,EAAO,IAAI,QAAS,OAAO,CAAK,CAAC,EAC7B,GAAQ,EAAO,IAAI,UAAW,CAAM,EACxC,EAAO,IAAI,aAAc,iBAAiB,EAE1C,IAAM,EAAO,MAAM,EAAA,eAGhB,CACD,UACA,OAAQ,MACR,KAAM,oCAAoC,EAAO,SAAS,GAC5D,CAAC,EAED,MAAO,CACL,OAAQ,GAAM,OAAS,CAAC,GAAG,IACxB,GAAS,EAA2B,CAAI,CAC3C,EACA,aAAc,GAAM,cAAgB,IACtC,CACF,CAMA,eAAsB,EACpB,EACqC,CACrC,GAAI,EAAI,SAAW,EAAG,MAAO,CAAC,EAC9B,IAAM,EAAU,EAAsB,E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AsB,EAChC,EAAS,IAAI,gBAOnB,OANA,EAAO,OAAO,YAAa,CAAQ,EAM5B,MALY,EAAA,eAAuB,CACxC,UACA,OAAQ,MACR,KAAM,6BAA6B,EAAe,QAAQ,EAAO,SAAS,GAC5E,CAAC,GACc,EACjB,CAUA,eAAsB,EACpB,EACA,EACmB,CACnB,IAAM,EAAU,EAAsB,EAChC,EAAS,IAAI,gBACnB,EAAO,OAAO,OAAQ,CAAI,EAC1B,IAAM,EAAO,MAAM,EAAA,eAAyB,CAC1C,UACA,OAAQ,MACR,KAAM,6BAA6B,EAAe,SAAS,EAAO,SAAS,GAC7E,CAAC,EACD,OAAO,MAAM,QAAQ,CAAI,EAAI,EAAO,CAAC,CACvC,CAOA,eAAsB,EACpB,EACA,EAC0C,CAC1C,IAAM,EAAU,GAAmB,EAAsB,EACnD,EAAS,IAAI,gBAOnB,OANA,EAAO,IAAI,MAAO,CAAM,GAMjB,MALY,EAAA,eAAoD,CACrE,UACA,OAAQ,MACR,KAAM,yCAAyC,EAAO,SAAS,GACjE,CAAC,KACa,IAAM,IACtB"}
|
|
@@ -67,6 +67,12 @@ export declare function deleteCloudConversation(conversationId: string): Promise
|
|
|
67
67
|
* the updated conversation.
|
|
68
68
|
*/
|
|
69
69
|
export declare function updateCloudConversationPublicFlag(conversationId: string, isPublic: boolean): Promise<AppConversation>;
|
|
70
|
+
/**
|
|
71
|
+
* Rename a cloud v1 app-conversation. The title belongs to the Cloud
|
|
72
|
+
* app-conversation resource, so updating a runtime Agent Server would not
|
|
73
|
+
* persist it in the Cloud conversation list.
|
|
74
|
+
*/
|
|
75
|
+
export declare function updateCloudConversationTitle(conversationId: string, title: string): Promise<AppConversation>;
|
|
70
76
|
/**
|
|
71
77
|
* Pause the cloud sandbox backing a v1 app-conversation. Mirrors
|
|
72
78
|
* OpenHands' `SandboxService.pauseSandbox`:
|
|
@@ -78,21 +78,29 @@ async function p(e, t) {
|
|
|
78
78
|
body: { public: t }
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
async function m(e) {
|
|
81
|
+
async function m(e, t) {
|
|
82
|
+
return i({
|
|
83
|
+
backend: o(),
|
|
84
|
+
method: "PATCH",
|
|
85
|
+
path: `/api/v1/app-conversations/${e}`,
|
|
86
|
+
body: { title: t }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function h(e) {
|
|
82
90
|
await i({
|
|
83
91
|
backend: o(),
|
|
84
92
|
method: "POST",
|
|
85
93
|
path: `/api/v1/sandboxes/${e}/pause`
|
|
86
94
|
});
|
|
87
95
|
}
|
|
88
|
-
async function
|
|
96
|
+
async function g(e) {
|
|
89
97
|
await i({
|
|
90
98
|
backend: o(),
|
|
91
99
|
method: "POST",
|
|
92
100
|
path: `/api/v1/sandboxes/${e}/resume`
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
|
-
async function
|
|
103
|
+
async function _(e, t) {
|
|
96
104
|
let n = o(), r = new URLSearchParams();
|
|
97
105
|
return r.append("file_path", t), await i({
|
|
98
106
|
backend: n,
|
|
@@ -100,7 +108,7 @@ async function g(e, t) {
|
|
|
100
108
|
path: `/api/v1/app-conversations/${e}/file?${r.toString()}`
|
|
101
109
|
}) ?? "";
|
|
102
110
|
}
|
|
103
|
-
async function
|
|
111
|
+
async function v(e, t) {
|
|
104
112
|
let n = o(), r = new URLSearchParams();
|
|
105
113
|
r.append("path", t);
|
|
106
114
|
let a = await i({
|
|
@@ -110,7 +118,7 @@ async function _(e, t) {
|
|
|
110
118
|
});
|
|
111
119
|
return Array.isArray(a) ? a : [];
|
|
112
120
|
}
|
|
113
|
-
async function
|
|
121
|
+
async function y(e, t) {
|
|
114
122
|
let n = t ?? o(), r = new URLSearchParams();
|
|
115
123
|
return r.set("ids", e), (await i({
|
|
116
124
|
backend: n,
|
|
@@ -119,6 +127,6 @@ async function v(e, t) {
|
|
|
119
127
|
}))?.[0] ?? null;
|
|
120
128
|
}
|
|
121
129
|
//#endregion
|
|
122
|
-
export { l as batchGetCloudConversations, u as createCloudAppConversation, f as deleteCloudConversation, d as downloadCloudConversation,
|
|
130
|
+
export { l as batchGetCloudConversations, u as createCloudAppConversation, f as deleteCloudConversation, d as downloadCloudConversation, y as getCloudAppConversationStartTask, v as listCloudConversationFiles, h as pauseCloudSandbox, s as pickCloudBackendForLaunch, _ as readCloudConversationFile, g as resumeCloudSandbox, c as searchCloudConversations, p as updateCloudConversationPublicFlag, m as updateCloudConversationTitle };
|
|
123
131
|
|
|
124
132
|
//# sourceMappingURL=conversation-service.api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-service.api.js","names":[],"sources":["../../../src/api/cloud/conversation-service.api.ts"],"sourcesContent":["import {\n getActiveBackend,\n getRegisteredBackends,\n} from \"../backend-registry/active-store\";\nimport type { Backend } from \"../backend-registry/types\";\nimport { getStoredConversationMetadata } from \"../conversation-metadata-store\";\nimport type {\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n} from \"../conversation-service/agent-server-conversation-service.types\";\nimport { AGENT_CANVAS_CLIENT_HEADERS } from \"../client-source\";\nimport { callCloudProxy } from \"./proxy\";\n\n/**\n * The cloud backend does not always echo `selected_repository` /\n * `selected_branch` / `git_provider` back from\n * `GET /api/v1/app-conversations` until its own background hydration\n * completes. We persist the selection to local storage at connect time\n * (see `AgentServerConversationService.updateConversationRepository`)\n * and overlay it here so the chat-page git control bar reflects the\n * connection immediately, instead of snapping back to the empty\n * \"Connect Repo\" state on every refetch.\n *\n * Server values take precedence whenever they're populated; the\n * local-storage fallback only fills in fields the server returned as\n * `null`/`undefined`.\n */\nfunction overlayStoredRepoSelection(\n conversation: AppConversation | null,\n): AppConversation | null {\n if (!conversation?.id) return conversation;\n const stored = getStoredConversationMetadata(conversation.id);\n if (!stored) return conversation;\n\n return {\n ...conversation,\n selected_repository:\n conversation.selected_repository ?? stored.selected_repository ?? null,\n selected_branch:\n conversation.selected_branch ?? stored.selected_branch ?? null,\n git_provider: conversation.git_provider ?? stored.git_provider ?? null,\n selected_workspace:\n conversation.selected_workspace ?? stored.selected_workspace ?? null,\n };\n}\n\nfunction getActiveCloudBackend(): Backend {\n const active = getActiveBackend().backend;\n if (active.kind !== \"cloud\") {\n throw new Error(\"Cloud conversations call requires a cloud backend.\");\n }\n return active;\n}\n\n/**\n * Resolve the cloud backend a Cloud conversation should be launched against\n * when the active backend may not be a cloud one. Cloud conversations cannot\n * register client tools, so the typed launch action always runs from a local\n * parent and has to reach a registered-but-inactive cloud backend.\n *\n * Prefers the active backend when it is already cloud, then the first\n * registered cloud backend that carries credentials. Returns `null` when the\n * user has no cloud backend connected, so callers can give the agent\n * corrective guidance instead of failing opaquely.\n *\n * Note: `createCloudClient` only sends `X-Org-Id` for the *active* backend, so\n * a conversation launched against an inactive backend lands in the API key's\n * own organization.\n */\nexport function pickCloudBackendForLaunch(): Backend | null {\n const active = getActiveBackend().backend;\n if (active.kind === \"cloud\") return active;\n return (\n getRegisteredBackends().find(\n (backend) => backend.kind === \"cloud\" && !!backend.apiKey,\n ) ?? null\n );\n}\n\n/**\n * Search the cloud app-conversations list. Mirrors the local\n * `AgentServerConversationService.searchConversations` interface but calls\n * the cloud endpoint `/api/v1/app-conversations/search`.\n */\nexport async function searchCloudConversations(\n limit: number = 20,\n pageId?: string,\n): Promise<AppConversationPage> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"limit\", String(limit));\n if (pageId) params.set(\"page_id\", pageId);\n params.set(\"sort_order\", \"UPDATED_AT_DESC\");\n\n const data = await callCloudProxy<{\n items: AppConversation[];\n next_page_id: string | null;\n }>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/search?${params.toString()}`,\n });\n\n return {\n items: (data?.items ?? []).map(\n (item) => overlayStoredRepoSelection(item) as AppConversation,\n ),\n next_page_id: data?.next_page_id ?? null,\n };\n}\n\n/**\n * Batch-fetch cloud app-conversations by id. Mirrors the local\n * `AgentServerConversationService.batchGetAppConversations` interface.\n */\nexport async function batchGetCloudConversations(\n ids: string[],\n): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n for (const id of ids) params.append(\"ids\", id);\n const data = await callCloudProxy<(AppConversation | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations?${params.toString()}`,\n });\n return (data ?? []).map(overlayStoredRepoSelection);\n}\n\n/**\n * Create a v1 app-conversation on the cloud backend.\n *\n * Mirrors OpenHands' cloud flow: POST /api/v1/app-conversations with the\n * `AppConversationStartRequest` payload, returning a\n * `AppConversationStartTask`. The task is initially WORKING; the caller\n * polls `getCloudAppConversationStartTask` (3s cadence per OpenHands)\n * until status is READY (then `app_conversation_id`, `agent_server_url`,\n * and `session_api_key` are populated) or ERROR.\n *\n * This path does NOT use encrypted-settings round-tripping. Secrets stay\n * server-side on the cloud backend — the only auth carried is the cloud bearer\n * token, and the conversation runtime is\n * provisioned with its own ephemeral session_api_key returned in the\n * task.\n */\nexport async function createCloudAppConversation(\n request: AppConversationStartRequest,\n // Defaults to the active backend. The typed launch action passes an explicit\n // backend because it always runs from a *local* parent conversation.\n backendOverride?: Backend,\n): Promise<AppConversationStartTask> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const data = await callCloudProxy<AppConversationStartTask>({\n backend,\n method: \"POST\",\n path: \"/api/v1/app-conversations\",\n body: request as unknown as Record<string, unknown>,\n headers: AGENT_CANVAS_CLIENT_HEADERS,\n });\n return data;\n}\n\n/**\n * Download a v1 app-conversation as a ZIP from the cloud backend. Mirrors\n * the local `AgentServerConversationService.downloadConversation` interface but\n * calls\n * `GET /api/v1/app-conversations/{id}/download`, which returns\n * `application/zip` with `Content-Disposition` set by the cloud backend.\n */\nexport async function downloadCloudConversation(\n conversationId: string,\n): Promise<Blob> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<Blob>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/download`,\n responseType: \"blob\",\n });\n}\n\n/**\n * Delete a v1 app-conversation on the cloud backend. Mirrors the local\n * `AgentServerConversationService.deleteConversation` interface but calls\n * `DELETE /api/v1/app-conversations/{id}`, which returns a JSON\n * `Success` envelope (discarded here — the caller only needs to know\n * the request didn't error).\n */\nexport async function deleteCloudConversation(\n conversationId: string,\n): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"DELETE\",\n path: `/api/v1/app-conversations/${conversationId}`,\n });\n}\n\n/**\n * Toggle the public-sharing flag on a cloud v1 app-conversation. Mirrors\n * OpenHands' `AgentServerConversationService.updateConversationPublicFlag`:\n * `PATCH /api/v1/app-conversations/{id}` with `{ public }`, returning\n * the updated conversation.\n */\nexport async function updateCloudConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n const data = await callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { public: isPublic },\n });\n return data;\n}\n\n/**\n * Pause the cloud sandbox backing a v1 app-conversation. Mirrors\n * OpenHands' `SandboxService.pauseSandbox`:\n * `POST /api/v1/sandboxes/{sandboxId}/pause` on the cloud backend, which stops\n * the runtime owning the conversation.\n */\nexport async function pauseCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/pause`,\n });\n}\n\n/**\n * Resume a paused cloud sandbox. Mirrors OpenHands' `SandboxService.resumeSandbox`\n * by calling `POST /api/v1/sandboxes/{sandboxId}/resume` on the SaaS.\n *\n * This is the correct endpoint for waking a PAUSED sandbox. It is a\n * lightweight unpause — NOT the same as creating a new start task via\n * `POST /api/v1/app-conversations`, which provisions a fresh conversation\n * and is subject to the 120-second sandbox-start timeout.\n */\nexport async function resumeCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/resume`,\n });\n}\n\n/**\n * Read a file from a cloud conversation's sandbox workspace. Mirrors\n * OpenHands' `AgentServerConversationService.readConversationFile` — hits\n * `GET /api/v1/app-conversations/{id}/file?file_path=...` on the cloud backend\n * and returns the file content as a string.\n */\nexport async function readCloudConversationFile(\n conversationId: string,\n filePath: string,\n): Promise<string> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"file_path\", filePath);\n const data = await callCloudProxy<string>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/file?${params.toString()}`,\n });\n return data ?? \"\";\n}\n\n/**\n * List every file in a cloud conversation's sandbox workspace. Hits\n * `GET /api/v1/app-conversations/{id}/files?path=...` on the cloud backend,\n * which resolves the conversation's runtime and runs a bounded `find`\n * server-side (see enterprise `list_conversation_files`). Unlike the\n * git-changes source, this returns the full tree so the Files tab matches the\n * local-backend experience. Paths come back relative to `path`.\n */\nexport async function listCloudConversationFiles(\n conversationId: string,\n path: string,\n): Promise<string[]> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"path\", path);\n const data = await callCloudProxy<string[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/files?${params.toString()}`,\n });\n return Array.isArray(data) ? data : [];\n}\n\n/**\n * Fetch a single v1 app-conversation start task. Mirrors OpenHands'\n * `AgentServerConversationService.getStartTask` — uses the batch search endpoint\n * with a single id and unwraps the first result.\n */\nexport async function getCloudAppConversationStartTask(\n taskId: string,\n backendOverride?: Backend,\n): Promise<AppConversationStartTask | null> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"ids\", taskId);\n const data = await callCloudProxy<(AppConversationStartTask | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/start-tasks?${params.toString()}`,\n });\n return data?.[0] ?? null;\n}\n"],"mappings":";;;;;AA6BA,SAAS,EACP,GAC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1C;EACA,QAAQ;EACR,MAAM,6BAA6B,EAAe,SAAS,EAAO,SAAS;CAC7E,CAAC;CACD,OAAO,MAAM,QAAQ,CAAI,IAAI,IAAO,CAAC;AACvC;AAOA,eAAsB,EACpB,GACA,GAC0C;CAC1C,IAAM,IAAU,KAAmB,EAAsB,GACnD,IAAS,IAAI,gBAAgB;CAOnC,OANA,EAAO,IAAI,OAAO,CAAM,IAMjB,MALY,EAAoD;EACrE;EACA,QAAQ;EACR,MAAM,yCAAyC,EAAO,SAAS;CACjE,CAAC,KACa,MAAM;AACtB"}
|
|
1
|
+
{"version":3,"file":"conversation-service.api.js","names":[],"sources":["../../../src/api/cloud/conversation-service.api.ts"],"sourcesContent":["import {\n getActiveBackend,\n getRegisteredBackends,\n} from \"../backend-registry/active-store\";\nimport type { Backend } from \"../backend-registry/types\";\nimport { getStoredConversationMetadata } from \"../conversation-metadata-store\";\nimport type {\n AppConversation,\n AppConversationPage,\n AppConversationStartRequest,\n AppConversationStartTask,\n} from \"../conversation-service/agent-server-conversation-service.types\";\nimport { AGENT_CANVAS_CLIENT_HEADERS } from \"../client-source\";\nimport { callCloudProxy } from \"./proxy\";\n\n/**\n * The cloud backend does not always echo `selected_repository` /\n * `selected_branch` / `git_provider` back from\n * `GET /api/v1/app-conversations` until its own background hydration\n * completes. We persist the selection to local storage at connect time\n * (see `AgentServerConversationService.updateConversationRepository`)\n * and overlay it here so the chat-page git control bar reflects the\n * connection immediately, instead of snapping back to the empty\n * \"Connect Repo\" state on every refetch.\n *\n * Server values take precedence whenever they're populated; the\n * local-storage fallback only fills in fields the server returned as\n * `null`/`undefined`.\n */\nfunction overlayStoredRepoSelection(\n conversation: AppConversation | null,\n): AppConversation | null {\n if (!conversation?.id) return conversation;\n const stored = getStoredConversationMetadata(conversation.id);\n if (!stored) return conversation;\n\n return {\n ...conversation,\n selected_repository:\n conversation.selected_repository ?? stored.selected_repository ?? null,\n selected_branch:\n conversation.selected_branch ?? stored.selected_branch ?? null,\n git_provider: conversation.git_provider ?? stored.git_provider ?? null,\n selected_workspace:\n conversation.selected_workspace ?? stored.selected_workspace ?? null,\n };\n}\n\nfunction getActiveCloudBackend(): Backend {\n const active = getActiveBackend().backend;\n if (active.kind !== \"cloud\") {\n throw new Error(\"Cloud conversations call requires a cloud backend.\");\n }\n return active;\n}\n\n/**\n * Resolve the cloud backend a Cloud conversation should be launched against\n * when the active backend may not be a cloud one. Cloud conversations cannot\n * register client tools, so the typed launch action always runs from a local\n * parent and has to reach a registered-but-inactive cloud backend.\n *\n * Prefers the active backend when it is already cloud, then the first\n * registered cloud backend that carries credentials. Returns `null` when the\n * user has no cloud backend connected, so callers can give the agent\n * corrective guidance instead of failing opaquely.\n *\n * Note: `createCloudClient` only sends `X-Org-Id` for the *active* backend, so\n * a conversation launched against an inactive backend lands in the API key's\n * own organization.\n */\nexport function pickCloudBackendForLaunch(): Backend | null {\n const active = getActiveBackend().backend;\n if (active.kind === \"cloud\") return active;\n return (\n getRegisteredBackends().find(\n (backend) => backend.kind === \"cloud\" && !!backend.apiKey,\n ) ?? null\n );\n}\n\n/**\n * Search the cloud app-conversations list. Mirrors the local\n * `AgentServerConversationService.searchConversations` interface but calls\n * the cloud endpoint `/api/v1/app-conversations/search`.\n */\nexport async function searchCloudConversations(\n limit: number = 20,\n pageId?: string,\n): Promise<AppConversationPage> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"limit\", String(limit));\n if (pageId) params.set(\"page_id\", pageId);\n params.set(\"sort_order\", \"UPDATED_AT_DESC\");\n\n const data = await callCloudProxy<{\n items: AppConversation[];\n next_page_id: string | null;\n }>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/search?${params.toString()}`,\n });\n\n return {\n items: (data?.items ?? []).map(\n (item) => overlayStoredRepoSelection(item) as AppConversation,\n ),\n next_page_id: data?.next_page_id ?? null,\n };\n}\n\n/**\n * Batch-fetch cloud app-conversations by id. Mirrors the local\n * `AgentServerConversationService.batchGetAppConversations` interface.\n */\nexport async function batchGetCloudConversations(\n ids: string[],\n): Promise<(AppConversation | null)[]> {\n if (ids.length === 0) return [];\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n for (const id of ids) params.append(\"ids\", id);\n const data = await callCloudProxy<(AppConversation | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations?${params.toString()}`,\n });\n return (data ?? []).map(overlayStoredRepoSelection);\n}\n\n/**\n * Create a v1 app-conversation on the cloud backend.\n *\n * Mirrors OpenHands' cloud flow: POST /api/v1/app-conversations with the\n * `AppConversationStartRequest` payload, returning a\n * `AppConversationStartTask`. The task is initially WORKING; the caller\n * polls `getCloudAppConversationStartTask` (3s cadence per OpenHands)\n * until status is READY (then `app_conversation_id`, `agent_server_url`,\n * and `session_api_key` are populated) or ERROR.\n *\n * This path does NOT use encrypted-settings round-tripping. Secrets stay\n * server-side on the cloud backend — the only auth carried is the cloud bearer\n * token, and the conversation runtime is\n * provisioned with its own ephemeral session_api_key returned in the\n * task.\n */\nexport async function createCloudAppConversation(\n request: AppConversationStartRequest,\n // Defaults to the active backend. The typed launch action passes an explicit\n // backend because it always runs from a *local* parent conversation.\n backendOverride?: Backend,\n): Promise<AppConversationStartTask> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const data = await callCloudProxy<AppConversationStartTask>({\n backend,\n method: \"POST\",\n path: \"/api/v1/app-conversations\",\n body: request as unknown as Record<string, unknown>,\n headers: AGENT_CANVAS_CLIENT_HEADERS,\n });\n return data;\n}\n\n/**\n * Download a v1 app-conversation as a ZIP from the cloud backend. Mirrors\n * the local `AgentServerConversationService.downloadConversation` interface but\n * calls\n * `GET /api/v1/app-conversations/{id}/download`, which returns\n * `application/zip` with `Content-Disposition` set by the cloud backend.\n */\nexport async function downloadCloudConversation(\n conversationId: string,\n): Promise<Blob> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<Blob>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/download`,\n responseType: \"blob\",\n });\n}\n\n/**\n * Delete a v1 app-conversation on the cloud backend. Mirrors the local\n * `AgentServerConversationService.deleteConversation` interface but calls\n * `DELETE /api/v1/app-conversations/{id}`, which returns a JSON\n * `Success` envelope (discarded here — the caller only needs to know\n * the request didn't error).\n */\nexport async function deleteCloudConversation(\n conversationId: string,\n): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"DELETE\",\n path: `/api/v1/app-conversations/${conversationId}`,\n });\n}\n\n/**\n * Toggle the public-sharing flag on a cloud v1 app-conversation. Mirrors\n * OpenHands' `AgentServerConversationService.updateConversationPublicFlag`:\n * `PATCH /api/v1/app-conversations/{id}` with `{ public }`, returning\n * the updated conversation.\n */\nexport async function updateCloudConversationPublicFlag(\n conversationId: string,\n isPublic: boolean,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n const data = await callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { public: isPublic },\n });\n return data;\n}\n\n/**\n * Rename a cloud v1 app-conversation. The title belongs to the Cloud\n * app-conversation resource, so updating a runtime Agent Server would not\n * persist it in the Cloud conversation list.\n */\nexport async function updateCloudConversationTitle(\n conversationId: string,\n title: string,\n): Promise<AppConversation> {\n const backend = getActiveCloudBackend();\n return callCloudProxy<AppConversation>({\n backend,\n method: \"PATCH\",\n path: `/api/v1/app-conversations/${conversationId}`,\n body: { title },\n });\n}\n\n/**\n * Pause the cloud sandbox backing a v1 app-conversation. Mirrors\n * OpenHands' `SandboxService.pauseSandbox`:\n * `POST /api/v1/sandboxes/{sandboxId}/pause` on the cloud backend, which stops\n * the runtime owning the conversation.\n */\nexport async function pauseCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/pause`,\n });\n}\n\n/**\n * Resume a paused cloud sandbox. Mirrors OpenHands' `SandboxService.resumeSandbox`\n * by calling `POST /api/v1/sandboxes/{sandboxId}/resume` on the SaaS.\n *\n * This is the correct endpoint for waking a PAUSED sandbox. It is a\n * lightweight unpause — NOT the same as creating a new start task via\n * `POST /api/v1/app-conversations`, which provisions a fresh conversation\n * and is subject to the 120-second sandbox-start timeout.\n */\nexport async function resumeCloudSandbox(sandboxId: string): Promise<void> {\n const backend = getActiveCloudBackend();\n await callCloudProxy<unknown>({\n backend,\n method: \"POST\",\n path: `/api/v1/sandboxes/${sandboxId}/resume`,\n });\n}\n\n/**\n * Read a file from a cloud conversation's sandbox workspace. Mirrors\n * OpenHands' `AgentServerConversationService.readConversationFile` — hits\n * `GET /api/v1/app-conversations/{id}/file?file_path=...` on the cloud backend\n * and returns the file content as a string.\n */\nexport async function readCloudConversationFile(\n conversationId: string,\n filePath: string,\n): Promise<string> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"file_path\", filePath);\n const data = await callCloudProxy<string>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/file?${params.toString()}`,\n });\n return data ?? \"\";\n}\n\n/**\n * List every file in a cloud conversation's sandbox workspace. Hits\n * `GET /api/v1/app-conversations/{id}/files?path=...` on the cloud backend,\n * which resolves the conversation's runtime and runs a bounded `find`\n * server-side (see enterprise `list_conversation_files`). Unlike the\n * git-changes source, this returns the full tree so the Files tab matches the\n * local-backend experience. Paths come back relative to `path`.\n */\nexport async function listCloudConversationFiles(\n conversationId: string,\n path: string,\n): Promise<string[]> {\n const backend = getActiveCloudBackend();\n const params = new URLSearchParams();\n params.append(\"path\", path);\n const data = await callCloudProxy<string[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/${conversationId}/files?${params.toString()}`,\n });\n return Array.isArray(data) ? data : [];\n}\n\n/**\n * Fetch a single v1 app-conversation start task. Mirrors OpenHands'\n * `AgentServerConversationService.getStartTask` — uses the batch search endpoint\n * with a single id and unwraps the first result.\n */\nexport async function getCloudAppConversationStartTask(\n taskId: string,\n backendOverride?: Backend,\n): Promise<AppConversationStartTask | null> {\n const backend = backendOverride ?? getActiveCloudBackend();\n const params = new URLSearchParams();\n params.set(\"ids\", taskId);\n const data = await callCloudProxy<(AppConversationStartTask | null)[]>({\n backend,\n method: \"GET\",\n path: `/api/v1/app-conversations/start-tasks?${params.toString()}`,\n });\n return data?.[0] ?? null;\n}\n"],"mappings":";;;;;AA6BA,SAAS,EACP,GACwB;CACxB,IAAI,CAAC,GAAc,IAAI,OAAO;CAC9B,IAAM,IAAS,EAA8B,EAAa,EAAE;CAG5D,OAFK,IAEE;EACL,GAAG;EACH,qBACE,EAAa,uBAAuB,EAAO,uBAAuB;EACpE,iBACE,EAAa,mBAAmB,EAAO,mBAAmB;EAC5D,cAAc,EAAa,gBAAgB,EAAO,gBAAgB;EAClE,oBACE,EAAa,sBAAsB,EAAO,sBAAsB;CACpE,IAXoB;AAYtB;AAEA,SAAS,IAAiC;CACxC,IAAM,IAAS,EAAiB,EAAE;CAClC,IAAI,EAAO,SAAS,SAClB,MAAU,MAAM,oDAAoD;CAEtE,OAAO;AACT;AAiBA,SAAgB,IAA4C;CAC1D,IAAM,IAAS,EAAiB,EAAE;CAElC,OADI,EAAO,SAAS,UAAgB,IAElC,EAAsB,EAAE,MACrB,MAAY,EAAQ,SAAS,WAAW,CAAC,CAAC,EAAQ,MACrD,KAAK;AAET;AAOA,eAAsB,EACpB,IAAgB,IAChB,GAC8B;CAC9B,IAAM,IAAU,EAAsB,GAChC,IAAS,IAAI,gBAAgB;CAGnC,AAFA,EAAO,IAAI,SAAS,OAAO,CAAK,CAAC,GAC7B,KAAQ,EAAO,IAAI,WAAW,CAAM,GACxC,EAAO,IAAI,cAAc,iBAAiB;CAE1C,IAAM,IAAO,MAAM,EAGhB;EACD;EACA,QAAQ;EACR,MAAM,oCAAoC,EAAO,SAAS;CAC5D,CAAC;CAED,OAAO;EACL,QAAQ,GAAM,SAAS,CAAC,GAAG,KACxB,MAAS,EAA2B,CAAI,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,MAAM,qBAAqB,EAAU;CACvC,CAAC;AACH;AAQA,eAAsB,EACpB,GACA,GACiB;CACjB,IAAM,IAAU,EAAsB,GAChC,IAAS,IAAI,gBAAgB;CAOnC,OANA,EAAO,OAAO,aAAa,CAAQ,GAM5B,MALY,EAAuB;EACxC;EACA,QAAQ;EACR,MAAM,6BAA6B,EAAe,QAAQ,EAAO,SAAS;CAC5E,CAAC,KACc;AACjB;AAUA,eAAsB,EACpB,GACA,GACmB;CACnB,IAAM,IAAU,EAAsB,GAChC,IAAS,IAAI,gBAAgB;CACnC,EAAO,OAAO,QAAQ,CAAI;CAC1B,IAAM,IAAO,MAAM,EAAyB;EAC1C;EACA,QAAQ;EACR,MAAM,6BAA6B,EAAe,SAAS,EAAO,SAAS;CAC7E,CAAC;CACD,OAAO,MAAM,QAAQ,CAAI,IAAI,IAAO,CAAC;AACvC;AAOA,eAAsB,EACpB,GACA,GAC0C;CAC1C,IAAM,IAAU,KAAmB,EAAsB,GACnD,IAAS,IAAI,gBAAgB;CAOnC,OANA,EAAO,IAAI,OAAO,CAAM,IAMjB,MALY,EAAoD;EACrE;EACA,QAAQ;EACR,MAAM,yCAAyC,EAAO,SAAS;CACjE,CAAC,KACa,MAAM;AACtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../_virtual/_rolldown/runtime.cjs");const e=require("./backend-registry/active-store.cjs"),t=require("./agent-server-client-options.cjs"),n=require("
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");const e=require("./backend-registry/active-store.cjs"),t=require("./agent-server-client-options.cjs"),n=require("../node_modules/@openhands/typescript-client/dist/workspace/remote-workspace.cjs"),r=require("./cloud/conversation-service.api.cjs"),i=require("./workspace-upload-path.cjs");var a=5;async function o(t,n){if(n?.id===t&&n.conversation_url?.trim()&&n.session_api_key?.trim())return{conversationUrl:n.conversation_url.trim(),sessionApiKey:n.session_api_key.trim()};if(e.getActiveBackend().backend.kind===`cloud`){let[e]=await r.batchGetCloudConversations([t]);return{conversationUrl:e?.conversation_url?.trim()??null,sessionApiKey:e?.session_api_key?.trim()??null}}return{conversationUrl:null,sessionApiKey:null}}function s(e){if(!e.conversationUrl||!e.sessionApiKey)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return{conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey}}async function c(t,n,r){let a=await i.resolveConversationUploadWorkingDir(t,r),c=await o(t,r),u=e.getActiveBackend().backend.kind===`cloud`,d=r?.id===t?r.session_api_key??c.sessionApiKey:c.sessionApiKey,f=r?.id===t?r.conversation_url??c.conversationUrl:c.conversationUrl;if(u){let e=s({conversationUrl:f,sessionApiKey:d});return l({files:n,workingDir:a,conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey})}return l({files:n,workingDir:a,conversationUrl:f,sessionApiKey:d})}async function l(e){let{files:r,workingDir:o,conversationUrl:s,sessionApiKey:c}=e,l=new n.RemoteWorkspace(t.getAgentServerClientOptions({conversationUrl:s,sessionApiKey:c,workingDir:o})),u=async e=>{try{let t=i.getSafeUploadFileName(e.name),n=await i.buildWorkspaceUploadPath(e.name,o,{conversationUrl:s,sessionApiKey:c});return await l.fileUpload(e,n),{uploadedFile:t,skippedFile:null}}catch(t){return{uploadedFile:null,skippedFile:{name:e.name,reason:t instanceof Error?t.message:`Upload failed`}}}},d=[];for(let e=0;e<r.length;e+=a){let t=r.slice(e,e+a);d.push(...await Promise.all(t.map(u)))}return{uploaded_files:d.flatMap(e=>e.uploadedFile?[e.uploadedFile]:[]),skipped_files:d.flatMap(e=>e.skippedFile?[e.skippedFile]:[])}}exports.resolveConversationRuntime=o,exports.uploadFilesToConversation=c;
|
|
2
2
|
//# sourceMappingURL=conversation-file-upload.api.cjs.map
|