@openhands/agent-canvas 1.2.1 → 1.4.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 +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{Trans-De9RwQhA.js → Trans-Ch-OVWEA.js} +1 -1
- package/build/assets/{acp-providers-D_D8VUpP.js → acp-providers-Sy2LKyMa.js} +1 -1
- package/build/assets/active-backend-context-hxq31W25.js +1 -0
- package/build/assets/{add-backend-modal-DIEyAkA4.js → add-backend-modal-Bgy8anoR.js} +1 -1
- package/build/assets/{agent-profiles-settings-BovdV4N8.js → agent-profiles-settings-3mmXljZX.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-BP73yONA.js → agent-server-conversation-service.api-CuSdr4Qb.js} +4 -4
- package/build/assets/{agent-settings-Ofbh6UTD.js → agent-settings-B-W10B4E.js} +1 -1
- package/build/assets/agent-settings-D_yOy8XB.js +1 -0
- package/build/assets/{alert-banner-BW0wRYw6.js → alert-banner-Bpf2NQJq.js} +1 -1
- package/build/assets/{api-key-entry-screen-CZIdRmUJ.js → api-key-entry-screen-Dl0qVYi4.js} +1 -1
- package/build/assets/{app-settings-BHJ9nKti.js → app-settings-yVizGXox.js} +1 -1
- package/build/assets/automation-detail-dvJfLs5u.js +2 -0
- package/build/assets/automation-export-BPcgLqPD.js +2 -0
- package/build/assets/automations-list-CUXogTe0.js +1 -0
- package/build/assets/{back-nav-button-BYmxFxGt.js → back-nav-button-CUS2mi-U.js} +1 -1
- package/build/assets/backend-form-modal-CQJGmItq.js +1 -0
- package/build/assets/{backend-synced-settings-badge-Bs3FSXsS.js → backend-synced-settings-badge-D9hZx05w.js} +1 -1
- package/build/assets/{base-modal-CC5Pp8CF.js → base-modal-BuF2f0YL.js} +1 -1
- package/build/assets/{brand-button-DKPMEKcW.js → brand-button-vMVuyDXu.js} +1 -1
- package/build/assets/{browser-B39N74jU.js → browser-BifzWIBd.js} +1 -1
- package/build/assets/{browser-tab-aiDg7aEn.js → browser-tab-CkkqJnqw.js} +1 -1
- package/build/assets/{chat-send-button-DxuZIoW8.js → chat-send-button-B_jc5z5C.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-T3eAIuPQ.js → circle-plus-check-toggle-C5YxjxvI.js} +1 -1
- package/build/assets/{combobox-caret-CLGvOs32.js → combobox-caret-DoObzqf4.js} +1 -1
- package/build/assets/{command-menu-DKrLCRla.js → command-menu-D-JV3Wqm.js} +1 -1
- package/build/assets/{condenser-settings-D_5vY4m3.js → condenser-settings-Ca8fYZ_Z.js} +1 -1
- package/build/assets/{confirmation-modal-BK1F0A68.js → confirmation-modal-BGLu6XJN.js} +1 -1
- package/build/assets/{context-menu-list-item-DBFzplWW.js → context-menu-list-item-BD5_EaKN.js} +1 -1
- package/build/assets/conversation-9NBSRoR9.js +1 -0
- package/build/assets/conversation-BXg6Oti2.js +89 -0
- package/build/assets/conversation-panel-CZri9Rup.js +1 -0
- package/build/assets/{conversation-service.api-CqZcHr1c.js → conversation-service.api-DPBQvTKD.js} +1 -1
- package/build/assets/{conversation-tab-empty-state-m8IUkfMj.js → conversation-tab-empty-state-B2dDYEwf.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-Aj9wFmt2.js → copy-to-clipboard-button-CaR52OnA.js} +1 -1
- package/build/assets/declaration-gq8V5eTU.js +1 -0
- package/build/assets/{device-verify-B5YCrvSu.js → device-verify-Dj6I4Iqe.js} +1 -1
- package/build/assets/{dropdown-classes-CgQ45JmQ.js → dropdown-classes-DJSXeLqc.js} +1 -1
- package/build/assets/{ellipsis-button-1BV9Sga8.js → ellipsis-button-C5Z-tPFp.js} +1 -1
- package/build/assets/{entry.client-Dy--3GeA.js → entry.client-2_3ePAm0.js} +2 -2
- package/build/assets/{enum-filter-dropdown-DCITiYVi.js → enum-filter-dropdown-DXbVwiNZ.js} +1 -1
- package/build/assets/{environment-switch-overlay-DUnKILNH.js → environment-switch-overlay-DZQfRGTx.js} +1 -1
- package/build/assets/{extensions-hub-CksKNpP9.js → extensions-hub-CLjmOGqS.js} +1 -1
- package/build/assets/{extensions-navigation-Di9rJ-b5.js → extensions-navigation-B5MeUiMq.js} +1 -1
- package/build/assets/files-tab-UVoray88.js +1 -0
- package/build/assets/{form-control-classes-9rkU4usZ.js → form-control-classes-ChpNBe9n.js} +1 -1
- package/build/assets/{git-provider-icon-aQRcUVI-.js → git-provider-icon-o6hdnJUB.js} +1 -1
- package/build/assets/home-D1IHvGTN.js +1 -0
- package/build/assets/{install-server-modal-BRab9inF.js → install-server-modal-BbuQaA2w.js} +1 -1
- package/build/assets/{launch-1TJRKkkX.js → launch-V_3Rp7WS.js} +1 -1
- package/build/assets/lesson-plan-jC0HBoe6.js +4 -0
- package/build/assets/{llm-not-configured-banner-BrU5uHto.js → llm-not-configured-banner-DoARbcdL.js} +4 -4
- package/build/assets/{llm-settings-BpdU51Jo.js → llm-settings-4JMLV8mq.js} +1 -1
- package/build/assets/llm-settings-D91gMw3U.js +1 -0
- package/build/assets/{loading-spinner-DHAIPZkP.js → loading-spinner-BLdswi6q.js} +1 -1
- package/build/assets/{manage-backends-modal-BREySP-J.js → manage-backends-modal-DkWAMSle.js} +1 -1
- package/build/assets/manifest-aa5c29f6.js +1 -0
- package/build/assets/{markdown-renderer-D8mayGjI.js → markdown-renderer-DMT7Zkpd.js} +1 -1
- package/build/assets/{mcp-XXf8k6mb.js → mcp-BQufNPZ6.js} +1 -1
- package/build/assets/{messages-D2oZb47Z.js → messages-BnJCqnFf.js} +11 -11
- package/build/assets/{modal-body-Dcu5McCa.js → modal-body-DouOE5KH.js} +1 -1
- package/build/assets/{modal-classes-DPqxSyuP.js → modal-classes-Cf-4tbHz.js} +1 -1
- package/build/assets/{modal-close-button-CTCX4nCH.js → modal-close-button-B6CfxxJj.js} +1 -1
- package/build/assets/{model-selector-VDHBytb6.js → model-selector-BfqpMkSJ.js} +1 -1
- package/build/assets/onboarding-Bu-HN1ze.js +1 -0
- package/build/assets/{onboarding-modal-C084vkv7.js → onboarding-modal-CZgjs5Bx.js} +1 -1
- package/build/assets/{option-service.api-Cl5VLGyw.js → option-service.api-BrZ5q87N.js} +1 -1
- package/build/assets/{organization-service.api-CnynNoT-.js → organization-service.api-Bk4pCGU1.js} +1 -1
- package/build/assets/{path-utils-BeOmjIcE.js → path-utils-CSmuZoix.js} +1 -1
- package/build/assets/{plan-components-j9X4AxYM.js → plan-components-CcCBmCzW.js} +1 -1
- package/build/assets/{planner-tab-AZMjJx31.js → planner-tab-Dhyqcqmb.js} +1 -1
- package/build/assets/{plugins-management-service-BAp70KN7.js → plugins-management-service-BRBLxvUl.js} +1 -1
- package/build/assets/{profiles-service.api-CeYEmSM3.js → profiles-service.api-BMXQ9pZC.js} +1 -1
- package/build/assets/providers-BpO967xS.js +1 -0
- package/build/assets/{proxy-CHmFkV16.js → proxy-BgJLtxu7.js} +1 -1
- package/build/assets/{recommended-automations-launcher-Bk8tQ-Cn.js → recommended-automations-launcher-CTcGTl4d.js} +1 -1
- package/build/assets/root-BM5WgQ4_.js +2 -0
- package/build/assets/root-V8fkplMy.css +1 -0
- package/build/assets/root-layout-BdoyoobY.js +2 -0
- package/build/assets/{runtime-waiting-state-DkzLgvMn.js → runtime-waiting-state-BsXLElvN.js} +1 -1
- package/build/assets/{schema-field-nvq_Juo2.js → schema-field-BSHrUMme.js} +1 -1
- package/build/assets/{sdk-section-page-CgT70FaZ.js → sdk-section-page-t82gsOqa.js} +1 -1
- package/build/assets/{sdk-settings-schema-BjBkMHzZ.js → sdk-settings-schema-Cv7M9eSe.js} +1 -1
- package/build/assets/{secrets-service-CZYjNxFw.js → secrets-service-B2GqPV0N.js} +1 -1
- package/build/assets/{secrets-settings-BCxk9p9s.js → secrets-settings-Cx6yJlyb.js} +1 -1
- package/build/assets/{segmented-toggle-Cen5AMUc.js → segmented-toggle-DyQqPhoD.js} +1 -1
- package/build/assets/{settings-CedTdtb5.js → settings-DmPLkgq0.js} +1 -1
- package/build/assets/{settings-dropdown-input-xzoZwgUe.js → settings-dropdown-input-BjunGXJb.js} +1 -1
- package/build/assets/{settings-index-Cct3PJSP.js → settings-index-D6sxWSRk.js} +1 -1
- package/build/assets/{settings-input-DYs7t3oK.js → settings-input-bD6npsDm.js} +1 -1
- package/build/assets/{settings-list-classes-DvQr5jVS.js → settings-list-classes-Dp_OgzN0.js} +1 -1
- package/build/assets/{settings-modal-DwLybV_O.js → settings-modal-CwrZKrTq.js} +1 -1
- package/build/assets/settings-service.api-Ce-ub11I.js +1 -0
- package/build/assets/{settings-switch-C2N2xqEb.js → settings-switch-5cuxl8Dc.js} +1 -1
- package/build/assets/{shared-conversation-DnDwfLgg.js → shared-conversation-BDREQPnE.js} +1 -1
- package/build/assets/{sidebar-layout-BtpUSN3j.js → sidebar-layout-DuzJMMw-.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-B8k3qu84.js → sidebar-mobile-menu-toggle-VvvX32iF.js} +1 -1
- package/build/assets/{sidebar-nav-link-CIB3NBRW.js → sidebar-nav-link-5AlTT5-j.js} +1 -1
- package/build/assets/{skill-card-pill-row-D2bUe2kB.js → skill-card-pill-row-eTIkE4nz.js} +1 -1
- package/build/assets/{skills-plugins-B68ay6Pu.js → skills-plugins-2Y44YHbO.js} +1 -1
- package/build/assets/{skills-settings-A6sUy0T7.js → skills-settings-BUv04tSc.js} +1 -1
- package/build/assets/{styled-tooltip-DsKsFjuq.js → styled-tooltip-CgX2oRaK.js} +1 -1
- package/build/assets/{suspense-X5dBsJzn.js → suspense-BO1Tl_Vf.js} +1 -1
- package/build/assets/{task-list-tab-BAThr9Ex.js → task-list-tab-0k9PhuqO.js} +1 -1
- package/build/assets/{terminal-BmT0_gIH.js → terminal-B61WrJdS.js} +1 -1
- package/build/assets/{toggle-switch-DBlOOzBr.js → toggle-switch-2j5wwR85.js} +1 -1
- package/build/assets/{typography-YGPBGzOG.js → typography-D8mHDeNG.js} +1 -1
- package/build/assets/{use-acp-credential-form-Bs6s0DTU.js → use-acp-credential-form-MzZM6D7D.js} +1 -1
- package/build/assets/{use-activate-agent-profile-CKtTToSx.js → use-activate-agent-profile-20v1xU0H.js} +1 -1
- package/build/assets/{use-active-agent-profile-CWLPpOtK.js → use-active-agent-profile-BkJN7Xsy.js} +1 -1
- package/build/assets/{use-active-conversation-DI5S5M1w.js → use-active-conversation-DOZVSVtU.js} +1 -1
- package/build/assets/{use-agent-profiles-DPcaYLpm.js → use-agent-profiles-DwZxnwO5.js} +1 -1
- package/build/assets/{use-agent-state-Buh3bQDh.js → use-agent-state-DHZO1obC.js} +1 -1
- package/build/assets/{use-backends-health-CxkvJy2N.js → use-backends-health-CRHzuvxO.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-DeX2Mfje.js → use-can-manage-org-profiles-C-OhWVBS.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-D_PQGfmT.js → use-cloud-current-user-id-utFreJ0i.js} +1 -1
- package/build/assets/use-config-mJrtZHP1.js +1 -0
- package/build/assets/{use-create-conversation-D9OWYcte.js → use-create-conversation-DdqsP78F.js} +1 -1
- package/build/assets/{use-create-secret-CVFSlhlR.js → use-create-secret-D0HCOZFu.js} +1 -1
- package/build/assets/{use-event-store-YSOxy9FC.js → use-event-store-DjgU4wfO.js} +1 -1
- package/build/assets/{use-handle-plan-click-Dug8egQl.js → use-handle-plan-click-DyRASKMC.js} +1 -1
- package/build/assets/use-is-authed-B6M0mcGL.js +1 -0
- package/build/assets/use-llm-profiles-RC-PkpBl.js +1 -0
- package/build/assets/{use-plugins-marketplace-BGb-KgfD.js → use-plugins-marketplace-FHlbeQ4c.js} +1 -1
- package/build/assets/use-runtime-is-ready-RKj2WmEh.js +1 -0
- package/build/assets/use-save-agent-profile-tvDP15mh.js +1 -0
- package/build/assets/{use-save-settings-CChDyjOB.js → use-save-settings-BGlSfuYn.js} +1 -1
- package/build/assets/{use-settings-dX4fKUPF.js → use-settings-CH5LzXD8.js} +1 -1
- package/build/assets/{use-settings-nav-items-D6pHnvxg.js → use-settings-nav-items-Dwktv8wo.js} +1 -1
- package/build/assets/{use-skills-Dqo-pDDx.js → use-skills-CSzSL6HG.js} +1 -1
- package/build/assets/{use-task-list-CmWGElgb.js → use-task-list-AVBLbbcR.js} +1 -1
- package/build/assets/{use-tracking-GtXCHmTv.js → use-tracking-BIXzagSI.js} +1 -1
- package/build/assets/{use-user-conversation-6uOXFP95.js → use-user-conversation-zpx7I18x.js} +1 -1
- package/build/assets/{useMutation-DCE9RcgK.js → useMutation-DrCAVg5w.js} +1 -1
- package/build/assets/{useMutationState-BUab8Kxr.js → useMutationState-D8QN0ZCy.js} +1 -1
- package/build/assets/{useQueries-CRzaAqzH.js → useQueries-DClgUTc7.js} +1 -1
- package/build/assets/{useQuery-CpjHYtZc.js → useQuery-CRBP8vIS.js} +1 -1
- package/build/assets/{useTranslation-Cgy4JA_g.js → useTranslation-CDRCKC9-.js} +1 -1
- package/build/assets/{utils-CE0lDWtb.js → utils-D3U3rlqr.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js} +1 -1
- package/build/assets/{verification-settings-D_zsNB_c.js → verification-settings-D576N2xa.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +24 -0
- package/build/locales/ca/openhands.json +24 -0
- package/build/locales/de/openhands.json +24 -0
- package/build/locales/en/openhands.json +25 -1
- package/build/locales/es/openhands.json +24 -0
- package/build/locales/fr/openhands.json +24 -0
- package/build/locales/it/openhands.json +24 -0
- package/build/locales/ja/openhands.json +24 -0
- package/build/locales/ko-KR/openhands.json +24 -0
- package/build/locales/no/openhands.json +24 -0
- package/build/locales/pt/openhands.json +24 -0
- package/build/locales/tr/openhands.json +24 -0
- package/build/locales/uk/openhands.json +24 -0
- package/build/locales/zh-CN/openhands.json +24 -0
- package/build/locales/zh-TW/openhands.json +24 -0
- package/config/defaults.json +4 -4
- package/dist/api/automation-service/automation-service.api.d.ts +2 -1
- package/dist/api/event-service/event-service.api.cjs +1 -1
- package/dist/api/event-service/event-service.api.cjs.map +1 -1
- package/dist/api/event-service/event-service.api.js +1 -1
- package/dist/api/event-service/event-service.api.js.map +1 -1
- package/dist/api/event-service/event-service.types.d.ts +6 -0
- package/dist/api/git-service/agent-server-git-service.api.cjs +1 -1
- package/dist/api/git-service/agent-server-git-service.api.cjs.map +1 -1
- package/dist/api/git-service/agent-server-git-service.api.js +2 -2
- package/dist/api/git-service/agent-server-git-service.api.js.map +1 -1
- package/dist/api/git-service/git-service.api.cjs +1 -1
- package/dist/api/git-service/git-service.api.cjs.map +1 -1
- package/dist/api/git-service/git-service.api.js +2 -2
- package/dist/api/git-service/git-service.api.js.map +1 -1
- package/dist/components/conversation-events/chat/event-thought-helpers.cjs +1 -1
- package/dist/components/conversation-events/chat/event-thought-helpers.js +1 -1
- package/dist/components/features/automations/automation-card.d.ts +2 -1
- package/dist/components/features/automations/automation-group.d.ts +2 -1
- package/dist/components/features/automations/automation-list-row.d.ts +2 -1
- package/dist/components/features/automations/build-automation-menu-items.d.ts +2 -1
- package/dist/components/features/automations/detail/detail-header.d.ts +3 -1
- package/dist/components/features/automations/import-automation-modal.d.ts +10 -0
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +3 -1
- package/dist/components/features/backends/backend-form-modal.js +17 -16
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.cjs +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.d.ts +2 -1
- package/dist/components/features/conversation/conversation-name-context-menu.js +74 -63
- package/dist/components/features/conversation/conversation-name-context-menu.js.map +1 -1
- package/dist/components/features/conversation/conversation-name.cjs +1 -1
- package/dist/components/features/conversation/conversation-name.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-name.js +73 -61
- package/dist/components/features/conversation/conversation-name.js.map +1 -1
- package/dist/components/features/conversation/transcript-export-modal.cjs +2 -0
- package/dist/components/features/conversation/transcript-export-modal.cjs.map +1 -0
- package/dist/components/features/conversation/transcript-export-modal.d.ts +10 -0
- package/dist/components/features/conversation/transcript-export-modal.js +140 -0
- package/dist/components/features/conversation/transcript-export-modal.js.map +1 -0
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs.map +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js.map +1 -1
- package/dist/components/features/home/shared/dropdown-item.cjs +1 -1
- package/dist/components/features/home/shared/dropdown-item.cjs.map +1 -1
- package/dist/components/features/home/shared/dropdown-item.d.ts +7 -1
- package/dist/components/features/home/shared/dropdown-item.js +2 -1
- package/dist/components/features/home/shared/dropdown-item.js.map +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.cjs +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.cjs.map +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.d.ts +8 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.js +18 -10
- package/dist/components/features/home/shared/generic-dropdown-menu.js.map +1 -1
- package/dist/components/features/home/workspace-dropdown/workspace-dropdown.d.ts +11 -2
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +4 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/hooks/query/use-automations.d.ts +2 -1
- package/dist/hooks/query/use-resolved-workspaces.cjs +1 -1
- package/dist/hooks/query/use-resolved-workspaces.cjs.map +1 -1
- package/dist/hooks/query/use-resolved-workspaces.d.ts +9 -1
- package/dist/hooks/query/use-resolved-workspaces.js +1 -0
- package/dist/hooks/query/use-resolved-workspaces.js.map +1 -1
- package/dist/hooks/query/use-workspace-file-content.cjs +1 -1
- package/dist/hooks/query/use-workspace-file-content.cjs.map +1 -1
- package/dist/hooks/query/use-workspace-file-content.js +61 -55
- package/dist/hooks/query/use-workspace-file-content.js.map +1 -1
- package/dist/hooks/query/use-workspace-files.cjs +1 -1
- package/dist/hooks/query/use-workspace-files.cjs.map +1 -1
- package/dist/hooks/query/use-workspace-files.d.ts +11 -4
- package/dist/hooks/query/use-workspace-files.js +39 -18
- package/dist/hooks/query/use-workspace-files.js.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.d.ts +9 -0
- package/dist/hooks/use-auto-refresh-files-on-edit.js +15 -11
- package/dist/hooks/use-auto-refresh-files-on-edit.js.map +1 -1
- package/dist/hooks/use-tracking.cjs +1 -1
- package/dist/hooks/use-tracking.cjs.map +1 -1
- package/dist/hooks/use-tracking.d.ts +7 -0
- package/dist/hooks/use-tracking.js +9 -0
- package/dist/hooks/use-tracking.js.map +1 -1
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +24 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +2 -2
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +409 -1
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +24 -0
- package/dist/locales/ca/openhands.json +24 -0
- package/dist/locales/de/openhands.json +24 -0
- package/dist/locales/en/openhands.json +25 -1
- package/dist/locales/es/openhands.json +24 -0
- package/dist/locales/fr/openhands.json +24 -0
- package/dist/locales/it/openhands.json +24 -0
- package/dist/locales/ja/openhands.json +24 -0
- package/dist/locales/ko-KR/openhands.json +24 -0
- package/dist/locales/no/openhands.json +24 -0
- package/dist/locales/pt/openhands.json +24 -0
- package/dist/locales/tr/openhands.json +24 -0
- package/dist/locales/uk/openhands.json +24 -0
- package/dist/locales/zh-CN/openhands.json +24 -0
- package/dist/locales/zh-TW/openhands.json +24 -0
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/routes/files-tab.cjs +1 -1
- package/dist/routes/files-tab.js +10 -10
- package/dist/types/automation.d.ts +8 -0
- package/dist/utils/custom-toast-handlers.cjs.map +1 -1
- package/dist/utils/custom-toast-handlers.d.ts +1 -0
- package/dist/utils/custom-toast-handlers.js.map +1 -1
- package/dist/utils/mcp-server-name.cjs +1 -1
- package/dist/utils/mcp-server-name.cjs.map +1 -1
- package/dist/utils/mcp-server-name.js +2 -2
- package/dist/utils/mcp-server-name.js.map +1 -1
- package/dist/utils/transcript-export/index.cjs +72 -0
- package/dist/utils/transcript-export/index.cjs.map +1 -0
- package/dist/utils/transcript-export/index.d.ts +10 -0
- package/dist/utils/transcript-export/index.js +302 -0
- package/dist/utils/transcript-export/index.js.map +1 -0
- package/dist/utils/transcript-export/load-complete-events.cjs +2 -0
- package/dist/utils/transcript-export/load-complete-events.cjs.map +1 -0
- package/dist/utils/transcript-export/load-complete-events.d.ts +22 -0
- package/dist/utils/transcript-export/load-complete-events.js +39 -0
- package/dist/utils/transcript-export/load-complete-events.js.map +1 -0
- package/package.json +1 -1
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/dev-safe.mjs +2 -2
- package/build/assets/active-backend-context-u2tdYRgH.js +0 -1
- package/build/assets/agent-settings-FGL3Yvkp.js +0 -1
- package/build/assets/automation-detail-DwYGzLkp.js +0 -2
- package/build/assets/automations-list-CuAfJmMW.js +0 -1
- package/build/assets/backend-form-modal-BiaOB2C4.js +0 -1
- package/build/assets/conversation-DnVC6vRV.js +0 -1
- package/build/assets/conversation-panel-ZEz-z3az.js +0 -1
- package/build/assets/conversation-xkBS3AHC.js +0 -19
- package/build/assets/declaration-B9kpCaYl.js +0 -1
- package/build/assets/edit-automation-modal-B6U96gVV.js +0 -1
- package/build/assets/files-tab-61Vaihc6.js +0 -1
- package/build/assets/home-5gOtUe-n.js +0 -1
- package/build/assets/lesson-plan-BtrZUCuj.js +0 -4
- package/build/assets/llm-settings-DsInf6yD.js +0 -1
- package/build/assets/manifest-a5bb7568.js +0 -1
- package/build/assets/onboarding-D32kiGME.js +0 -1
- package/build/assets/providers-vX9jk9Vy.js +0 -1
- package/build/assets/root-CxWZUXTQ.css +0 -1
- package/build/assets/root-layout-CoWw4kpz.js +0 -2
- package/build/assets/root-tuEPDx-i.js +0 -2
- package/build/assets/settings-service.api-DldkFI1x.js +0 -1
- package/build/assets/use-config-ur0RbjCP.js +0 -1
- package/build/assets/use-is-authed-_dhQ2Xuj.js +0 -1
- package/build/assets/use-llm-profiles-DjackuP1.js +0 -1
- package/build/assets/use-runtime-is-ready-Diiq65Q-.js +0 -1
- package/build/assets/use-save-agent-profile-aKKLqDJM.js +0 -1
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js} +0 -0
package/scripts/dev-safe.mjs
CHANGED
|
@@ -48,7 +48,7 @@ const LOCAL_AGENT_SERVER_SUBDIRS = [
|
|
|
48
48
|
"openhands-workspace",
|
|
49
49
|
];
|
|
50
50
|
const DEFAULT_AGENT_SERVER_VERSION = SHARED_DEFAULTS.versions.agentServer;
|
|
51
|
-
// Temporary transitive-dep pin: openhands-sdk 1.
|
|
51
|
+
// Temporary transitive-dep pin: openhands-sdk 1.35.0 leaves agent-client-protocol
|
|
52
52
|
// unbounded (>=0.10.1), but acp 0.11.0 reordered the ACP prompt() args and breaks
|
|
53
53
|
// the SDK's ACP client. Hold acp <0.11 until a fixed SDK ships. See config/defaults.json.
|
|
54
54
|
const AGENT_CLIENT_PROTOCOL_CONSTRAINT =
|
|
@@ -399,7 +399,7 @@ export function validateFrontendDependencies(
|
|
|
399
399
|
* edits are picked up without a manual reinstall. The agent-server itself
|
|
400
400
|
* is rebuilt from local source on each invocation (--reinstall).
|
|
401
401
|
* - OH_AGENT_SERVER_GIT_REF: Git commit SHA or branch name
|
|
402
|
-
* - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.
|
|
402
|
+
* - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.35.0")
|
|
403
403
|
*
|
|
404
404
|
* If none are set, defaults to the released version specified by
|
|
405
405
|
* DEFAULT_AGENT_SERVER_VERSION. Set OH_AGENT_SERVER_GIT_REF to use a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{a as r,c as i,i as a,l as o,n as s,o as ee,r as te,u as ne}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js";import{i as re,t as c}from"./declaration-B9kpCaYl.js";import{m as ie,o as ae,v as oe}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{I as se,t as ce}from"./utils-CE0lDWtb.js";import{E as l,c as u,d,f,g as le,h as p,l as m,m as h,n as ue,p as de,s as fe,u as pe,v as me}from"./agent-server-client-options-DVLRd9sw.js";var g=e(t(),1),_=`openhands`,v=[{label:`English`,value:`en`},{label:`日本語`,value:`ja`},{label:`简体中文`,value:`zh-CN`},{label:`繁體中文`,value:`zh-TW`},{label:`한국어`,value:`ko-KR`},{label:`Norsk`,value:`no`},{label:`Arabic`,value:`ar`},{label:`Deutsch`,value:`de`},{label:`Français`,value:`fr`},{label:`Italiano`,value:`it`},{label:`Português`,value:`pt`},{label:`Español`,value:`es`},{label:`Català`,value:`ca`},{label:`Türkçe`,value:`tr`},{label:`Українська`,value:`uk`}],y=new WeakMap,he=e=>{if(!y.has(e)){let t=e.use(r).use(a).use(re).init({fallbackLng:`en`,debug:!1,supportedLngs:v.map(e=>e.value),nonExplicitSupportedLngs:!1,ns:[_],defaultNS:_,fallbackNS:_,backend:{loadPath:`/locales/{{lng}}/{{ns}}.json`},interpolation:{escapeValue:!1}});y.set(e,t)}return e},ge=()=>he(ee()),b=null,x=null,S=()=>(b||=ge(),b),C=()=>x??S(),_e=e=>(x=e??S(),x),ve=async(e=S())=>(await y.get(e),e),ye=e=>e?typeof e==`object`&&!Array.isArray(e)?{ns:_,...e}:e:{ns:_},w=new Proxy({},{get:(e,t)=>{let n=C();if(t===`t`)return(e,t)=>n.t(e,ye(t));if(t===`exists`)return(e,t)=>n.exists(e,ye(t));let r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=C();return Reflect.set(r,t,n,r)}}),be=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`error`in e.response.data&&typeof e.response?.data?.error==`string`,xe=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`message`in e.response.data&&typeof e.response?.data?.message==`string`,Se=`Disconnected (check URL or network). Check that the backend URL is correct and the backend server is reachable. If the backend is on another origin, check that it allows this frontend origin.`,Ce=`Disconnected (request timed out). Check that the backend URL is correct and reachable.`,we=4;function Te(e){return typeof e==`object`&&!!e}function T(e){let t=[],n=new Set,r=e,i=0;for(;r!=null&&i<we&&!n.has(r);){if(n.add(r),r instanceof Error)r.message&&t.push(r.message),r=r.cause;else if(typeof r==`string`){r&&t.push(r);break}else if(Te(r)){let e=r.message;typeof e==`string`&&e&&t.push(e),r=r.cause}else break;i+=1}return t}function E(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`disconnected (check cors or network)`)||t.includes(`disconnected (check url or network)`)||t.includes(`blocked by cors`)||t.includes(`failed to fetch`)||t.includes(`network error`)||t.includes(`load failed`)||t.includes(`networkerror when attempting to fetch resource`)||t.includes(`cors`)&&t.includes(`blocked`)}function Ee(e){return T(e).some(E)}function D(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`request timeout`)||t.includes(`timeout after`)||t.includes(`backend request timed out`)}function O(e){let t=T(e);return t.some(E)?Se:t.some(D)?Ce:t[0]??null}function De(e){return typeof e==`object`&&!!e&&`isAxiosError`in e&&e.isAxiosError===!0}var k=e=>{let t=null,n=!1;return De(e)?(n=!0,t=be(e)&&e.response?.data.error?e.response?.data.error:xe(e)&&e.response?.data.message?e.response?.data.message:e.message):t=e instanceof Error?e.message:typeof e==`string`?e:null,O(n?t??e:e)??t??``},A=(e,t=5e3,n=1e4)=>{if(!e)return t;let r=e.length/(1e3/60)*1e3*1.5;return Math.min(Math.max(r,t),n)},j=n(),M={background:`var(--oh-color-tertiary)`,border:`1px solid var(--oh-border-input)`,color:`#fff`,borderRadius:`var(--oh-radius)`,maxWidth:`400px`,wordBreak:`break-word`,overflowWrap:`anywhere`,whiteSpace:`pre-wrap`},N={position:`top-right`,style:M},Oe={...M,color:`var(--oh-muted)`};function ke({message:e}){let t=g.useRef(null),[n,r]=g.useState(!1);return g.useLayoutEffect(()=>{let e=t.current;if(!e)return;let n=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){r(!1);return}r(e.getBoundingClientRect().height>t*1.5)};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),(0,j.jsxs)(`div`,{className:ce(`flex min-w-0 gap-2`,n?`items-start`:`items-center`),children:[(0,j.jsx)(te,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:se}}),(0,j.jsx)(`span`,{ref:t,className:`min-w-0 flex-1 text-sm leading-5 [word-break:break-word] [overflow-wrap:anywhere]`,children:e})]})}var Ae={...N,icon:null,style:Oe},P=e=>{let t=e||w.t(c.STATUS$ERROR);E(t)?t=w.t(c.ERROR$CORS_OR_NETWORK):D(t)&&(t=w.t(c.ERROR$BACKEND_REQUEST_TIMEOUT));let n=A(t,4e3);s((0,j.jsx)(ke,{message:t}),{...Ae,duration:n})},je=e=>{let t=A(e,5e3);s.success((0,j.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...N,duration:t})},Me=e=>{let t=A(e,6e3);s((0,j.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...N,icon:`⚠️`,duration:t})},F=`openhands-backend-health`,I=500;function Ne(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.consecutiveFailures)&&t.consecutiveFailures>=0&&t.consecutiveFailures<=5&&(t.lastError===null||typeof t.lastError==`string`)&&(t.lastFailureAt===null||typeof t.lastFailureAt==`number`)&&typeof t.disabled==`boolean`}function Pe(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(F);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&e.length>0&&Ne(r)&&(n[e]=r);return n}catch{return{}}}function Fe(e){if(!(typeof window>`u`))try{if(Object.keys(e).length===0){window.localStorage.removeItem(F);return}window.localStorage.setItem(F,JSON.stringify(e))}catch{}}function Ie(e){let t=O(e)??`Unknown error`;return t.length>I?`${t.slice(0,I)}…`:t}var L=Pe(),R=new Set;function Le(){R.forEach(e=>e())}function z(e){L=e,Fe(e),Le()}function Re(){return L}function ze(e){return R.add(e),()=>{R.delete(e)}}function Be(e,t){let n=L[e],r=Math.min((n?.consecutiveFailures??0)+1,5),i=n?.disabled===!0||r>=5,a={consecutiveFailures:r,lastError:Ie(t),lastFailureAt:Date.now(),disabled:i};z({...L,[e]:a})}function Ve(e){if(!(e in L))return;let{[e]:t,...n}=L;z(n)}function He(e){if(!(e in L))return;let{[e]:t,...n}=L;z(n)}function Ue(e){if(!(e in L))return;let{[e]:t,...n}=L;z(n)}var We=(e,t)=>{(e?.response?.status===401||e?.status===401)&&t.invalidateQueries({queryKey:[`user`,`authenticated`]})},Ge=e=>{if(!(e instanceof oe)||e.response?.status!==401&&e.status!==401)return!1;let t=u().backend;if(t.kind!==`cloud`)return!1;let n=e.config?.url;return!n||n.startsWith(t.host.replace(/\/+$/,``))},B=new Set,Ke=()=>{let e=new i({queryCache:new o({onSuccess:(e,t)=>{let n=t.meta?.backendId??t.options.meta?.backendId;typeof n==`string`&&Ve(n)},onError:(t,n)=>{if(n.queryKey[0]===`user`&&n.queryKey[1]===`authenticated`||We(t,e),!(n.meta?.disableToast??n.options.meta?.disableToast)&&!Ge(t)){let e=k(t);B.has(e||``)||(P(e||w.t(c.ERROR$GENERIC)),B.add(e||``),setTimeout(()=>{B.delete(e||``)},3e3))}}}),mutationCache:new ne({onError:(t,n,r,i)=>{We(t,e),!(i?.meta?.disableToast??i?.options.meta?.disableToast)&&!Ge(t)&&P(k(t)||w.t(c.ERROR$GENERIC))}})});return e},V=null,H=null,U=()=>(V||=Ke(),V),W=()=>H??U(),qe=e=>(H=e??U(),H),G=new Proxy({},{get:(e,t)=>{let n=W(),r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=W();return Reflect.set(r,t,n,r)}}),Je={_comment:`Single source of truth for version pins, ports, paths, and defaults shared across the npm and Docker install paths. Read by scripts/dev-safe.mjs, scripts/dev-with-automation.mjs, docker/entrypoint.sh (via generated defaults.env), and .github/workflows/docker.yml.`,versions:{agentServer:`1.33.0`,agentCanvas:`1.2.1`,automation:`1.1.4`},compatibility:{minimumAgentServer:`1.28.0`},constraints:{_comment:`Temporary upper bound on the agent-client-protocol (acp) transitive dependency. openhands-sdk 1.33.0 requires agent-client-protocol>=0.10.1 with no upper bound, but acp 0.11.0 reordered the ACP prompt() arguments and breaks the SDK's ACP client (a PromptRequest validation error surfaces as 'ACP error: 2 validation errors for PromptRequest'). Pin acp <0.11 until a fixed openhands-sdk ships. Consumed by scripts/dev-safe.mjs (agent-server uvx install) and .github/workflows/mock-llm-e2e.yml (mock ACP server venv).`,agentClientProtocol:`agent-client-protocol<0.11`},images:{agentServer:`ghcr.io/openhands/agent-server`,agentCanvas:`ghcr.io/openhands/agent-canvas`},ports:{agentServer:18e3,automation:18001,proxy:8e3},paths:{stateSubdir:`agent-canvas`,conversations:`agent-canvas/conversations`,bashEvents:`agent-canvas/bash_events`,automationDb:`automation/automations.db`},packages:{agentServer:`openhands-agent-server`,automation:`openhands-automation`,tools:`openhands-tools`,workspace:`openhands-workspace`}},Ye=5e3,Xe=`unknown`,K=Je.compatibility.minimumAgentServer,Ze=`AGENT_SERVER_UNSUPPORTED_VERSION`,Qe=`AGENT_SERVER_UNKNOWN_VERSION`,q=null,$e=e=>Array.isArray(e?.usable_tools)?e.usable_tools:null,J=class extends Error{details;noBackendConfigured;constructor(e,t){let n=t?.noBackendConfigured??!1;super(n?`No agent server backend is configured yet. Add a backend to get started.`:`Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.`),this.name=`AgentServerUnavailableError`,this.details=e??null,this.noBackendConfigured=n}},et=e=>e instanceof J||typeof e==`object`&&!!e&&`name`in e&&e.name===`AgentServerUnavailableError`,tt=class extends J{code=Ze;actualVersion;requiredVersion=K;constructor(e){let t=`Agent Canvas requires agent-server ${K} or newer; this backend is running ${e}. Please upgrade the agent-server backend.`;super(t),this.name=`AgentServerUnsupportedVersionError`,this.message=t,this.actualVersion=e}},Y=class extends J{code=Qe;actualVersion;requiredVersion=K;constructor(e){let t=`Could not determine this backend's agent-server version.${e?` It reported "${e}".`:``} Agent Canvas requires agent-server ${K} or newer, but this backend did not return a valid version from /server_info. Restart or rebuild the agent-server backend, then try again.`;super(t),this.name=`AgentServerUnknownVersionError`,this.message=t,this.actualVersion=e}},nt=e=>l()&&Z(e,401);function X(){q=null}function rt(e){let t=$e(q);return Array.isArray(t)?t.includes(e):!0}function it(e){return e instanceof Error&&e.name===`HttpError`&&`status`in e&&typeof e.status==`number`}function Z(e,t){return it(e)&&e.status===t}function at(e){return typeof e.version==`string`&&e.version.trim()||null}function ot(e){let t=at(e);return!t||t.toLowerCase()===Xe?null:t}function st(e){let t=ot(e);return!t||!Q(t)?null:t}function ct(e,t){let n=Q(e),r=Q(t);if(!n||!r)return null;for(let e of[`major`,`minor`,`patch`]){if(n[e]>r[e])return 1;if(n[e]<r[e])return-1}return n.prerelease&&!r.prerelease?-1:!n.prerelease&&r.prerelease?1:n.prerelease&&r.prerelease?n.prerelease.localeCompare(r.prerelease):0}function Q(e){let[t]=e.trim().replace(/^v/,``).split(`+`),[n,r]=t.split(`-`,2),i=n.split(`.`);if(i.length!==3)return null;let[a,o,s]=i.map(e=>Number(e));return[a,o,s].every(e=>Number.isInteger(e)&&e>=0)?{major:a,minor:o,patch:s,prerelease:r}:null}function lt(e){let t=ot(e);if(!t)throw X(),new Y(at(e));let n=ct(t,K);if(n===null)throw X(),new Y(t);if(n<0)throw X(),new tt(t)}async function ut(){let e=pe();if(!e){if(X(),de(u().backend))throw new J(`No backend configured`,{noBackendConfigured:!0});return null}let t=ue({host:e.host,sessionApiKey:e.apiKey||null,timeout:Ye}),n;try{n=await new ie(t).getServerInfo()}catch(e){throw X(),Z(e,401)?e:new J(e instanceof Error?e.message:null)}if(lt(n),l())try{await new ae(t).getSettings()}catch(e){if(Z(e,401))throw e;console.warn(`[agent-server] getSettings() probe failed (non-401):`,e)}return q=n,n}var dt={WEB_CLIENT_CONFIG:[`web-client-config`]},ft={all:[`settings`],byScope:e=>[`settings`,e],personal:()=>[`settings`,`personal`]},pt={all:[`llm-profiles`]},mt={all:[`agent-profiles`]},ht={retry:!1},gt={all:[`llm-subscription`],openaiStatus:[`llm-subscription`,`openai`,`status`],openaiModels:[`llm-subscription`,`openai`,`models`]},_t={all:[`local-workspaces`]},vt={marketplace:[`plugins-marketplace`],installed:[`plugins-installed`],local:[`plugins-local`]},yt={staleTime:1e3*60*5,gcTime:1e3*60*15},$=g.createContext(null);function bt(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`backend-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function xt({children:e}){let t=g.useSyncExternalStore(le,f,f),n=g.useCallback(()=>{X(),G.invalidateQueries({queryKey:dt.WEB_CLIENT_CONFIG})},[]),r=g.useCallback((e,t)=>{let r=m()?.backendId??null,i=m()?.orgId??null,a=t??null;e===r&&a===i||(h({backendId:e,orgId:a}),n())},[n]),i=g.useCallback(e=>{let t={...e,id:bt()};return p([...d(),t]),h({backendId:t.id}),n(),t},[n]),a=g.useCallback((e,t)=>{let r=d().find(t=>t.id===e),i=m()?.backendId??null;p(d().map(n=>n.id===e?{...n,...t}:n));let a=t.host!==void 0&&r!==void 0&&t.host!==r.host,o=t.apiKey!==void 0&&r!==void 0&&t.apiKey!==r.apiKey;(a||o)&&(He(e),i===e&&n())},[n]),o=g.useCallback(e=>{p(d().filter(t=>t.id!==e)),Ue(e),n()},[n]),s=g.useMemo(()=>({backends:t.backends,active:t.active,setActive:r,addBackend:i,updateBackend:a,removeBackend:o}),[t,r,i,a,o]);return(0,j.jsx)($.Provider,{value:s,children:e})}function St(){let e=g.useContext($);if(!e)throw Error(`useActiveBackendContext must be used inside <ActiveBackendProvider>`);return e}function Ct(){let e=g.useContext($);return e?e.active:{backend:me()??fe,orgId:null}}export{P as A,S as B,G as C,Ve as D,Be as E,D as F,w as H,Ee as I,E as L,Me as M,k as N,ze as O,O as P,v as R,W as S,Re as T,_e as U,C as V,ve as W,rt as _,ht as a,ut as b,gt as c,dt as d,ft as f,nt as g,st as h,mt as i,je as j,N as k,_t as l,X as m,Ct as n,yt as o,lt as p,St as r,pt as s,xt as t,vt as u,et as v,qe as w,U as x,Z as y,_ as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./agent-settings-Ofbh6UTD.js";export{e as default,t as handle};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r,P as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as a}from"./useQuery-CpjHYtZc.js";import{t as o}from"./useTranslation-Cgy4JA_g.js";import{t as s}from"./declaration-B9kpCaYl.js";import{b as c,p as l,y as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{A as d,j as f,n as p}from"./active-backend-context-u2tdYRgH.js";import{t as m}from"./back-nav-button-BYmxFxGt.js";import{t as h}from"./utils-CE0lDWtb.js";import{a as g,c as _,n as v}from"./agent-server-client-options-DVLRd9sw.js";import{t as y}from"./proxy-CHmFkV16.js";import{r as b}from"./modal-classes-DPqxSyuP.js";import{t as x}from"./brand-button-DKPMEKcW.js";import{n as S}from"./navigation-context-DPs2G0X8.js";import{t as C}from"./use-tracking-GtXCHmTv.js";import{t as w}from"./use-create-conversation-D9OWYcte.js";import{t as T}from"./u-edit-DJ90xc8Z.js";import{t as E}from"./terminal-BuLtIrb9.js";import{t as D}from"./use-user-conversation-6uOXFP95.js";import{t as O}from"./toggle-switch-DBlOOzBr.js";import{t as k}from"./x-mark-Batp6gXa.js";import{t as A}from"./code-tag-DYlAhEQY.js";import{t as j}from"./link-external-DfKQroKX.js";import{C as M,S as ee,_ as N,a as P,b as F,c as I,d as L,f as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as ce,s as le,t as ue,u as de,w as fe,x as pe,y as me}from"./edit-automation-modal-B6U96gVV.js";import{t as R}from"./automation-BU8zu-FP.js";var z=e(t()),B=n();function V(){let{t:e}=o(`openhands`);return(0,B.jsx)(m,{to:`/automations`,children:e(s.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var he=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function ge({active:e}){let{t}=o(`openhands`);return(0,B.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:h(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?s.AUTOMATIONS$DETAIL$ACTIVE:s.AUTOMATIONS$DETAIL$INACTIVE)})}function _e({automation:e,onToggle:t,onEdit:n,onDelete:r,onRunNow:i,isRunningNow:a=!1}){let{t:c}=o(`openhands`),l=se(`manage_automations`),u=[...n?[{label:c(s.AUTOMATIONS$EDIT),icon:(0,B.jsx)(T,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?c(s.AUTOMATIONS$TURN_OFF):c(s.AUTOMATIONS$TURN_ON),icon:(0,B.jsx)(le,{className:`size-4`}),onClick:t},{label:c(s.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,B.jsx)(he,{className:`size-4`}),onClick:()=>{fe.downloadTarball(e.id,e.name)}},{label:c(s.AUTOMATIONS$DELETE),icon:(0,B.jsx)(oe,{className:`size-4`}),onClick:r}];return(0,B.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,B.jsx)(ge,{active:e.enabled})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&i&&(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:a||!e.enabled,onClick:i,children:[(0,B.jsx)(te,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),c(a?s.AUTOMATIONS$STARTING:s.AUTOMATIONS$RUN_NOW)]}),l&&(0,B.jsx)(O,{enabled:e.enabled,label:e.enabled?c(s.AUTOMATIONS$TURN_OFF):c(s.AUTOMATIONS$TURN_ON),onToggle:t}),l&&(0,B.jsx)(ie,{items:u})]})]})})}function H({icon:e,title:t,children:n}){return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,B.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var ve=240,ye=`max-h-60`;function be({prompt:e}){let{t}=o(`openhands`),[n,r]=z.useState(!1),[i,a]=z.useState(!1),c=z.useRef(null),l=i&&!n;return z.useLayoutEffect(()=>{let e=c.current;if(!e)return;let t=()=>{a(e.scrollHeight>ve)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,B.jsx)(H,{icon:(0,B.jsx)(E,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$PROMPT),children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`p`,{ref:c,className:h(`whitespace-pre-wrap text-sm leading-6 text-content`,l&&h(ye,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),l?(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,B.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?s.COMMON$VIEW_LESS:s.COMMON$VIEW_MORE)}):null]})})}var xe=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),Se=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,B.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:9,cy:18,r:2})]}),U=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),W=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),Ce=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function G({icon:e,label:t,children:n}){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,B.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function we({branch:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var K=60;function Te({filter:e}){let{t}=o(`openhands`),[n,r]=(0,z.useState)(!1),i=e.length>K;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`break-all`,children:i&&!n?`${e.slice(0,K)}…`:e}),i&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?s.SETTINGS$SKILLS_SHOW_LESS:s.SETTINGS$SKILLS_SHOW_MORE)})]})}function Ee({automation:e}){let{t}=o(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?s.AUTOMATIONS$DETAIL$TRIGGER_EVENT:s.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,B.jsx)(H,{icon:(0,B.jsx)(xe,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,B.jsx)(G,{icon:(0,B.jsx)(Se,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,B.jsx)(we,{branch:e.branch})]})}),(0,B.jsx)(G,{icon:(0,B.jsx)(U,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,B.jsx)(G,{icon:(0,B.jsx)(de,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,B.jsx)(G,{icon:(0,B.jsx)(j,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_TYPE),children:I(e.trigger.on)}),n&&e.trigger.filter&&(0,B.jsx)(G,{icon:(0,B.jsx)(A,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,B.jsx)(Te,{filter:e.trigger.filter})}),(0,B.jsx)(G,{icon:(0,B.jsx)(re,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$MODEL),children:e.model??t(s.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,B.jsx)(G,{icon:(0,B.jsx)(Ce,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var De=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Oe({name:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function ke({plugins:e}){let{t}=o(`openhands`);return(0,B.jsx)(H,{icon:(0,B.jsx)(De,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$PLUGINS),children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,B.jsx)(Oe,{name:e},e))})})}var q=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function J(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function Ae(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?n(s.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(s.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(s.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):o===1?n(s.AUTOMATIONS$DETAIL$TIME_YESTERDAY):o<7?n(s.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:o}):J(e,t)}function je({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=o(`openhands`),i=r.language;return(0,B.jsx)(H,{icon:(0,B.jsx)(q,{className:`size-4`}),title:n(s.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:n(s.AUTOMATIONS$DETAIL$CREATED),children:J(e,i)}),(0,B.jsx)(G,{icon:(0,B.jsx)(L,{className:`size-3.5`}),label:n(s.AUTOMATIONS$DETAIL$LAST_RUN),children:t?Ae(t,i,n):n(s.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Me=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Ne={[R.COMPLETED]:{label:s.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[R.FAILED]:{label:s.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[R.PENDING]:{label:s.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[R.RUNNING]:{label:s.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Pe({status:e}){switch(e){case R.COMPLETED:return(0,B.jsx)(U,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case R.FAILED:return(0,B.jsx)(Me,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,B.jsx)(L,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Fe({status:e}){let{t}=o(`openhands`),n=Ne[e];return(0,B.jsxs)(`span`,{className:h(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,B.jsx)(Pe,{status:e}),t(n.label)]})}var Ie=20;function Le(e){return e.kind===`BashOutput`}var Re=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Ie;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{Le(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=_().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),y({backend:r,method:`GET`,hostOverride:g(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new l(v({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},ze=[`bash-command-logs`];function Be(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function Ve(e){if(!c.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function He(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=p(),o=D(r?t??null:null),s=o.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=i.backend.kind===`cloud`,d=o.isFetched,f=null,m=!1;u&&d&&(s?f=Be(s.sandbox_status)??(s.conversation_url?null:`missing`):m=!0);let h=r&&!!n&&(u?!!c:!0)&&!f&&!m,g=a({queryKey:[...ze,n,c,l,i.backend.id,i.orgId],queryFn:()=>Re.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Ve(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&o.isPending,conversationMissing:m,sandboxIssue:v}}var Ue=4e3;function We(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function Ge({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?We(a,Ue):`No error output was captured for this run.`,s=e?.trim(),c=[`${s?`The scheduled automation "${s}" failed during a run.`:`A scheduled automation failed during a run.`} Please investigate the error and fix the root cause.`],l=t?.trim();return l&&c.push(``,`What the automation was set up to do:`,l),c.push(``,`Error output from the failed run (run ${i}):`,o,``,`Please diagnose why it failed and propose or implement a fix.`),c.join(`
|
|
2
|
-
`)}function Y({run:e,automation:t,stderr:n}){let{t:r}=o(`openhands`),{navigate:i}=S(),a=w();return(0,B.jsx)(x,{testId:`debug-automation-button`,type:`button`,variant:`primary`,onClick:()=>{if(a.isPending)return;let r=Ge({automationName:t?.name,automationPrompt:t?.prompt,errorDetail:e.error_detail,stderr:n,runId:e.id});a.mutate({query:r},{onSuccess:e=>{i(`/conversations/${e.conversation_id}`)}})},isDisabled:a.isPending,"aria-busy":a.isPending,children:r(s.AUTOMATIONS$DETAIL$DEBUG_WITH_OPENHANDS)})}var Ke={missing:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function X(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function qe({conversationId:e,bashCommandId:t,isOpen:n,onClose:r,run:i,automation:a}){let{t:c}=o(`openhands`),[l,u]=(0,z.useState)(`stdout`),{data:d,isFetching:f,isResolvingConversation:p,sandboxIssue:m,conversationMissing:g,error:_}=He({conversationId:e,bashCommandId:t,enabled:n});(0,z.useEffect)(()=>{n&&u(`stdout`)},[n,t]),(0,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:v,stderr:y}=(0,z.useMemo)(()=>d?{stdout:X(d,`stdout`),stderr:X(d,`stderr`)}:{stdout:``,stderr:``},[d]);if(!n)return null;let x=p||f&&!d,S=!t,C=l===`stdout`?v:y,w=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,T=`border-[var(--oh-primary)] text-white`,E=`border-transparent text-muted hover:text-content`;return(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":c(s.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,B.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,B.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":c(s.AUTOMATIONS$CANCEL),children:(0,B.jsx)(k,{className:`size-5`})}),(0,B.jsx)(`h2`,{className:h(`pr-8`,b),children:c(s.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,B.jsxs)(`div`,{role:`tablist`,"aria-label":c(s.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:l===`stdout`?0:-1,onClick:()=>u(`stdout`),className:`${w} ${l===`stdout`?T:E}`,children:c(s.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:l===`stderr`?0:-1,onClick:()=>u(`stderr`),className:`${w} ${l===`stderr`?T:E}`,children:c(s.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${l}`,"aria-labelledby":`run-logs-tab-${l}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[S&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!S&&g&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!S&&!g&&m&&(0,B.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${m}`,className:`text-muted italic`,children:c(Ke[m])}),!S&&!g&&!m&&x&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!S&&!g&&!m&&!x&&_&&!d&&(0,B.jsxs)(`p`,{className:`text-danger`,children:[c(s.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(_)]}),!x&&!m&&d&&(0,B.jsx)(`pre`,{"data-testid":`run-logs-output-${l}`,className:`whitespace-pre-wrap break-words ${l===`stderr`?`text-danger`:`text-content`}`,children:C.length>0?C:(0,B.jsx)(`span`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]}),i?.status===R.FAILED&&(0,B.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,B.jsx)(Y,{run:i,automation:a,stderr:y})})]})]})}function Je(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ye(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function Xe(e){return`/conversations/${e}`}function Ze({run:e,automation:t}){let{t:n,i18n:r}=o(`openhands`),i=!!e.conversation_id,a=!!e.bash_command_id,c=e.status===R.COMPLETED||e.status===R.FAILED,l=!i&&c,[u,d]=(0,z.useState)(!1),[f]=(0,z.useState)(()=>new Date().toISOString()),p=Je(Ye(e.started_at)?f:e.started_at,r.language),m=a?(0,B.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),d(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":n(s.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:p}),title:n(s.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,B.jsx)(E,{className:`size-4`})}):null,h=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm text-content`,children:p}),l&&(0,B.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,n(s.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,B.jsx)(Fe,{status:e.status})]})]});return(0,B.jsxs)(B.Fragment,{children:[i&&e.conversation_id?(0,B.jsx)(`a`,{href:Xe(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${p}`,children:h}):(0,B.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:h}),a&&(0,B.jsx)(qe,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:u,onClose:()=>d(!1),run:e,automation:t})]})}var Z=20;function Qe({automation:e}){let{t}=o(`openhands`),[n,r]=(0,z.useState)(Z),{data:i,isLoading:a}=M({id:e.id,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:(0,B.jsx)(q,{className:`size-4`})}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(s.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),a&&(0,B.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,B.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,B.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!a&&i?.runs.length===0&&(0,B.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(s.AUTOMATIONS$DETAIL$NO_RUNS)}),!a&&i&&i.runs.length>0&&(0,B.jsxs)(`div`,{children:[i.runs.map((t,n)=>(0,B.jsx)(`div`,{className:n>0?`border-t border-[var(--oh-border)]`:``,children:(0,B.jsx)(Ze,{run:t,automation:e})},t.id)),c&&(0,B.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:t(s.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,B.jsx)(`div`,{className:h(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,B.jsx)(Q,{className:`h-5 w-40`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Q,{className:`h-6 w-48`}),(0,B.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,B.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,B.jsx)(Q,{className:`h-5 w-96`}),(0,B.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function $e(){let{t:e}=o(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(P,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(s.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(s.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(V,{})})]})}var et=r(function(){let{t:e}=o(`openhands`),{automationId:t}=i(),{navigate:n}=S(),[r,a]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),{data:m,isLoading:h,refetch:g}=N(),_=m?.status===`ok`,v=p(),y=(0,z.useRef)(v.backend.id).current!==v.backend.id,{data:b,isLoading:x,isError:w,error:T,refetch:E}=ee({id:t??``,enabled:_&&!y}),{trackPrebuiltAutomationEnabled:D}=C(),O=pe(),k=me(),A=F(),j=w&&u(T)&&T.response?.status===404;if(h)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(!_)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(ce,{onRetry:g})})});if(x)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(j)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($e,{})})});if(w||!b)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(ne,{onRetry:()=>E()})})});let M=()=>{let e=!b.enabled;O.mutate({id:b.id,enabled:e}),e&&D({automationId:b.id,automationName:b.name})},P=()=>{k.mutate(b.id,{onSuccess:()=>{n?.(`/automations`)}})},I=()=>{A.mutate(b.id,{onSuccess:()=>{f(e(s.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{d(u(t)?t.response?.data?.message||t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR))}})},L=v.backend.kind===`local`;return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(V,{}),(0,B.jsx)(_e,{automation:b,onToggle:M,onEdit:L?()=>l(!0):void 0,onDelete:()=>a(!0),onRunNow:I,isRunningNow:A.isPending}),b.prompt&&(0,B.jsx)(be,{prompt:b.prompt}),(0,B.jsx)(Ee,{automation:b}),b.plugins&&b.plugins.length>0&&(0,B.jsx)(ke,{plugins:b.plugins}),(0,B.jsx)(je,{createdAt:b.created_at,lastRunAt:b.last_triggered_at}),(0,B.jsx)(Qe,{automation:b}),(0,B.jsx)(ae,{automationName:b.name,isOpen:r,onConfirm:P,onCancel:()=>a(!1)}),L&&(0,B.jsx)(ue,{automation:b,isOpen:c,onClose:()=>l(!1)})]})})})});export{et as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{L as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as a}from"./Trans-De9RwQhA.js";import{t as o}from"./useTranslation-Cgy4JA_g.js";import{t as s}from"./declaration-B9kpCaYl.js";import{y as c}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{A as l,j as u,n as d}from"./active-backend-context-u2tdYRgH.js";import{t as f}from"./createLucideIcon-CVAsW2Yo.js";import{t as p}from"./check-Bvi71siz.js";import{t as m}from"./utils-CE0lDWtb.js";import{t as h}from"./modal-backdrop-zVwfOJZr.js";import{n as g}from"./modal-classes-DPqxSyuP.js";import{t as _}from"./brand-button-DKPMEKcW.js";import{n as v}from"./navigation-context-DPs2G0X8.js";import{t as y}from"./styled-tooltip-DsKsFjuq.js";import{u as b}from"./dropdown-classes-CgQ45JmQ.js";import{t as x}from"./modal-close-button-CTCX4nCH.js";import{t as S}from"./use-tracking-GtXCHmTv.js";import{n as C,t as ee}from"./recommended-automations-launcher-Bk8tQ-Cn.js";import{n as te,t as w}from"./context-menu-list-item-DBFzplWW.js";import{t as T}from"./u-edit-DJ90xc8Z.js";import{t as E}from"./folder-mMWFvaw0.js";import{t as D}from"./search-BsjCEFNf.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./extension-module-card-classes-9V3J9J_b.js";import{n as P}from"./skill-card-pill-row-D2bUe2kB.js";import{n as F,t as I}from"./use-launch-skill-in-chat-BnoDgvAy.js";import{_ as ne,b as re,c as L,d as R,f as z,g as B,h as V,i as ie,l as H,m as U,n as ae,o as oe,p as W,r as se,s as ce,t as le,u as G,v as ue,x as de,y as fe}from"./edit-automation-modal-B6U96gVV.js";var pe=f(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),me=f(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),he=f(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),K=e(t(),1),q=n();function ge({value:e,onChange:t,className:n}){let{t:r}=o(`openhands`);return(0,q.jsxs)(`div`,{className:m(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,q.jsx)(D,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,q.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(s.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(s.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}function J(e,t){let n=[];if(e.repository&&n.push({id:`repository`,node:(0,q.jsxs)(`span`,{className:m(k,`gap-1`),children:[(0,q.jsx)(E,{className:`size-3 shrink-0`}),e.repository]})}),e.trigger.type===`event`){let t=[e.trigger.on?L(e.trigger.on):``,e.trigger.source?`(${e.trigger.source})`:``].filter(Boolean).join(` `);n.push({id:`event-trigger`,node:(0,q.jsxs)(`span`,{className:m(k,`gap-1`),children:[(0,q.jsx)(G,{className:`size-3 shrink-0`}),t]})})}else n.push({id:`schedule`,node:(0,q.jsxs)(`span`,{className:m(k,`gap-1`),children:[(0,q.jsx)(R,{className:`size-3 shrink-0`}),t]})});return e.model&&n.push({id:`model`,node:(0,q.jsxs)(`span`,{className:m(k,`gap-1`),children:[(0,q.jsx)(H,{className:`size-3 shrink-0`}),e.model]})}),n}function Y({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:a,onEdit:o,onToggle:c,onDelete:l}){return[...n?[{label:t(s.AUTOMATIONS$RUN_NOW),icon:(0,q.jsx)(z,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(s.COMMON$VIEW),icon:(0,q.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),onClick:a},...n&&o?[{label:t(s.AUTOMATIONS$EDIT),icon:(0,q.jsx)(T,{className:`size-4`}),onClick:()=>o(e.id)}]:[],...n?[{label:e.enabled?t(s.AUTOMATIONS$TURN_OFF):t(s.AUTOMATIONS$TURN_ON),icon:(0,q.jsx)(ce,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(s.AUTOMATIONS$DELETE),icon:(0,q.jsx)(oe,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function _e({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:a}){let{navigate:c}=v(),{t:l}=o(`openhands`),u=W(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,K.useMemo)(()=>J(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},h=Y({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:a,onToggle:t,onDelete:i}),g=()=>{p()};return(0,q.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:m(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,O,M),children:[(0,q.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 truncate text-sm font-semibold text-white`,children:[e.trigger.type===`event`?(0,q.jsx)(G,{className:`size-4 shrink-0 text-muted`}):(0,q.jsx)(R,{className:`size-4 shrink-0 text-muted`}),(0,q.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.prompt?(0,q.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,q.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:B,children:[(0,q.jsx)(z,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(s.AUTOMATIONS$RUN_NOW)]}):null,(0,q.jsx)(U,{items:h})]})]}),f.length>0?(0,q.jsx)(P,{pills:f,testId:`automation-pills-${e.id}`}):null]})}var ve=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,ye=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),be=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,X=`px-3 align-middle`,xe=[ye,be,`cursor-pointer`].join(` `),Se=`openhands-automations-view`;function Ce(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function we(e){window.localStorage.setItem(Se,e)}function Te({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:a}){let{navigate:c}=v(),{t:l}=o(`openhands`),u=W(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,K.useMemo)(()=>J(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},h=Y({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:a,onToggle:t,onDelete:i}),g=()=>{p()};return(0,q.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},tabIndex:0,className:m(xe,`cursor-pointer`),children:[(0,q.jsx)(`td`,{className:X,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.trigger.type===`event`?(0,q.jsx)(G,{className:`size-4 shrink-0 text-muted`}):(0,q.jsx)(R,{className:`size-4 shrink-0 text-muted`}),(0,q.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(P,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,q.jsx)(`td`,{className:m(`w-0 whitespace-nowrap`,X),children:(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,q.jsx)(y,{content:l(s.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,q.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":l(s.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:V,children:(0,q.jsx)(z,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,q.jsx)(U,{items:h})]})})]})}function Z({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:o=null,onDelete:s,onEdit:c}){return n.length===0?null:(0,q.jsxs)(`section`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,q.jsx)(C,{count:t})]}),r===`grid`?(0,q.jsx)(`div`,{className:m(`mt-3`,A),children:(0,q.jsx)(`div`,{className:N,children:n.map(e=>(0,q.jsx)(_e,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})}):(0,q.jsx)(`div`,{className:m(ve,`mt-3`),children:(0,q.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,q.jsx)(`tbody`,{children:n.map(e=>(0,q.jsx)(Te,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})})})]})}var Ee=e(r(),1);function De({icon:e,label:t,isSelected:n}){return(0,q.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,q.jsx)(`span`,{className:b,"aria-hidden":!0,children:(0,q.jsx)(e,{})}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,q.jsx)(p,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}var Q=[{value:`grid`,icon:me,labelKey:s.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:he,labelKey:s.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Oe({view:e,onChange:t,disabled:n=!1}){let{t:r}=o(`openhands`),[i,a]=(0,K.useState)(!1),[c,l]=(0,K.useState)(),u=(0,K.useRef)(null),d=(0,K.useRef)(null),f=(Q.find(t=>t.value===e)??Q[0]).icon;(0,K.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&l({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,K.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&c?(0,q.jsx)(te,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:Q.map(n=>(0,q.jsx)(`li`,{children:(0,q.jsx)(w,{testId:n.testId,onClick:()=>{t(n.value),a(!1)},className:`group`,children:(0,q.jsx)(De,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(s.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||a(e=>!e)},className:m(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,q.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&c&&typeof document<`u`?Ee.createPortal((0,q.jsx)(`div`,{style:c,children:p}),document.body):null]})}function ke(){return(0,q.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${O} border border-transparent p-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,q.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,q.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,q.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,q.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,q.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,q.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ae=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,q.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),je=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Me({children:e}){return(0,q.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function Ne({children:e}){return(0,q.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:m(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Pe({children:e}){return(0,q.jsx)(q.Fragment,{children:e})}var Fe={example:(0,q.jsx)(Me,{}),cmd:(0,q.jsx)(Ne,{}),punct:(0,q.jsx)(Pe,{})};function $({onLaunch:e}={}){let{t}=o(`openhands`),n=I(),r=d(),{trackAutomationCreated:i}=S();return(0,q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,q.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,q.jsx)(a,{ns:`openhands`,i18nKey:s.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:Fe}),` `,t(s.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,q.jsx)(`a`,{href:je,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(s.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,q.jsx)(_,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{i({backendKind:r.backend.kind}),n(t(s.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),children:t(s.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Ie({collapsible:e=!1}){let{t}=o(`openhands`),[n,r]=(0,K.useState)(!e);return e?(0,q.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,q.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(s.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,q.jsx)(Ae,{className:m(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,q.jsx)(`div`,{className:`px-4 pb-4`,children:(0,q.jsx)($,{})}):null]}):(0,q.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,q.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(s.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,q.jsx)(`div`,{className:`mt-4`,children:(0,q.jsx)($,{})})]})}function Le(){let{t:e}=o(`openhands`);return(0,q.jsxs)(`div`,{"data-testid":`automations-empty`,className:j,children:[(0,q.jsx)(`p`,{className:`text-sm text-white`,children:e(s.AUTOMATIONS$EMPTY)}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(s.AUTOMATIONS$EMPTY_HINT)}),(0,q.jsx)(`div`,{className:`mt-8 flex justify-center border-t border-[var(--oh-border)] pt-8`,children:(0,q.jsx)(Ie,{})})]})}function Re({isOpen:e,onClose:t}){let{t:n}=o(`openhands`);return e?(0,q.jsx)(h,{onClose:t,"aria-label":n(s.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,q.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,q.jsx)(x,{onClose:t,testId:`add-automation-modal-close`}),(0,q.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,q.jsx)(`h2`,{id:`add-automation-modal-title`,className:m(`pr-6`,g),children:n(s.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,q.jsx)(`div`,{className:`px-6 pb-6`,children:(0,q.jsx)($,{onLaunch:t})})]})}):null}var ze=50,Be=i(function(){let{t:e}=o(`openhands`),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(()=>Ce()),[a,f]=(0,K.useState)(ze),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),b=d().backend.kind===`local`,{data:x,isLoading:C,refetch:te}=ne(),w=x?.status===`ok`,{data:T,isLoading:E,isError:D,refetch:O}=ue({limit:a,offset:0,enabled:w}),{trackPrebuiltAutomationEnabled:k}=S(),A=de(),j=fe(),M=re(),N=(0,K.useMemo)(()=>{if(!T?.automations)return[];let e=t.toLowerCase();return e?T.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):T.automations},[T?.automations,t]),P=(0,K.useMemo)(()=>N.filter(e=>e.enabled),[N]),F=(0,K.useMemo)(()=>N.filter(e=>!e.enabled),[N]),I=(e,t)=>{let n=!t;if(A.mutate({id:e,enabled:n}),n){let t=T?.automations.find(t=>t.id===e);k({automationId:e,automationName:t?.name??e})}},L=t=>{M.mutate(t,{onSuccess:()=>{u(e(s.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{l(c(t)?t.response?.data?.message||t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR))}})},R=e=>{let t=T?.automations.find(t=>t.id===e);t&&m({id:e,name:t.name})},z=e=>{let t=T?.automations.find(t=>t.id===e);t&&g(t)},B=()=>{p&&(j.mutate(p.id),m(null))},V=(0,K.useCallback)(e=>{i(e),we(e)},[]),H=T?T.total>T.automations.length:!1,U=!E&&!D&&T?.automations.length===0;return C?(0,q.jsx)(`div`,{className:`min-h-full`,children:(0,q.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(s.AUTOMATIONS$TITLE)}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(s.AUTOMATIONS$SUBTITLE)}),(0,q.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,q.jsx)(ke,{},`skeleton-${String(t)}`))})]})}):w?(0,q.jsx)(`div`,{className:`min-h-full`,children:(0,q.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(s.AUTOMATIONS$TITLE)}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(s.AUTOMATIONS$SUBTITLE)})]}),(0,q.jsx)(_,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>y(!0),children:e(s.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,q.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,q.jsx)(ge,{value:t,onChange:n}),(0,q.jsx)(Oe,{view:r,onChange:V,disabled:U})]}),(0,q.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[E&&(0,q.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,q.jsx)(ke,{},`skeleton-${String(t)}`))}),D&&!E&&(0,q.jsx)(ie,{onRetry:O}),U&&(0,q.jsx)(Le,{}),!E&&!D&&T&&T.automations.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Z,{title:e(s.AUTOMATIONS$ACTIVE),count:P.length,automations:P,view:r,onToggle:I,onRunNow:L,runPendingId:M.isPending?M.variables??null:null,onDelete:R,onEdit:b?z:void 0}),(0,q.jsx)(Z,{title:e(s.AUTOMATIONS$INACTIVE),count:F.length,automations:F,view:r,onToggle:I,onRunNow:L,runPendingId:M.isPending?M.variables??null:null,onDelete:R,onEdit:b?z:void 0}),H&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e=>e+ze),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(s.AUTOMATIONS$LOAD_MORE)})]})]}),(0,q.jsx)(`div`,{className:`mt-6`,children:(0,q.jsx)(ee,{query:t})}),(0,q.jsx)(ae,{automationName:p?.name??``,isOpen:p!==null,onConfirm:B,onCancel:()=>m(null)}),h&&(0,q.jsx)(le,{automation:h,isOpen:h!==null,onClose:()=>g(null)}),(0,q.jsx)(Re,{isOpen:v,onClose:()=>y(!1)})]})}):(0,q.jsx)(`div`,{className:`min-h-full`,children:(0,q.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(s.AUTOMATIONS$TITLE)}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(s.AUTOMATIONS$SUBTITLE)}),(0,q.jsx)(se,{onRetry:te})]})})});export{Be as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useQuery-CpjHYtZc.js";import{t as i}from"./useTranslation-Cgy4JA_g.js";import{t as a}from"./declaration-B9kpCaYl.js";import{m as o}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{F as s,L as c,P as l,h as u,p as d,r as f}from"./active-backend-context-u2tdYRgH.js";import{t as p}from"./utils-CE0lDWtb.js";import{T as m,n as h}from"./agent-server-client-options-DVLRd9sw.js";import{a as g,i as _,n as v,r as y,t as b}from"./use-backends-health-CxkvJy2N.js";import{t as x}from"./modal-backdrop-zVwfOJZr.js";import{n as S,r as C,t as w}from"./modal-body-Dcu5McCa.js";import{n as T,r as E}from"./modal-classes-DPqxSyuP.js";import{t as D}from"./brand-button-DKPMEKcW.js";import{n as O}from"./navigation-context-DPs2G0X8.js";import{t as k}from"./modal-close-button-CTCX4nCH.js";import{t as A}from"./settings-input-DYs7t3oK.js";import{t as j}from"./segmented-toggle-Cen5AMUc.js";import{t as M}from"./use-tracking-GtXCHmTv.js";var N=e(t()),P=n(),F=e=>(0,P.jsxs)(`svg`,{width:1365,height:1365,viewBox:`0 -24 148 148`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,P.jsx)(`path`,{d:`M71.7542 16.863V2.97414C71.7542 1.82355 72.6872 0.890503 73.8378 0.890503C74.9884 0.890503 75.9214 1.82355 75.9214 2.97414V16.863C75.9214 18.0136 74.9884 18.9466 73.8378 18.9466C72.6872 18.9466 71.7542 18.0136 71.7542 16.863Z`,fill:`white`}),(0,P.jsx)(`path`,{d:`M82.5272 18.9329L89.4716 6.90477C90.0469 5.90832 91.3215 5.5668 92.3179 6.1421C93.3144 6.7174 93.6559 7.99197 93.0806 8.98841L86.1362 21.0165C85.5609 22.0129 84.2863 22.3545 83.2899 21.7792C82.2934 21.2039 81.9519 19.9293 82.5272 18.9329Z`,fill:`white`}),(0,P.jsx)(`path`,{d:`M65.1481 18.9329L58.2037 6.90477C57.6284 5.90832 56.3538 5.5668 55.3574 6.1421C54.3609 6.7174 54.0194 7.99197 54.5947 8.98841L61.5391 21.0165C62.1144 22.0129 63.389 22.3545 64.3854 21.7792C65.3819 21.2039 65.7234 19.9293 65.1481 18.9329Z`,fill:`white`}),(0,P.jsx)(`path`,{d:`M140.606 62.0292C140.606 58.409 141.583 47.6748 141.89 44.1323C142.097 41.7374 141.809 40.4247 141.424 39.7542C141.141 39.2626 140.699 38.915 139.634 38.8436C138.865 38.7921 138.027 39.0114 137.401 39.5761C136.814 40.1052 136.159 41.1682 136.159 43.3176L136.155 43.4388L135.198 59.758C135.164 60.3451 134.883 60.8911 134.424 61.2599C133.966 61.6284 133.374 61.7859 132.793 61.6941L122.764 60.1068L111.948 58.6703C110.949 58.5376 110.188 57.7084 110.142 56.7016L109.561 44.1323C109.535 43.621 109.51 43.1141 109.484 42.6146C109.241 37.9294 109.022 33.7805 109.022 32.4282C109.022 28.3859 108.338 26.6806 107.74 25.9634C107.263 25.3915 106.577 25.1402 105.11 25.1402C104.583 25.1402 104.212 25.2481 103.933 25.4111C103.659 25.5714 103.346 25.8587 103.049 26.4208C102.41 27.6257 101.945 29.891 102.118 33.8479C102.342 38.9804 102.692 42.8146 103.035 46.2718C103.377 49.7231 103.718 52.8561 103.908 56.4971C104.204 62.1966 104.178 66.1256 103.945 68.7924C103.828 70.124 103.656 71.1996 103.423 72.0501C103.202 72.8558 102.871 73.6757 102.296 74.2887C101.6 75.0303 100.608 75.3844 99.577 75.136C98.7592 74.9389 98.1847 74.4215 97.8706 74.0916C97.2141 73.4017 96.7501 72.5106 96.568 72.0512C95.5097 69.3812 92.2352 63.1808 87.8023 59.6811C86.5089 58.6599 85.5666 58.3652 84.9736 58.3204C84.4148 58.2783 84.0094 58.4436 83.6909 58.6967C83.34 58.9756 83.0781 59.3811 82.9479 59.7643C82.9019 59.8999 82.8823 59.9968 82.8741 60.0584C84.0759 62.0865 88.8421 69.5222 91.0896 77.069C92.7648 82.6941 96.8038 88.4259 99.8194 90.8809C102.74 93.258 107.988 94.7313 113.9 95.0218C119.756 95.3095 125.788 94.4121 130.033 92.5092C138.233 88.8334 139.903 80.7382 140.651 77.2292C141.232 74.5057 141.243 71.5987 141.087 68.9009C141.01 67.5551 140.894 66.2969 140.793 65.1373C140.695 64.0105 140.606 62.9215 140.606 62.0292ZM120.986 27.0953C120.986 25.8314 120.648 24.7049 120.089 23.9514C119.583 23.27 118.84 22.7987 117.646 22.7984C116.668 22.7982 116.011 22.9187 115.546 23.1167C115.13 23.2943 114.781 23.5699 114.463 24.0831C113.73 25.2671 113.192 27.6455 113.189 32.384L113.721 43.9088C113.91 47.5661 114.106 51.4922 114.235 54.7707L120.986 55.6666V27.0953ZM125.153 56.2652L131.172 57.218L131.992 43.267V32.5083C131.992 31.031 131.39 30.1275 130.678 29.5489C129.884 28.9039 128.957 28.6731 128.519 28.6731C127.722 28.6731 126.899 28.797 126.306 29.2179C125.849 29.5421 125.153 30.3087 125.153 32.5083V56.2652ZM136.159 35.4278C137.406 34.8069 138.74 34.6083 139.912 34.6868C142.037 34.8292 143.91 35.718 145.037 37.6779C146.06 39.4592 146.273 41.8136 146.041 44.4927C145.72 48.1949 144.772 58.6457 144.772 62.0292C144.772 62.708 144.843 63.6116 144.944 64.7758C145.042 65.907 145.165 67.2389 145.247 68.6606C145.411 71.4987 145.422 74.8383 144.727 78.0987C144.002 81.4953 142.041 91.6918 131.738 96.3108C126.731 98.5551 120.002 99.4936 113.696 99.1838C107.445 98.8767 101.128 97.3189 97.1887 94.1122C93.4809 91.0937 88.9938 84.6307 87.0962 78.2589C84.9529 71.0619 80.3109 63.9646 79.1527 61.9533C78.4706 60.7689 78.684 59.3628 79.0019 58.4258C79.3607 57.3688 80.0554 56.2631 81.0993 55.4337C82.1758 54.5784 83.6043 54.0377 85.2876 54.1647C86.9369 54.2893 88.6462 55.0393 90.3834 56.4107C94.8541 59.9401 98.1342 65.5082 99.7424 68.9231C99.759 68.7664 99.779 68.6024 99.7941 68.4298C100.003 66.0435 100.039 62.3344 99.7467 56.7132C99.5635 53.1942 99.2356 50.1809 98.8888 46.6828C98.5425 43.1904 98.184 39.2713 97.955 34.0302C97.7722 29.8481 98.2012 26.6722 99.3672 24.471C99.9716 23.3302 100.79 22.4223 101.83 21.814C102.866 21.2087 103.995 20.974 105.11 20.974C106.759 20.974 108.813 21.2062 110.448 22.7678C110.593 22.4576 110.75 22.1652 110.921 21.8899C111.676 20.6698 112.681 19.8084 113.912 19.2835C115.095 18.7791 116.378 18.6309 117.646 18.6311C120.195 18.6315 122.164 19.7567 123.434 21.4683C124.256 22.576 124.75 23.8775 124.985 25.1982C126.338 24.5876 127.691 24.5068 128.519 24.5068C129.933 24.5068 131.784 25.0791 133.305 26.3154C134.908 27.6179 136.159 29.6733 136.159 32.5083V35.4278Z`,fill:`white`}),(0,P.jsx)(`path`,{d:`M7.15661 62.0292C7.15661 58.409 6.17994 47.6748 5.87291 44.1323C5.6654 41.7374 5.95357 40.4247 6.33875 39.7542C6.62116 39.2626 7.06336 38.915 8.12834 38.8436C8.89759 38.7921 9.73544 39.0114 10.3616 39.5761C10.9484 40.1052 11.6032 41.1682 11.6032 43.3176L11.6074 43.4388L12.5644 59.758C12.5988 60.3451 12.8798 60.8911 13.338 61.2599C13.7961 61.6284 14.3887 61.7859 14.9695 61.6941L24.9988 60.1068L35.8143 58.6703C36.8135 58.5376 37.5741 57.7084 37.6208 56.7016L38.2015 44.1323C38.2279 43.621 38.2525 43.1141 38.2784 42.6146C38.5218 37.9294 38.7401 33.7805 38.7401 32.4282C38.7401 28.3859 39.4246 26.6806 40.0227 25.9634C40.4996 25.3915 41.185 25.1402 42.6523 25.1402C43.1794 25.1402 43.5505 25.2481 43.8295 25.4111C44.1038 25.5714 44.416 25.8587 44.7138 26.4208C45.3521 27.6257 45.8173 29.891 45.6444 33.8479C45.4201 38.9804 45.0703 42.8146 44.7275 46.2718C44.3853 49.7231 44.0443 52.8561 43.8548 56.4971C43.5582 62.1966 43.5847 66.1256 43.8179 68.7924C43.9344 70.124 44.1069 71.1996 44.3396 72.0501C44.5601 72.8558 44.891 73.6757 45.4663 74.2887C46.1625 75.0303 47.1546 75.3844 48.1855 75.136C49.0033 74.9389 49.5778 74.4215 49.8918 74.0916C50.5484 73.4017 51.0123 72.5106 51.1945 72.0512C52.2527 69.3812 55.5272 63.1808 59.9601 59.6811C61.2536 58.6599 62.1958 58.3652 62.7889 58.3204C63.3476 58.2783 63.753 58.4436 64.0715 58.6967C64.4225 58.9756 64.6844 59.3811 64.8146 59.7643C64.8606 59.8999 64.8801 59.9968 64.8883 60.0584C63.6866 62.0865 58.9204 69.5222 56.6729 77.069C54.9977 82.6941 50.9586 88.4259 47.9431 90.8809C45.0229 93.258 39.7747 94.7313 33.8624 95.0218C28.0068 95.3095 21.9748 94.4121 17.7297 92.5092C9.52988 88.8334 7.85961 80.7382 7.11129 77.2292C6.53054 74.5057 6.5195 71.5987 6.67496 68.9009C6.75251 67.5551 6.86809 66.2969 6.96901 65.1373C7.06707 64.0105 7.1566 62.9215 7.15661 62.0292ZM26.7768 27.0953C26.7768 25.8314 27.1147 24.7049 27.6737 23.9514C28.1792 23.27 28.9221 22.7987 30.1167 22.7984C31.0942 22.7982 31.7518 22.9187 32.2162 23.1167C32.6326 23.2943 32.9817 23.5699 33.2996 24.0831C34.0328 25.2671 34.5705 27.6455 34.5738 32.384L34.0416 43.9088C33.8524 47.5661 33.6565 51.4922 33.5273 54.7707L26.7768 55.6666V27.0953ZM22.6095 56.2652L16.5904 57.218L15.7705 43.267V32.5083C15.7705 31.031 16.3726 30.1275 17.0847 29.5489C17.8785 28.9039 18.8058 28.6731 19.2432 28.6731C20.0404 28.6731 20.8634 28.797 21.4565 29.2179C21.9131 29.5421 22.6095 30.3087 22.6095 32.5083V56.2652ZM11.6032 35.4278C10.3568 34.8069 9.02265 34.6083 7.8501 34.6868C5.72541 34.8292 3.85197 35.718 2.72584 37.6779C1.70247 39.4592 1.48924 41.8136 1.72143 44.4927C2.0423 48.1949 2.99038 58.6457 2.99038 62.0292C2.99037 62.708 2.91991 63.6116 2.81859 64.7758C2.72014 65.907 2.59699 67.2389 2.51505 68.6606C2.3515 71.4987 2.34041 74.8383 3.0357 78.0987C3.76005 81.4953 5.72154 91.6918 16.0245 96.3108C21.0311 98.5551 27.7601 99.4936 34.0669 99.1838C40.3172 98.8767 46.6346 97.3189 50.5737 94.1122C54.2816 91.0937 58.7686 84.6307 60.6662 78.2589C62.8095 71.0619 67.4515 63.9646 68.6098 61.9533C69.2919 60.7689 69.0785 59.3628 68.7605 58.4258C68.4018 57.3688 67.707 56.2631 66.6632 55.4337C65.5867 54.5784 64.1582 54.0377 62.4748 54.1647C60.8256 54.2893 59.1162 55.0393 57.379 56.4107C52.9083 59.9401 49.6283 65.5082 48.02 68.9231C48.0034 68.7664 47.9835 68.6024 47.9684 68.4298C47.7597 66.0435 47.7232 62.3344 48.0158 56.7132C48.1989 53.1942 48.5269 50.1809 48.8737 46.6828C49.22 43.1904 49.5784 39.2713 49.8075 34.0302C49.9903 29.8481 49.5612 26.6722 48.3952 24.471C47.7909 23.3302 46.9729 22.4223 45.9321 21.814C44.8964 21.2087 43.7676 20.974 42.6523 20.974C41.0038 20.974 38.9497 21.2062 37.3141 22.7678C37.1698 22.4576 37.0124 22.1652 36.8419 21.8899C36.0863 20.6698 35.0817 19.8084 33.8508 19.2835C32.6679 18.7791 31.3849 18.6309 30.1167 18.6311C27.5677 18.6315 25.5986 19.7567 24.3285 21.4683C23.5066 22.576 23.0121 23.8775 22.7771 25.1982C21.4247 24.5876 20.0718 24.5068 19.2432 24.5068C17.8298 24.5068 15.9788 25.0791 14.4573 26.3154C12.8542 27.6179 11.6032 29.6733 11.6032 32.5083V35.4278Z`,fill:`white`})]}),I=class extends Error{constructor(e,t){super(e),this.code=t,this.name=`DeviceFlowError`}},L=6e5,R=3e4;function z(e){try{let t=e.trim().toLowerCase(),n=/^https?:\/\//i.test(t)?t:`https://${t}`,r=new URL(n).hostname;return r.endsWith(`.all-hands.dev`)||r===`all-hands.dev`||r.endsWith(`.openhands.dev`)||r===`openhands.dev`}catch{return!1}}async function B(e,t,n,r,i,a){let o=r===void 0?void 0:typeof r==`string`||r instanceof Blob||r instanceof FormData||r instanceof URLSearchParams?r:JSON.stringify(r);return await fetch(`${e.replace(/\/+$/,``)}${n}`,{method:t,headers:{...i?{"Content-Type":i}:{}},body:o,signal:a})}async function V(e){let t=e.replace(/\/+$/,``);try{let e=await B(t,`POST`,`/oauth/device/authorize`,{},`application/json`);if(!e.ok)throw new I(`Failed to start device flow: Server returned ${e.status}`);let n=await e.json();if(!n.device_code||!n.user_code||!n.verification_uri)throw new I(`Invalid response from device authorization endpoint: missing required fields`);let r=n.verification_uri_complete??`${n.verification_uri}?user_code=${encodeURIComponent(n.user_code)}`;return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,verification_uri_complete:r,expires_in:n.expires_in??600,interval:n.interval??5}}catch(e){throw e instanceof I?e:new I(`Failed to start device flow: ${e instanceof Error?e.message:String(e)}`)}}async function ee(e,t,n){let r=e.replace(/\/+$/,``),i=n.timeout??L,a=Math.max(1,n.interval)*1e3,o=Date.now();for(;Date.now()-o<i;){if(n.signal?.aborted)throw new I(`Authorization cancelled`,`cancelled`);try{let e=await B(r,`POST`,`/oauth/device/token`,new URLSearchParams({grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:t}).toString(),`application/x-www-form-urlencoded`,n.signal);if(e.ok){let t=await e.json();if(!t.access_token)throw new I(`Invalid token response: missing access_token`);return{access_token:t.access_token,token_type:t.token_type??`Bearer`,expires_in:t.expires_in}}let i;try{i=await e.json()}catch{throw new I(`Unexpected response from server: ${e.status}`)}let{error:o,error_description:s}=i;switch(o){case`authorization_pending`:break;case`slow_down`:a=typeof i.interval==`number`&&isFinite(i.interval)&&i.interval>0?Math.max(1,Math.min(i.interval,30))*1e3:Math.min(a+5e3,R);break;case`expired_token`:throw new I(`Device code has expired. Please try again.`,`expired_token`);case`access_denied`:throw new I(`Authorization request was denied.`,`access_denied`);default:throw new I(`Authorization error: ${o}${s?` - ${s}`:``}`,o)}}catch(e){if(e instanceof I)throw e;if(e instanceof DOMException&&e.name===`AbortError`)throw new I(`Authorization cancelled`,`cancelled`);console.warn(`Network error during polling, retrying:`,e)}try{await te(a,n.signal)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?new I(`Authorization cancelled`,`cancelled`):e}}throw new I(`Timeout waiting for authorization. Please try again.`,`timeout`)}function te(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))},{once:!0})})}var H=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.3235 10.9352L11.5016 14.2111L7.67969 10.9352L8.6152 9.84375L11.5016 12.3178L14.388 9.84375L15.3235 10.9352Z`,fill:`currentColor`})});function U(e,t,n){let r=n?.lastError??null,i=t?.kind===`cloud`;return i&&!t?.apiKey?.trim()||_(r)?e(a.BACKEND$STATUS_DISCONNECTED_ADD_API_KEY):y(r)?e(a.BACKEND$STATUS_DISCONNECTED_CHECK_API_KEY):v(r)?e(a.BACKEND$LOGGED_OUT):n?.isConnected===!0?e(a.ONBOARDING$BACKEND_STATUS_CONNECTED):i&&n?.isConnected===!1&&(b(r)||c(r))?e(a.BACKEND$STATUS_DISCONNECTED_CHECK_CLOUD_ACCESS):n?.isConnected===!1&&s(r)?e(a.BACKEND$STATUS_DISCONNECTED_CHECK_TUNNEL):n?.isConnected===!1&&c(r)?e(a.BACKEND$STATUS_DISCONNECTED_CHECK_URL_OR_NETWORK):n?.isConnected===!1?e(a.ONBOARDING$BACKEND_STATUS_DISCONNECTED):e(a.ONBOARDING$BACKEND_STATUS_CHECKING)}function W({isConnected:e,className:t}){let n,r,i;return e===`unavailable`?(n=`bg-[var(--oh-text-tertiary)]`,r=`No Backend Available`,i=`unavailable`):e===!0?(n=`bg-[var(--oh-status-success)]`,r=`Connected`,i=`connected`):e===!1?(n=`bg-red-500`,r=`Disconnected`,i=`disconnected`):(n=`bg-[var(--oh-interactive-selected)]`,r=`Checking connection`,i=`checking`),(0,P.jsx)(`span`,{"data-testid":`backend-status-dot`,"data-status":i,"aria-label":r,title:r,role:`status`,className:p(`inline-block w-2 h-2 rounded-full shrink-0`,n,t)})}var G={status:`idle`,verificationUrl:null,userCode:null,apiKey:null,error:null,errorCode:null};function ne(){let[e,t]=N.useState(G),n=N.useRef(null),r=N.useCallback(e=>{n.current?.abort();let r=new AbortController;n.current=r,t({...G,status:`starting`}),(async()=>{let n;try{n=await V(e)}catch(e){if(r.signal.aborted)return;let n=e instanceof Error?e.message:`Failed to start device flow`,i=e instanceof I?e.code:void 0;t({...G,status:`error`,error:n,errorCode:i??null});return}if(!r.signal.aborted){t({...G,status:`awaiting_authorization`,verificationUrl:n.verification_uri_complete,userCode:n.user_code});try{let i=await ee(e,n.device_code,{interval:n.interval,signal:r.signal});if(r.signal.aborted)return;t({...G,status:`success`,apiKey:i.access_token})}catch(e){if(r.signal.aborted)return;if(e instanceof I&&e.code===`cancelled`){t(G);return}let n=e instanceof Error?e.message:`Authorization failed`,i=e instanceof I?e.code:void 0;t({...G,status:`error`,error:n,errorCode:i??null})}}})()},[]),i=N.useCallback(()=>{n.current?.abort(),n.current=null,t(G)},[]),a=N.useCallback(()=>{n.current?.abort(),n.current=null,t(G)},[]);return N.useEffect(()=>()=>{n.current?.abort()},[]),{...e,start:r,cancel:i,reset:a}}function K(e){try{return new URL(e).protocol===`https:`}catch{return!1}}function q({host:e,onSuccess:t,testIdRoot:n,isDisabled:r=!1,idleButtonLabel:o,idleButtonContent:s,className:c,buttonClassName:l,buttonVariant:u=`primary`,statusDisplay:d=`inline`}){let{t:f}=i(`openhands`),m=ne(),h=N.useRef(null);N.useEffect(()=>()=>{h.current?.close()},[]),N.useEffect(()=>{if(m.status===`awaiting_authorization`&&m.verificationUrl&&h.current&&!h.current.closed){if(!K(m.verificationUrl)){console.error(`Invalid verification URL protocol`);return}try{h.current.location.href=m.verificationUrl}catch{h.current=window.open(m.verificationUrl,`_blank`,`noopener,noreferrer`)}}},[m.status,m.verificationUrl]),N.useEffect(()=>{if(m.status===`success`&&m.apiKey)try{t(m.apiKey)}finally{m.reset(),h.current?.close()}},[m.status,m.apiKey,m.reset,t]);let g=()=>{let t=e.trim().replace(/\/+$/,``),n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{let e=new URL(n);if(e.username||e.password)throw Error(`Invalid URL format`)}catch{return}h.current=window.open(`about:blank`,`_blank`),h.current||console.warn(`Popup blocked - user will need to use manual link`),m.start(n)},_=()=>{m.cancel(),h.current?.close()},v=(0,P.jsx)(re,{status:m.status,error:m.error,verificationUrl:m.verificationUrl,testIdRoot:n,onCancel:_,onRetry:g}),y=d===`modal`&&m.status!==`idle`,b=o??f(a.BACKEND$LOGIN_WITH_OPENHANDS);return(0,P.jsxs)(`div`,{"data-testid":`${n}-device-flow`,className:p(`flex flex-col gap-3`,c),children:[m.status===`idle`&&u===`unstyled`&&(0,P.jsx)(`button`,{type:`button`,onClick:g,"data-testid":`${n}-login-button`,className:l,disabled:r,"aria-label":s?b:void 0,children:s??b}),m.status===`idle`&&u!==`unstyled`&&(0,P.jsx)(D,{type:`button`,variant:u,onClick:g,testId:`${n}-login-button`,className:p(`w-full`,l),isDisabled:r,ariaLabel:s?b:void 0,children:s??b}),d===`inline`?v:null,y?(0,P.jsx)(x,{onClose:_,"aria-label":f(a.BACKEND$LOGIN_WITH_OPENHANDS),closeOnBackdropClick:!1,children:(0,P.jsx)(S,{testID:`${n}-auth-modal`,width:`sm`,className:`items-stretch border border-[var(--oh-border)]`,children:v})}):null]})}function re({status:e,error:t,verificationUrl:n,testIdRoot:r,onCancel:o,onRetry:s}){let{t:c}=i(`openhands`);if(e===`idle`||e===`success`)return null;if(e===`starting`)return(0,P.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-base-tertiary p-3`,"data-testid":`${r}-auth-starting`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(J,{}),(0,P.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:c(a.BACKEND$AUTH_STARTING)})]});if(e===`awaiting_authorization`){let e=n&&K(n)?n:null;return(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-lg bg-base-tertiary p-4`,"data-testid":`${r}-auth-awaiting`,role:`status`,"aria-live":`polite`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(J,{}),(0,P.jsx)(`span`,{className:`text-sm font-medium text-white`,children:c(a.BACKEND$AUTH_AWAITING)})]}),(0,P.jsx)(`p`,{className:`text-sm leading-5 text-[var(--oh-text-tertiary)]`,children:c(a.BACKEND$AUTH_BROWSER_OPENED)}),e?(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-[var(--oh-border)] bg-[var(--oh-surface)] p-3 text-xs text-[var(--oh-muted)]`,children:[(0,P.jsx)(`p`,{children:c(a.BACKEND$AUTH_OPEN_MANUALLY)}),(0,P.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`max-h-16 overflow-auto break-all text-blue-400 hover:underline`,children:e})]}):null,(0,P.jsx)(D,{type:`button`,variant:`secondary`,onClick:o,testId:`${r}-auth-cancel`,className:`w-full`,children:c(a.BACKEND$AUTH_CANCEL)})]})}return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-red-700 bg-red-900/20 p-4`,"data-testid":`${r}-auth-error`,role:`alert`,children:[(0,P.jsx)(`p`,{className:`text-sm text-red-400`,children:t}),(0,P.jsx)(D,{type:`button`,variant:`secondary`,onClick:s,testId:`${r}-auth-retry`,className:`w-full`,children:c(a.BACKEND$AUTH_RETRY)})]})}function J(){return(0,P.jsx)(`svg`,{className:`animate-spin h-4 w-4 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})})}function ie(e){return z(e)?`cloud`:`local`}function ae(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return!!(t===`localhost`||t===`::1`||t===`::`||t===`0.0.0.0`||/^127\./.test(t)||/^::ffff:127\./i.test(t)||/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^fe[89ab][0-9a-f]:/i.test(t)||/^f[cd][0-9a-f]{2}:/i.test(t)||t.endsWith(`.local`)||!t.includes(`.`)&&!t.includes(`:`))}function Y(e){let t=e.trim().replace(/\/+$/,``);if(!t)return``;if(/^https?:\/\//i.test(t))return t;let n=t.match(/^\[([^\]]+)\]/);return`${ae(n?n[1]:(t.match(/:/g)??[]).length>1?t:t.split(`:`)[0])?`http`:`https`}://${t}`}function X(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=Y(t);if(!n)return!1;try{let e=new URL(n);return(e.protocol===`http:`||e.protocol===`https:`)&&e.hostname.length>0}catch{return!1}}var Z=`https://app.all-hands.dev`;function oe(e,t){return e(a.BACKEND$CONNECTION_TEST_FAILED,{host:t,interpolation:{escapeValue:!1}})}function se(e){return l(e)}function ce(e,t){let n=se(t);return n?`${e}\n${n}`:e}async function Q(e){e.kind===`local`&&d(await new o(h({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo())}function le({backend:e,testIdRoot:t}){let{t:n}=i(`openhands`),s=g([e])[e.id],c=s?.isConnected??null,l=s?.disabled===!0,d=s?.consecutiveFailures??0,f=s?.lastError??null,{data:p}=r({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>u(await new o(h({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()),retry:!1,staleTime:6e4,enabled:e.kind===`local`&&!l}),m=U(n,e,s),_=e.kind===`cloud`?n(a.BACKEND$KIND_CLOUD):n(a.BACKEND$KIND_LOCAL);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsxs)(`div`,{"data-testid":`${t}-status`,className:`flex items-center gap-3 text-sm`,children:[(0,P.jsx)(W,{isConnected:c}),(0,P.jsx)(`span`,{className:`text-white`,"data-testid":`${t}-status-label`,children:m}),(0,P.jsx)(`span`,{className:`text-tertiary-alt`,children:`·`}),(0,P.jsx)(`span`,{className:`text-[var(--oh-text-tertiary)]`,children:_}),p?(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-version`,children:n(a.BACKEND$VERSION_LABEL,{version:p})}):null]}),l?(0,P.jsxs)(`div`,{"data-testid":`${t}-status-error`,className:`flex flex-col gap-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm`,children:[(0,P.jsx)(`span`,{className:`font-semibold text-red-300`,children:n(a.BACKEND$HEALTH_FAILED_TITLE)}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-text-tertiary)]`,children:n(a.BACKEND$HEALTH_FAILED_DETAIL,{count:d})}),f?(0,P.jsx)(`span`,{"data-testid":`${t}-status-error-message`,className:`text-xs text-red-300 whitespace-pre-wrap break-words`,children:f}):null]}):null]})}function $({initialName:e=``,initialHost:t=``,initialApiKey:n=``,onTestConnection:r,onSuccess:a,requireApiKey:o=!1,onSubmitOverride:s}){let{t:c}=i(`openhands`),[l,u]=N.useState(e),[d,f]=N.useState(t),[p,m]=N.useState(n),[h,g]=N.useState(null),[_,v]=N.useState(!1),[y,b]=N.useState(null),x=y??ie(d),S=o||x!==`local`,C=l.trim().length>0&&X(d)&&(!S||p.trim().length>0);return{name:l,setName:u,host:d,setHost:f,apiKey:p,setApiKey:m,connectionError:h,setConnectionError:g,isSubmitting:_,kind:x,setKind:b,canSubmit:C,handleSubmit:N.useCallback(async e=>{if(e.preventDefault(),!C||_)return;let t={name:l.trim(),host:Y(d),apiKey:p.trim(),kind:x};g(null),v(!0);try{s?await s(t):(await r(t),a())}catch(e){g(ce(oe(c,t.host),e))}finally{v(!1)}},[C,_,l,d,p,x,r,a,o,s,c])}}function ue({mode:e,backend:t,onSubmitted:n,renderActions:r,testIdRoot:o,hostReadOnly:s,requireApiKey:c,hideConfigurationFields:l=!1,onSubmitOverride:u}){let{t:d}=i(`openhands`),{addBackend:m,updateBackend:h}=f(),g=e===`edit`&&t?t.kind:null,{name:_,setName:v,host:y,setHost:b,apiKey:x,setApiKey:S,connectionError:C,setConnectionError:w,isSubmitting:T,kind:E,handleSubmit:O}=$({initialName:t?.name??``,initialHost:t?.host??``,initialApiKey:t?.apiKey??``,onTestConnection:Q,onSuccess:async()=>{let r={name:_.trim(),host:Y(y),apiKey:x.trim(),kind:g??E};e===`edit`&&t?h(t.id,r):m(r),n()},requireApiKey:c,onSubmitOverride:u}),[k,j]=N.useState(!1),[M,F]=N.useState(!1),I=g??E,L=o??(e===`edit`?`edit-backend`:`add-backend`),R=c||I!==`local`,z=_.trim().length>0&&X(y)&&(!R||x.trim().length>0),B=k&&!_.trim()?d(a.BACKEND$NAME_REQUIRED):void 0,V=M?y.trim()?X(y)?void 0:d(a.BACKEND$HOST_INVALID):d(a.BACKEND$HOST_REQUIRED):void 0;return(0,P.jsxs)(`form`,{"data-testid":`${L}-form`,onSubmit:async e=>{if(!z){j(!0),F(!0);return}await O(e)},className:`flex flex-col gap-4`,children:[(0,P.jsxs)(`div`,{"data-testid":`${L}-configuration-fields`,className:p(`flex flex-col gap-4`,l&&`hidden`),children:[(0,P.jsx)(A,{testId:`${L}-name`,name:`${L}-name`,type:`text`,label:d(a.BACKEND$NAME_LABEL),value:_,onChange:e=>{v(e),w(null)},onBlur:()=>j(!0),placeholder:`Production`,className:`w-full`,showRequiredTag:!0,error:B}),(0,P.jsx)(A,{testId:`${L}-host`,name:`${L}-host`,type:`text`,label:d(a.BACKEND$HOST_LABEL),value:y,onChange:s?void 0:e=>{b(e),w(null)},onBlur:()=>F(!0),placeholder:Z,className:`w-full`,showRequiredTag:!0,error:V,isDisabled:s}),(0,P.jsx)(A,{testId:`${L}-api-key`,name:`${L}-api-key`,type:`password`,label:d(a.BACKEND$KEY_LABEL),value:x,onChange:e=>{S(e),w(null)},placeholder:``,className:`w-full`}),C?(0,P.jsx)(`div`,{role:`alert`,"data-testid":`${L}-error`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:C}):null,e===`edit`&&t&&(0,P.jsx)(le,{backend:t,testIdRoot:L})]}),r?r({canSubmit:z&&!T,isSubmitting:T,testIdRoot:L}):(0,P.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2 w-full`,children:[(0,P.jsx)(D,{type:`button`,variant:`secondary`,onClick:n,testId:`${L}-cancel`,children:d(a.BUTTON$CANCEL)}),(0,P.jsx)(D,{type:`submit`,variant:`primary`,isDisabled:!z||T,testId:`${L}-submit`,children:d(a.BACKEND$SAVE)})]})]})}function de(){let{currentPath:e,navigate:t}=O();return N.useCallback(()=>{/^\/automations\/[^/]+/.test(e)?t(`/automations`):/^\/conversations\/[^/]+/.test(e)&&t(`/conversations`)},[e,t])}function fe({onConnected:e,testIdRoot:t=`add-backend`,initialManualBackend:n,requireManualApiKey:r=!1,manualSubmitLabel:o,manualSubmittingLabel:s,manualSubmitTestId:c}){let{t:l}=i(`openhands`),u=m();return u?(0,P.jsx)(`div`,{"data-testid":`${t}-connection-options`,className:`flex justify-center`,children:(0,P.jsx)(`div`,{className:`w-full`,children:(0,P.jsx)(me,{onConnected:e,testIdRoot:t,lockedHost:u})})}):(0,P.jsxs)(`div`,{"data-testid":`${t}-connection-options`,className:`flex flex-col gap-6 md:flex-row`,children:[(0,P.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,P.jsx)(pe,{onConnected:e,testIdRoot:t,initialBackend:n,requireApiKey:r,submitLabel:o??l(a.BACKEND$CONNECT),submittingLabel:s??l(a.ONBOARDING$BACKEND_STATUS_CHECKING),submitTestId:c})}),(0,P.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,P.jsx)(me,{onConnected:e,testIdRoot:t})})]})}function pe({onConnected:e,testIdRoot:t,initialBackend:n,requireApiKey:r,submitLabel:o,submittingLabel:s,submitTestId:c}){let{t:l}=i(`openhands`),{name:u,setName:d,host:f,setHost:p,apiKey:m,setApiKey:h,connectionError:g,setConnectionError:_,isSubmitting:v,kind:y,setKind:b,canSubmit:x,handleSubmit:S}=$({initialName:n?.name??``,initialHost:n?.host??``,initialApiKey:n?.apiKey??``,onTestConnection:Q,onSuccess:()=>{e({name:u.trim(),host:Y(f),apiKey:m.trim(),kind:y},`manual`)},requireApiKey:r});return(0,P.jsxs)(`form`,{"data-testid":`${t}-form`,onSubmit:S,className:`flex flex-col gap-4 flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(A,{testId:`${t}-name`,name:`${t}-name`,type:`text`,label:l(a.BACKEND$NAME_LABEL),value:u,onChange:e=>{d(e),_(null)},placeholder:`e.g. My Server`,className:`w-full`}),(0,P.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:l(a.BACKEND$NAME_HELPER)})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(A,{testId:`${t}-host`,name:`${t}-host`,type:`text`,label:l(a.BACKEND$HOST_LABEL),value:f,onChange:e=>{p(e),_(null)},placeholder:`http://localhost:8000`,className:`w-full`}),(0,P.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-host-helper`,children:l(a.BACKEND$HOST_HELPER)})]}),(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:l(a.BACKEND$KIND_LABEL)}),(0,P.jsx)(j,{value:y,options:[{value:`local`,label:l(a.BACKEND$KIND_LOCAL)},{value:`cloud`,label:l(a.BACKEND$KIND_CLOUD)}],onChange:e=>b(e),ariaLabel:l(a.BACKEND$KIND_LABEL),testId:`${t}-kind`})]}),(0,P.jsx)(A,{testId:`${t}-api-key`,name:`${t}-api-key`,type:`password`,label:l(a.BACKEND$KEY_LABEL),value:m,onChange:e=>{h(e),_(null)},placeholder:`sk-••••••••••`,className:`w-full`}),g?(0,P.jsx)(`div`,{role:`alert`,"data-testid":`${t}-error`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:g}):null,(0,P.jsx)(D,{type:`submit`,variant:`secondary`,isDisabled:!x||v,testId:c??`${t}-submit`,className:`w-full text-center`,children:v?s:o})]})}function me({onConnected:e,testIdRoot:t,lockedHost:n}){let{t:r}=i(`openhands`),[o,s]=N.useState(!1),[c,l]=N.useState(``),u=n??(c.trim()||Z);return(0,P.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col items-center gap-3 pb-7`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,P.jsx)(F,{width:56,height:56,"aria-hidden":!0}),(0,P.jsx)(`h4`,{className:E,"data-testid":`${t}-cloud-title`,children:r(a.BACKEND$CLOUD_TITLE)})]}),(0,P.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-[var(--oh-muted)]`,children:r(a.BACKEND$CLOUD_DESCRIPTION)}),(0,P.jsx)(q,{host:u,onSuccess:t=>{e({name:`OpenHands Cloud`,host:Y(u),apiKey:t,kind:`cloud`},`cloud_login`)},testIdRoot:t}),n?null:(0,P.jsxs)(`div`,{className:`w-full`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"data-testid":`${t}-advanced-toggle`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,P.jsx)(`span`,{children:r(a.BACKEND$ADVANCED)}),(0,P.jsx)(H,{className:p(`h-4 w-4 shrink-0 text-muted transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]}),(0,P.jsxs)(`div`,{className:p(`pt-2`,!o&&`pointer-events-none invisible`),"aria-hidden":!o,children:[(0,P.jsx)(A,{testId:`${t}-cloud-host`,name:`${t}-cloud-host`,type:`text`,label:r(a.BACKEND$HOST_LABEL),value:c,onChange:l,placeholder:Z,className:`w-full`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-[var(--oh-muted)]`,children:r(a.BACKEND$LOGIN_CLOUD_HINT)})]})]})]})}function he({onClose:e,source:t}){let{addBackend:n}=f(),r=de(),{trackBackendAdded:i}=M();return(0,P.jsx)(fe,{onConnected:N.useCallback((a,o)=>{n(a);let s=a.host===Z;i({backendKind:a.kind,connectionMethod:o,isOpenhandsCloud:s,isCustomHost:!s,hasApiKey:!!a.apiKey,source:t}),r(),e()},[n,r,e,i,t])})}function ge({mode:e,backend:t,onClose:n,source:r=`add_backend_modal`}){let{t:o}=i(`openhands`);if(e===`add`)return(0,P.jsx)(x,{onClose:n,closeOnEscape:!1,"aria-label":o(a.BACKEND$ADD_TITLE),children:(0,P.jsxs)(`div`,{"data-testid":`add-backend-modal`,className:p(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,C(`xl`),w),children:[(0,P.jsx)(k,{onClose:n,testId:`add-backend-close`}),(0,P.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,P.jsx)(`h2`,{className:T,children:o(a.BACKEND$ADD_TITLE)})}),(0,P.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:(0,P.jsx)(he,{onClose:n,source:r})})]})});let s=`edit-backend`;return(0,P.jsx)(x,{onClose:n,closeOnEscape:!1,"aria-label":o(a.BACKEND$EDIT_TITLE),children:(0,P.jsxs)(`div`,{"data-testid":`${s}-modal`,className:p(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,C(`md`)),children:[(0,P.jsx)(k,{onClose:n,testId:`${s}-close`}),(0,P.jsx)(`h2`,{className:p(`pr-6`,T),children:o(a.BACKEND$EDIT_TITLE)}),(0,P.jsx)(ue,{mode:`edit`,backend:t,onSubmitted:n,testIdRoot:s})]})})}export{W as a,q as i,ue as n,U as o,ge as r,H as s,fe as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./conversation-xkBS3AHC.js";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./conversation-xkBS3AHC.js";export{e as default};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-61Vaihc6.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor-styling-CI0PQ3ab.js","assets/active-backend-context-u2tdYRgH.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js","assets/createLucideIcon-CVAsW2Yo.js","assets/declaration-B9kpCaYl.js","assets/agent-server-client-options-DVLRd9sw.js","assets/utils-CE0lDWtb.js","assets/common-Dh7OqABE.js","assets/vendor~files-tab-B02k3xvx.js","assets/iconBase-DaTRRUjy.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js","assets/useQuery-CpjHYtZc.js","assets/suspense-X5dBsJzn.js","assets/mouse-pointer-click-PdEQPL6v.js","assets/useTranslation-Cgy4JA_g.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9UMeuPV6.js","assets/objectWithoutPropertiesLoose-BgYIAs2y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D7EUmQ8Y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTzw2x50.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CqXiHwjU.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD0GaRGa.js","assets/react-DPDgL6du.js","assets/agent-server-conversation-service.api-BP73yONA.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js","assets/v4-DbCkTSoU.js","assets/proxy-CHmFkV16.js","assets/profiles-service.api-CeYEmSM3.js","assets/settings-service.api-DldkFI1x.js","assets/settings-mQUckT0g.js","assets/llm-subscription-service-CKyaV24y.js","assets/llm-subscription-DtsX5Lhg.js","assets/acp-providers-D_D8VUpP.js","assets/use-event-store-YSOxy9FC.js","assets/runtime-waiting-state-DkzLgvMn.js","assets/loading-spinner-DHAIPZkP.js","assets/typography-YGPBGzOG.js","assets/dist-CodhvuAP.js","assets/conversation-tab-empty-state-m8IUkfMj.js","assets/segmented-toggle-Cen5AMUc.js","assets/markdown-renderer-D8mayGjI.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js","assets/copy-to-clipboard-button-Aj9wFmt2.js","assets/checkmark-h7udgXMM.js","assets/copy-BLmGeJcd.js","assets/use-active-conversation-DI5S5M1w.js","assets/conversation-service.api-CqZcHr1c.js","assets/navigation-context-DPs2G0X8.js","assets/use-user-conversation-6uOXFP95.js","assets/use-agent-state-Buh3bQDh.js","assets/conversation-state-store-B2Bp32XI.js","assets/use-runtime-is-ready-Diiq65Q-.js","assets/files-tab-store-DJsPxYdg.js","assets/folder-mMWFvaw0.js","assets/get-language-from-path-CPNnuVhI.js","assets/link-external-DfKQroKX.js","assets/conversation-local-storage-F6zVMM--.js","assets/git-status-mapper-BI8FyUVp.js","assets/browser-tab-aiDg7aEn.js","assets/external-link-D2zJjE9G.js","assets/vendor~browser-tab-Di0kh5Zw.js","assets/browser-store-BI6uklCG.js","assets/planner-tab-AZMjJx31.js","assets/list-todo-BfH6yYUK.js","assets/plan-components-j9X4AxYM.js","assets/brand-button-DKPMEKcW.js","assets/form-control-classes-9rkU4usZ.js","assets/use-handle-plan-click-Dug8egQl.js","assets/use-create-conversation-D9OWYcte.js","assets/useMutation-DCE9RcgK.js","assets/use-agent-profiles-DPcaYLpm.js","assets/plugins-management-service-BAp70KN7.js","assets/use-llm-profiles-DjackuP1.js","assets/use-tracking-GtXCHmTv.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js","assets/use-settings-dX4fKUPF.js","assets/conversation-store-LptbOvKa.js","assets/middleware-DYHYNAnP.js","assets/task-list-tab-BAThr9Ex.js","assets/use-task-list-CmWGElgb.js","assets/u-check-circle-half-LiwZkuFe.js","assets/u-check-circle-BqoIxNz_.js","assets/terminal-BmT0_gIH.js","assets/vendor~terminal-aeP3PnKf.js","assets/vendor~terminal-T4IDBjWs.css","assets/square-chevron-right-Czw3FFWc.js","assets/command-store-D8J5LMW1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,_t as r,bt as i,et as a,gt as o,h as s,o as c,xt as l}from"./vendor-styling-CI0PQ3ab.js";import{A as u,L as d,M as f,k as p}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as m}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{a as h,c as g,f as _,i as v,u as y}from"./path-utils-BeOmjIcE.js";import{n as b,r as x}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js";import{t as S}from"./useMutation-DCE9RcgK.js";import{t as C}from"./useQuery-CpjHYtZc.js";import{t as w}from"./Trans-De9RwQhA.js";import{t as T}from"./useTranslation-Cgy4JA_g.js";import{t as E}from"./declaration-B9kpCaYl.js";import{A as D,j as O,k,n as A}from"./active-backend-context-u2tdYRgH.js";import{t as j}from"./createLucideIcon-CVAsW2Yo.js";import{a as M,c as ee,d as te,f as N,g as P,h as F,i as ne,l as re,m as ie,n as I,o as L,p as ae,r as R,s as oe,t as se,u as ce}from"./messages-D2oZb47Z.js";import{t as le}from"./check-Bvi71siz.js";import{n as ue,t as z}from"./vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js";import{t as de}from"./copy-3JCw_XFB.js";import{t as fe}from"./external-link-D2zJjE9G.js";import{t as B}from"./list-todo-BfH6yYUK.js";import{t as pe}from"./loader-circle-BEykUKYG.js";import{t as me}from"./square-chevron-right-Czw3FFWc.js";import{t as he}from"./x-Cb0WAtak.js";import{A as ge,C as V,E as _e,I as ve,S as H,T as ye,b as be,c as xe,d as Se,h as Ce,l as we,o as Te,t as U,u as Ee,w as De,x as Oe}from"./utils-CE0lDWtb.js";import{t as ke}from"./common-Dh7OqABE.js";import{c as Ae,i as je}from"./agent-server-client-options-DVLRd9sw.js";import{t as Me}from"./proxy-CHmFkV16.js";import{t as Ne}from"./modal-backdrop-zVwfOJZr.js";import{n as Pe}from"./modal-body-Dcu5McCa.js";import{r as Fe}from"./base-modal-CC5Pp8CF.js";import{t as Ie}from"./brand-button-DKPMEKcW.js";import{t as Le}from"./loading-spinner-DHAIPZkP.js";import{n as Re}from"./navigation-context-DPs2G0X8.js";import{t as ze}from"./styled-tooltip-DsKsFjuq.js";import{r as Be,u as Ve}from"./dropdown-classes-CgQ45JmQ.js";import{_ as He,f as Ue,h as We,n as Ge,p as Ke,s as qe}from"./git-provider-icon-aQRcUVI-.js";import{t as Je}from"./react-DPDgL6du.js";import{n as Ye}from"./middleware-DYHYNAnP.js";import{i as Xe,s as Ze}from"./conversation-local-storage-F6zVMM--.js";import{t as W}from"./conversation-store-LptbOvKa.js";import{t as Qe}from"./modal-close-button-CTCX4nCH.js";import{r as $e}from"./use-settings-dX4fKUPF.js";import{t as et}from"./use-tracking-GtXCHmTv.js";import{t as tt}from"./v4-DbCkTSoU.js";import{a as nt,i as rt,t as it}from"./agent-server-conversation-service.api-BP73yONA.js";import{t as at}from"./use-is-authed-_dhQ2Xuj.js";import{c as ot,d as st,f as ct,i as lt,l as ut,n as dt,r as ft,s as pt,t as mt,u as ht}from"./sidebar-mobile-menu-toggle-B8k3qu84.js";import{t as gt}from"./use-click-outside-element-Bf4Omzot.js";import{t as _t}from"./use-create-conversation-D9OWYcte.js";import{r as vt,t as yt}from"./conversation-service.api-CqZcHr1c.js";import{n as bt,t as G}from"./context-menu-list-item-DBFzplWW.js";import{i as K,r as xt,t as St}from"./ellipsis-button-1BV9Sga8.js";import{t as Ct}from"./u-edit-DJ90xc8Z.js";import{t as wt}from"./skills-9cDZONKh.js";import{t as Tt}from"./use-user-conversation-6uOXFP95.js";import{t as Et}from"./conversation-state-store-B2Bp32XI.js";import{t as Dt}from"./copy-BLmGeJcd.js";import{r as Ot}from"./typography-YGPBGzOG.js";import{C as kt,D as At,E as jt,I as Mt,L as Nt,M as Pt,N as Ft,O as It,P as Lt,S as Rt,T as zt,V as Bt,_ as Vt,a as Ht,b as Ut,f as Wt,g as Gt,h as Kt,i as qt,j as Jt,k as Yt,m as Xt,n as Zt,o as Qt,p as $t,r as en,t as tn,v as nn,w as rn,x as an,y as on,z as sn}from"./llm-not-configured-banner-BrU5uHto.js";import{n as q,r as cn,t as J}from"./use-active-conversation-DI5S5M1w.js";import{t as Y}from"./use-agent-state-Buh3bQDh.js";import{a as ln,c as un,d as dn,f as fn,h as pn,l as mn,m as X,n as hn,p as gn,r as _n,s as vn,u as yn}from"./lesson-plan-BtrZUCuj.js";import{D as bn,c as xn,l as Sn,m as Cn,t as Z}from"./use-event-store-YSOxy9FC.js";import{t as wn}from"./command-store-D8J5LMW1.js";import{t as Tn}from"./use-runtime-is-ready-Diiq65Q-.js";import{r as En}from"./plan-components-j9X4AxYM.js";import{t as Dn}from"./use-breakpoint-B-O0lQ84.js";import{t as On}from"./use-task-list-CmWGElgb.js";import{t as kn}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var An=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),jn=j(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Mn=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Nn(){let e=new Set,t=new WeakMap,n=()=>e.forEach(Mn);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var Q=i(),$=e(t(),1),Pn=(0,$.createContext)(null);function Fn(){let e=(0,$.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function In(){let e=Fn(),[t,n]=(0,$.useState)(0),r=(0,$.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,$.useCallback)(()=>a.postRender(r),[r]),t]}var Ln=e=>e===!0,Rn=e=>Ln(e===!0)||e===`id`,zn=({children:e,id:t,inherit:n=!0})=>{let i=(0,$.useContext)(r),a=(0,$.useContext)(Pn),[o,s]=In(),c=(0,$.useRef)(null),l=i.id||a;c.current===null&&(Rn(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:Ln(n)&&i.group||Nn()});let u=(0,$.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,Q.jsx)(r.Provider,{value:u,children:e})},Bn={curAgentState:V.LOADING},Vn=Je(e=>({...Bn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(Bn)})),Hn=`openhands-last-conversation-by-backend`;function Un(e,t){return t?`${e}::${t}`:e}function Wn(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(Hn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function Gn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Hn,JSON.stringify(e))}catch{}}function Kn(e,t,n){if(!n)return;let r=Wn();r[Un(e,t)]=n,Gn(r)}function qn(e,t){let n=Wn(),r=Un(e,t);r in n&&(delete n[r],Gn(n))}var Jn=e=>({action:F.CHANGE_AGENT_STATE,args:{agent_state:e}}),Yn=e=>`error`in e,Xn=e=>`type`in e&&e.type===`error`,Zn=()=>{let{send:e}=ie(),t=Z(e=>e.events);$.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Sn(n)&&xn(n))){if(Yn(n)){if(n.error_code===401){D(`Session expired.`);return}typeof n.error==`string`?D(n.error):D(n.message);return}Xn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(Jn(V.PAUSED))}},[t.length])},Qn=()=>{let{curAgentState:e}=Y();return{runtimeActive:!De.includes(e)}};function $n({children:e}){return Zn(),Qn(),e}var er=`ACPAuthRequired`,tr={ACPAuthRequired:E.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function nr(e){return e?tr[e]??null:null}function rr(e){return e===er}var ir={entriesByConversation:{}},ar=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),or=Je()(Ye(e=>({...ir,addPending:(t,n)=>{let r=tt();return e(e=>ar(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>ar(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function sr({onClick:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,Q.jsx)(te,{className:`w-3.5 h-3.5 fill-success`}),(0,Q.jsx)(`span`,{children:t(E.CHAT_INTERFACE$BTW_GOT_IT)})]})}function cr({conversationId:e}){let{t}=T(`openhands`),n=or(e=>e.entriesByConversation),r=or(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,Q.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,Q.jsx)(N,{title:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`opacity-60`,children:t(E.CHAT_INTERFACE$BTW_PREFIX)}),(0,Q.jsx)(`span`,{children:n.question}),i&&(0,Q.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`})]}),details:i?t(E.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,Q.jsx)(sr,{onClick:()=>r(e,n.id)})},n.id)})})}function lr({conversationId:e}){let t=gn(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,Q.jsx)(ce,{status:n}):null}var ur=`${_e} `,dr=(e,t)=>{let n=or(e=>e.addPending),r=or(e=>e.resolve),i=or(e=>e.fail);return(0,$.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(ur);if(!e||!s){t(a);return}let c=o.slice(_e.length).trim();if(!c)return;let l=n(e,c);v(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},fr=`${ge} `,pr=/^--max(?:=|\s+)(\d+)\s*/,mr=(e,t)=>{let{t:n}=T();return(0,$.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(fr);if(!e||!a){t(r);return}let o=i.slice(ge.length).trim(),s,c=o.match(pr);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){D(n(E.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),y(e,u).catch(e=>{let t=n(E.GOAL$START_FAILED);D(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},hr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function gr(e){return U(hr,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function _r(e){return e?`white`:`var(--oh-muted)`}var vr=`font-normal text-sm leading-5 truncate`;function yr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=T(`openhands`),{trackPullButtonClick:a}=et(),o=n&&t&&r;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(xe())},disabled:!o,className:U(gr(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(At,{width:12,height:12,color:_r(o)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[76px]`),title:i(E.COMMON$PULL),children:i(E.COMMON$PULL)})]})}function br({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackPushButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(we(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(It,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[77px]`),title:a(E.COMMON$PUSH),children:a(E.COMMON$PUSH)})]})}function xr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackCreatePrButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Te(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(jt,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[126px]`),title:a(E.COMMON$PULL_REQUEST),children:a(E.COMMON$PULL_REQUEST)})]})}function Sr(e){return e.kind===`BashCommand`}function Cr(e){return e.kind===`BashOutput`}function wr(e){return e.kind===`BashError`}function Tr(e,t,n){let r=(0,$.useRef)(null),i=(0,$.useRef)([]),a=(0,$.useRef)([]),o=(0,$.useRef)(new Map);return(0,$.useEffect)(()=>{if(!n)return;let s=je(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Sr(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Cr(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else wr(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,$.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Er={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Dr(e){return e.replace(/\.git$/,``)}function Or(e){return e?Er[e.toLowerCase()]??null:null}function kr(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Ar(e,t,n){let r=Dr(n.replace(/^\/+/,``)),i=Or(t);return{url:e,host:t,repository:(i===`azure_devops`?kr(r):r)||null,provider:i}}function jr(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Ar(t,e,n[2])}try{let e=new URL(t);return Ar(t,e.hostname||null,e.pathname)}catch{return null}}var Mr={repository:null,branch:null,provider:null,remoteUrl:null},Nr=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
|
|
3
|
-
`);async function Pr(e,t){let n=await e(Nr,t,10);if(n.exit_code!==0)return Mr;let r=n.stdout.indexOf(`
|
|
4
|
-
`),i=(r>=0?n.stdout.slice(0,r):n.stdout).trim(),a=(r>=0?n.stdout.slice(r+1):``).trim(),o=a&&a!==`HEAD`?a:null;if(!i&&!o)return Mr;let s=jr(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var Fr=()=>{let{data:e}=J(),t=Tn(),{backend:n}=A(),r=n.kind===`local`,i=e?.id,a=e?.conversation_url,o=e?.session_api_key,s=e?.workspace?.working_dir?.trim(),c=!!e?.selected_repository,l=!!e?.git_provider,u=!!e?.selected_branch,d=r&&t&&!!i&&!!s&&(!c||!l||!u),f=Tr(a,o,d),p=(0,$.useRef)(f);return p.current=f,C({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>Pr((e,t,n)=>p.current(e,t,n),s),enabled:d,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},Ir=()=>{let e=m(),{t}=T(`openhands`);return S({mutationFn:e=>it.updateConversationRepository(e.conversationId,e.repository,e.branch,e.gitProvider),onMutate:async t=>{let n=[`user`,`conversation`,t.conversationId];await e.cancelQueries({queryKey:n});let r=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e&&{...e,selected_repository:t.repository,selected_branch:t.branch??null,git_provider:t.gitProvider??null}),{previousEntries:r}},onError:(n,r,i)=>{i?.previousEntries.forEach(([t,n])=>{e.setQueryData(t,n)}),D(t(E.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{O(t(E.CONVERSATION$REPOSITORY_UPDATED))},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`local-git-info`,r.conversationId]})}})};function Lr({children:e,tooltipMessage:t,testId:n,shouldShowTooltip:r}){return r?(0,Q.jsx)(ze,{content:t,placement:`top`,showArrow:!0,tooltipClassName:`bg-white text-black`,children:(0,Q.jsx)(`span`,{"data-testid":n,className:`hover:opacity-100`,children:e})}):e}function Rr({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=T(`openhands`),{providers:a}=qe(),[o,s]=(0,$.useState)(null),[c,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null);(0,$.useEffect)(()=>{a.length===1&&!o?s(a[0]):a.length>1&&!o&&r&&a.includes(r)&&s(r)},[a,o,r]);let f=(0,$.useCallback)(e=>{e!==o&&(s(e),l(null),d(null))},[o]),p=(0,$.useCallback)(e=>{e?(l(e),d(null)):(l(null),d(null))},[]),m=(0,$.useCallback)(e=>{d(e)},[]),h=()=>{!c||!u||(n(c,u),l(null),d(null),t())},g=()=>{s(null),l(null),d(null),t()};if(!e)return null;let _=c?.git_provider||o||r,v=!!c&&!!u;return(0,Q.jsx)(Ne,{onClose:g,children:(0,Q.jsxs)(Pe,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Q.jsx)(Qe,{onClose:g,testId:`close-open-repository-modal`}),(0,Q.jsx)(`div`,{className:`w-full pr-6`,children:(0,Q.jsx)(Fe,{title:i(E.CONVERSATION$OPEN_REPOSITORY)})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:i(E.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,Q.jsx)(Qt,{providers:a,value:o,onChange:f})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,Q.jsx)(qt,{provider:_,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,className:`w-full`}),(0,Q.jsx)(Ht,{repository:c?.full_name||null,provider:_,selectedBranch:u,onBranchSelect:m,defaultBranch:c?.main_branch||null,disabled:!c,className:`w-full`})]})]}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(Ie,{type:`button`,variant:`secondary`,onClick:g,children:i(E.BUTTON$CANCEL)}),(0,Q.jsx)(Ie,{type:`button`,variant:`primary`,onClick:h,isDisabled:!v,children:i(E.BUTTON$LAUNCH)})]})]})})}function zr({onSuggestionsClick:e}){let{t}=T(`openhands`),{conversationId:n}=q(),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(null),{addRecentRepository:c}=Ge(),l=X(e=>e.enqueuePendingMessage),u=X(e=>e.markPendingMessageError),{backend:d}=A(),f=d.kind===`local`,{providers:p}=qe(),m=f||p.length>0,{data:h}=J(),{repositoryInfo:g}=Ft(),{data:_}=Fr(),v=sn(),y=_n()?.isLoadingHistory??!1,b=(0,$.useRef)(v);(0,$.useEffect)(()=>{b.current=v},[v]);let{send:x}=ie(),S=(0,$.useRef)(x);(0,$.useEffect)(()=>{S.current=x},[x]);let C=ee(),{mutate:w}=Ir(),{mutate:O,isPending:k}=_t(),j=h?.selected_repository||g?.selectedRepository,M=h?.git_provider||g?.gitProvider,te=h?.selected_branch||g?.selectedBranch,N=j||_?.repository||void 0,P=M||_?.provider,F=te||_?.branch||void 0,ne=(h?.id?nt(h.id):null)?.selected_workspace??null,re=ne&&ne.replace(/\/+$/,``).split(`/`).pop()||null,I=!!N&&!!P,L=!!h&&v===`OPEN`&&!y;(0,$.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,$.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let ae=(e,r)=>{n&&(c(e),w({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(b.current!==`OPEN`){D(t(E.CONVERSATION$CLONE_COMMAND_FAILED_DISCONNECTED));return}let i=e.git_provider.charAt(0).toUpperCase()+e.git_provider.slice(1),a=`Clone ${e.full_name} from ${i} and checkout branch ${r.name}.`,o=n?l({conversationId:n,text:a}):null;C?.scrollDomToBottom(),Promise.resolve(S.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:t(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))})}}))},R=!f||!!N||!!re,oe=f&&!I;return R||F||I?(0,Q.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center overflow-x-auto flex-nowrap relative scrollbar-hide`,children:[R?(0,Q.jsx)(en,{selectedRepository:N,gitProvider:P,workspaceName:re,onClick:()=>i(!0),disabled:!L||oe}):null,F?(0,Q.jsx)(Zt,{selectedBranch:F,selectedRepository:N,gitProvider:P}):null,I?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(yr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,isConversationReady:L})}),(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(br,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:L})}),(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(xr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:L})})]}):null]}),(0,Q.jsx)(Rr,{isOpen:r,onClose:()=>i(!1),onLaunch:ae,defaultProvider:P})]}):null}function Br({onSubmit:e,disabled:t=!1}){let{images:n,files:r,imagesMarkedUploadAsFile:i,clearAllFiles:a,subConversationTaskId:o}=W(),{curAgentState:s}=Y(),{data:c}=J(),{conversationId:l}=cn(),u=l??c?.id??null,{taskStatus:d}=Pt(o,c?.id||null),{handleUpload:f}=Wt(),p=Xt(u,mr(u,dr(u,t=>{let{imagesToEmbed:o,imagesAsFiles:s}=Bt(n,i);e(t,o,[...r,...s]),a()})));return(0,Q.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,Q.jsx)(Kt,{disabled:t||s===V.AWAITING_USER_CONFIRMATION||Ce(d),isNewConversationPending:t,onSubmit:p,onFilesPaste:f}),(0,Q.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,Q.jsx)(zr,{onSuggestionsClick:e=>{p(e)}})})]})}function Vr(){let e=Z(e=>e.events),t=Z(e=>e.uiEvents),n=$.useMemo(()=>t.filter(un),[t]),r=$.useMemo(()=>e,[e]),i=$.useMemo(()=>n.length,[n]),a=$.useMemo(()=>r.some(e=>e.source===`agent`&&!bn(e)&&!Cn(e)),[r]),o=vn(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var Hr=e=>`timestamp`in e?e.timestamp:void 0,Ur=e=>{let t=!!e&&Xe(e),n=t?void 0:e,{data:r}=Tt(e??null),{data:i,isFetched:a}=mn(n??void 0),o=Z(e=>e.addEvents),[s,c]=$.useState(!1),[l,u]=$.useState(!0),d=$.useRef(!1),f=$.useRef(!0);return $.useEffect(()=>{if(d.current=!1,c(!1),t){f.current=!1,u(!1);return}f.current=!0,u(!0)},[e,t]),$.useEffect(()=>{t||!a||!i||i.hasMore||(f.current=!1,u(!1))},[t,a,i?.hasMore,n]),{isLoading:s,hasMore:l,loadOlder:$.useCallback(async()=>{if(!e||Xe(e)||d.current||!f.current||!r)return;let{events:t}=Z.getState(),n=t[0];if(!n)return;let i=Hr(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await dn.searchEvents(e,r?.conversation_url??null,r?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`,timestampLt:i});if(!Array.isArray(t.items))throw Error(`Invalid older-events response: expected page.items to be an array.`);let n=[...t.items].reverse();n.length>0&&(o(n),ln(e,Z.getState().uiEvents)),(!t.next_page_id||t.items.length<50)&&(f.current=!1,u(!1))}finally{d.current=!1,c(!1)}},[e,r,r?.conversation_url,r?.session_api_key,o])}};function Wr(){return(0,Q.jsxs)(`div`,{className:`flex items-center space-x-1.5 rounded-full bg-[var(--oh-surface)] px-3 py-1.5`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:0ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:75ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:150ms]`})]})}function Gr({suggestion:e,onClick:t}){let{t:n}=T(`openhands`);return(0,Q.jsxs)(`button`,{type:`button`,className:`list-none border border-[var(--oh-border)] rounded-[15px] hover:bg-surface-raised hover:border-[var(--oh-interactive-hover)] transition-colors flex-1 flex items-center justify-center cursor-pointer gap-[10px] h-[55px] px-4`,onClick:()=>t(e.value),children:[(0,$.useMemo)(()=>{switch(e.label){case`INCREASE_TEST_COVERAGE`:return(0,Q.jsx)(zt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,Q.jsx)(rn,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,Q.jsx)(kt,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,Q.jsx)(Rt,{width:24,height:24,color:`#fff`});default:return null}},[e]),(0,Q.jsx)(`span`,{"data-testid":`suggestion`,className:`text-[15px] font-normal leading-5 text-white text-center cursor-pointer`,children:n(e.label)})]})}function Kr({suggestions:e,onSuggestionClick:t}){return(0,Q.jsx)(`div`,{"data-testid":`suggestions`,className:`grid grid-cols-2 gap-5 max-w-fit`,children:e.map((e,n)=>(0,Q.jsx)(Gr,{suggestion:e,onClick:t},n))})}var qr=E.SUGGESTIONS$HACKER_NEWS,Jr=`Please write a bash script which displays the top story on Hacker News. It should show the title, the link, and the number of points.
|
|
5
|
-
The script should only use tools that are widely available on unix systems, like curl and grep.`,Yr=E.SUGGESTIONS$HELLO_WORLD,Xr=`I want to create a Hello World app in Javascript that:
|
|
6
|
-
* Displays Hello World in the middle.
|
|
7
|
-
* Has a button that when clicked, changes the greeting with a bouncing animation to fun versions of Hello.
|
|
8
|
-
* Has a counter for how many times the button has been clicked.
|
|
9
|
-
* Has another button that changes the app's background color.`,Zr=E.SUGGESTIONS$TODO_APP,Qr=`I want to create a VueJS app that allows me to:
|
|
10
|
-
* See all the items on my todo list
|
|
11
|
-
* add a new item to the list
|
|
12
|
-
* mark an item as done
|
|
13
|
-
* totally remove an item from the list
|
|
14
|
-
* change the text of an item
|
|
15
|
-
* set a due date on the item
|
|
16
|
-
|
|
17
|
-
This should be a client-only app with no backend. The list should persist in localStorage.`,$r={repo:an,"non-repo":{[qr]:Jr,[Yr]:Xr,[Zr]:Qr}};function ei({onSuggestionsClick:e}){let{t}=T(`openhands`),{shouldHideSuggestions:n}=W();return(0,Q.jsx)(s,{children:!n&&(0,Q.jsxs)(z.div,{"data-testid":`chat-suggestions`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},className:`pointer-events-auto absolute inset-x-4 bottom-[151px] top-0 flex flex-col items-center justify-center md:inset-x-8`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col items-center p-4 rounded-xl w-full`,children:(0,Q.jsx)(`span`,{className:`pb-6 text-[32px] font-medium leading-5 text-white`,children:t(E.LANDING$TITLE)})}),(0,Q.jsx)(Kr,{suggestions:Object.entries($r.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var ti={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},ni=Je(e=>({...ti,addFile:t=>e(e=>({files:[...e.files,t]})),removeFile:t=>e(e=>({files:e.files.filter((e,n)=>n!==t)})),clearFiles:()=>e(()=>({files:[]})),setInitialPrompt:t=>e(()=>({initialPrompt:t})),clearInitialPrompt:()=>e(()=>({initialPrompt:null})),setSelectedRepository:t=>e(()=>({selectedRepository:t})),clearSelectedRepository:()=>e(()=>({selectedRepository:null})),setSelectedRepositoryProvider:t=>e(()=>({selectedRepositoryProvider:t})),setReplayJson:t=>e(()=>({replayJson:t})),reset:()=>e(()=>ti)})),ri=e=>(0,Q.jsx)(`svg`,{width:12,height:17,viewBox:`0 0 12 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.5304 6.46978L10.4697 7.53044L6.75006 3.81077L6.75006 17.0001H5.25006L5.25006 3.81077L1.53039 7.53044L0.469727 6.46978L6.00006 0.939453L11.5304 6.46978Z`,fill:`currentColor`})});function ii({onClick:e}){return(0,Q.jsx)(`button`,{type:`button`,onClick:e,"data-testid":`scroll-to-bottom`,className:`flex items-center justify-center size-8 rounded-full bg-[var(--oh-surface)] text-[var(--oh-muted)] hover:bg-tertiary hover:text-white rotate-180 cursor-pointer transition-colors`,children:(0,Q.jsx)(ri,{width:15,height:15})})}var ai=[{width:`w-[25%]`,height:`h-4`,align:`justify-end`},{width:`w-[60%]`,height:`h-4`,align:`justify-start`},{width:`w-[45%]`,height:`h-4`,align:`justify-start`},{width:`w-[65%]`,height:`h-20`,align:`justify-start`},{width:`w-[35%]`,height:`h-4`,align:`justify-end`},{width:`w-[50%]`,height:`h-4`,align:`justify-start`},{width:`w-[30%]`,height:`h-4`,align:`justify-end`},{width:`w-[75%]`,height:`h-4`,align:`justify-start`},{width:`w-[55%]`,height:`h-4`,align:`justify-start`}];function oi({width:e,height:t}){return(0,Q.jsx)(`div`,{className:U(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function si(){let{t:e}=T(`openhands`);return(0,Q.jsx)(`div`,{className:`flex flex-col gap-6 p-4 w-full h-full overflow-hidden`,"data-testid":`chat-messages-skeleton`,"aria-label":e(E.CHAT_INTERFACE$LOADING_CONVERSATION),children:ai.map((e,t)=>(0,Q.jsx)(`div`,{className:U(`flex w-full`,e.align),children:(0,Q.jsx)(oi,{width:e.width,height:e.height})},t))})}var ci=220;function li({message:e,code:t,onDismiss:n,onRetry:r,onReauth:i}){let{t:a,i18n:o}=T(`openhands`),s=nr(t),[c,l]=$.useState(!1),[u,d]=$.useState(!1),[f,p]=$.useState(!1),m=$.useRef(null),h=o.exists(e,{ns:`openhands`}),g=h?String(a(e)):e,_=g.length>ci,v=_&&!c;return $.useEffect(()=>{if(!f)return;let e=setTimeout(()=>{p(!1)},2e3);return()=>clearTimeout(e)},[f]),$.useEffect(()=>{p(!1)},[g]),$.useLayoutEffect(()=>{let e=m.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){d(!1);return}d(e.getBoundingClientRect().height>t*1.5)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[g,v,c,e]),(0,Q.jsxs)(`div`,{className:U(`flex w-full gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,u?`items-start`:`items-center`),"data-testid":`error-message-banner`,children:[(0,Q.jsx)(x,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:ve},"data-testid":`error-message-banner-icon`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s&&(0,Q.jsx)(`div`,{className:`text-sm font-medium text-[var(--oh-foreground)]`,"data-testid":`error-message-banner-header`,children:a(s)}),(0,Q.jsx)(`div`,{ref:m,className:U(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,v&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:h?(0,Q.jsx)(w,{ns:`openhands`,i18nKey:e}):e}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:`mt-2 cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-reauth`,children:a(E.ERROR$ACP_UPDATE_CREDENTIALS)}),_&&(0,Q.jsx)(`button`,{type:`button`,className:`mt-1 cursor-pointer text-xs font-normal text-[var(--oh-foreground)] underline`,onClick:()=>l(e=>!e),"data-testid":`error-message-banner-toggle`,children:a(c?E.COMMON$VIEW_LESS:E.COMMON$VIEW_MORE)})]}),(0,Q.jsxs)(`div`,{className:U(`flex shrink-0 gap-1`,u?`self-start`:`items-center`),children:[r&&(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-retry`,children:a(E.CHAT_INTERFACE$MESSAGE_RETRY)}),(0,Q.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(g),p(!0)}catch{D(a(E.CHAT_INTERFACE$CHAT_MESSAGE_COPY_FAILED))}},className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(f?E.BUTTON$COPIED:E.BUTTON$COPY),"data-testid":`error-message-banner-copy`,children:f?(0,Q.jsx)(le,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Q.jsx)(de,{className:`h-4 w-4`,"aria-hidden":!0})}),n&&(0,Q.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(E.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,Q.jsx)(he,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}function ui(){let{t:e}=T(`openhands`),{conversationId:t}=cn(),n=X(e=>e.pendingMessages),r=X(e=>e.markPendingMessageError),i=X(e=>e.markPendingMessageSending),a=X(e=>e.removePendingMessage),o=W(e=>e.restoreMessageToInputIfEmpty),{send:s}=ie(),c=$.useMemo(()=>t?n.filter(e=>Lt(t,e.conversationId)):[],[n,t]),l=$.useCallback(async t=>{let n=X.getState().pendingMessages.find(e=>e.id===t);if(n){i(t);try{await s(ae(n.text,n.imageUrls,n.fileUrls,n.timestamp))}catch(n){r(t,n instanceof Error?n.message:e(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}}},[s,r,i,e]),u=$.useCallback((e,t)=>{o(t),a(e)},[o,a]);return c.length===0?null:(0,Q.jsx)(Q.Fragment,{children:c.map(e=>(0,Q.jsx)(ne,{type:`user`,message:e.text,pendingStatus:e.status,onRetry:e.status===`error`?()=>l(e.id):void 0,onStop:e.status===`sending`?()=>u(e.id,e.text):void 0,children:e.imageUrls.length>0&&(0,Q.jsx)(I,{size:`small`,images:e.imageUrls})},e.id))})}var di=()=>{let{data:e}=J();return S({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return vt(n,r,e)},meta:{disableToast:!0}})},fi=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3.25C9.92893 3.25 8.25 4.92893 8.25 7V10H7C6.44772 10 6 10.4477 6 11V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V11C18 10.4477 17.5523 10 17 10H15.75V7C15.75 4.92893 14.0711 3.25 12 3.25ZM14.25 10V7C14.25 5.75736 13.2426 4.75 12 4.75C10.7574 4.75 9.75 5.75736 9.75 7V10H14.25Z`,fill:`currentColor`})});function pi(){let{t:e}=T(`openhands`),{data:t}=$e();return t?.confirmation_mode?(0,Q.jsx)(ze,{closeDelay:100,content:e(E.COMMON$CONFIRMATION_MODE_ENABLED),tooltipClassName:`bg-white text-black hover:bg-transparent`,children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center w-[26px] h-[26px] rounded-lg bg-[var(--oh-surface)]`,children:(0,Q.jsx)(fi,{width:15,height:15})})}):null}var mi=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{d:`M15 12C15 12.7956 14.6839 13.5587 14.1213 14.1213C13.5587 14.6839 12.7956 15 12 15C11.2044 15 10.4413 14.6839 9.87868 14.1213C9.31607 13.5587 9 12.7956 9 12C9 11.2044 9.31607 10.4413 9.87868 9.87868C10.4413 9.31607 11.2044 9 12 9C12.7956 9 13.5587 9.31607 14.1213 9.87868C14.6839 10.4413 15 11.2044 15 12Z`,fill:`currentColor`})});function hi({status:e,statusColor:t}){return(0,Q.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:c(`w-full max-w-full rounded-[100px] p-1 bg-[var(--oh-surface)] flex items-center gap-1`),children:(0,Q.jsxs)(s,{mode:`wait`,children:[(0,Q.jsx)(z.span,{className:`flex-shrink-0 animate-[pulse_1.2s_ease-in-out_infinite]`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,Q.jsx)(mi,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,Q.jsx)(z.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:2},transition:{duration:.3},className:`pr-1.5 font-normal text-[11px] leading-[16px] normal-case break-words whitespace-normal`,children:e},`text-${e}`)]})})}var gi=()=>{let e=m(),{navigate:t}=Re(),{t:n}=T(`openhands`),{data:r}=J(),{trackConversationCreated:i}=et();return S({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await it.createConversation(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,r.sandbox_id??void 0);if(e.status===`ERROR`)throw Error(e.detail||`Failed to create new conversation`);return{newConversationId:e.app_conversation_id?e.app_conversation_id:`task-${e.id}`,oldConversationId:r.id,taskId:e.id}},onMutate:()=>{b.loading(n(E.CONVERSATION$CLEARING),{...k,id:`clear-conversation`})},onSuccess:r=>{i({conversationId:r.newConversationId,taskId:r.taskId,hasRepository:!1,hasWorkspace:!1,hasInitialQuery:!1,hasParentConversation:!1,entryPoint:`new_command`}),b.dismiss(`clear-conversation`),O(n(E.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{b.dismiss(`clear-conversation`);let t=n(E.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),D(n(E.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function _i(e,t){return e?`github`:t?`replay`:`direct`}function vi(){let{trackInitialQuerySubmitted:e,trackUserMessageSent:t}=et(),{setMessageToSend:n}=W(),{errorMessage:r,errorCode:i,removeErrorMessage:a,setErrorMessage:o}=pn(),s=f(),{isTask:c,taskStatus:l,taskDetail:u}=Ft(),d=c,p=_n(),{send:m}=ie(),{renderableEvents:h,allConversationEvents:g,totalEvents:_,hasSubstantiveAgentActions:v,userEventsExist:y}=Vr(),b=X(e=>e.enqueuePendingMessage),x=X(e=>e.markPendingMessageError),S=X(e=>e.pendingMessages),{t:C}=T(`openhands`),w=$.useRef(null),{scrollDomToBottom:O,onChatBodyScroll:k,hitBottom:A,autoScroll:j,setAutoScroll:M,setHitBottom:ee}=En(w),{mutate:te,isPending:N}=gi(),{curAgentState:P}=Y(),{handleBuildPlanClick:F}=L(),{data:ne}=J(),I=ne?.sandbox_status??null,R=on(),{isConfigured:ce,isLoading:le}=$t(),ue=!le&&!ce,z=P===V.RUNNING||P===V.LOADING;$.useEffect(()=>{if(z)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),F(e),O())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[z,F,O]);let{selectedRepository:de,replayJson:fe}=ni(),{conversationId:B}=cn(),pe=gn(e=>{let t=B?e.statusByConversation[B]:void 0;return t?.active?`${t.iteration}:${t.status}`:null}),{mutateAsync:me}=di(),{isLoading:he,hasMore:ge,loadOlder:_e}=Ur(B),ve=$.useRef(null),H=$.useCallback(e=>{if(d||he||!ge)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(ve.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},_e().catch(e=>{ve.current=null,o(e instanceof Error&&e.message?e.message:C(E.ERROR$GENERIC))}))},[ge,he,d,_e,o,C]),ye=$.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&H(e.currentTarget)},[H]),be=$.useMemo(()=>B?S.some(e=>Lt(B,e.conversationId)):!1,[S,B]),xe=g.length>0||be||!p?.isLoadingHistory,Ce=!!B,we=!xe&&!c,Te=fn(e=>B?(e.entriesByConversation[B]?.length??0)>0:!1),U=async(r,i,a)=>{if(r.trim()===`/new`){if(!B){D(C(E.CONVERSATION$CLEAR_NO_ID));return}if(_===0){D(C(E.CONVERSATION$CLEAR_EMPTY));return}if(N)return;te();return}let o=[...i],s=[...a];_===0?e({entryPoint:_i(de!==null,fe!==null),queryCharacterLength:r.length,replayJsonSize:fe?.length}):t({sessionMessageCount:_,currentMessageLength:r.length});let c=Mt([...o,...s]);if(!c.isValid){D(`Error: ${c.errorMessage}`);return}let l=o.map(e=>Nt(e)),u=await Promise.all(l),d=new Date().toISOString(),{skipped_files:f,uploaded_files:p}=s.length>0?await me({conversationId:B,files:s}):{skipped_files:[],uploaded_files:[]};f.forEach(e=>D(e.reason));let h=`${C(E.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${p.join(`
|
|
18
|
-
|
|
19
|
-
`)}`,g=p.length>0?`${r}\n\n${h}`:r,v=b({conversationId:B,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});O(),n(``);try{await m(ae(g,u,p,d))}catch(e){x(v,e instanceof Error?e.message:C(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};$.useEffect(()=>{if(ve.current&&w.current){let{scrollHeight:e,scrollTop:t}=ve.current,n=w.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ve.current=null;return}j&&O()},[h.length,be,pe,O]);let De=$.useRef(H);$.useEffect(()=>{De.current=H}),$.useEffect(()=>{let e=w.current;e&&De.current(e)},[h.length,ge]);let Oe={scrollRef:w,autoScroll:j,setAutoScroll:M,scrollDomToBottom:O,hitBottom:A,setHitBottom:ee,onChatBodyScroll:k},ke=P===V.LOADING||P===V.INIT,Ae=P===V.STOPPED,je=P===V.PAUSED,Me=Ee({isPausing:je,isTask:c,taskStatus:l,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P}),Ne=Se({isPausing:je,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P,errorMessage:r,t:C});return(0,Q.jsx)(oe,{value:Oe,children:(0,Q.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!v&&!be&&!y&&!Te&&!we&&!d&&_===0&&!R&&!ue&&(0,Q.jsx)(ei,{onSuggestionsClick:e=>n(e)}),(0,Q.jsxs)(`div`,{ref:w,"data-testid":`chat-scroll-container`,onScroll:e=>{k(e.currentTarget),H(e.currentTarget)},onWheel:ye,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[we&&Ce&&(0,Q.jsx)(si,{}),we&&!Ce&&(0,Q.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,Q.jsx)(Le,{size:`small`})}),he&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,Q.jsx)(Le,{size:`small`}),(0,Q.jsx)(`span`,{children:C(E.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,Q.jsx)(re,{conversationId:B,anchorEventId:null}),xe&&h.length>0&&(0,Q.jsx)(se,{messages:h,allEvents:g}),(0,Q.jsx)(ui,{}),(0,Q.jsx)(lr,{conversationId:B})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,Q.jsx)(cr,{conversationId:B}),r&&(0,Q.jsx)(li,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:rr(i)?()=>s(`/settings/agents`):void 0}),ue&&!R&&(0,Q.jsx)(tn,{}),R?(0,Q.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,Q.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,Q.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,Q.jsx)(pi,{}),ke&&(0,Q.jsx)(hi,{statusColor:Me,status:Ne})]}),A?P===V.RUNNING&&(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(Wr,{})}):(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(ii,{onClick:O})})]})}),(0,Q.jsx)(Br,{onSubmit:U,disabled:N||ue})]})]})]})})}function yi({isRightPanelShown:e}){return(0,Q.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,Q.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,Q.jsx)(vi,{})})})}function bi({children:e}){return(0,Q.jsx)(`div`,{className:`absolute inset-0`,children:e})}function xi({children:e}){return(0,Q.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Si({children:e}){return(0,Q.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function Ci({className:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,Q.jsx)(pe,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,Q.jsx)(M,{as:`p`,role:`status`,"aria-live":`polite`,className:`block w-full text-center text-base font-normal leading-5`,duration:1,spread:2,children:t(E.HOME$LOADING)})]})}function wi({children:e,onReady:t}){return(0,$.useLayoutEffect)(()=>{t()},[t]),e}function Ti({onPending:e}){return(0,$.useLayoutEffect)(()=>{e()},[e]),(0,Q.jsx)(Ci,{})}var Ei={duration:.35,ease:`easeInOut`};function Di({showAgentLoading:e,tabKey:t,children:n}){let r=P(),[i,a]=(0,$.useState)(!1);(0,$.useLayoutEffect)(()=>{a(!1)},[t]);let o=(0,$.useCallback)(()=>{a(!0)},[]),c=(0,$.useCallback)(()=>{a(!1)},[]),l=e||i;return r?(0,Q.jsx)(`div`,{className:`relative h-full w-full overflow-hidden`,children:l?(0,Q.jsx)(Ci,{}):(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}):(0,Q.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,Q.jsx)(z.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:Ei,"aria-hidden":l,children:(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}),(0,Q.jsx)(s,{children:l?(0,Q.jsx)(z.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:Ei,children:(0,Q.jsx)(Ci,{})},`conversation-tab-loading-overlay`):null})]})}var Oi=(0,$.lazy)(()=>n(()=>import(`./files-tab-61Vaihc6.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]))),ki=(0,$.lazy)(()=>n(()=>import(`./browser-tab-aiDg7aEn.js`),__vite__mapDeps([62,2,1,63,7,8,18,64,13,42,10,11,65,26]))),Ai=(0,$.lazy)(()=>n(()=>import(`./planner-tab-AZMjJx31.js`),__vite__mapDeps([66,1,2,67,7,8,18,42,10,11,44,22,20,21,23,24,45,13,19,25,46,47,48,68,69,70,71,3,4,5,6,9,72,73,74,15,16,30,27,28,14,29,31,32,33,34,35,36,75,76,77,78,79,80,49,50,51,52,81,82,26,60]))),ji=(0,$.lazy)(()=>n(()=>import(`./task-list-tab-BAThr9Ex.js`),__vite__mapDeps([83,1,2,8,18,42,10,11,84,37,26,85,86,40,41]))),Mi=(0,$.lazy)(()=>n(()=>import(`./terminal-BmT0_gIH.js`),__vite__mapDeps([87,1,2,88,89,90,7,8,18,38,39,10,11,40,41,42,53,49,50,4,14,27,3,5,6,9,28,29,30,31,32,33,34,35,36,51,52,15,16,54,26,91]))),Ni={tasklist:{component:ji},files:{component:Oi},browser:{component:ki},terminal:{component:Mi},planner:{component:Ai}};function Pi(){let{selectedTab:e,shouldShownAgentLoading:t}=W(),{conversationId:n}=q(),r=(0,$.useMemo)(()=>Ni[e]??Ni.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,Q.jsx)(xi,{children:(0,Q.jsx)(Si,{children:(0,Q.jsx)(Di,{showAgentLoading:t,tabKey:i,children:(0,Q.jsx)(bi,{children:(0,Q.jsx)(r,{})},i)})})})}var Fi=()=>{let e=m(),t=pn(e=>e.removeErrorMessage);return S({mutationKey:[`start-conversation`],mutationFn:async e=>g(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{h(e,r.conversationId)},onSuccess:(n,r)=>{t(),_(e,r.conversationId,ke.RUNNING)}})},Ii=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),Li=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function Ri({icon:e,text:t,onClick:n,testId:r}){return(0,Q.jsx)(G,{testId:r,onClick:n,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:e})]})})}function zi({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=Y(),{isTask:i,taskStatus:a,taskDetail:o}=Ft(),{t:s}=T(`openhands`),{errorMessage:c}=pn(),l=r===V.LOADING||r===V.INIT,u=Oe(t)||H(t),d=Ee({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=Se({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,Q.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(mi,{className:`w-6 h-6 shrink-0`,color:d}),(0,Q.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function Bi({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=T(`openhands`),c=gt(e),l=be(r),u=H(r),d=l||u;return(0,Q.jsxs)(bt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,Q.jsx)(zi,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{inset:`menu`}),l&&t&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Ii,{width:18,height:18}),text:s(E.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Li,{width:18,height:18}),text:s(E.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var Vi=e(l(),1);function Hi({isPublic:e,onToggle:t,ariaLabel:n}){return(0,Q.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,Q.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,Q.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function Ui({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=Dn(),{t:h}=T(`openhands`),{backend:g}=A(),{data:_}=J(),v=on(),y=gt(e),b=p?.current??null,[x,S]=$.useState();$.useLayoutEffect(()=>{if(!b)return;let e=()=>{let e=b.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,S(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[b,f]);let C=!!(a||o||s),w=!!i,D=!!(r||n),O=g.kind===`cloud`?E.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:E.COMMON$STOP_CONVERSATION,k=g.kind===`cloud`&&!!c,j=_?.public||!1,M=!!b,ee=(0,Q.jsxs)(bt,{ref:y,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:U(m?`right-0 translate-x-[34%] left-auto`:``,M?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,Q.jsx)(G,{testId:`rename-button`,onClick:t,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ct,{width:16,height:16}),text:h(E.BUTTON$RENAME)})}),C&&(0,Q.jsx)(He,{testId:`separator-tools`,inset:`menu`}),o&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-skills-button`,onClick:o,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(wt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-hooks-button`,onClick:s,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Yt,{width:16,height:16,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-agent-tools-button`,onClick:a,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ke,{width:16,height:16}),text:h(E.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,Q.jsx)(G,{testId:`download-trajectory-button`,onClick:u,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(ot,{width:16,height:16}),text:h(E.BUTTON$EXPORT_CONVERSATION)})}),(w||D)&&(0,Q.jsx)(He,{testId:`separator-info-control`,inset:`menu`}),i&&(0,Q.jsx)(G,{testId:`display-cost-button`,onClick:i,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(pt,{width:16,height:16}),text:h(E.BUTTON$DISPLAY_COST)})}),k&&c&&(0,Q.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,Q.jsx)(jn,{size:16})}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:h(E.CONVERSATION$SHARE_PUBLICLY)}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[j&&d&&l&&(0,Q.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$COPY_TO_CLIPBOARD),children:(0,Q.jsx)(Dt,{width:14,height:14})}),(0,Q.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$OPEN_IN_NEW_TAB),children:(0,Q.jsx)(fe,{size:14,"aria-hidden":!0})})]}),(0,Q.jsx)(Hi,{isPublic:j,onToggle:c,ariaLabel:h(E.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`stop-button`,onClick:r,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ue,{width:16,height:16}),text:h(O)})})}),n&&(0,Q.jsx)(G,{testId:`delete-button`,onClick:n,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(xt,{width:16,height:16}),text:h(E.COMMON$DELETE_CONVERSATION)})})]});return M?typeof document>`u`||!x?null:Vi.createPortal((0,Q.jsx)(`div`,{style:x,children:ee}),document.body):ee}function Wi({onClose:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qe,{onClose:e,testId:`close-metrics-modal`}),(0,Q.jsx)(`div`,{className:`w-full pr-6`,children:(0,Q.jsx)(Fe,{title:t(E.CONVERSATION$METRICS_INFO)})})]})}function Gi({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,Q.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function Ki({currentCost:e,maxBudget:t}){let{t:n}=T(`openhands`),r=e/t*100;return(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(E.CONVERSATION$USED)})})})}function qi({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{currentCost:e,maxBudget:t}),(0,Q.jsx)(Ki,{currentCost:e,maxBudget:t})]}):(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$NO_BUDGET_LIMIT)})})}function Ji({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,Q.jsx)(`span`,{className:`text-lg font-semibold`,children:n(E.CONVERSATION$TOTAL_COST)}),(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,Q.jsx)(qi,{cost:e,maxBudgetPerTask:t})]})}function Yi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,Q.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,Q.jsx)(`span`,{className:n,children:e}),(0,Q.jsx)(`span`,{className:r,children:t})]})}function Xi({usage:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_HIT)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_WRITE)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function Zi({perTurnToken:e,contextWindow:t}){let{t:n}=T(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Q.jsx)(`span`,{className:`font-semibold`,children:n(E.CONVERSATION$CONTEXT_WINDOW)})}),(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(E.CONVERSATION$USED),`)`]})})]})}function Qi(){let{t:e}=T(`openhands`);return(0,Q.jsx)(`div`,{className:`text-center`,children:(0,Q.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(E.CONVERSATION$NO_METRICS)})})}function $i(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var ea=(e,t,n,r=!0)=>{let i=C({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return $i(await it.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function ta({isOpen:e,onOpenChange:t}){let n=yn(),{data:r}=J(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=ea(i,a,o,e),c=(0,$.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,Q.jsx)(Ne,{onClose:()=>t(!1),children:(0,Q.jsxs)(Pe,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,Q.jsx)(Wi,{onClose:()=>t(!1)}),(0,Q.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(Ji,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xi,{usage:c.usage}),(0,Q.jsx)(Zi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsx)(Qi,{})})]})]})}):null}function na(){let{t:e}=T(`openhands`),{conversationId:t}=q(),{data:n}=J(),{mutate:r}=ht(),[i,a]=$.useState(`view`),[o,s]=$.useState(!1),c=$.useRef(null),l=$.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:h,handleShowHooks:g,handleTogglePublic:_,handleCopyShareLink:v,shareUrl:y,handleConfirmDelete:b,handleConfirmStop:x,metricsModalVisible:S,setMetricsModalVisible:C,systemModalVisible:w,setSystemModalVisible:D,skillsModalVisible:k,setSkillsModalVisible:A,hooksModalVisible:j,setHooksModalVisible:M,confirmDeleteModalVisible:ee,setConfirmDeleteModalVisible:te,confirmStopModalVisible:N,setConfirmStopModalVisible:P,systemMessage:F,shouldShowStop:ne,shouldShowDownloadConversation:re,shouldShowDisplayCost:ie,shouldShowAgentTools:I,shouldShowSkills:L,shouldShowHooks:ae}=Jt({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return $.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,Q.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{O(e(E.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,Q.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,Q.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,Q.jsx)(St,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,Q.jsx)(Ui,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:ne?d:void 0,onDisplayCost:ie?p:void 0,onShowAgentTools:I?m:void 0,onShowSkills:L?h:void 0,onShowHooks:ae?g:void 0,onTogglePublic:_,onCopyShareLink:v,shareUrl:y,onDownloadConversation:re?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,Q.jsx)(ta,{isOpen:S,onOpenChange:C}),(0,Q.jsx)(nn,{isOpen:w,onClose:()=>D(!1),systemMessage:F||null}),k&&(0,Q.jsx)(Vt,{onClose:()=>A(!1)}),j&&(0,Q.jsx)(Gt,{onClose:()=>M(!1)}),ee&&(0,Q.jsx)(ct,{onConfirm:b,onCancel:()=>te(!1),conversationTitle:n?.title||``}),N&&(0,Q.jsx)(st,{onConfirm:x,onCancel:()=>P(!1)})]}):null}function ra({children:e,tooltip:t,ariaLabel:n}){return(0,Q.jsx)(ze,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,Q.jsx)(`span`,{"data-aria-label":n,children:e})})}function ia({className:e}){let{t}=T(`openhands`),n=Dn(),r=on(),i=f(),{conversationId:a}=q(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=W(),u=()=>{if(r)return;if(n){if(!a)return;s(!0),c(!0);let{selectedTab:e}=W.getState();e||l(`files`),i(`/conversations/${a}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=W.getState();e||l(`files`)}},d=t(r?E.CONVERSATION$UNAVAILABLE_FOR_ARCHIVES:n?E.COMMON$SHOW_PANEL:o?E.COMMON$HIDE_PANEL:E.COMMON$SHOW_PANEL),p=n?!1:o;return(0,Q.jsx)(ra,{tooltip:d,ariaLabel:d,children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:r,className:U(ft,r&&`cursor-not-allowed opacity-50 hover:bg-transparent hover:text-[var(--oh-muted)]`,e),"aria-label":d,"aria-pressed":p,"aria-disabled":r,"data-testid":`right-panel-toggle`,children:(0,Q.jsx)(dt,{className:`w-5 h-5 -scale-x-100`})})})}function aa(){let{conversationId:e}=q(),{data:t}=J(),{curAgentState:n}=Y(),{isTask:r,taskStatus:i}=Ft(),{mutate:a}=We(),{mutate:o}=Fi(),{providers:s}=qe(),c=t?.execution_status??null,l=Ee({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===V.LOADING||n===V.INIT,isStopStatus:Oe(c),curAgentState:n});return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,Q.jsx)(mi,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,Q.jsx)(Bi,{onClose:()=>{},onStopServer:be(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:H(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,Q.jsx)(na,{})]}),(0,Q.jsx)(ia,{className:`mr-2`})]})}var oa=e=>(0,Q.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,Q.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Q.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]}),sa=160,ca={duration:.22,ease:[.4,0,.2,1]};function la({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o,suppressLayoutAnimation:s=!1}){let c=P(),l=o||c||!1,u=!l&&!s,d=U(`flex items-center rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),f=(0,Q.jsx)(t,{className:U(`h-4 w-4 shrink-0 text-inherit`)}),p=i&&r?(0,Q.jsx)(`span`,{className:`whitespace-nowrap text-sm font-normal`,children:i}):null,m=i?(0,Q.jsx)(z.span,{initial:!1,animate:{maxWidth:r?sa:0,opacity:+!!r,marginLeft:r?8:0},transition:ca,className:`block overflow-hidden whitespace-nowrap text-sm font-normal`,"aria-hidden":!r,children:i}):null;return l?(0,Q.jsxs)(`button`,{type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:U(d,`gap-2`),children:[f,p]}):(0,Q.jsxs)(z.button,{layout:u?`position`:!1,type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:d,transition:u?{layout:ca}:void 0,children:[f,m]})}var ua=e=>(0,Q.jsx)(`svg`,{viewBox:`0 0 128 128`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M90.767 127.126a7.968 7.968 0 0 0 6.35-.244l26.353-12.681a8 8 0 0 0 4.53-7.209V21.009a8 8 0 0 0-4.53-7.21L97.117 1.12a7.97 7.97 0 0 0-9.093 1.548l-50.45 46.026L15.6 32.013a5.328 5.328 0 0 0-6.807.302l-7.048 6.411a5.335 5.335 0 0 0-.006 7.888L20.796 64 1.74 81.387a5.336 5.336 0 0 0 .006 7.887l7.048 6.411a5.327 5.327 0 0 0 6.807.303l21.974-16.68 50.45 46.025a7.96 7.96 0 0 0 2.743 1.793Zm5.252-92.183L57.74 64l38.28 29.058V34.943Z`})});function da(){let e=Ae().backend;if(e.kind!==`cloud`)throw Error(`Cloud sandboxes call requires a cloud backend.`);return e}async function fa(e){if(e.length===0)return[];let t=da(),n=new URLSearchParams;for(let t of e)n.append(`id`,t);return await Me({backend:t,method:`GET`,path:`/api/v1/sandboxes?${n.toString()}`})??[]}var pa=e=>{let t=A(),n=t.backend.kind===`cloud`;return C({queryKey:[`cloud`,`sandbox`,t.backend.id,t.orgId,e],queryFn:async()=>{if(!e)return null;let[t]=await fa([e]);return t??null},enabled:n&&!!e,staleTime:1e3*60*5,gcTime:1e3*60*15})},ma=`VSCODE`,ha=()=>{let{t:e}=T(`openhands`),{conversationId:t}=q(),n=Tn({allowAgentError:!0}),{data:r}=J(),i=A(),a=r?.conversation_url??null,o=r?.session_api_key??null,s=r?.sandbox_id??null,c=i.backend.kind===`cloud`,l=pa(c?s:null),u=C({queryKey:[`unified`,`vscode_url`,`local`,t,a,o],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return{url:ut((await it.getVSCodeUrl(t,a,o).catch(()=>yt.getVSCodeUrl(t))).vscode_url)}},enabled:!c&&n&&!!t,refetchOnMount:!0,retry:3}),d,f,p,m,h,g,_;if(c){let e=l.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;d=l.isSuccess?{url:ut(e)}:void 0,f=l.isLoading,p=l.isError,m=l.isSuccess,h=l.status,g=l.error,_=async()=>{let e=await l.refetch(),t=e.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;return{data:e.data?{url:ut(t)}:void 0}}}else d=u.data,f=u.isLoading,p=u.isError,m=u.isSuccess,h=u.status,g=u.error,_=async()=>({data:(await u.refetch()).data});let v=d&&!d.url?e(E.VSCODE$URL_NOT_AVAILABLE):null;return{data:d?{...d,error:v}:void 0,error:g,isLoading:f,isError:p,isSuccess:m,status:h,refetch:_}};function ga(){let{t:e}=T(`openhands`),{curAgentState:t}=Y(),{data:n,refetch:r,isLoading:i}=ha(),a=ye.includes(t);return(0,Q.jsxs)(`button`,{type:`button`,onClick:async()=>{let e=n?.url;e||=(await r()).data?.url??null,e&&window.open(e,`_blank`,`noopener,noreferrer`)},disabled:i||a,"aria-label":e(E.VSCODE$OPEN),title:e(E.VSCODE$OPEN),"data-testid":`drawer-vscode-link`,className:U(`inline-flex items-center gap-1.5 rounded-[7px] border border-[var(--oh-border)] bg-base-secondary px-2 py-1 text-xs`,`text-[var(--oh-muted)] transition-colors hover:enabled:bg-surface-raised hover:enabled:text-white`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,Q.jsx)(ua,{className:`h-[15px] w-[15px] shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:e(E.FILES$VSCODE)}),(0,Q.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0,strokeWidth:2})]})}var _a=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),va=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function ya({isOpen:e,onClose:t,ignoreOutsideClickRef:n,anchorRef:r}){let i=gt(t,n),[a,o]=(0,$.useState)();(0,$.useLayoutEffect)(()=>{if(!e||!r?.current){o(void 0);return}let t=()=>{let e=r.current?.getBoundingClientRect();e&&o({position:`fixed`,zIndex:9999,top:e.bottom+8,left:e.left})};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,r]);let{t:s}=T(`openhands`),{conversationId:c}=q(),{state:l,setUnpinnedTabs:u,setSelectedTab:d}=Ze(c),{selectedTab:f,isRightPanelShown:p,setSelectedTab:m}=W(),{navigateToTab:h}=R(),{hasTaskList:g}=On(),{backend:_}=A(),v=on(),y=[{tab:`planner`,icon:B,i18nKey:E.COMMON$PLANNER},{tab:`files`,icon:kt,i18nKey:E.COMMON$FILES},{tab:`terminal`,icon:me,i18nKey:E.COMMON$TERMINAL},{tab:`browser`,icon:An,i18nKey:E.COMMON$BROWSER}];g&&y.unshift({tab:`tasklist`,icon:oa,i18nKey:E.COMMON$TASK_LIST});let b=y.filter(({tab:e})=>e!==`planner`||_.kind===`cloud`),x=e=>{v||(h(e),t())},S=(e,t)=>{if(v){t.preventDefault(),t.stopPropagation();return}if(t.preventDefault(),t.stopPropagation(),l.unpinnedTabs.includes(e))u(l.unpinnedTabs.filter(t=>t!==e));else{let t=[...l.unpinnedTabs,e];if(u(t),f===e&&p){let n=b.find(({tab:n})=>n!==e&&!t.includes(n));n&&(m(n.tab),d(n.tab))}}};if(!e)return null;let C=!!(r?.current&&a),w=(0,Q.jsx)(bt,{ref:i,theme:C?`popover`:`default`,position:C?`none`:`bottom`,alignment:C?`none`:`left`,spacing:C?`none`:`default`,className:U(`z-[9999] w-fit`,C?`mt-0`:`mt-2`),children:b.map(({tab:e,icon:t,i18nKey:n})=>{let r=!l.unpinnedTabs.includes(e);return(0,Q.jsx)(`li`,{className:`list-none`,children:(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsxs)(`div`,{className:U(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,!v&&`hover:bg-[var(--oh-interactive-hover)]`,v&&`opacity-50`),children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,disabled:v,className:U(`flex min-w-0 flex-1 items-center gap-2 rounded-l p-2 text-start text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer`),onClick:()=>x(e),children:[(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:(0,Q.jsx)(t,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`text-sm`,children:s(n)})]}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,disabled:v,className:U(`flex shrink-0 items-center justify-center rounded-r px-2 text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer hover:bg-white/10`),"aria-pressed":r,"aria-label":s(r?E.CONVERSATION$UNPIN_TAB:E.CONVERSATION$PIN_TAB),onClick:t=>S(e,t),children:r?(0,Q.jsx)(`span`,{className:U(`-mr-[5px] ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(va,{className:`h-7 w-7`})}):(0,Q.jsx)(`span`,{className:U(`ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(_a,{className:`h-4.5 w-4.5`})})})]})})},e)})});return C&&a&&typeof document<`u`?Vi.createPortal((0,Q.jsx)(`div`,{style:a,children:w}),document.body):w}function ba({variant:e=`default`,isPanelResizing:t=!1}){let{conversationId:n}=q(),{setSelectedTab:r,planContent:i}=W(),[a,o]=(0,$.useState)(!1),{state:s}=Ze(n),{hasTaskList:c}=On(),{backend:l}=A(),{handleBuildPlanClick:u}=L(),{curAgentState:d}=Y(),{selectTab:f,isTabActive:p,onTabChange:m,selectedTab:h,isRightPanelShown:g}=R();(0,$.useEffect)(()=>{r(s.selectedTab)},[r,s.selectedTab]),(0,$.useEffect)(()=>{g&&(h||m(`files`))},[g,h,m]);let{t:_,i18n:v}=T(`openhands`),y=[{tabValue:`files`,isActive:p(`files`),icon:kt,onClick:()=>f(`files`),tooltipContent:_(E.COMMON$FILES),tooltipAriaLabel:_(E.COMMON$FILES),label:_(E.COMMON$FILES)},{tabValue:`planner`,isActive:p(`planner`),icon:B,onClick:()=>f(`planner`),tooltipContent:_(E.COMMON$PLANNER),tooltipAriaLabel:_(E.COMMON$PLANNER),label:_(E.COMMON$PLANNER)},{tabValue:`terminal`,isActive:p(`terminal`),icon:me,onClick:()=>f(`terminal`),tooltipContent:_(E.COMMON$TERMINAL),tooltipAriaLabel:_(E.COMMON$TERMINAL),label:_(E.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:p(`browser`),icon:An,onClick:()=>f(`browser`),tooltipContent:_(E.COMMON$BROWSER),tooltipAriaLabel:_(E.COMMON$BROWSER),label:_(E.COMMON$BROWSER)}];c&&y.splice(1,0,{tabValue:`tasklist`,isActive:p(`tasklist`),icon:oa,onClick:()=>f(`tasklist`),tooltipContent:_(E.COMMON$TASK_LIST),tooltipAriaLabel:_(E.COMMON$TASK_LIST),label:_(E.COMMON$TASK_LIST)});let b=y.filter(e=>e.tabValue===`planner`&&l.kind!==`cloud`?!1:s.unpinnedTabs.includes(e.tabValue)?h===e.tabValue:!0),x=s.unpinnedTabs.join(`,`),S=d===V.RUNNING||d===V.LOADING||!i,C=(0,$.useRef)(null),w=(0,$.useRef)(null),D=(0,$.useRef)(null),O=(0,$.useRef)(null),k=(0,$.useRef)(null),[j,M]=(0,$.useState)(b.length);(0,$.useLayoutEffect)(()=>{let e=C.current,t=w.current,n=D.current,r=O.current;if(!e||!t||!n||!r)return;let i=()=>{let i=t.querySelectorAll(`[data-tab-measure="true"]`),a=i.length,o=e.getBoundingClientRect().width;if(o===0){M(a);return}let s=Array.from(i).map(e=>e.getBoundingClientRect().width);if(s.length!==a||a===0){M(Math.max(0,a));return}let c=n.getBoundingClientRect().width,l=r.getBoundingClientRect().width,u=getComputedStyle(e).columnGap||getComputedStyle(e).gap,d=parseFloat(u)||6,f=0;for(let e=a;e>=0;--e){let t=c+l;for(let n=0;n<e;n+=1)t+=s[n]??0;if(e>0&&(t+=e*d),t<=o+.5){f=e;break}}M(e=>e===f?e:f)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(e),()=>a.disconnect()},[x,b.length,c,l.kind,h,g,v.language]);let ee=Math.min(j,b.length);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:U(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,Q.jsx)(`div`,{ref:w,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:b.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,Q.jsx)(ra,{tooltip:r,ariaLabel:i,children:(0,Q.jsx)(la,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:U(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,Q.jsxs)(`div`,{ref:C,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center justify-start overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(zn,{id:`conversation-drawer-tabs`,children:(0,Q.jsx)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:b.slice(0,ee).map(({tabValue:e,icon:n,onClick:r,isActive:i,tooltipContent:a,tooltipAriaLabel:o,label:s,className:c},l)=>(0,Q.jsx)(ra,{tooltip:a,ariaLabel:o,children:(0,Q.jsx)(la,{tabValue:e,icon:n,onClick:r,isActive:i,label:s,className:U(c,`shrink-0`),suppressLayoutAnimation:t})},`${e}-${l}`))})}),(0,Q.jsxs)(`div`,{ref:D,className:`relative shrink-0`,children:[(0,Q.jsx)(St,{ref:k,onClick:()=>o(!a),ariaLabel:_(E.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?lt:void 0}),(0,Q.jsx)(ya,{isOpen:a,onClose:()=>o(!1),ignoreOutsideClickRef:k,anchorRef:k})]})]})}),(0,Q.jsx)(`div`,{ref:O,className:U(`ml-auto shrink-0`,l.kind===`cloud`&&`pr-1`),children:l.kind===`cloud`&&(0,Q.jsx)(ga,{})})]})]}),p(`planner`)&&(0,Q.jsx)(`div`,{className:U(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:S,className:U(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,S?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,Q.jsxs)(Ot.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(E.COMMON$BUILD),` ⌘↩`]})})})]})}function xa({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,$.useState)(!1),a=n||r;return(0,Q.jsxs)(`div`,{className:U(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,Q.jsx)(`div`,{className:U(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var Sa=200;function Ca({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=kn(r,e),o=(0,$.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,$.useState)(()=>o(i)),[l,u]=(0,$.useState)(!1),d=(0,$.useRef)(null),f=(0,$.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,$.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,$.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,$.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(Sa),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function wa(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Ta(){let e=Dn(),t=Dn(767),{isRightPanelShown:n}=W(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Ca({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,Q.jsx)(`div`,{className:U(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,Q.jsxs)(`div`,{ref:o,className:U(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{className:U(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:U(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,Q.jsx)(mt,{}):null,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(aa,{})})]}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(yi,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,Q.jsx)(xa,{onMouseDown:s,isDragging:a}),!e&&(0,Q.jsx)(`div`,{className:U(`transition-all duration-300 ease-in-out overflow-hidden`,wa(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,Q.jsx)(ba,{isPanelResizing:a})}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(Pi,{})})]})})})]})})}function Ea({onNavigateBack:e}){let{t}=T(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=W();return $.useLayoutEffect(()=>(n(!0),r(!0),W.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,Q.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(E.COMMON$BACK),className:ft,children:(0,Q.jsx)(ue,{size:20,className:lt,"aria-hidden":!0,strokeWidth:2})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,Q.jsx)(ba,{variant:`compact`})})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,Q.jsx)(Pi,{})})]})}var Da=1e3*60*5,Oa=1e3*60*15,ka=e=>{let t=e||[],n=A();return C({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:it.batchGetAppConversations(t),enabled:t.length>0,staleTime:Da,gcTime:Oa,retry:!1})};function Aa({children:e,conversationId:t}){let{data:n}=J(),{data:r}=ka(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,Q.jsx)(hn,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function ja(){let{t:e}=T(`openhands`),{conversationId:t}=q(),n=u(`/conversations/:conversationId/panel`),{isTask:r,taskStatus:i,taskDetail:a}=Ft(),o=A(),s=$.useRef(o.backend.id),c=$.useRef(o.orgId),l=s.current!==o.backend.id||c.current!==o.orgId,{data:d,isFetched:m}=J(),{data:h}=at(),{resetConversationState:g}=W(),_=f(),v=p(),y=wn(e=>e.clearTerminal),b=Et(e=>e.reset),x=Vn(e=>e.setCurrentAgentState),S=pn(e=>e.removeErrorMessage);$.useEffect(()=>{y(),g(),b(),x(V.LOADING),S()},[t,y,g,b,x,S]),$.useEffect(()=>{if(r&&i===`ERROR`){D(a||e(E.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=v.state?.resumedFromConversationId;_(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[r,i,a,e,_,v.state]),$.useEffect(()=>{!m||!h||l||d||(qn(o.backend.id,o.orgId),D(e(E.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),_(`/conversations`))},[d,m,h,_,e,l,o.backend.id,o.orgId]),$.useEffect(()=>{l||t&&(t.startsWith(`task-`)||Kn(o.backend.id,o.orgId,t))},[t,l,o.backend.id,o.orgId]);let C=$.useRef(null);return $.useEffect(()=>{!m||!d||o.backend.kind===`cloud`&&d.sandbox_status===`PAUSED`&&d.sandbox_id&&C.current!==d.id&&(C.current=d.id,rt(d.sandbox_id).catch(()=>{D(e(E.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,d?.id,d?.sandbox_status,d?.sandbox_id,o.backend.kind,e]),l?null:(0,Q.jsx)(Aa,{conversationId:t,children:(0,Q.jsx)($n,{children:(0,Q.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,Q.jsx)(Ea,{onNavigateBack:()=>_(`/conversations/${t}`)}):(0,Q.jsx)(Ta,{})})})})}function Ma(){return(0,Q.jsx)(ja,{})}var Na=d(Ma);export{Na as t};
|