@openhands/agent-canvas 1.7.2 → 1.8.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-DP5rcauH.js → Trans-B7lYw4uD.js} +1 -1
- package/build/assets/{acp-providers-BHKZvEm5.js → acp-providers-WUD4tfSq.js} +1 -1
- package/build/assets/active-backend-context-mY7Gff5c.js +2 -0
- package/build/assets/{agent-context-settings-CTaN-Iw9.js → agent-context-settings-BTUmWEzL.js} +1 -1
- package/build/assets/{agent-profiles-settings-CR4VTqv_.js → agent-profiles-settings-Ilqid_R5.js} +1 -1
- package/build/assets/agent-server-conversation-service.api-C_7YnjzP.js +41 -0
- package/build/assets/{agent-settings-BIOsUglV.js → agent-settings-BGTyoT6X.js} +2 -2
- package/build/assets/agent-settings-CxfT4ksO.js +1 -0
- package/build/assets/{alert-banner-C1nzoXBC.js → alert-banner-eRyIwDyU.js} +1 -1
- package/build/assets/api-key-entry-screen-JOx3SH1-.js +1 -0
- package/build/assets/app-settings-D53QZy5p.js +1 -0
- package/build/assets/automation-detail-nEflClmc.js +2 -0
- package/build/assets/{automation-export-Bu-r-EzL.js → automation-export-BO_kfqC8.js} +1 -1
- package/build/assets/{automations-list-CYw7_6FR.js → automations-list-BYncC7gv.js} +1 -1
- package/build/assets/{back-nav-button-Be_L157B.js → back-nav-button-C02hGa8t.js} +1 -1
- package/build/assets/backend-form-modal-CKrBF80P.js +1 -0
- package/build/assets/{backend-synced-settings-badge-BNpEylNP.js → backend-synced-settings-badge-CQ9xtNWm.js} +1 -1
- package/build/assets/{badge-DwgrwohM.js → badge-CzXbf7tR.js} +1 -1
- package/build/assets/{base-modal-CSHhJTSr.js → base-modal-DkVyzFMt.js} +1 -1
- package/build/assets/{brand-button-CQO8oqVo.js → brand-button-BUlDL-mz.js} +1 -1
- package/build/assets/{browser-BUDJnBg4.js → browser-3QjrEr1D.js} +1 -1
- package/build/assets/{browser-tab-CEApjoEV.js → browser-tab-BijpUbdt.js} +1 -1
- package/build/assets/{chat-send-button-D4614wUz.js → chat-send-button-BKsVjhtA.js} +1 -1
- package/build/assets/check-CrxQfJZ2.js +1 -0
- package/build/assets/chevron-down-D_LsyTA7.js +1 -0
- package/build/assets/circle-check-DZn9HkLE.js +1 -0
- package/build/assets/{circle-plus-check-toggle-E3Ecb_gg.js → circle-plus-check-toggle-DdjUiOo1.js} +1 -1
- package/build/assets/cloud-funnel-analytics-NlmDoeo2.js +1 -0
- package/build/assets/{combobox-caret-C8_eGdp2.js → combobox-caret-Dl9UtvD6.js} +1 -1
- package/build/assets/{command-menu-N_BriUy8.js → command-menu-CvLPs7dg.js} +1 -1
- package/build/assets/{condenser-settings-Czi8cKxV.js → condenser-settings-C4Y9CzQV.js} +1 -1
- package/build/assets/{confirmation-modal-gZtbojCm.js → confirmation-modal-CRBJSllP.js} +1 -1
- package/build/assets/{context-menu-list-item-BTHGFhIx.js → context-menu-list-item-FGaafXGh.js} +1 -1
- package/build/assets/conversation-D_ORtpKC.js +1 -0
- package/build/assets/conversation-Dpc5nmGi.js +90 -0
- package/build/assets/conversation-panel-D_ORtpKC.js +1 -0
- package/build/assets/conversation-state-store-CGRQemtx.js +1 -0
- package/build/assets/{conversation-tab-empty-state-BCMHkGQk.js → conversation-tab-empty-state-CDjvNgpG.js} +1 -1
- package/build/assets/{copy-B8Y5ufoR.js → copy-Drwu97Gx.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-C4l3CMSd.js → copy-to-clipboard-button-NbN1clVr.js} +1 -1
- package/build/assets/{device-verify-C_M7Z8xs.js → device-verify-CDm_WrVu.js} +1 -1
- package/build/assets/{dropdown-classes-DQlj-MpS.js → dropdown-classes-CqA2BTCL.js} +1 -1
- package/build/assets/{entry.client-DETaouwO.js → entry.client-BO2KQj0y.js} +2 -2
- package/build/assets/{enum-filter-dropdown-paB-lFSP.js → enum-filter-dropdown-DSqPZnsD.js} +1 -1
- package/build/assets/{environment-switch-overlay-D0FgCMqs.js → environment-switch-overlay-mGl2pqqx.js} +1 -1
- package/build/assets/extensions-hub-Br3Lgynp.js +1 -0
- package/build/assets/extensions-navigation-BQmstKDZ.js +1 -0
- package/build/assets/{external-link-Cnnd6ikC.js → external-link-D9B2QMPf.js} +1 -1
- package/build/assets/files-tab-4c9HFSLo.js +1 -0
- package/build/assets/{form-control-classes-CSPevi7c.js → form-control-classes-CtVAktAy.js} +1 -1
- package/build/assets/{format-time-delta-DuhE50B-.js → format-time-delta-DICE64sz.js} +1 -1
- package/build/assets/git-provider-icon-0PqmIS_S.js +1 -0
- package/build/assets/{highlighted-source-view-suUKd5if.js → highlighted-source-view-KMsA9c4a.js} +1 -1
- package/build/assets/home-D9JsyEmE.js +1 -0
- package/build/assets/{home-sN90Xcxp.js → home-TFhnmZLx.js} +1 -1
- package/build/assets/index-home-D9JsyEmE.js +1 -0
- package/build/assets/install-server-modal-BgGRnqA0.js +1 -0
- package/build/assets/{launch-Ccnhte5b.js → launch-DjkKw55l.js} +1 -1
- package/build/assets/{list-todo-_BXQzOiB.js → list-todo-BpAf7aOT.js} +1 -1
- package/build/assets/{llm-not-configured-banner-DTWzISnk.js → llm-not-configured-banner-Y4W9-sar.js} +4 -4
- package/build/assets/llm-settings-D8zNkIlP.js +1 -0
- package/build/assets/llm-settings-nPwv7hKu.js +1 -0
- package/build/assets/{llm-subscription-service-W5BprsNA.js → llm-subscription-service-COTgZc1C.js} +1 -1
- package/build/assets/loader-circle-CGD6-Vak.js +1 -0
- package/build/assets/{loading-spinner-CcpnCr_d.js → loading-spinner-DRFyh6Iy.js} +1 -1
- package/build/assets/manage-backends-modal-DiRWE3tJ.js +1 -0
- package/build/assets/manifest-1cf33a7b.js +1 -0
- package/build/assets/markdown-renderer-U40HF0Ak.js +8 -0
- package/build/assets/mcp-xDMaHzOw.js +9 -0
- package/build/assets/{messages-DINDkPNK.js → messages-CdNfZPgd.js} +2 -2
- package/build/assets/{modal-body-DQhiw-AR.js → modal-body-C3bGicn4.js} +1 -1
- package/build/assets/{modal-classes-YaEEa5eZ.js → modal-classes-DFFO6BMU.js} +1 -1
- package/build/assets/{modal-close-button-turIYn0t.js → modal-close-button-vxkAIRyZ.js} +1 -1
- package/build/assets/{onboarding-BegDrOKn.js → onboarding-DWuFieEA.js} +1 -1
- package/build/assets/onboarding-modal-C8m72Dpb.js +1 -0
- package/build/assets/organization-service.api-CQ73CB-S.js +1 -0
- package/build/assets/{pencil-8_lvWDoZ.js → pencil-DzW2GB2M.js} +1 -1
- package/build/assets/{planner-tab-w6HT0N_A.js → planner-tab-YG0bGxDY.js} +1 -1
- package/build/assets/plugins-management-service-ijhH8OSh.js +1 -0
- package/build/assets/plus-CTGLo3aa.js +1 -0
- package/build/assets/profiles-service.api-C32pPm70.js +1 -0
- package/build/assets/providers-DuSn9s2i.js +1 -0
- package/build/assets/proxy-BiyDhMBd.js +1 -0
- package/build/assets/{puzzle-DXWdfaa7.js → puzzle-DlqT0yvr.js} +1 -1
- package/build/assets/{recommended-automations-launcher-BF2mtAKw.js → recommended-automations-launcher-Dru1yN46.js} +2 -2
- package/build/assets/{refresh-cw-D7CYLy-d.js → refresh-cw-Br5254f4.js} +1 -1
- package/build/assets/root-DOLLQteU.js +2 -0
- package/build/assets/root-layout-xmylWoew.js +3 -0
- package/build/assets/schema-field-htfNouTG.js +1 -0
- package/build/assets/{sdk-section-page-BW-i45yr.js → sdk-section-page-D0K1dBQY.js} +1 -1
- package/build/assets/search-BrpWXWUi.js +1 -0
- package/build/assets/secrets-service-Dbv5Zb8G.js +1 -0
- package/build/assets/{secrets-settings-D7U1ErCH.js → secrets-settings-Da4SSaX9.js} +1 -1
- package/build/assets/{segmented-toggle-DbbD3Tve.js → segmented-toggle-CZKOdIly.js} +1 -1
- package/build/assets/settings-F4a09IxY.js +1 -0
- package/build/assets/{settings-dropdown-input-Dx6vlkgf.js → settings-dropdown-input-jOiv5Yrk.js} +1 -1
- package/build/assets/{settings-index-COAdxm2Q.js → settings-index-CyJBf5NA.js} +1 -1
- package/build/assets/{settings-input-BjW_zyTN.js → settings-input-BEaTCem1.js} +1 -1
- package/build/assets/{settings-list-classes-gQdBahdt.js → settings-list-classes-VqMzkYYt.js} +1 -1
- package/build/assets/{settings-modal-CFnbQ8_4.js → settings-modal-C-S1NpbC.js} +1 -1
- package/build/assets/settings-service.api-CTJRrvMu.js +1 -0
- package/build/assets/{settings-switch-UNSf8K8I.js → settings-switch-B405oU_v.js} +1 -1
- package/build/assets/{shared-conversation-CnMxy7p_.js → shared-conversation-BvWtTwES.js} +1 -1
- package/build/assets/{sidebar-layout-DXHtbEj1.js → sidebar-layout-BGMuyC86.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-U78hQRJ1.js → sidebar-mobile-menu-toggle-xiKoUfGa.js} +1 -1
- package/build/assets/{sidebar-nav-link-pvUivfK2.js → sidebar-nav-link-DA4_ct9G.js} +1 -1
- package/build/assets/{sidebar-store-DwrYKwYr.js → sidebar-store-FRJ3rADB.js} +1 -1
- package/build/assets/{skill-card-pill-row-D7XCz5uk.js → skill-card-pill-row-BMdhr_sd.js} +1 -1
- package/build/assets/{skill-icon-badge-HqBWZ2Eq.js → skill-icon-badge-CGUkgcVH.js} +1 -1
- package/build/assets/{skills-plugins-BPhaNpfx.js → skills-plugins-C5eJnyft.js} +1 -1
- package/build/assets/{skills-settings-CcwMtnnJ.js → skills-settings-pUxMr6WZ.js} +1 -1
- package/build/assets/{styled-tooltip-DsjDnR_W.js → styled-tooltip-B3kIdVyH.js} +1 -1
- package/build/assets/{task-list-tab-BmaTwjaS.js → task-list-tab-B3k4W1cK.js} +1 -1
- package/build/assets/{terminal-BRcoba5B.js → terminal-CBI_41Zc.js} +1 -1
- package/build/assets/{toggle-switch-BptY3XRG.js → toggle-switch-DYRr9CAR.js} +1 -1
- package/build/assets/{trash-2-Bq4lHbTB.js → trash-2-gZPlx23R.js} +1 -1
- package/build/assets/{typography-C6fuRTTT.js → typography-B1UxuuEC.js} +1 -1
- package/build/assets/{use-acp-credential-form-B0_pZ_uS.js → use-acp-credential-form-CjSvKWFH.js} +1 -1
- package/build/assets/use-activate-agent-profile-DCRf47e-.js +1 -0
- package/build/assets/use-agent-profiles-DmT9zxAN.js +1 -0
- package/build/assets/{use-can-manage-org-profiles-CrG1km7R.js → use-can-manage-org-profiles-vBiP7rHF.js} +1 -1
- package/build/assets/use-cloud-current-user-id-BMq9gw93.js +1 -0
- package/build/assets/use-config-C959QcRC.js +1 -0
- package/build/assets/{use-create-conversation-Dsa4nzU9.js → use-create-conversation-CakhLF0X.js} +1 -1
- package/build/assets/{use-create-secret-BnxuAjDt.js → use-create-secret-RT4QtSS9.js} +1 -1
- package/build/assets/use-llm-profiles-CdaxVpyY.js +1 -0
- package/build/assets/use-onboarding-completion-CJU4MNAY.js +1 -0
- package/build/assets/use-plugins-marketplace-D-93nqtJ.js +1 -0
- package/build/assets/{use-save-agent-profile-2Mk9ZX37.js → use-save-agent-profile-DGJ3-u0M.js} +1 -1
- package/build/assets/{use-save-settings-BRh9p_fv.js → use-save-settings--C6LZXfI.js} +1 -1
- package/build/assets/use-settings-DIAo5KFk.js +1 -0
- package/build/assets/use-settings-nav-items-DPK5sxvR.js +16 -0
- package/build/assets/use-skills-D_mLhYNa.js +1 -0
- package/build/assets/use-tracking-COqZLobY.js +1 -0
- package/build/assets/{use-user-conversation-GnGhs_Ob.js → use-user-conversation-DhcAEyJX.js} +1 -1
- package/build/assets/{useMutation-DyQXZFEF.js → useMutation-DHLpZ6J0.js} +1 -1
- package/build/assets/utils-DsWhWn2F.js +1 -0
- package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js} +1 -1
- package/build/assets/{vendor~files-tab-vm3f67Pz.js → vendor~files-tab-atebg0iG.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation-kX4LrGQC.js → vendor~index-home~home~conversation-panel~conversation-G9DMrR7m.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation-DpA6fir3.js → vendor~root-layout~conversation-panel~conversation-DEhW1h3I.js} +1 -1
- package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation-EShpjxey.js → vendor~root-layout~index-home~home~conversation-panel~conversation-Acmf1sKj.js} +1 -1
- package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-DD_UNO02.js → vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-CmzCY1BT.js} +1 -1
- package/build/assets/{vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-Be63Q2Ln.js → vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-C7Yh77RT.js} +1 -1
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-VFnwct3q.js} +1 -1
- package/build/assets/{verification-settings-CaCzojbc.js → verification-settings-Vr5cN4md.js} +1 -1
- package/build/assets/x-Dx_JbpHA.js +1 -0
- package/build/favicon-16x16.png +0 -0
- package/build/favicon-32x32.png +0 -0
- package/build/favicon.ico +0 -0
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +2 -0
- package/build/locales/ca/openhands.json +2 -0
- package/build/locales/de/openhands.json +2 -0
- package/build/locales/en/openhands.json +2 -0
- package/build/locales/es/openhands.json +2 -0
- package/build/locales/fr/openhands.json +2 -0
- package/build/locales/it/openhands.json +2 -0
- package/build/locales/ja/openhands.json +2 -0
- package/build/locales/ko-KR/openhands.json +2 -0
- package/build/locales/no/openhands.json +2 -0
- package/build/locales/pt/openhands.json +2 -0
- package/build/locales/tr/openhands.json +2 -0
- package/build/locales/uk/openhands.json +2 -0
- package/build/locales/zh-CN/openhands.json +2 -0
- package/build/locales/zh-TW/openhands.json +2 -0
- package/config/defaults.json +4 -4
- package/dist/api/agent-server-adapter.cjs +1 -1
- package/dist/api/agent-server-adapter.cjs.map +1 -1
- package/dist/api/agent-server-adapter.js +7 -7
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/api/automation-service/automation-service.api.cjs +1 -1
- package/dist/api/automation-service/automation-service.api.cjs.map +1 -1
- package/dist/api/automation-service/automation-service.api.js +95 -95
- package/dist/api/automation-service/automation-service.api.js.map +1 -1
- package/dist/api/backend-registry/storage.cjs +1 -1
- package/dist/api/backend-registry/storage.cjs.map +1 -1
- package/dist/api/backend-registry/storage.js +1 -1
- package/dist/api/backend-registry/storage.js.map +1 -1
- package/dist/api/backend-registry/types.d.ts +2 -0
- package/dist/api/cloud/conversation-service.api.cjs +1 -1
- package/dist/api/cloud/conversation-service.api.js +22 -22
- package/dist/api/mcp-service/mcp-service.api.cjs +1 -1
- package/dist/api/mcp-service/mcp-service.api.cjs.map +1 -1
- package/dist/api/mcp-service/mcp-service.api.js +19 -19
- package/dist/api/mcp-service/mcp-service.api.js.map +1 -1
- package/dist/api/settings-service/settings-service.api.cjs +1 -1
- package/dist/api/settings-service/settings-service.api.cjs.map +1 -1
- package/dist/api/settings-service/settings-service.api.js +26 -12
- package/dist/api/settings-service/settings-service.api.js.map +1 -1
- package/dist/components/features/mcp-page/custom-server-editor.cjs +1 -1
- package/dist/components/features/mcp-page/custom-server-editor.js +16 -16
- package/dist/components/features/mcp-page/installed-server-card.cjs +1 -1
- package/dist/components/features/mcp-page/installed-server-card.cjs.map +1 -1
- package/dist/components/features/mcp-page/installed-server-card.d.ts +2 -2
- package/dist/components/features/mcp-page/installed-server-card.js +6 -7
- package/dist/components/features/mcp-page/installed-server-card.js.map +1 -1
- package/dist/components/features/mcp-page/installed-servers-section.cjs +1 -1
- package/dist/components/features/mcp-page/installed-servers-section.cjs.map +1 -1
- package/dist/components/features/mcp-page/installed-servers-section.d.ts +2 -2
- package/dist/components/features/mcp-page/installed-servers-section.js +2 -2
- package/dist/components/features/mcp-page/installed-servers-section.js.map +1 -1
- package/dist/components/features/mcp-page/mcp-server-health.cjs +1 -1
- package/dist/components/features/mcp-page/mcp-server-health.js +4 -4
- package/dist/components/features/settings/mcp-settings/mcp-server-form.cjs +1 -1
- package/dist/components/features/settings/mcp-settings/mcp-server-form.cjs.map +1 -1
- package/dist/components/features/settings/mcp-settings/mcp-server-form.js +2 -1
- package/dist/components/features/settings/mcp-settings/mcp-server-form.js.map +1 -1
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +3 -3
- package/dist/config/defaults.js.map +1 -1
- package/dist/contexts/active-backend-context.cjs +1 -1
- package/dist/contexts/active-backend-context.cjs.map +1 -1
- package/dist/contexts/active-backend-context.d.ts +3 -2
- package/dist/contexts/active-backend-context.js +55 -42
- package/dist/contexts/active-backend-context.js.map +1 -1
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/hooks/mutation/use-update-mcp-server.cjs +1 -1
- package/dist/hooks/mutation/use-update-mcp-server.js +5 -5
- package/dist/hooks/query/use-cloud-current-user-id.cjs +1 -1
- package/dist/hooks/query/use-cloud-current-user-id.cjs.map +1 -1
- package/dist/hooks/query/use-cloud-current-user-id.js +7 -5
- package/dist/hooks/query/use-cloud-current-user-id.js.map +1 -1
- package/dist/hooks/query/use-cloud-organizations.cjs +1 -1
- package/dist/hooks/query/use-cloud-organizations.cjs.map +1 -1
- package/dist/hooks/query/use-cloud-organizations.js +5 -1
- package/dist/hooks/query/use-cloud-organizations.js.map +1 -1
- package/dist/hooks/use-can-manage-org-profiles.cjs +1 -1
- package/dist/hooks/use-can-manage-org-profiles.cjs.map +1 -1
- package/dist/hooks/use-can-manage-org-profiles.js +2 -1
- package/dist/hooks/use-can-manage-org-profiles.js.map +1 -1
- package/dist/hooks/use-tracking.cjs +1 -1
- package/dist/hooks/use-tracking.js +9 -9
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +2 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +1 -1
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +34 -0
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +2 -0
- package/dist/locales/ca/openhands.json +2 -0
- package/dist/locales/de/openhands.json +2 -0
- package/dist/locales/en/openhands.json +2 -0
- package/dist/locales/es/openhands.json +2 -0
- package/dist/locales/fr/openhands.json +2 -0
- package/dist/locales/it/openhands.json +2 -0
- package/dist/locales/ja/openhands.json +2 -0
- package/dist/locales/ko-KR/openhands.json +2 -0
- package/dist/locales/no/openhands.json +2 -0
- package/dist/locales/pt/openhands.json +2 -0
- package/dist/locales/tr/openhands.json +2 -0
- package/dist/locales/uk/openhands.json +2 -0
- package/dist/locales/zh-CN/openhands.json +2 -0
- package/dist/locales/zh-TW/openhands.json +2 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.js +9 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/dist/routes/app-settings.cjs +1 -1
- package/dist/routes/app-settings.js +5 -5
- package/dist/routes/mcp.cjs +1 -1
- package/dist/routes/mcp.cjs.map +1 -1
- package/dist/routes/mcp.js +73 -82
- package/dist/routes/mcp.js.map +1 -1
- package/dist/services/telemetry.cjs +1 -1
- package/dist/services/telemetry.cjs.map +1 -1
- package/dist/services/telemetry.d.ts +8 -0
- package/dist/services/telemetry.js +163 -116
- package/dist/services/telemetry.js.map +1 -1
- package/dist/types/mcp-server.d.ts +5 -0
- package/dist/types/settings.d.ts +3 -0
- package/dist/utils/mcp-config.cjs +1 -1
- package/dist/utils/mcp-config.cjs.map +1 -1
- package/dist/utils/mcp-config.d.ts +8 -0
- package/dist/utils/mcp-config.js +25 -20
- package/dist/utils/mcp-config.js.map +1 -1
- package/dist/utils/mcp-installed-servers.cjs +1 -1
- package/dist/utils/mcp-installed-servers.cjs.map +1 -1
- package/dist/utils/mcp-installed-servers.js +6 -3
- package/dist/utils/mcp-installed-servers.js.map +1 -1
- package/package.json +2 -2
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/dev-safe.mjs +2 -2
- package/build/assets/active-backend-context-BlZPzZNU.js +0 -1
- package/build/assets/agent-server-conversation-service.api-Btmi4q6d.js +0 -41
- package/build/assets/agent-settings-KQs-occT.js +0 -1
- package/build/assets/api-key-entry-screen-BhR24gkM.js +0 -1
- package/build/assets/app-settings-Bs4sY8WP.js +0 -1
- package/build/assets/automation-detail-CwDnJbYR.js +0 -2
- package/build/assets/backend-form-modal-Ce-KRHOJ.js +0 -1
- package/build/assets/check-BMOG005H.js +0 -1
- package/build/assets/chevron-down-CV1zZP_K.js +0 -1
- package/build/assets/circle-check-lvN_jFN5.js +0 -1
- package/build/assets/client-source-1v-kWLNU.js +0 -1
- package/build/assets/cloud-funnel-analytics-CasMM7EO.js +0 -1
- package/build/assets/conversation-C25pc2dT.js +0 -1
- package/build/assets/conversation-CObLYSJd.js +0 -90
- package/build/assets/conversation-panel-C25pc2dT.js +0 -1
- package/build/assets/conversation-state-store-DTq4hFoP.js +0 -1
- package/build/assets/extensions-hub-BKftOQ-X.js +0 -1
- package/build/assets/extensions-navigation-DF24q1H1.js +0 -1
- package/build/assets/files-tab-SAiFCnS5.js +0 -1
- package/build/assets/git-provider-icon-BREx-yUX.js +0 -1
- package/build/assets/home-EPNFgzUh.js +0 -1
- package/build/assets/index-home-EPNFgzUh.js +0 -1
- package/build/assets/install-server-modal-BI8yUfmr.js +0 -1
- package/build/assets/llm-settings-BXk5_Pac.js +0 -1
- package/build/assets/llm-settings-C1vpgWam.js +0 -1
- package/build/assets/loader-circle-6zlEYCJw.js +0 -1
- package/build/assets/manage-backends-modal-DhflyGTf.js +0 -1
- package/build/assets/manifest-8082e879.js +0 -1
- package/build/assets/markdown-renderer-CvOO0YIr.js +0 -8
- package/build/assets/mcp-CxLPda-W.js +0 -9
- package/build/assets/onboarding-modal-DdvE6rzw.js +0 -1
- package/build/assets/organization-service.api-CT2OQlLz.js +0 -1
- package/build/assets/plugins-management-service-DVkoM3eA.js +0 -1
- package/build/assets/plus-vIbGD459.js +0 -1
- package/build/assets/profiles-service.api-CBafmAPO.js +0 -1
- package/build/assets/providers-9UzRB9mT.js +0 -1
- package/build/assets/proxy-C79PCMjo.js +0 -1
- package/build/assets/root-Sj7W28yE.js +0 -2
- package/build/assets/root-layout-DbhKVoc7.js +0 -3
- package/build/assets/schema-field-CV6bFnoL.js +0 -1
- package/build/assets/search-sKuYKllf.js +0 -1
- package/build/assets/secrets-service-BjK-bPN2.js +0 -1
- package/build/assets/settings-Bj5Oo45A.js +0 -1
- package/build/assets/settings-service.api-DryhKdSr.js +0 -1
- package/build/assets/telemetry-cmCL3o6Z.js +0 -2
- package/build/assets/use-activate-agent-profile-DH33MvVj.js +0 -1
- package/build/assets/use-agent-profiles-Dmd_4H8q.js +0 -1
- package/build/assets/use-cloud-current-user-id-B6DP3s47.js +0 -1
- package/build/assets/use-config-Csy8EAP9.js +0 -1
- package/build/assets/use-llm-profiles-BMQoc612.js +0 -1
- package/build/assets/use-onboarding-completion-B-2BTS-y.js +0 -1
- package/build/assets/use-plugins-marketplace-PBc_XNz_.js +0 -1
- package/build/assets/use-settings-DBI44RnH.js +0 -1
- package/build/assets/use-settings-nav-items-Cva28C-c.js +0 -16
- package/build/assets/use-skills-RQsCtdzN.js +0 -1
- package/build/assets/use-tracking-CN1nIMnY.js +0 -1
- package/build/assets/utils-qjs_KuS4.js +0 -1
- package/build/assets/x-EjvKGawc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{n as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{A as a,g as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";import{t as s}from"./useQuery-B38jBavx.js";import{J as c,Z as l,dt as u,et as d,jt as f,n as p,ot as m}from"./active-backend-context-mY7Gff5c.js";import{E as h,t as g,z as _}from"./utils-DsWhWn2F.js";import{r as v,u as y}from"./messages-CdNfZPgd.js";import{r as b}from"./conversation-Dpc5nmGi.js";import{a as x,c as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k}from"./vendor~files-tab-atebg0iG.js";import{n as A,t as j}from"./format-time-delta-DICE64sz.js";import{i as M}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-VFnwct3q.js";import{t as N}from"./proxy-BiyDhMBd.js";import{s as P}from"./git-provider-icon-0PqmIS_S.js";import{c as ee,f as te}from"./conversation-store-C6hSXHw0.js";import{t as ne}from"./segmented-toggle-CZKOdIly.js";import{c as re,u as ie}from"./agent-server-conversation-service.api-C_7YnjzP.js";import{r as ae}from"./typography-B1UxuuEC.js";import{_ as F}from"./llm-not-configured-banner-Y4W9-sar.js";import{G as oe,J as se,K as I,h as L,q as R,t as ce,x as le}from"./markdown-renderer-U40HF0Ak.js";import{t as ue}from"./link-external-BDBCz-_z.js";import{n as de,t as fe}from"./highlighted-source-view-KMsA9c4a.js";import{t as z}from"./conversation-tab-empty-state-CDjvNgpG.js";var B=e(t(),1),V=n();function pe(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{className:`h-full`,icon:(0,V.jsx)(A,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(_.FILES$NO_FILE_SELECTED)})}var me=class{static async executeCommand(e,t,n,r,i=30){let a=m().backend;if(a.kind===`cloud`&&e){let o=await N({backend:a,method:`POST`,hostOverride:d(e),path:`/api/bash/execute_bash_command`,body:{command:n,...r?{cwd:r}:{},timeout:Math.floor(i)},authMode:`session-api-key`,sessionApiKey:t,timeoutSeconds:i+10});return{exit_code:o.exit_code??-1,stdout:o.stdout??``,stderr:o.stderr??``}}let o=await new M(l({conversationUrl:e,sessionApiKey:t})).executeCommand(n,r,i);return{exit_code:o.exit_code,stdout:o.stdout,stderr:o.stderr}}static async downloadFile(e,t,n){let r=m().backend;return r.kind===`cloud`&&e?(await N({backend:r,method:`GET`,hostOverride:d(e),path:`/api/file/download?path=${encodeURIComponent(n)}`,authMode:`session-api-key`,sessionApiKey:t,responseType:`blob`})).arrayBuffer():new o(l({conversationUrl:e,sessionApiKey:t})).downloadFile(n)}};function H(e){return e.startsWith(`/`)?e:`/${e}`}async function U(e,t,n,r){let i=m().backend;if(i.kind===`cloud`&&e){let a=new URLSearchParams({...r,path:H(r.path)});return N({backend:i,method:`GET`,hostOverride:d(e),path:`${n}?${a.toString()}`,authMode:`session-api-key`,sessionApiKey:t??void 0})}return(await new M(l({conversationUrl:e,sessionApiKey:t})).client.get(n,{params:r})).data}function he(e){return c(e,404)||a(e)&&e.response?.status===404}var W=class{static async getGitChanges(e,t,n,r){let i=m().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({backend:i,method:`GET`,path:`/api/v1/app-conversations/${e}/git/changes?${t.toString()}`});if(!Array.isArray(n))throw Error(`Invalid response from runtime - runtime may be unavailable`);return n.map(e=>({status:P(String(e.status)),path:e.path}))}let a=await new M(l({conversationUrl:t,sessionApiKey:n})).gitChanges(r);if(!Array.isArray(a))throw Error(`Invalid response from runtime - runtime may be unavailable`);return a.map(e=>({status:P(String(e.status)),path:e.path}))}static async getGitCommits(e,t,n,r=50){try{let i=await U(e,t,`/api/git/commits`,{path:n,limit:String(r)});return{commits:(i?.commits??[]).map(e=>({sha:e.sha,shortSha:e.short_sha,subject:e.subject,author:e.author,timestamp:e.timestamp})),hasMore:!!i?.has_more}}catch(e){if(he(e))return null;throw e}}static async getCommitChanges(e,t,n,r){let i=await U(e,t,`/api/git/commits/${encodeURIComponent(r)}/changes`,{path:n});if(!Array.isArray(i))throw Error(`Invalid response from runtime - runtime may be unavailable`);return i.map(e=>({status:P(String(e.status)),path:e.path}))}static async getGitChangeDiff(e,t,n,r,i){if(i){let e=await U(t,n,`/api/git/diff`,{path:r,commit:i});return{modified:e?.modified??``,original:e?.original??``,...e?.diff?{diff:e.diff}:{}}}let a=m().backend;if(a.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({backend:a,method:`GET`,path:`/api/v1/app-conversations/${e}/git/diff?${t.toString()}`});return{modified:n?.modified??``,original:n?.original??``,...n?.diff?{diff:n.diff}:{}}}let o=await new M(l({conversationUrl:t,sessionApiKey:n})).gitDiff(r);return{modified:o.modified??``,original:o.original??``,...o.diff?{diff:o.diff}:{}}}};function G(e,t){let n=t?.trim();if(n)return n;if(!e)return u;let r=e.split(`/`);return`${u}/${r[r.length-1]}`}var K=()=>{let{conversationId:e}=R(),{data:t}=I(),[n,r]=B.useState([]),i=B.useRef(null),a=b(),o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=B.useMemo(()=>G(l,u),[l,u]),f=s({queryKey:[`file_changes`,e,o,c,d],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitChanges(e,o,c,d)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:a&&!!e,meta:{disableToast:!0}});return B.useEffect(()=>{if(!f.isFetching&&f.isSuccess&&f.data){let e=f.data;if(e!==i.current)if(i.current=e,Array.isArray(e)){let t=new Set(e.map(e=>e.path)),i=new Set(n.map(e=>e.path)),a=e.filter(e=>!i.has(e.path)),o=n.filter(e=>t.has(e.path));r([...a,...o])}else r([e])}},[f.isFetching,f.isSuccess,f.data]),{data:n,isLoading:f.isLoading,isFetching:f.isFetching,isSuccess:f.isSuccess,isError:f.isError,error:f.error,refetch:f.refetch}},q=2e3,ge=[`.git`,`node_modules`,`.venv`,`venv`,`__pycache__`,`dist`,`build`,`.next`,`.cache`,`.pytest_cache`,`.mypy_cache`,`.turbo`,`.parcel-cache`,`target`];function _e(){return`find . \\( ${ge.map(e=>`-name '${e}' -prune`).join(` -o `)} \\) -o -type f -print 2>/dev/null | sort | head -n ${q}`}function ve(e){return e.startsWith(`./`)?e.slice(2):e}function ye(e){let{data:t}=I(),n=b(),r=t?.id,i=t?.conversation_url,a=t?.session_api_key,o=t?.workspace?.working_dir?.trim(),c=s({queryKey:[`workspace-files`,r,i,a,o],queryFn:async()=>{let e=await me.executeCommand(i,a,_e(),o,30);if(e.exit_code!==0)throw Error(e.stderr?.trim()||`Failed to list workspace files`);let t=e.stdout.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(ve);return Array.from(new Set(t)).slice(0,q)},enabled:e&&n&&!!r&&!!o,retry:!1,staleTime:1e3*30,gcTime:1e3*60*5,meta:{disableToast:!0}});return{data:c.data,isLoading:c.isLoading}}function be(e){let t=K(),n=(0,B.useMemo)(()=>{if(!e)return;let n=t.data.filter(e=>e.status!==`D`).map(e=>e.path);return Array.from(new Set(n)).slice(0,q)},[e,t.data]);return{data:e?n:void 0,isLoading:e?t.isLoading:!1}}function xe(){let{backend:e}=p(),t=e.kind===`cloud`,n=ye(!t),r=be(t);return t?r:n}function Se(){let{data:e}=I(),t=b(),n=e?.id,r=e?.conversation_url,i=e?.session_api_key,a=m().backend.kind===`local`,o=s({queryKey:[`workspace-session`,n,r,i],queryFn:async()=>({baseUrl:await new M(l({conversationUrl:r,sessionApiKey:i})).startWorkspaceSession(n)}),enabled:t&&!!n&&a,staleTime:1/0,gcTime:1/0,retry:!1});return{data:o.data??null,isLoading:o.isLoading,isError:o.isError,error:o.error??null}}function Ce(e,t){let n=(t??``).replace(/^\/+/,``);return n?`${e}${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`:e}var J=te(e=>({count:0,bump:()=>e(e=>({count:e.count+1}))}));function we(e,t){return e===null?null:`${e}${e.includes(`?`)?`&`:`?`}v=${t}`}var Te=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`svg`,`avif`]),Ee=new Set([`pdf`]);function Y(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function De(e){switch(Y(e)){case`html`:case`htm`:return`text/html`;case`css`:return`text/css`;case`js`:case`mjs`:case`cjs`:return`text/javascript`;case`json`:return`application/json`;case`md`:case`markdown`:return`text/markdown`;case`svg`:return`image/svg+xml`;case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;case`bmp`:return`image/bmp`;case`ico`:return`image/x-icon`;case`avif`:return`image/avif`;case`pdf`:return`application/pdf`;default:return`text/plain`}}function Oe(e){let t=Y(e);return Te.has(t)?`image`:Ee.has(t)?`pdf`:`text`}function ke(e){let t=new Uint8Array(e,0,Math.min(e.byteLength,8e3));for(let e=0;e<t.length;e+=1)if(t[e]===0)return!0;return!1}function X(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode.apply(null,t.subarray(e,e+n));return btoa(r)}function Ae(e){let{data:t}=I(),n=b(),{data:r}=Se(),i=J(e=>e.count),a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=r?.baseUrl,f=m().backend.kind===`cloud`,p=G(l,u),h=p.startsWith(`/`)?p:`/${p}`,g=e?`${h}/${e}`:null;return s({queryKey:[`workspace-file-content`,a,o,c,f?`cloud`:d,e,g,i],queryFn:async()=>{if(!e)throw Error(`No path`);let t=Oe(e),n=De(e);if(f){let r=await re(a,g);if(t===`text`){let t=new TextEncoder().encode(r);return ke(t.buffer)?{path:e,kind:`binary`,text:null,staticUrl:`data:application/octet-stream;base64,${X(t.buffer)}`,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:r,staticUrl:`data:${n};charset=utf-8;base64,${X(t.buffer)}`,mimeType:n}}return{path:e,kind:t,text:null,staticUrl:`data:${n};base64,${X(new TextEncoder().encode(r).buffer)}`,mimeType:n}}if(!d)throw Error(`No workspace session`);let r=Ce(d,e);if(t!==`text`)return{path:e,kind:t,text:null,staticUrl:r,mimeType:n};let i=await fetch(r,{credentials:`include`});if(!i.ok)throw Error(`Failed to read ${e}: ${i.status}`);let o=await i.arrayBuffer();return ke(o)?{path:e,kind:`binary`,text:null,staticUrl:r,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:new TextDecoder(`utf-8`,{fatal:!1}).decode(o),staticUrl:r,mimeType:n}},enabled:n&&!!a&&!!e&&(f||!!d),retry:!1,staleTime:1e3*5,gcTime:1e3*60,meta:{disableToast:!0}})}function je(){let{data:e,isLoading:t}=I(),n=e?.id?ie(e.id):null;return{hasAttachedSource:!!e?.selected_repository||!!n?.selected_workspace,isLoading:t}}function Me(e){let{data:t}=I(),n=b(),{backend:r}=p(),i=r.kind===`local`,a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.workspace?.working_dir?.trim(),u=(e?.enabled??!0)&&i&&n&&!!a&&!!l,d=s({queryKey:[`has-git-commits`,a,o,c,l],queryFn:async()=>(await me.executeCommand(o,c,`git rev-parse --verify HEAD`,l,10)).exit_code===0,enabled:u,retry:!1,staleTime:6e4,gcTime:5*6e4,meta:{disableToast:!0}});return{hasCommits:d.data??null,isLoading:d.isLoading}}var Ne=new Set([`FileEditorObservation`,`StrReplaceEditorObservation`,`PlanningFileEditorObservation`]),Pe=new Set([`view`]),Fe=new Set([`ExecuteBashObservation`,`TerminalObservation`]);function Ie(e){let t=e.observation;return!(!t||typeof t.kind!=`string`||!Ne.has(t.kind)||t.command&&Pe.has(t.command))}function Le(e){let t=e.observation;return!!t&&typeof t.kind==`string`&&Fe.has(t.kind)}function Re(){let e=r(),t=le(e=>e.events),n=J(e=>e.bump),i=(0,B.useRef)(new Set),a=(0,B.useRef)(new WeakSet);(0,B.useEffect)(()=>{let r=!1,o=!1;for(let e of t){let t=`id`in e?e.id:void 0;(t===void 0?a.current.has(e):i.current.has(t))||(t===void 0?a.current.add(e):i.current.add(t),Ie(e)?r=!0:Le(e)&&(o=!0))}!r&&!o||(e.invalidateQueries({queryKey:[`file_changes`]}),e.invalidateQueries({queryKey:[`file_diff`]}),e.invalidateQueries({queryKey:[`git_commits`]}),r&&(e.invalidateQueries({queryKey:[`workspace-files`]}),e.invalidateQueries({queryKey:[`workspace-file-content`]}),n()))},[t,e,n])}var ze=[`index.html`,`index.htm`,`readme.md`,`readme`,`main.html`,`app.html`,`index.js`,`index.ts`,`index.tsx`,`index.jsx`,`main.py`,`app.py`,`main.go`,`main.rs`,`main.java`,`main.c`,`main.cpp`,`package.json`,`pyproject.toml`,`cargo.toml`,`go.mod`,`pom.xml`,`dockerfile`,`makefile`],Be=[`license`,`license.md`,`license.txt`,`changelog.md`,`agents.md`,`tsconfig.json`,`.env.sample`,`.env.example`];function Ve(e){let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()}function He(e){return e.split(`/`).filter(Boolean).length-1}function Ue(e){let t=Ve(e),n=ze.indexOf(t);if(n!==-1)return n;let r=Be.indexOf(t);return r===-1?1e4:1e3+r}function We(e){return[...e].sort((e,t)=>{let n=He(e)-He(t);if(n!==0)return n;let r=Ue(e)-Ue(t);return r===0?e.localeCompare(t):r})}function Ge({paths:e,selectedPath:t,onSelectFile:n,isTreeVisible:r,onToggleTree:a}){let{t:o}=i(`openhands`),s=(0,B.useMemo)(()=>We(e),[e]);return(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-[var(--oh-border)] px-2 py-1.5 min-h-[34px]`,"data-testid":`file-quick-row`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:a,"data-testid":`file-quick-row-tree-toggle`,"aria-pressed":r,"aria-label":o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),title:o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),className:g(`shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md cursor-pointer`,`text-[var(--oh-text-tertiary)] hover:bg-tertiary`,r&&`bg-[var(--oh-surface-raised)]`),children:(0,V.jsx)(w,{className:`w-3 h-3`,"aria-hidden":!0,strokeWidth:2})}),s.length>0&&(0,V.jsx)(`div`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden flex-1 min-w-0`,children:s.map(e=>{let r=t===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:e,"data-testid":`file-quick-row-item-${e}`,className:g(`inline-flex items-center px-2 py-0.5 text-xs whitespace-nowrap rounded-md cursor-pointer`,r?`bg-[var(--oh-interactive-hover)] text-white`:`bg-[var(--oh-surface-raised)] text-[var(--oh-text-tertiary)] hover:bg-tertiary`),children:e},e)})})]})}var Ke=new Set([`html`,`htm`,`svg`]),qe=new Set([`md`,`markdown`,`mdx`]),Je={pptx:`PowerPoint`,ppt:`PowerPoint`,docx:`Word`,doc:`Word`,xlsx:`Excel`,xls:`Excel`};function Z(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function Q({path:e}){let{t}=i(`openhands`),n=Je[Z(e)];return(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":n?`file-content-viewer-unsupported-document`:`file-content-viewer-binary-fallback`,children:n?t(_.FILES$UNSUPPORTED_DOCUMENT,{type:n}):t(_.FILES$BINARY_FALLBACK)})}function Ye({path:e,viewMode:t}){let{t:n}=i(`openhands`),r=Ae(e),a=J(e=>e.count);if(r.isLoading)return(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,children:n(_.FILES$LOADING_FILES)});if(r.isError||!r.data)return(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":`file-content-viewer-error`,children:r.error?.message??n(_.FILES$LOAD_ERROR)});let{kind:o,text:s,staticUrl:c,mimeType:l}=r.data,u=we(c,a);return t===`plain`?o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e}):o===`image`?(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center bg-[var(--oh-surface)] p-4`,"data-testid":`file-content-viewer-image`,children:(0,V.jsx)(`img`,{src:u,alt:e,className:`max-h-full max-w-full object-contain`})}):o===`pdf`?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`binary`?(0,V.jsx)(Q,{path:e}):l===`text/html`||Ke.has(Z(e))?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`text`&&qe.has(Z(e))?(0,V.jsx)(`div`,{"data-testid":`file-content-viewer-markdown`,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] text-white custom-scrollbar-always`,children:(0,V.jsx)(`div`,{className:`prose prose-sm prose-invert max-w-none p-6 [--tw-prose-body:#fff] [--tw-prose-bold:#fff] [--tw-prose-headings:#fff] [--tw-prose-lead:#fff] [--tw-prose-counters:#fff] [--tw-prose-quotes:#fff] [--tw-prose-quote-borders:var(--oh-border-subtle)] [--tw-prose-bullets:var(--oh-muted)] [--tw-prose-hr:var(--oh-border-subtle)] [--tw-prose-captions:var(--oh-muted)] [--tw-prose-kbd:#fff]`,children:(0,V.jsx)(ce,{content:s??``,includeStandard:!0,includeHeadings:!0})})}):o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e})}var Xe=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 13 15`,fill:`none`,...e,children:(0,V.jsx)(`path`,{d:`M6.59467 0.21967C6.88756 -0.0732233 7.36244 -0.0732233 7.65533 0.21967L9.90533 2.46967C10.1982 2.76256 10.1982 3.23744 9.90533 3.53033L7.65533 5.78033C7.36244 6.07322 6.88756 6.07322 6.59467 5.78033C6.30178 5.48744 6.30178 5.01256 6.59467 4.71967L7.56434 3.75H6.375C3.71421 3.75 1.5 5.96421 1.5 8.625C1.5 11.2858 3.71421 13.5 6.375 13.5C9.03579 13.5 11.25 11.2858 11.25 8.625C11.25 8.21079 11.5858 7.875 12 7.875C12.4142 7.875 12.75 8.21079 12.75 8.625C12.75 12.1142 9.86421 15 6.375 15C2.88579 15 0 12.1142 0 8.625C0 5.13579 2.88579 2.25 6.375 2.25H7.56434L6.59467 1.28033C6.30178 0.987437 6.30178 0.512563 6.59467 0.21967Z`,fill:`currentColor`})}),Ze=()=>{let{conversationId:e}=R(),{data:t}=I(),n=b(),r=t?.conversation_url,i=t?.session_api_key,a=t?.selected_repository,o=t?.workspace?.working_dir?.trim(),c=B.useMemo(()=>G(a,o),[a,o]),l=s({queryKey:[`git_commits`,e,r,i,c],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitCommits(r,i,c,50)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:n&&!!e,meta:{disableToast:!0}});return{commits:l.data?.commits??[],hasMore:l.data?.hasMore??!1,isUnsupported:l.data===null,isLoading:l.isLoading,isFetching:l.isFetching,isSuccess:l.isSuccess,isError:l.isError}},Qe=e=>(0,V.jsx)(`svg`,{width:13,height:8,viewBox:`0 0 13 8`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,V.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.259766 6.17427L6.26425 0.715628L12.2688 6.17427L11.2597 7.28418L6.26425 2.74282L1.26878 7.28418L0.259766 6.17427Z`,fill:`currentColor`})}),$e=e=>{let{conversationId:t}=R(),{data:n}=I(),r=n?.conversation_url,i=n?.session_api_key,a=n?.selected_repository,o=n?.workspace?.working_dir?.trim(),c=B.useMemo(()=>`${G(a,o)}/${e.filePath}`,[a,e.filePath,o]),l=e.type===`D`;return s({queryKey:e.commit?[`commit_file_diff`,t,r,i,e.commit,c]:[`file_diff`,t,r,i,c],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return W.getGitChangeDiff(t,r,i,c,e.commit)},enabled:e.enabled&&(!l||!!e.commit),staleTime:e.commit?1/0:1e3*60*5,gcTime:1e3*60*15})};function et({className:e}){let{t}=i(`openhands`);return(0,V.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,V.jsx)(`div`,{className:g(`animate-spin rounded-full border-4 border-transparent border-t-white`,e),role:`status`,"aria-label":t(_.HOME$LOADING)})})}function tt({height:e,children:t}){return(0,V.jsx)(`div`,{"data-testid":`editor-container`,className:`w-full border-b border-[var(--oh-border)] overflow-hidden h-[var(--editor-height)]`,style:{"--editor-height":`${e}px`},children:t})}var nt=[{mode:`old`,icon:E},{mode:`diff`,icon:x},{mode:`new`,icon:k}],rt={renderValidationDecorations:`off`,readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},automaticLayout:!0,scrollbar:{alwaysConsumeMouseWheel:!1}},it={A:C,D,M:T,R:`Renamed`,U:`Untracked`},at=e=>{e.editor.defineTheme(`custom-diff-theme`,{base:`vs-dark`,inherit:!0,rules:[{token:`comment`,foreground:`6a9955`},{token:`keyword`,foreground:`569cd6`},{token:`string`,foreground:`ce9178`},{token:`number`,foreground:`b5cea8`}],colors:{"diffEditor.insertedTextBackground":`#014b01AA`,"diffEditor.removedTextBackground":`#750000AA`,"diffEditor.insertedLineBackground":`#003f00AA`,"diffEditor.removedLineBackground":`#5a0000AA`,"diffEditor.border":`var(--oh-border-subtle)`,"editorUnnecessaryCode.border":`#00000000`,"editorUnnecessaryCode.opacity":`rgba(0, 0, 0, 0.467)`}})};function ot({path:e,type:t,commit:n}){let{t:r}=i(`openhands`),[a,o]=B.useState(!0),[s,c]=B.useState(400),[l,u]=B.useState(`diff`),d=B.useRef(null),f=B.useRef(null),p=t===`A`||t===`U`,m=t===`D`,h=B.useMemo(()=>{if(t===`R`){let t=e.split(/\s+/).slice(1);return t[t.length-1]}return e},[e,t]),{data:y,isLoading:b,isSuccess:x,isRefetching:C}=$e({filePath:h,type:t,enabled:!a,commit:n}),w=B.useCallback(()=>{if(!d.current)return;let e=d.current.getOriginalEditor(),t=d.current.getModifiedEditor();e&&t&&c(Math.max(e.getContentHeight(),t.getContentHeight())+20)},[]),T=B.useCallback(()=>{f.current&&c(f.current.getContentHeight()+20)},[]),E=e=>{d.current=e,w(),e.getOriginalEditor().onDidContentSizeChange(w),e.getModifiedEditor().onDidContentSizeChange(w)},D=e=>{f.current=e,T(),e.onDidContentSizeChange(T)},k=(t===`U`?it.A:it[t])||`?`,A=typeof k==`string`?(0,V.jsx)(ae.Text,{children:k}):B.createElement(k,{className:`w-5 h-5`}),j=b||C,M=v(h),N=M===`markdown`,P=l===`old`?y?.original??``:y?.modified??``;return(0,V.jsxs)(`div`,{"data-testid":`file-diff-viewer-outer`,className:`w-full flex flex-col`,children:[(0,V.jsx)(`div`,{className:`flex justify-between items-center px-3 py-2.5 border-b border-[var(--oh-border)] hover:cursor-pointer`,onClick:()=>o(e=>!e),children:(0,V.jsxs)(`span`,{className:`text-sm w-full text-content flex items-center gap-2`,children:[j?(0,V.jsx)(et,{className:`w-4 h-4`}):A,(0,V.jsx)(`strong`,{className:`w-full truncate font-medium`,children:h}),!a&&!m&&(0,V.jsx)(`span`,{className:`flex items-center gap-0.5 shrink-0`,onClick:e=>e.stopPropagation(),children:nt.map(({mode:e,icon:t})=>(0,V.jsx)(`button`,{"data-testid":`view-mode-${e}`,type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:g(`p-1 rounded transition-colors cursor-pointer`,l===e?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-white`),children:(0,V.jsx)(t,{className:`w-4 h-4`})},e))}),(0,V.jsx)(`button`,{"data-testid":`collapse`,type:`button`,children:(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform`,a&&`transform rotate-180`)})})]})}),!a&&m&&!n&&(0,V.jsx)(`div`,{"data-testid":`file-deleted-message`,className:`w-full border-b border-[var(--oh-border)] p-4 bg-base text-[var(--oh-text-dim)] text-sm`,children:r(_.DIFF_VIEWER$FILE_DELETED)}),!a&&(!m||!!n)&&x&&(l===`diff`?(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(S,{"data-testid":`file-diff-viewer`,className:`w-full h-full`,language:M,original:p?``:y?.original??``,modified:m?``:y?.modified??``,theme:`custom-diff-theme`,onMount:E,beforeMount:at,options:{...rt,renderSideBySide:!p&&!m,hideUnchangedRegions:{enabled:!0}}})}):N?(0,V.jsx)(`div`,{className:`w-full border-b border-[var(--oh-border)] overflow-auto p-4 bg-base prose prose-invert max-w-none`,"data-testid":`markdown-preview`,children:(0,V.jsx)(ce,{content:P,includeStandard:!0,includeHeadings:!0})}):(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(O,{"data-testid":`file-single-viewer`,className:`w-full h-full`,language:M,value:P,theme:`custom-diff-theme`,beforeMount:at,onMount:D,options:rt})}))]})}function $(){return(0,V.jsx)(T,{"aria-hidden":!0,className:`size-full`})}function st(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_CHANGES)})}var ct=[{key:_.TIPS$CUSTOMIZE_MICROAGENT,link:`https://docs.all-hands.dev/usage/prompting/microagents-repo`},{key:_.TIPS$SETUP_SCRIPT,link:`https://docs.all-hands.dev/usage/prompting/repository#setup-script`},{key:_.TIPS$VSCODE_INSTANCE},{key:_.TIPS$SAVE_WORK},{key:_.TIPS$SPECIFY_FILES,link:`https://docs.all-hands.dev/usage/prompting/prompting-best-practices`},{key:_.TIPS$HEADLESS_MODE,link:`https://docs.all-hands.dev/usage/how-to/headless-mode`},{key:_.TIPS$CLI_MODE,link:`https://docs.all-hands.dev/usage/how-to/cli-mode`},{key:_.TIPS$GITHUB_HOOK,link:`https://docs.all-hands.dev/usage/cloud/github-installation#working-on-github-issues-and-pull-requests-using-openhands`},{key:_.TIPS$BLOG_SIGNUP,link:`https://www.all-hands.dev/blog`},{key:_.TIPS$API_USAGE,link:`https://docs.all-hands.dev/api-reference/health-check`}];function lt(){return ct[Math.floor(Math.random()*ct.length)]}function ut(){let{t:e}=i(`openhands`),[t,n]=B.useState(lt());return B.useEffect(()=>{n(lt())},[]),(0,V.jsx)(`div`,{className:`w-full bg-tertiary p-4 text-left`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(y,{className:`mt-0.5 h-4 w-4 shrink-0 fill-[var(--oh-muted)]`,"aria-hidden":!0}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-[var(--oh-text-tertiary)]`,children:e(_.TIPS$PROTIP)}),(0,V.jsxs)(`p`,{className:`text-sm font-normal leading-5 text-[var(--oh-muted)]`,children:[e(t.key),t.link?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:t.link,target:`_blank`,rel:`noopener noreferrer`,className:`underline transition-colors hover:text-white`,children:e(_.TIPS$LEARN_MORE)})]}):null]})]})]})})}var dt=/not a git repository/i,ft=new Set([_.DIFF_VIEWER$WAITING_FOR_RUNTIME,_.DIFF_VIEWER$LOADING]);function pt({messages:e}){let{t}=i(`openhands`);return e.length===1&&ft.has(e[0])?(0,V.jsx)(F,{testId:`changes-tab-status`,messageKey:e[0]}):(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e.map(e=>(0,V.jsx)(`span`,{className:`block`,children:t(e)},e))})}function mt(){let{data:e,isSuccess:t,isError:n,error:r,isLoading:i}=K(),[a,o]=B.useState(null),{curAgentState:s}=oe(),c=!h.includes(s),l=r&&dt.test(f(r));return B.useEffect(()=>{if(!c)o([_.DIFF_VIEWER$WAITING_FOR_RUNTIME]);else if(r){let e=f(r);dt.test(e)?o([_.DIFF_VIEWER$NOT_A_GIT_REPO,_.DIFF_VIEWER$ASK_OH]):o([e])}else o(i?[_.DIFF_VIEWER$LOADING]:null)},[c,l,i,r,o]),(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:!t||!e.length?(0,V.jsxs)(`div`,{className:`flex flex-col h-full w-full`,children:[(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[a&&(0,V.jsx)(pt,{messages:a}),!a&&t&&e.length===0&&(0,V.jsx)(st,{})]}),!n&&t&&e.length===0&&(0,V.jsx)(ut,{})]}):(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:e.slice(0,100).map(e=>(0,V.jsx)(ot,{path:e.path,type:e.status},e.path))})})}var ht=(e,t)=>{let{conversationId:n}=R(),{data:r}=I(),i=b(),a=r?.conversation_url,o=r?.session_api_key,c=r?.selected_repository,l=r?.workspace?.working_dir?.trim(),u=B.useMemo(()=>G(c,l),[c,l]);return s({queryKey:[`commit_changes`,n,a,o,u,e],queryFn:async()=>{if(!n)throw Error(`No conversation ID`);return W.getCommitChanges(a,o,u,e)},staleTime:1/0,gcTime:1e3*60*15,retry:!1,enabled:t.enabled&&i&&!!n,meta:{disableToast:!0}})};function gt({commit:e,showAuthor:t,isExpanded:n,onToggle:r}){let{t:a}=i(`openhands`),{data:o,isLoading:s,isSuccess:c}=ht(e.sha,{enabled:n});return(0,V.jsxs)(`div`,{"data-testid":`commit-row`,className:`w-full flex flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,"data-testid":`commit-row-toggle`,className:`w-full flex items-center gap-2 px-3 py-2.5 border-b border-[var(--oh-border)] text-sm text-content text-left hover:cursor-pointer`,children:[(0,V.jsx)(`code`,{className:`font-mono text-xs text-[var(--oh-muted)] flex-shrink-0`,children:e.shortSha}),(0,V.jsx)(`strong`,{className:`flex-1 truncate font-medium`,children:e.subject}),t&&(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate max-w-32 flex-shrink-0`,children:e.author}),(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] flex-shrink-0`,children:`${j(e.timestamp)} ${a(_.CONVERSATION$AGO)}`}),(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform flex-shrink-0`,!n&&`transform rotate-180`)})]}),n&&(0,V.jsxs)(`div`,{"data-testid":`commit-row-content`,className:`w-full flex flex-col pl-6`,children:[s&&(0,V.jsx)(`div`,{className:`p-3`,children:(0,V.jsx)(et,{className:`w-4 h-4`})}),c&&o?.map(t=>(0,V.jsx)(ot,{path:t.path,type:t.status,commit:e.sha},t.path))]})]})}function _t({commits:e,hasMore:t}){let{t:n}=i(`openhands`),[r,a]=B.useState(null),o=new Set(e.map(e=>e.author)).size>1;return(0,V.jsxs)(`section`,{"data-testid":`commit-list`,className:`w-full flex flex-col`,children:[e.map(e=>(0,V.jsx)(gt,{commit:e,showAuthor:o,isExpanded:r===e.sha,onToggle:()=>a(t=>t===e.sha?null:e.sha)},e.sha)),t&&(0,V.jsx)(`div`,{"data-testid":`commit-list-cap-notice`,className:`px-3 py-2.5 text-xs text-[var(--oh-muted)]`,children:n(_.DIFF_VIEWER$COMMITS_CAP,{count:e.length})})]})}function vt(){let{t:e}=i(`openhands`),{conversationId:t}=R(),{commits:n,hasMore:r,isUnsupported:a,isLoading:o,isSuccess:s}=Ze(),{curAgentState:c}=oe(),l=!h.includes(c);return(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:s&&!a&&n.length>0?(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:(0,V.jsx)(_t,{commits:n,hasMore:r},t)}):(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[!l&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$WAITING_FOR_RUNTIME}),l&&o&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$LOADING}),l&&!o&&(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_COMMITS)})]})})}function yt(){let{t:e}=i(`openhands`);Re();let{hasAttachedSource:t,isLoading:n}=je(),{hasCommits:a}=Me({enabled:t}),{conversationId:o}=se(),{state:s,setFilesTabDiffView:c,setFilesTabContentViewMode:l}=ee(o??``),u=(t||n)&&a!==!1,d=s.filesTabDiffView??u,f=s.filesTabContentViewMode,{isSuccess:p,isUnsupported:m}=Ze(),h=p&&!m,[g,v]=(0,B.useState)(!1),y=d?`on`:`off`;g&&h&&(y=`commits`);let[b,x]=(0,B.useState)(!1),S=xe(),C=(0,B.useMemo)(()=>S.data??[],[S.data]),w=L(e=>e.selectedPath),T=L(e=>e.selectedConversationId),E=L(e=>e.setSelectedPath),D=T===o?w:null,O=(0,B.useCallback)(e=>E(e,o),[o,E]),k=Ae(D),A=J(e=>e.count),j=we(k.data?.staticUrl??null,A);(0,B.useEffect)(()=>{T!==o&&E(null,o)},[T,o,E]),(0,B.useEffect)(()=>{if(D||C.length===0)return;let[e]=We(C);e&&E(e,o)},[C,D,o,E]);let M=r(),{refetch:N,isFetching:P}=K(),te=()=>{N(),M.invalidateQueries({queryKey:[`workspace-files`]}),M.invalidateQueries({queryKey:[`workspace-file-content`]}),M.invalidateQueries({queryKey:[`git_commits`]})};return(0,V.jsxs)(`main`,{className:`h-full w-full flex flex-col items-stretch`,"data-testid":`files-tab`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-b border-[var(--oh-border)]`,children:[(0,V.jsx)(ne,{ariaLabel:e(_.FILES$DIFF_VIEW),testId:`files-tab-diff-toggle`,value:y,options:[{value:`on`,label:e(_.FILES$DIFF_VIEW)},...h?[{value:`commits`,label:e(_.DIFF_VIEWER$COMMITS)}]:[],{value:`off`,label:e(_.COMMON$FILES)}],onChange:e=>{e===`commits`?v(!0):(v(!1),c(e===`on`))}}),y===`off`&&(0,V.jsx)(ne,{ariaLabel:e(_.FILES$RICH),testId:`files-tab-content-mode-toggle`,value:f,options:[{value:`rich`,label:e(_.FILES$RICH)},{value:`plain`,label:e(_.FILES$PLAIN)}],onChange:l}),(0,V.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[y===`off`&&j&&(0,V.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(_.FILES$OPEN_IN_NEW_WINDOW),title:e(_.FILES$OPEN_IN_NEW_WINDOW),"data-testid":`files-tab-open-in-new-window`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:bg-[var(--oh-interactive-hover)] cursor-pointer text-white`,children:(0,V.jsx)(ue,{width:14,height:14})}),(0,V.jsx)(`button`,{type:`button`,onClick:te,disabled:P,"aria-label":e(_.FILES$REFRESH),title:e(_.FILES$REFRESH),"data-testid":`files-tab-refresh`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:enabled:bg-[var(--oh-interactive-hover)] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,V.jsx)(Xe,{width:12.75,height:15,color:`#ffffff`,className:P?`animate-spin`:``})})]})]}),y===`on`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(mt,{})}),y===`commits`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(vt,{})}),y===`off`&&(0,V.jsx)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:S.isLoading?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--oh-muted)]`,children:e(_.FILES$LOADING_FILES)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ge,{paths:C,selectedPath:D,onSelectFile:O,isTreeVisible:b,onToggleTree:()=>x(e=>!e)}),(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1`,children:[b&&(0,V.jsx)(`aside`,{className:`w-56 shrink-0 border-r border-[var(--oh-border)] overflow-y-auto custom-scrollbar-always`,"data-testid":`files-tab-tree`,children:(0,V.jsx)(de,{paths:C,selectedPath:D,onSelectFile:O})}),(0,V.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"data-testid":`files-tab-content`,children:D?(0,V.jsx)(Ye,{path:D,viewMode:f}):(0,V.jsx)(pe,{})})]})]})})]})}export{yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./utils-
|
|
1
|
+
import{t as e}from"./utils-DsWhWn2F.js";var t=`h-9 min-h-9`,n=`rounded-lg`,r=`border border-[var(--oh-border)]`,i=`bg-base-secondary`,a=`duration-75`,o=`!duration-75`,s=`motion-reduce:transition-none`,c=e(`transition-[background-color,border-color,box-shadow,opacity]`,a,s),l=e(`!transition-[background-color,border-color,box-shadow,opacity]`,o,s),u=e(`transition-[transform] ease`,a,s),d=`hover:text-white hover:bg-white/10`,f=e(`inline-flex items-center gap-1 rounded-[100px] border border-transparent px-1.5`,`text-sm font-normal leading-5 text-[var(--oh-muted)] whitespace-nowrap min-w-0 cursor-pointer`,c,d),p=e(`flex items-center justify-center rounded-full text-[var(--oh-muted)] cursor-pointer`,c,d),m=`focus:border-white/40 focus:ring-1 focus:ring-white/20 focus:outline-none`,h=`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,g=`disabled:cursor-not-allowed disabled:opacity-60`,_=e(t,n,r,i,c,m,g,`w-full min-w-0 px-3 text-sm text-white placeholder:text-tertiary-alt`),v=e(_,`placeholder:italic`,l),y=e(n,r,i,c,m,g,`w-full min-w-0 px-3 py-2 text-sm text-white placeholder:text-tertiary-alt`),b=e(t,`relative flex min-w-0 items-center`,n,r,i,c,h),x=e(`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm outline-none`,`placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`),S=e(t,`inline-flex w-fit cursor-pointer items-center justify-center gap-2 px-3`,n,c,`text-sm font-normal disabled:cursor-not-allowed disabled:opacity-30`),C=`pl-12`;e(S,r,i,`shrink-0 text-white`);var w=e(`inline-flex items-center gap-2 self-start rounded-lg p-2`,`text-sm font-normal leading-5 text-[var(--oh-muted)] cursor-pointer`,c,`hover:bg-tertiary hover:text-white`);export{c as _,S as a,x as c,n as d,v as f,u as g,C as h,r as i,y as l,i as m,f as n,g as o,b as p,w as r,_ as s,p as t,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-
|
|
1
|
+
import{E as e}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";var t=e(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),n=e=>e.includes(`Z`)||e.match(/[+-]\d{2}:\d{2}$/)!==null?new Date(e):new Date(`${e}Z`),r=e=>{let t=typeof e==`string`?n(e):e,r=new Date().getTime()-t.getTime(),i=Math.floor(r/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24),c=Math.floor(s/30),l=Math.floor(c/12);return i<60?`${i}s`:a<60?`${a}m`:o<24?`${o}h`:s<30?`${s}d`:c<12?`${c}mo`:`${l}y`};export{t as n,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{n as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{a,o,t as s,u as c}from"./vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-CmzCY1BT.js";import{w as l}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";import{t as u}from"./useMutation-DHLpZ6J0.js";import{t as d}from"./useQuery-B38jBavx.js";import{Dt as f,Et as p,Z as m,n as h,ot as g}from"./active-backend-context-mY7Gff5c.js";import{C as ee,_,i as v,t as y,z as b}from"./utils-DsWhWn2F.js";import{i as x}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-VFnwct3q.js";import{t as S}from"./proxy-BiyDhMBd.js";import{t as C}from"./use-tracking-COqZLobY.js";import{n as te}from"./use-settings-DIAo5KFk.js";import{n as w}from"./navigation-context-BOGzIng3.js";import{t as ne}from"./dist-hOnv1nn2.js";import{d as re,f as T,l as E,n as ie}from"./conversation-store-C6hSXHw0.js";import{t as D}from"./agent-server-conversation-service.api-C_7YnjzP.js";import{t as ae}from"./use-is-authed-BsS4XwSL.js";import{d as oe,u as se}from"./conversation-state-store-CGRQemtx.js";var O=n(),k=ne(`shrink-0 self-stretch min-w-full bg-[var(--oh-border)]`,{variants:{orientation:{horizontal:`h-[1px]`},color:{light:`bg-[var(--oh-border)]`},size:{thin:`h-[1px]`},inset:{none:``,menu:``}},defaultVariants:{orientation:`horizontal`,color:`light`,size:`thin`,inset:`none`}});function A({orientation:e,color:t,size:n,inset:r,className:i,testId:a}){return r===`menu`?(0,O.jsx)(`div`,{"data-testid":a,role:`separator`,className:y(`relative min-w-full shrink-0 self-stretch`,`h-3`,i),children:(0,O.jsx)(`div`,{"aria-hidden":!0,className:`absolute top-1/2 -left-1 -right-1 h-px -translate-y-1/2 bg-[var(--oh-border)]`})}):(0,O.jsx)(`div`,{"data-testid":a,role:`separator`,className:y(k({orientation:e,color:t,size:n,inset:r}),i)})}var j=()=>{let e=r();return u({mutationFn:e=>D.deleteConversation(e.conversationId),onMutate:async t=>{await e.cancelQueries({queryKey:[`user`,`conversations`]});let n=e.getQueryData([`user`,`conversations`]);return e.setQueryData([`user`,`conversations`],e=>e?.filter(e=>e.conversation_id!==t.conversationId)),{previousConversations:n}},onSuccess:(e,t)=>{ie(t.conversationId)},onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:()=>{e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`start-tasks`]})}})},M=()=>{let{t:e}=i(`openhands`),t=r(),{conversationId:n,navigate:a}=w();return u({mutationKey:[`stop-conversation`],mutationFn:async e=>oe(e.conversationId),onMutate:async()=>{let n=l.loading(e(b.TOAST$STOPPING_CONVERSATION),p);return await t.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:t.getQueryData([`user`,`conversations`]),toastId:n}},onError:(n,r,i)=>{i?.toastId&&l.dismiss(i.toastId),f(e(b.TOAST$FAILED_TO_STOP_CONVERSATION)),i?.previousConversations&&t.setQueryData([`user`,`conversations`],i.previousConversations)},onSuccess:(r,i,o)=>{o?.toastId&&l.dismiss(o.toastId),l.success(e(b.TOAST$CONVERSATION_STOPPED),p),se(t,i.conversationId,{execution_status:ee.PAUSED,sandbox_status:`PAUSED`}),n===i.conversationId&&a(`/conversations`)}})};function N(e){return e===`MISSING`||e===`ERROR`}var P=e(t()),F=e=>(0,O.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,O.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M22.1595 5.22752L20.9895 4.95152L17.8275 8.09552L16.0365 6.27152L19.1205 3.03602L18.8505 1.84802C18.1988 1.62999 17.5172 1.51461 16.83 1.50602C16.0804 1.49449 15.3365 1.63746 14.6445 1.92602C13.9764 2.22843 13.3725 2.65616 12.8655 3.18602C12.3011 3.72063 11.8542 4.36683 11.553 5.08352C10.9732 6.50984 10.9732 8.10619 11.553 9.53252C8.42587 12.609 5.3391 15.7263 2.29351 18.8835C1.97851 19.296 1.82851 19.8105 1.86751 20.328C1.89825 20.8846 2.14856 21.4063 2.56351 21.7785C2.74951 21.981 2.97151 22.149 3.21901 22.2705C3.47401 22.383 3.74851 22.4475 4.02601 22.461C4.50001 22.452 4.95451 22.272 5.30701 21.9555C7.62901 19.77 12.078 15.2805 14.6055 12.6495C15.291 12.9405 16.0275 13.0905 16.7715 13.089C17.5204 13.0884 18.2616 12.9377 18.9513 12.6458C19.641 12.3539 20.2652 11.9267 20.787 11.3895C21.8588 10.2964 22.4575 8.82543 22.4535 7.29452C22.4708 6.59398 22.3715 5.89544 22.1595 5.22752ZM4.39951 20.892C4.34178 20.9433 4.27218 20.9794 4.19701 20.997C4.12306 21.0098 4.04746 21.0098 3.97351 20.997C3.89598 20.9852 3.82213 20.956 3.75751 20.9115C3.68817 20.8709 3.62955 20.8144 3.58651 20.7465C3.37651 20.532 3.18001 20.124 3.37651 19.8945C5.43151 17.709 9.66301 13.437 12.309 10.8255C12.459 11.0235 12.624 11.2125 12.801 11.3895C12.978 11.574 13.1685 11.745 13.371 11.901C10.812 14.526 6.63901 18.747 4.40101 20.892H4.39951ZM21.0765 7.29452C21.0795 8.44202 20.6325 9.54452 19.8285 10.3665C19.0262 11.1536 17.9472 11.5944 16.8233 11.5944C15.6994 11.5944 14.6203 11.1536 13.818 10.3665C13.23 9.75286 12.8283 8.98485 12.6597 8.15183C12.4911 7.31882 12.5624 6.45505 12.8655 5.66102C13.0673 5.12062 13.3802 4.62858 13.784 4.21671C14.1879 3.80485 14.6737 3.48233 15.21 3.27002C15.7192 3.05688 16.266 2.94774 16.818 2.94902H17.199L14.4735 5.75852V6.80252L17.316 9.63152H18.306L21.0765 6.90752V7.29452ZM4.86001 10.032H7.15651L8.21401 11.1075L9.23101 10.0965L8.23351 9.07952V9.01502L8.31901 6.54152L7.98901 5.88602L3.69901 3.06302L2.81251 3.16202L1.56601 4.43552L1.46701 5.33402L4.22401 9.71102L4.86001 10.0335V10.032ZM3.44251 4.58402L6.91351 6.87002L6.85501 8.55452H5.24101L3.00301 5.01152L3.44251 4.58402ZM14.1 15.024L15.111 14.0145L19.77 18.792C20.1624 19.2045 20.3813 19.752 20.3813 20.3213C20.3813 20.8906 20.1624 21.4381 19.77 21.8505C19.4749 22.1535 19.0955 22.3605 18.6811 22.4448C18.2667 22.5291 17.8365 22.4866 17.4465 22.323C17.1976 22.2126 16.9744 22.0517 16.791 21.8505L12.078 17.046L13.0965 16.029L17.7945 20.82C17.8577 20.8897 17.9363 20.9436 18.024 20.9775C18.1967 21.0476 18.3899 21.0476 18.5625 20.9775C18.6502 20.9436 18.7288 20.8897 18.792 20.82C18.8577 20.755 18.9088 20.6768 18.942 20.5905C18.9764 20.5025 18.9947 20.409 18.996 20.3145C18.9945 20.2202 18.9767 20.1268 18.9435 20.0385C18.9103 19.9523 18.8592 19.8741 18.7935 19.809L14.1 15.024Z`,fill:`currentColor`})}),I=e=>(0,O.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,O.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 13.0605L17.469 18.531L18.531 17.4705L13.0605 12L18.531 6.53099L17.4705 5.46899L12 10.9395L6.53099 5.46899L5.47049 6.53099L10.9395 12L5.47049 17.469L6.53099 18.531L12 13.0605Z`,fill:`currentColor`})}),L=e=>(0,O.jsx)(`svg`,{height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,O.jsx)(`path`,{fill:`currentColor`,d:`m22 18-5 4-8-3v3l-4.19-5.75 12.91 1.05v-10.96l4.28-.69zm-17.19-1.75v-7.29l12.91-2.62-7.12-4.34v2.84l-6.63 1.92-1.97 2.62v5.69z`})}),R=e=>(0,O.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,O.jsx)(`path`,{d:`M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM7.79289 7.79289C8.18342 7.40237 8.81658 7.40237 9.20711 7.79289L12 10.5858L14.7929 7.79289C15.1834 7.40237 15.8166 7.40237 16.2071 7.79289C16.5976 8.18342 16.5976 8.81658 16.2071 9.20711L13.4142 12L16.2071 14.7929C16.5976 15.1834 16.5976 15.8166 16.2071 16.2071C15.8166 16.5976 15.1834 16.5976 14.7929 16.2071L12 13.4142L9.20711 16.2071C8.81658 16.5976 8.18342 16.5976 7.79289 16.2071C7.40237 15.8166 7.40237 15.1834 7.79289 14.7929L10.5858 12L7.79289 9.20711C7.40237 8.81658 7.40237 8.18342 7.79289 7.79289Z`,fill:`currentColor`})}),z=()=>{let{trackDownloadTrajectoryButtonClicked:e}=C(),{t}=i(`openhands`);return u({mutationKey:[`conversations`,`download`],mutationFn:async t=>{e(),v(await D.downloadConversation(t),`conversation_${t}.zip`)},onError:()=>{f(t(b.CONVERSATION$DOWNLOAD_ERROR))}})},B=e=>(0,O.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,O.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M21 15V2.25L20.25 1.5H5.60999C5.26596 1.50381 4.92547 1.56987 4.60499 1.695C4.28194 1.83856 3.99081 2.0452 3.74868 2.30278C3.50656 2.56036 3.31831 2.8637 3.19499 3.195C3.07229 3.49004 3.00614 3.80552 2.99999 4.125V18.375C2.99638 18.7197 3.06272 19.0616 3.19499 19.38C3.46049 20.0205 3.96749 20.532 4.60499 20.805C4.92547 20.9301 5.26596 20.9962 5.60999 21H5.99999V19.5H5.60999C5.46032 19.5005 5.31218 19.4698 5.17499 19.41C4.90342 19.2974 4.68763 19.0816 4.57499 18.81C4.52706 18.6699 4.50174 18.5231 4.49999 18.375V17.625C4.50174 17.4769 4.52706 17.3301 4.57499 17.19C4.68763 16.9184 4.90342 16.7026 5.17499 16.59C5.31033 16.531 5.45634 16.5004 5.60399 16.5H19.5V19.5H13.5V21H20.25L21 20.25V15ZM5.99999 15V3H19.5V15H5.99999ZM7.49999 4.5H8.99999V6H7.49999V4.5ZM7.49999 7.5H8.99999V9H7.49999V7.5ZM8.99999 10.5H7.49999V12H8.99999V10.5ZM9.74999 20.235L7.91999 22.5H7.49999V18H12V22.5H11.58L9.74999 20.235Z`,fill:`currentColor`})}),V=e=>{if(!e)return[];let t=[];for(let n of Object.keys(e))n&&t.push(n);return t},H=()=>{let{data:e,isLoading:t}=te();return{providers:P.useMemo(()=>V(e?.provider_tokens_set),[e?.provider_tokens_set]),isLoadingSettings:t}};function U(e){switch(e){case`ADDED`:case`added`:return`A`;case`DELETED`:case`deleted`:return`D`;case`UPDATED`:case`modified`:return`M`;case`MOVED`:case`renamed`:return`R`;default:return`M`}}function W(){let e=g().backend;if(e.kind!==`cloud`)throw Error(`Cloud git call requires a cloud backend.`);return e}async function G(e){let t=W(),n=new URLSearchParams;n.set(`provider`,e.provider),n.set(`limit`,String(e.limit??100)),e.query&&n.set(`query`,e.query),e.pageId&&n.set(`page_id`,e.pageId),e.installationId&&n.set(`installation_id`,e.installationId);let r=await S({backend:t,method:`GET`,path:`/api/v1/git/repositories/search?${n.toString()}`});return{items:r?.items??[],next_page_id:r?.next_page_id??null}}async function K(e){let t=W(),n=new URLSearchParams;n.set(`provider`,e.provider),n.set(`limit`,String(e.limit??100)),e.pageId&&n.set(`page_id`,e.pageId);let r=await S({backend:t,method:`GET`,path:`/api/v1/git/installations/search?${n.toString()}`});return{items:r?.items??[],next_page_id:r?.next_page_id??null}}async function q(e){let t=W(),n=new URLSearchParams;n.set(`provider`,e.provider),n.set(`repository`,e.repository),n.set(`limit`,String(e.limit??30)),n.set(`query`,e.query??``),e.pageId&&n.set(`page_id`,e.pageId);let r=await S({backend:t,method:`GET`,path:`/api/v1/git/branches/search?${n.toString()}`});return{items:r?.items??[],next_page_id:r?.next_page_id??null}}var J=e=>e,Y=()=>g().backend.kind===`cloud`,X=e=>!e||e===`undefined`||e===`null`,Z={items:[],next_page_id:null},Q={items:[],next_page_id:null},ce={items:[],next_page_id:null},$=class{static async searchGitRepositories(e,t,n=100,r,i){return X(t)||!Y()?Z:G({provider:J(t),query:e||void 0,limit:n,pageId:r,installationId:i})}static async retrieveUserGitRepositories(e,t,n=30,r){return X(e)||!Y()?Z:G({provider:J(e),limit:n,pageId:t,installationId:r})}static async retrieveInstallationRepositories(e,t,n,r,i=30){if(X(e)||!Y())return Z;let a=n[t];return a?G({provider:J(e),installationId:a,limit:i,pageId:r}):Z}static async getRepositoryBranches(e,t,n=``,r,i=30){return X(t)||!Y()?Q:q({provider:J(t),repository:e,query:n||void 0,pageId:r,limit:i})}static async searchRepositoryBranches(e,t,n,r,i=30){return X(t)||!Y()?Q:q({provider:J(t),repository:e,query:n,pageId:r,limit:i})}static async getUserInstallations(e,t,n=100){return X(e)||!Y()?ce:K({provider:J(e),pageId:t,limit:n})}static async getGitChanges(e){let t=await D.resolveConversationWorkingDir(e);return(await new x(m({workingDir:t})).gitChanges(t)).map(e=>({path:e.path,status:U(String(e.status))}))}static async getGitChangeDiff(e,t){let n=await new x(m()).gitDiff(t);return{modified:n.modified??``,original:n.original??``}}},le=e=>{let{data:t}=ae(),{providers:n}=H(),r=h();return d({queryKey:[`installations`,e,r.backend.id,r.orgId],queryFn:()=>$.getUserInstallations(e),enabled:t&&!!e&&n.length>0&&_(e,r.backend.kind),staleTime:1e3*60*5,gcTime:1e3*60*15})};function ue(e){let{provider:t,pageSize:n=30,enabled:r=!0}=e,{providers:i}=H(),{data:a}=le(t),o=a?.items,s=h(),l=t?_(t,s.backend.kind):!1,u=c({queryKey:[`repositories`,t,l,n,s.backend.id,s.orgId,...l?[o||[]]:[]],queryFn:async({pageParam:e})=>{if(!t)throw Error(`Provider is required`);if(l){if(!o)throw Error(`Missing installation list`);let r=e;return await $.retrieveInstallationRepositories(t,r.installationIndex,o,r.pageId??void 0,n)}let r=e;return await $.retrieveUserGitRepositories(t,r??void 0,n)},getNextPageParam:(e,t,n)=>{if(l&&o){let t=n;if(e.next_page_id)return{installationIndex:t.installationIndex,pageId:e.next_page_id};let r=t.installationIndex+1;return r<o.length?{installationIndex:r,pageId:null}:void 0}return e.next_page_id},initialPageParam:l?{installationIndex:0,pageId:null}:null,enabled:r&&(i||[]).length>0&&!!t&&(!l||Array.isArray(o)&&o.length>0),staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnWindowFocus:!1});return{data:u.data,isLoading:u.isLoading,isError:u.isError,hasNextPage:u.hasNextPage,isFetchingNextPage:u.isFetchingNextPage,fetchNextPage:u.fetchNextPage,onLoadMore:()=>{u.hasNextPage&&!u.isFetchingNextPage&&u.fetchNextPage()}}}function de(e,t,n,r=100){return d({queryKey:[`repositories`,`search`,e,t,r],queryFn:async()=>t?(await $.searchGitRepositories(e,t,r)).items:[],enabled:!!e&&!!t&&!n,staleTime:1e3*60*5,gcTime:1e3*60*15})}function fe(e,t){let[n,r]=(0,P.useState)(e);return(0,P.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var pe={recentRepositories:[],lastSelectedProvider:null},me=T()(re((e,t)=>({...pe,addRecentRepository:t=>e(e=>({recentRepositories:[t,...e.recentRepositories.filter(e=>e.id!==t.id)].slice(0,3)})),clearRecentRepositories:()=>e(()=>({recentRepositories:[]})),getRecentRepositories:()=>t().recentRepositories,setLastSelectedProvider:t=>e(()=>({lastSelectedProvider:t})),getLastSelectedProvider:()=>t().lastSelectedProvider}),{name:`home-store`,storage:E(()=>localStorage)}));function he({gitProvider:e,className:t}){return(0,O.jsxs)(O.Fragment,{children:[e===`github`&&(0,O.jsx)(a,{size:14,className:t}),e===`gitlab`&&(0,O.jsx)(o,{size:14,className:t}),e===`bitbucket`&&(0,O.jsx)(s,{size:14,className:t}),e===`bitbucket_data_center`&&(0,O.jsx)(s,{size:14,className:t}),e===`azure_devops`&&(0,O.jsx)(L,{className:y(t,`w-[14px] h-[14px]`)})]})}export{j as _,ue as a,H as c,R as d,L as f,M as g,N as h,de as i,B as l,F as m,me as n,$ as o,I as p,fe as r,U as s,he as t,z as u,A as v};
|
package/build/assets/{highlighted-source-view-suUKd5if.js → highlighted-source-view-KMsA9c4a.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as i,z as a}from"./utils-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as i,z as a}from"./utils-DsWhWn2F.js";import{ot as o,st as s}from"./vendor-markdown-BML7QbqS.js";import{t as c}from"./folder-C86qXV7M.js";import{t as l}from"./syntax-highlighter-B92AFGMy.js";var u=e(t(),1);function d(e){e.children.sort((e,t)=>e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1);for(let t of e.children)t.isDirectory&&d(t)}function f(e,t,n,r,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let o=a.get(n);if(o)return!i&&!o.isDirectory&&(o.isDirectory=!0),o;let s={name:n,path:r,isDirectory:!i,children:[]};return e.children.push(s),a.set(n,s),s}function p(e){let t={name:``,path:``,isDirectory:!0,children:[]},n=new Map;for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length>0){let r=t,i=``;for(let t=0;t<e.length;t+=1){let a=e[t];i=i?`${i}/${a}`:a;let o=t===e.length-1;r=f(r,n,a,i,o)}}}return d(t),t}var m=n();function h({node:e,depth:t,selectedPath:n,onSelectFile:r}){let[a,o]=(0,u.useState)(!1),s=8+t*12;if(e.isDirectory)return(0,m.jsxs)(`li`,{children:[(0,m.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,"data-testid":`file-tree-dir-${e.path}`,className:i(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm text-white`,`hover:bg-tertiary cursor-pointer`),style:{paddingLeft:`${s}px`},children:[(0,m.jsx)(`span`,{"aria-hidden":!0,className:i(`inline-block w-3 text-[10px] text-[var(--oh-muted)] transition-transform`,a?`rotate-90`:`rotate-0`),children:`▶`}),(0,m.jsx)(c,{className:`w-3.5 h-3.5 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate`,children:e.name})]}),a&&e.children.length>0&&(0,m.jsx)(`ul`,{children:e.children.map(e=>(0,m.jsx)(h,{node:e,depth:t+1,selectedPath:n,onSelectFile:r},e.path))})]});let d=n===e.path;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`file-tree-file-${e.path}`,className:i(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm`,`hover:bg-tertiary cursor-pointer`,d?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-text-tertiary)]`),style:{paddingLeft:`${s+16}px`},children:[(0,m.jsx)(l,{className:`w-3.5 h-3.5 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate`,children:e.name})]})})}function g({paths:e,selectedPath:t,onSelectFile:n}){let{t:i}=r(`openhands`),o=(0,u.useMemo)(()=>p(e),[e]);return o.children.length===0?(0,m.jsx)(`div`,{className:`px-3 py-4 text-sm text-[var(--oh-muted)]`,children:i(a.FILES$NO_FILES)}):(0,m.jsx)(`ul`,{className:`py-1 custom-scrollbar-always`,"data-testid":`file-tree-view`,children:o.children.map(e=>(0,m.jsx)(h,{node:e,depth:0,selectedPath:t,onSelectFile:n},e.path))})}var _={js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,tsx:`tsx`,py:`python`,pyi:`python`,pyw:`python`,html:`markup`,htm:`markup`,svg:`markup`,xml:`markup`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,json:`json`,json5:`json5`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,properties:`properties`,conf:`ini`,env:`bash`,md:`markdown`,markdown:`markdown`,mdx:`markdown`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,bat:`batch`,cmd:`batch`,ps1:`powershell`,ps:`powershell`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,cs:`csharp`,java:`java`,kt:`kotlin`,kts:`kotlin`,scala:`scala`,rs:`rust`,go:`go`,rb:`ruby`,php:`php`,swift:`swift`,m:`objectivec`,mm:`objectivec`,hs:`haskell`,ex:`elixir`,exs:`elixir`,erl:`erlang`,fs:`fsharp`,fsx:`fsharp`,ml:`ocaml`,mli:`ocaml`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,lua:`lua`,pl:`perl`,pm:`perl`,r:`r`,jl:`julia`,dart:`dart`,groovy:`groovy`,gradle:`groovy`,tf:`hcl`,hcl:`hcl`,dockerfile:`docker`,sql:`sql`,graphql:`graphql`,gql:`graphql`,proto:`protobuf`,diff:`diff`,patch:`diff`,nix:`nix`,sol:`solidity`},v={dockerfile:`docker`,makefile:`makefile`,gnumakefile:`makefile`,".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,".env":`bash`,".gitignore":`bash`,".dockerignore":`bash`};function y(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)),n=e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r+1).toLowerCase()}function b(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return e.slice(t+1).toLowerCase()}function x(e,t){let n=v[b(e)];if(n)return n;let r=y(e);if(r&&_[r])return _[r];if(t){if(t===`text/html`)return`markup`;if(t===`text/css`)return`css`;if(t===`application/json`)return`json`;if(t===`text/markdown`)return`markdown`;if(t===`application/javascript`||t===`text/javascript`)return`javascript`;if(t===`application/x-yaml`||t===`text/yaml`)return`yaml`}return null}function S({path:e,text:t,mimeType:n}){let r=x(e,n);return r?(0,m.jsx)(`div`,{"data-testid":`file-content-viewer-highlighted`,"data-language":r,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] custom-scrollbar-always`,children:(0,m.jsx)(o,{language:r,style:s,showLineNumbers:!0,wrapLongLines:!1,customStyle:{margin:0,padding:`1rem`,background:`transparent`,fontSize:`0.75rem`,lineHeight:`1.25rem`,minHeight:`100%`},codeTagProps:{style:{background:`transparent`,fontFamily:`inherit`}},lineNumberStyle:{color:`var(--oh-border)`,minWidth:`2.5em`,paddingRight:`1em`,userSelect:`none`},children:t})}):(0,m.jsx)(`pre`,{"data-testid":`file-content-viewer-plain`,className:`h-full w-full overflow-auto whitespace-pre-wrap break-words bg-[var(--oh-surface)] p-4 text-xs leading-5 text-white custom-scrollbar-always`,children:t})}export{g as n,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./home-TFhnmZLx.js";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{F as r,U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as a}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{w as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as s}from"./use-is-creating-conversation-CIAcnd8M.js";import{n as c,nt as l,rt as u}from"./active-backend-context-BlZPzZNU.js";import{t as d,z as f}from"./utils-qjs_KuS4.js";import{t as p}from"./chevron-down-CV1zZP_K.js";import{t as m}from"./vendor~root-layout~index-home~home~conversation-panel~conversation-EShpjxey.js";import{a as h,c as g,d as _,f as v,i as y,l as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D}from"./onboarding-BegDrOKn.js";import{t as O}from"./search-sKuYKllf.js";import{t as k}from"./x-EjvKGawc.js";import{t as A}from"./modal-backdrop-X-vKo61e.js";import{n as j,r as M,t as N}from"./modal-body-DQhiw-AR.js";import{r as P}from"./base-modal-CSHhJTSr.js";import{_ as F,i as I,m as L,s as R}from"./form-control-classes-CSPevi7c.js";import{t as z}from"./brand-button-CQO8oqVo.js";import{n as B}from"./navigation-context-BOGzIng3.js";import{t as V}from"./styled-tooltip-DsjDnR_W.js";import{i as H,n as U,o as W,u as G}from"./dropdown-classes-DQlj-MpS.js";import{c as K,l as ee,n as te}from"./git-provider-icon-BREx-yUX.js";import{t as q}from"./conversation-store-C6hSXHw0.js";import{t as J}from"./modal-close-button-turIYn0t.js";import{i as ne}from"./conversation-state-store-DTq4hFoP.js";import{n as re}from"./use-create-conversation-Dsa4nzU9.js";import{t as ie}from"./folder-C86qXV7M.js";import{r as Y}from"./typography-C6fuRTTT.js";import{i as ae,n as oe,t as se}from"./extension-module-card-classes-Bo43vY5V.js";import{n as ce}from"./circle-plus-check-toggle-E3Ecb_gg.js";import{G as le,H as ue,V as de,W as fe,a as pe,c as me,d as he,f as ge,h as _e,i as ve,j as ye,l as be,m as xe,n as Se,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe,z as ke}from"./llm-not-configured-banner-DTWzISnk.js";import{y as Ae}from"./markdown-renderer-CvOO0YIr.js";import{t as je}from"./use-plugins-marketplace-PBc_XNz_.js";var X=e(t(),1);async function Me(e){let{imagesToEmbed:t}=le(e.images,e.imagesMarkedUploadAsFile),n=await Promise.all(t.map(e=>de(e)));Ae.getState().enqueuePendingMessage({conversationId:e.conversationId,text:e.text,content:e.text,imageUrls:n,fileUrls:[]})}var Z=n();function Ne({plugin:e,isSelected:t,isDisabled:n=!1,onToggle:r}){return(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker-card-${e.name}`,className:d(`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-tertiary p-4`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{"data-testid":`plugin-picker-name-${e.name}`,className:`truncate text-sm font-semibold text-white`,children:e.name}),(0,Z.jsx)(`p`,{className:`mt-0.5 min-w-0 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-tertiary-light`,children:e.description}):null,e.repo_path||e.ref?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.repo_path?(0,Z.jsx)(`span`,{className:ae,children:e.repo_path}):null,e.ref?(0,Z.jsxs)(`span`,{className:ae,children:[`@`,e.ref]}):null]}):null]}),(0,Z.jsx)(ce,{testId:`plugin-picker-toggle-${e.name}`,isSelected:t,isDisabled:n,onToggle:r,enableLabelKey:f.BUTTON$ADD,disableLabelKey:f.COMMON$REMOVE,enableTooltipKey:f.BUTTON$ADD,disableTooltipKey:f.COMMON$REMOVE})]})}function Q(e){return[e.source,e.ref??``,e.repo_path??``].join(`\0`)}function Pe(e){return{source:e.source,ref:e.ref??null,repo_path:e.repo_path??null}}function Fe(e,t){let n=Q(t);return e.some(e=>Q(e)===n)}function Ie(e,t){let n=Q(t);return e.some(e=>Q(e)===n)?e.filter(e=>Q(e)!==n):[...e,Pe(t)]}function Le(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description,e.source,e.repo_path,e.ref].filter(e=>typeof e==`string`&&e.length>0).some(e=>e.toLowerCase().includes(n)):!0}function Re({selected:e,onChange:t,disabled:n=!1}){let{t:r}=a(`openhands`),{data:i,isLoading:o,isError:s}=je(),[c,l]=(0,X.useState)(``),u=(i??[]).filter(e=>Le(e,c));return(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker`,className:`flex w-full flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:d(`relative flex min-w-0 items-center`,`rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`transition-colors focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`),children:[(0,Z.jsx)(O,{className:`ml-3 h-4 w-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{"data-testid":`plugin-picker-search-input`,type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:r(f.PLUGINS$PICKER_SEARCH_PLACEHOLDER),"aria-label":r(f.PLUGINS$PICKER_SEARCH_PLACEHOLDER),className:d(`min-w-0 flex-1 border-0 bg-transparent outline-none`,`px-3 py-2 text-sm placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`)}),c?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(``),"aria-label":r(f.MCP$SEARCH_CLEAR),className:`mr-2 cursor-pointer rounded p-1 text-tertiary-alt hover:text-white`,children:(0,Z.jsx)(k,{className:`h-4 w-4`,"aria-hidden":!0})}):null]}),o?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-loading`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_LOADING)}):s?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-error`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_ERROR)}):u.length===0?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-empty`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_EMPTY)}):(0,Z.jsx)(`div`,{className:oe,children:(0,Z.jsx)(`div`,{className:se,children:u.map(r=>(0,Z.jsx)(Ne,{plugin:r,isSelected:Fe(e,r),isDisabled:n,onToggle:()=>t(Ie(e,r))},`${r.source} ${r.ref??``} ${r.repo_path??``} ${r.name}`))})})]})}function ze({selected:e,onChange:t,onClose:n}){let{t:r}=a(`openhands`);return(0,Z.jsx)(A,{onClose:n,children:(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker-modal`,className:d(`relative flex max-h-[80vh] flex-col gap-4 rounded-xl border border-[var(--oh-border)] bg-base-secondary p-6`,M(`lg`),N),children:[(0,Z.jsx)(J,{onClose:n,testId:`plugin-picker-close`}),(0,Z.jsxs)(`div`,{className:`pr-6`,children:[(0,Z.jsx)(Y.H2,{children:r(f.PLUGINS$PICKER_TITLE)}),(0,Z.jsx)(Y.Text,{className:`mt-1 block text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_SUBTITLE)})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:(0,Z.jsx)(Re,{selected:e,onChange:t})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-[var(--oh-border-subtle)] pt-4`,children:[(0,Z.jsx)(Y.Text,{className:`text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_SELECTED_COUNT,{count:e.length})}),(0,Z.jsx)(z,{testId:`plugin-picker-done`,type:`button`,variant:`primary`,onClick:n,className:`px-4`,children:r(f.PLUGINS$PICKER_DONE)})]})]})})}function Be({count:e,onClick:t,disabled:n=!1}){let{t:r}=a(`openhands`);return(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`open-plugin-picker`,onClick:t,disabled:n,className:d(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,I,L,F,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Z.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Z.jsx)(ye,{width:16,height:16,className:`shrink-0`,"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:r(f.PLUGINS$PICKER_TRIGGER)}),e>0?(0,Z.jsx)(`span`,{"data-testid":`plugin-picker-count`,className:`inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-white px-1 text-[11px] font-semibold leading-none text-black`,children:e}):null]})}function Ve(){let{t:e}=a(`openhands`);return(0,Z.jsx)(`div`,{className:`flex min-h-[80px] w-full items-center justify-center py-2`,children:(0,Z.jsx)(Y.H1,{className:`w-full text-center leading-normal`,children:e(f.HOME$LETS_START_BUILDING)})})}function He({kind:e,onClick:t,disabled:n=!1,disabledTooltip:r}){let{t:i}=a(`openhands`),o=e===`local`,s=i(o?f.HOME$OPEN_WORKSPACE:f.COMMON$OPEN_REPOSITORY),c=(0,Z.jsxs)(`button`,{type:`button`,"data-testid":o?`open-workspace-button`:`open-repository-button`,onClick:t,disabled:n,className:d(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,I,L,F,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Z.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:o?(0,Z.jsx)(C,{"aria-hidden":!0,className:`h-4 w-4`,strokeWidth:2}):(0,Z.jsx)(ne,{width:16,height:16,className:`shrink-0`})}),(0,Z.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:s})]});return r?(0,Z.jsx)(V,{content:r,placement:`top`,children:(0,Z.jsx)(`span`,{className:`inline-flex`,children:c})}):c}var $=`__ungrouped__`;function Ue({workspaces:e,parents:t=[],value:n,placeholder:r,className:i,disabled:o=!1,disabledTooltip:s,showManage:c,onChange:l,onAddClick:u,onManageClick:p}){let{t:h}=a(`openhands`),[g,_]=(0,X.useState)(n?.name??``),v=(0,X.useRef)(null),y=(0,X.useMemo)(()=>{let t=g.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,g]),b=(0,X.useCallback)(e=>e.parentPath??$,[]),x=(0,X.useMemo)(()=>{let e=new Map;return t.forEach(t=>e.set(t.path,t.name)),e},[t]),{groupedWorkspaces:S,isGrouped:C,headerByFirstIndex:w,groupLabelByIndex:T}=(0,X.useMemo)(()=>{let e=[],t=new Map;y.forEach(n=>{let r=b(n);t.has(r)||(t.set(r,[]),e.push(r)),t.get(r)?.push(n)}),e.sort((e,t)=>e===$?1:t===$?-1:0);let n=e.length>1,r=[],i=new Map,a=new Map;return e.forEach(e=>{let o=e===$?h(f.HOME$WORKSPACE_GROUP_OTHER):x.get(e)||e.split(`/`).filter(Boolean).pop()||e;n&&i.set(r.length,o),(t.get(e)??[]).forEach(e=>{a.set(r.length,o),r.push(e)})}),{groupedWorkspaces:r,isGrouped:n,headerByFirstIndex:i,groupLabelByIndex:a}},[y,b,x,h]),E=(0,X.useCallback)(e=>{l(e),e&&_(e.name)},[l]),D=(0,X.useCallback)(()=>{E(null),_(``)},[E]),{isOpen:O,getToggleButtonProps:k,getMenuProps:A,getInputProps:j,highlightedIndex:M,getItemProps:N,selectedItem:P,closeMenu:F}=m({items:S,itemToString:e=>e?.name??``,selectedItem:n,onSelectedItemChange:({selectedItem:e})=>{E(e??null)},inputValue:g,onIsOpenChange:({isOpen:e,selectedItem:t})=>{_(e?``:t?.name??``)},stateReducer:(e,t)=>t.type===m.stateChangeTypes.InputClick&&e.isOpen?{...t.changes,isOpen:!0}:t.changes}),I=(e,t,n,r,i)=>(0,Z.jsx)(be,{item:e,index:t,isSelected:r?.id===e.id,getItemProps:i,getDisplayText:e=>e.name,getItemKey:e=>e.id,ariaLabel:C?`${T.get(t)??``}, ${e.name}`.trim():void 0},e.id),L=e=>(0,Z.jsx)(me,{inputValue:e,searchMessage:h(f.HOME$NO_WORKSPACES),emptyMessage:h(f.HOME$NO_WORKSPACES),testId:`workspace-dropdown-empty`}),z=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),B=(0,X.useCallback)(e=>{z(e),F(),u()},[F,u,z]),W=(0,X.useCallback)(e=>{z(e),F(),u()},[F,u,z]),G=(0,X.useCallback)(e=>{z(e),F(),p()},[F,p,z]),K=(0,X.useCallback)(e=>{z(e),F(),p()},[F,p,z]),te=(0,X.useMemo)(()=>(0,Z.jsxs)(`div`,{className:H,children:[(0,Z.jsx)(`button`,{type:`button`,"data-testid":`add-workspaces-button`,className:d(U,`cursor-pointer`),onMouseDown:z,onTouchStart:z,onTouchEnd:W,onClick:B,children:h(f.HOME$ADD_WORKSPACES)}),(c??e.length>0)&&(0,Z.jsx)(`button`,{type:`button`,"data-testid":`manage-workspaces-button`,className:d(U,`cursor-pointer`),onMouseDown:z,onTouchStart:z,onTouchEnd:K,onClick:G,children:h(f.HOME$MANAGE_WORKSPACES)})]}),[B,W,G,K,z,h,e.length,c]),q=(0,Z.jsxs)(`div`,{className:d(`relative`,i),children:[(0,Z.jsxs)(`div`,{className:`group relative text-[var(--oh-muted)] hover:text-white`,children:[(0,Z.jsx)(`div`,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 z-10`,children:(0,Z.jsx)(ee,{width:16,height:16})}),(0,Z.jsx)(`input`,{...j({disabled:o,placeholder:O&&n?n.name:r??h(f.HOME$WORKSPACE_PLACEHOLDER),className:d(R,`text-inherit shadow-none pl-7 pr-16 text-sm font-normal leading-5`,`placeholder:text-[var(--oh-muted)]`,`disabled:cursor-not-allowed disabled:opacity-60`),onChange:e=>{_(e.target.value)}}),"data-testid":`workspace-dropdown`}),(0,Z.jsxs)(`div`,{className:`absolute right-1 top-1/2 transform -translate-y-1/2 flex items-center`,children:[n&&(0,Z.jsx)(he,{disabled:o,onClear:D}),(0,Z.jsx)(Oe,{isOpen:O,disabled:o,getToggleButtonProps:k})]})]}),(0,Z.jsx)(Ee,{isOpen:O,filteredItems:S,inputValue:g,highlightedIndex:M,selectedItem:P,getMenuProps:A,getItemProps:N,menuRef:v,renderItem:I,renderItemPrefix:C?(e,t)=>{let n=w.get(t);return n?(0,Z.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,"data-testid":`workspace-group-header`,className:`px-2 pt-2 pb-1 text-xs font-medium text-[var(--oh-muted)] select-none`,children:n}):null}:void 0,renderEmptyState:L,stickyFooterItem:te,testId:`workspace-dropdown-menu`,itemKey:e=>e.id})]});return s?(0,Z.jsx)(V,{content:s,placement:`top`,children:(0,Z.jsx)(`span`,{className:`block`,children:q})}):q}var We=`oh:home-selected-workspace-path`;function Ge(){if(typeof window>`u`)return null;try{let e=window.sessionStorage.getItem(We);return e&&e.length>0?e:null}catch{return null}}function Ke(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(We,e):window.sessionStorage.removeItem(We)}catch{}}function qe({isLoadingSettings:e=!1,onConfirm:t}){let{t:n}=a(`openhands`),{navigate:r}=B(),{data:i,error:o}=T(),c=i?.workspaceParents??[],{mutate:l}=b(),{mutate:u}=D(),{mutate:d}=g(),{mutate:p}=_(),{workspaces:m,parents:v,isLoading:x,isError:C,error:E}=S(),O=h(o??E,n),[k,A]=X.useState(null),[j,M]=X.useState(!1),[N,P]=X.useState(!1),{mutate:F,isPending:I,isSuccess:L}=re(),R=s(),V=I||L||R,H=X.useCallback(e=>{A(e),Ke(e?.path??null)},[]);X.useEffect(()=>{let e=Ge();if(!e)return;let t=m.find(t=>t.path===e);if(t){A(e=>e?.path===t.path?e:t);return}!x&&!C&&!O&&(Ke(null),A(t=>t?.path===e?null:t))},[C,x,m,O]);let U=c.length>0||!!O,W=null;O?W=O:x?W=n(f.HOME$LOADING):C&&(W=n(f.HOME$WORKSPACE_SCAN_ERROR));let G=!!O||e||x&&m.length===0;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[!t&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Z.jsx)(ie,{width:24,height:24}),(0,Z.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:n(f.HOME$WORKSPACES_TAB)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Z.jsx)(Ue,{workspaces:m,parents:v,value:k,placeholder:O?n(f.HOME$WORKSPACES_UNSUPPORTED_PLACEHOLDER):G?n(f.HOME$LOADING):void 0,disabled:G,disabledTooltip:O,showManage:m.length>0||c.length>0,onChange:H,onAddClick:()=>M(!0),onManageClick:()=>P(!0),className:`max-w-auto`},k?.path??`empty-workspace-selection`),U&&W&&(0,Z.jsx)(`p`,{className:`px-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`workspace-status-message`,children:W})]}),(0,Z.jsx)(z,{testId:`workspace-launch-button`,variant:`primary`,type:`button`,isDisabled:!k||!t&&V||e,onClick:()=>{if(k){if(t){t(k);return}F({workingDir:k.path,entryPoint:`home_workspace_form`},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:t?`w-full`:`w-auto absolute bottom-5 left-5 right-5`,children:n(t?f.BUTTON$CONFIRM:V?f.HOME$LOADING:f.BUTTON$LAUNCH)}),(0,Z.jsx)(y,{isOpen:j,onClose:()=>M(!1),onAdd:e=>{let t=e[e.length-1];l(e,{onSuccess:()=>{t&&H(t)}})},onAddParent:e=>d(e)}),(0,Z.jsx)(w,{isOpen:N,workspaces:m,workspaceParents:c,onClose:()=>P(!1),onRemove:e=>{k?.path===e&&H(null),u(e)},onRemoveParent:e=>{k?.parentPath===e&&H(null),p(e)}})]})}function Je({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=a(`openhands`),{isLoadingSettings:i}=K();return e?(0,Z.jsx)(A,{onClose:t,children:(0,Z.jsxs)(j,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Z.jsx)(J,{onClose:t,testId:`close-open-workspace-dialog`}),(0,Z.jsx)(`div`,{className:`w-full pr-6`,children:(0,Z.jsx)(P,{title:r(f.HOME$OPEN_WORKSPACE)})}),(0,Z.jsx)(`div`,{className:`w-full`,"data-testid":`open-workspace-dialog-body`,children:(0,Z.jsx)(qe,{isLoadingSettings:i,onConfirm:e=>{n(e),t()}})})]})}):null}function Ye({onRepoSelection:e,isLoadingSettings:t=!1,onConfirm:n}){let{navigate:r}=B(),[i,o]=X.useState(null),[c,l]=X.useState(null),[u,d]=X.useState(null),{providers:p}=K(),{addRecentRepository:m,setLastSelectedProvider:h,getLastSelectedProvider:g}=te(),{mutate:_,isPending:v,isSuccess:y}=re(),b=s(),{t:x}=a(`openhands`);X.useEffect(()=>{if(p.length!==0){if(p.length===1&&!u){d(p[0]);return}if(p.length>1&&!u){let e=g();e&&p.includes(e)&&d(e)}}},[p,u,g]);let S=v||y||b,C=t=>{t!==u&&(d(t),h(t),o(null),l(null),e?.(null))},w=X.useCallback(e=>{l(e)},[]);return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[!n&&(0,Z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Z.jsx)(ne,{width:24,height:24}),(0,Z.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:x(f.COMMON$OPEN_REPOSITORY)})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:x(f.HOME$SELECT_OR_INSERT_URL)}),p.length<=1?null:(0,Z.jsx)(Ce,{providers:p,value:u,className:`max-w-[500px]`,onChange:C,disabled:t})]}),(0,Z.jsx)(ve,{provider:u||p[0],value:i?.id||null,repositoryName:i?.full_name||null,placeholder:`user/repo`,disabled:!u||t,onChange:t=>{t?(e?.(t),o(t)):(e?.(null),o(null),l(null))},className:`max-w-auto`}),(()=>{let e=i?.main_branch||null;return(0,Z.jsx)(pe,{repository:i?.full_name||null,provider:u||p[0],selectedBranch:c,onBranchSelect:w,defaultBranch:e,className:`max-w-full`,disabled:!i||t})})()]}),(0,Z.jsx)(z,{testId:`repo-launch-button`,variant:`primary`,type:`button`,isDisabled:!i||!c||!n&&S||p.length>1&&!u||t,onClick:()=>{if(!(!i||!c)){if(m(i),n){n({repository:i,branch:c,provider:u});return}_({repository:{name:i.full_name||``,gitProvider:i.git_provider||`github`,branch:c.name||`main`},entryPoint:`home_repo_form`},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:`w-full`,children:x(n?f.BUTTON$CONFIRM:S?f.HOME$LOADING:f.BUTTON$LAUNCH)})]})}function Xe({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=a(`openhands`),{isLoadingSettings:i}=K();return e?(0,Z.jsx)(A,{onClose:t,children:(0,Z.jsxs)(j,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Z.jsx)(J,{onClose:t,testId:`close-open-repository-dialog`}),(0,Z.jsx)(`div`,{className:`w-full pr-6`,children:(0,Z.jsx)(P,{title:r(f.COMMON$OPEN_REPOSITORY)})}),(0,Z.jsx)(`div`,{className:`w-full`,"data-testid":`open-repository-dialog-body`,children:(0,Z.jsx)(Ye,{isLoadingSettings:i,onConfirm:e=>{n(e),t()}})})]})}):null}function Ze(e,t){return e===`new_worktree`?f.COMMON$WORKSPACE_MODE_NEW_WORKTREE:t===`cloud`?f.COMMON$WORKSPACE_MODE_CLOUD_REPO:f.COMMON$WORKSPACE_MODE_LOCAL_REPO}function Qe({mode:e}){return e===`new_worktree`?(0,Z.jsx)(v,{className:`size-3`,strokeWidth:2,"aria-hidden":!0}):(0,Z.jsx)(ne,{width:12,height:12,color:`white`,"aria-hidden":!0})}var $e=[`local_repo`,`new_worktree`];function et({value:e,backendKind:t,onChange:n,disabled:r=!1,testId:i=`workspace-mode-selector`}){let{t:o}=a(`openhands`),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=o(Ze(e,t));return(0,X.useEffect)(()=>{if(!s)return;let e=e=>{l.current&&!l.current.contains(e.target)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),(0,X.useEffect)(()=>{if(!s)return;let e=e=>{e.key===`Escape`&&c(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s]),(0,Z.jsxs)(`div`,{ref:l,className:`relative inline-flex`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-testid":i,"aria-haspopup":`menu`,"aria-expanded":s,"aria-label":u,disabled:r,onClick:()=>c(e=>!e),className:d(`group flex flex-row items-center justify-between gap-2 pl-2.5 pr-2 py-1 rounded-[100px] truncate relative`,`border border-[rgba(71,74,84,0.50)] bg-transparent text-white`,r?`cursor-not-allowed opacity-50`:`cursor-pointer hover:border-[var(--oh-border-subtle)]`),children:[(0,Z.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:(0,Z.jsx)(Qe,{mode:e})}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-normal leading-5`,children:u}),(0,Z.jsx)(p,{className:`size-3 shrink-0 text-white`,"aria-hidden":!0})]}),s?(0,Z.jsx)(`div`,{role:`menu`,"data-testid":`${i}-menu`,className:d(`absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)] p-1 shadow-lg`,H),children:$e.map(r=>{let a=o(Ze(r,t));return(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":r===e,"data-testid":`${i}-option-${r}`,onClick:()=>{n(r),c(!1)},className:W,children:[(0,Z.jsx)(`span`,{className:G,children:(0,Z.jsx)(Qe,{mode:r})}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]},r)})}):null]})}function tt({workspace:e,repository:t,branch:n,provider:r,workspaceMode:i,backendKind:a,onRepoClick:o,onWorkspaceModeChange:s}){let c=e?e.path.replace(/\/+$/,``).split(`/`).pop()||e.path:null;return(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center flex-wrap`,"data-testid":`home-git-control-bar-preview`,children:[(0,Z.jsx)(Te,{selectedRepository:t?.full_name??null,gitProvider:r??null,workspaceName:c,onClick:o}),e?(0,Z.jsx)(et,{value:i,backendKind:a,onChange:s}):null,n?(0,Z.jsx)(Se,{selectedBranch:n.name,selectedRepository:t?.full_name??null,gitProvider:r??null}):null]})}function nt(){let{t:e}=a(`openhands`),{backend:t}=c(),{navigate:n}=B(),r=t.kind===`local`,[i,d]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`local_repo`),[w,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),{mutateAsync:k,isPending:A}=re(),j=s(),M=A||j,{isConfigured:N,isLoading:P}=we(),F=!P&&!N,{images:I,files:L,imagesMarkedUploadAsFile:R,clearAllFiles:z}=q(),{handleUpload:V}=ge(),{error:H}=T({enabled:r}),U=r?h(H,e):null,W=r?!!p:!!g&&!!v,G=xe(null,t=>{let i=t.trim(),a=I.length>0||L.length>0;if(!i&&!a||M||F)return;let s={images:[...I],files:[...L]},c={query:a?void 0:i||void 0,entryPoint:`home_chat_launcher`};r&&p?c={...c,workingDir:p.path,workspaceMode:S}:!r&&g&&v&&(c={...c,repository:{name:g.full_name,gitProvider:g.git_provider,branch:v.name}}),w.length>0&&(c={...c,plugins:w});let d=o.loading(e(f.HOME$CREATING_CONVERSATION),l);(async()=>{try{let t=await k(c);o.dismiss(d);try{sessionStorage.removeItem(fe)}catch{}let l=t.conversation_id,f=l.startsWith(`task-`);if(a)if(!r||f){let e=t.task_id??(f?l.slice(5):null);if(!e){u(null);return}ue(e,{content:i,images:s.images,files:s.files,imagesMarkedUploadAsFile:[...R]}),z(),await Me({conversationId:l,text:i,images:s.images,imagesMarkedUploadAsFile:R}),n(`/conversations/${l}`);return}else try{await ke({conversationId:l,content:i,images:s.images,files:s.files,imagesMarkedUploadAsFile:R,t:e}),z()}catch(e){u(e instanceof Error?e.message:null);return}f&&i&&await Me({conversationId:l,text:i,images:[],imagesMarkedUploadAsFile:[]}),n(`/conversations/${l}`)}catch(e){o.dismiss(d),u(e instanceof Error?e.message:null)}})()});return(0,Z.jsxs)(`div`,{"data-testid":`home-chat-launcher`,className:`flex w-full max-w-[800px] flex-col gap-4 md:px-4`,children:[(0,Z.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,Z.jsx)(Ve,{})}),(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(_e,{onSubmit:G,onFilesPaste:V,disabled:M||F})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-2`,children:[W?(0,Z.jsx)(tt,{workspace:p,repository:g,branch:v,provider:b,workspaceMode:S,backendKind:t.kind,onRepoClick:()=>d(!0),onWorkspaceModeChange:C}):(0,Z.jsx)(He,{kind:r?`local`:`cloud`,onClick:()=>d(!0),disabled:M||!!U,disabledTooltip:U}),(0,Z.jsx)(Be,{count:w.length,onClick:()=>O(!0),disabled:M})]}),r?(0,Z.jsx)(Je,{isOpen:i,onClose:()=>d(!1),onConfirm:e=>{m(e),_(null),y(null),x(null),C(`local_repo`)}}):(0,Z.jsx)(Xe,{isOpen:i,onClose:()=>d(!1),onConfirm:({repository:e,branch:t,provider:n})=>{_(e),y(t),x(n??e.git_provider),m(null),C(`local_repo`)}}),D&&(0,Z.jsx)(ze,{selected:w,onChange:E,onClose:()=>O(!1)})]})}function rt(){let e=x(r().search);return(0,Z.jsxs)(`div`,{"data-testid":`home-screen`,className:`custom-scrollbar-always flex h-full flex-col overflow-y-auto rounded-xl bg-transparent px-4 md:px-0 lg:px-[42px]`,children:[(0,Z.jsx)(`div`,{className:`md:px-4 lg:px-0`,children:(0,Z.jsx)(De,{})}),(0,Z.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col items-center justify-center`,children:(0,Z.jsx)(nt,{})}),e?null:(0,Z.jsx)(E,{})]})}var it=i(rt);export{it as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{F as r,U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as a}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{w as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";import{t as s}from"./use-is-creating-conversation-CIAcnd8M.js";import{Dt as c,Et as l,n as u}from"./active-backend-context-mY7Gff5c.js";import{t as d,z as f}from"./utils-DsWhWn2F.js";import{t as p}from"./chevron-down-D_LsyTA7.js";import{t as m}from"./vendor~root-layout~index-home~home~conversation-panel~conversation-Acmf1sKj.js";import{a as h,c as g,d as _,f as v,i as y,l as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D}from"./onboarding-DWuFieEA.js";import{t as O}from"./search-BrpWXWUi.js";import{t as k}from"./x-Dx_JbpHA.js";import{t as A}from"./modal-backdrop-X-vKo61e.js";import{n as j,r as M,t as N}from"./modal-body-C3bGicn4.js";import{r as P}from"./base-modal-DkVyzFMt.js";import{_ as F,i as I,m as L,s as R}from"./form-control-classes-CtVAktAy.js";import{t as z}from"./brand-button-BUlDL-mz.js";import{n as B}from"./navigation-context-BOGzIng3.js";import{t as V}from"./styled-tooltip-B3kIdVyH.js";import{i as H,n as U,o as W,u as G}from"./dropdown-classes-CqA2BTCL.js";import{c as K,l as ee,n as te}from"./git-provider-icon-0PqmIS_S.js";import{t as q}from"./conversation-store-C6hSXHw0.js";import{t as J}from"./modal-close-button-vxkAIRyZ.js";import{i as ne}from"./conversation-state-store-CGRQemtx.js";import{n as re}from"./use-create-conversation-CakhLF0X.js";import{t as ie}from"./folder-C86qXV7M.js";import{r as Y}from"./typography-B1UxuuEC.js";import{i as ae,n as oe,t as se}from"./extension-module-card-classes-Bo43vY5V.js";import{n as ce}from"./circle-plus-check-toggle-DdjUiOo1.js";import{G as le,H as ue,V as de,W as fe,a as pe,c as me,d as he,f as ge,h as _e,i as ve,j as ye,l as be,m as xe,n as Se,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe,z as ke}from"./llm-not-configured-banner-Y4W9-sar.js";import{y as Ae}from"./markdown-renderer-U40HF0Ak.js";import{t as je}from"./use-plugins-marketplace-D-93nqtJ.js";var X=e(t(),1);async function Me(e){let{imagesToEmbed:t}=le(e.images,e.imagesMarkedUploadAsFile),n=await Promise.all(t.map(e=>de(e)));Ae.getState().enqueuePendingMessage({conversationId:e.conversationId,text:e.text,content:e.text,imageUrls:n,fileUrls:[]})}var Z=n();function Ne({plugin:e,isSelected:t,isDisabled:n=!1,onToggle:r}){return(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker-card-${e.name}`,className:d(`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-tertiary p-4`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{"data-testid":`plugin-picker-name-${e.name}`,className:`truncate text-sm font-semibold text-white`,children:e.name}),(0,Z.jsx)(`p`,{className:`mt-0.5 min-w-0 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-tertiary-light`,children:e.description}):null,e.repo_path||e.ref?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.repo_path?(0,Z.jsx)(`span`,{className:ae,children:e.repo_path}):null,e.ref?(0,Z.jsxs)(`span`,{className:ae,children:[`@`,e.ref]}):null]}):null]}),(0,Z.jsx)(ce,{testId:`plugin-picker-toggle-${e.name}`,isSelected:t,isDisabled:n,onToggle:r,enableLabelKey:f.BUTTON$ADD,disableLabelKey:f.COMMON$REMOVE,enableTooltipKey:f.BUTTON$ADD,disableTooltipKey:f.COMMON$REMOVE})]})}function Q(e){return[e.source,e.ref??``,e.repo_path??``].join(`\0`)}function Pe(e){return{source:e.source,ref:e.ref??null,repo_path:e.repo_path??null}}function Fe(e,t){let n=Q(t);return e.some(e=>Q(e)===n)}function Ie(e,t){let n=Q(t);return e.some(e=>Q(e)===n)?e.filter(e=>Q(e)!==n):[...e,Pe(t)]}function Le(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description,e.source,e.repo_path,e.ref].filter(e=>typeof e==`string`&&e.length>0).some(e=>e.toLowerCase().includes(n)):!0}function Re({selected:e,onChange:t,disabled:n=!1}){let{t:r}=a(`openhands`),{data:i,isLoading:o,isError:s}=je(),[c,l]=(0,X.useState)(``),u=(i??[]).filter(e=>Le(e,c));return(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker`,className:`flex w-full flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:d(`relative flex min-w-0 items-center`,`rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`transition-colors focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`),children:[(0,Z.jsx)(O,{className:`ml-3 h-4 w-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{"data-testid":`plugin-picker-search-input`,type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:r(f.PLUGINS$PICKER_SEARCH_PLACEHOLDER),"aria-label":r(f.PLUGINS$PICKER_SEARCH_PLACEHOLDER),className:d(`min-w-0 flex-1 border-0 bg-transparent outline-none`,`px-3 py-2 text-sm placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`)}),c?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(``),"aria-label":r(f.MCP$SEARCH_CLEAR),className:`mr-2 cursor-pointer rounded p-1 text-tertiary-alt hover:text-white`,children:(0,Z.jsx)(k,{className:`h-4 w-4`,"aria-hidden":!0})}):null]}),o?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-loading`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_LOADING)}):s?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-error`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_ERROR)}):u.length===0?(0,Z.jsx)(`p`,{"data-testid":`plugin-picker-empty`,className:`py-8 text-center text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_EMPTY)}):(0,Z.jsx)(`div`,{className:oe,children:(0,Z.jsx)(`div`,{className:se,children:u.map(r=>(0,Z.jsx)(Ne,{plugin:r,isSelected:Fe(e,r),isDisabled:n,onToggle:()=>t(Ie(e,r))},`${r.source} ${r.ref??``} ${r.repo_path??``} ${r.name}`))})})]})}function ze({selected:e,onChange:t,onClose:n}){let{t:r}=a(`openhands`);return(0,Z.jsx)(A,{onClose:n,children:(0,Z.jsxs)(`div`,{"data-testid":`plugin-picker-modal`,className:d(`relative flex max-h-[80vh] flex-col gap-4 rounded-xl border border-[var(--oh-border)] bg-base-secondary p-6`,M(`lg`),N),children:[(0,Z.jsx)(J,{onClose:n,testId:`plugin-picker-close`}),(0,Z.jsxs)(`div`,{className:`pr-6`,children:[(0,Z.jsx)(Y.H2,{children:r(f.PLUGINS$PICKER_TITLE)}),(0,Z.jsx)(Y.Text,{className:`mt-1 block text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_SUBTITLE)})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:(0,Z.jsx)(Re,{selected:e,onChange:t})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-[var(--oh-border-subtle)] pt-4`,children:[(0,Z.jsx)(Y.Text,{className:`text-sm text-tertiary-light`,children:r(f.PLUGINS$PICKER_SELECTED_COUNT,{count:e.length})}),(0,Z.jsx)(z,{testId:`plugin-picker-done`,type:`button`,variant:`primary`,onClick:n,className:`px-4`,children:r(f.PLUGINS$PICKER_DONE)})]})]})})}function Be({count:e,onClick:t,disabled:n=!1}){let{t:r}=a(`openhands`);return(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`open-plugin-picker`,onClick:t,disabled:n,className:d(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,I,L,F,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Z.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Z.jsx)(ye,{width:16,height:16,className:`shrink-0`,"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:r(f.PLUGINS$PICKER_TRIGGER)}),e>0?(0,Z.jsx)(`span`,{"data-testid":`plugin-picker-count`,className:`inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-white px-1 text-[11px] font-semibold leading-none text-black`,children:e}):null]})}function Ve(){let{t:e}=a(`openhands`);return(0,Z.jsx)(`div`,{className:`flex min-h-[80px] w-full items-center justify-center py-2`,children:(0,Z.jsx)(Y.H1,{className:`w-full text-center leading-normal`,children:e(f.HOME$LETS_START_BUILDING)})})}function He({kind:e,onClick:t,disabled:n=!1,disabledTooltip:r}){let{t:i}=a(`openhands`),o=e===`local`,s=i(o?f.HOME$OPEN_WORKSPACE:f.COMMON$OPEN_REPOSITORY),c=(0,Z.jsxs)(`button`,{type:`button`,"data-testid":o?`open-workspace-button`:`open-repository-button`,onClick:t,disabled:n,className:d(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,I,L,F,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Z.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:o?(0,Z.jsx)(C,{"aria-hidden":!0,className:`h-4 w-4`,strokeWidth:2}):(0,Z.jsx)(ne,{width:16,height:16,className:`shrink-0`})}),(0,Z.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:s})]});return r?(0,Z.jsx)(V,{content:r,placement:`top`,children:(0,Z.jsx)(`span`,{className:`inline-flex`,children:c})}):c}var $=`__ungrouped__`;function Ue({workspaces:e,parents:t=[],value:n,placeholder:r,className:i,disabled:o=!1,disabledTooltip:s,showManage:c,onChange:l,onAddClick:u,onManageClick:p}){let{t:h}=a(`openhands`),[g,_]=(0,X.useState)(n?.name??``),v=(0,X.useRef)(null),y=(0,X.useMemo)(()=>{let t=g.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,g]),b=(0,X.useCallback)(e=>e.parentPath??$,[]),x=(0,X.useMemo)(()=>{let e=new Map;return t.forEach(t=>e.set(t.path,t.name)),e},[t]),{groupedWorkspaces:S,isGrouped:C,headerByFirstIndex:w,groupLabelByIndex:T}=(0,X.useMemo)(()=>{let e=[],t=new Map;y.forEach(n=>{let r=b(n);t.has(r)||(t.set(r,[]),e.push(r)),t.get(r)?.push(n)}),e.sort((e,t)=>e===$?1:t===$?-1:0);let n=e.length>1,r=[],i=new Map,a=new Map;return e.forEach(e=>{let o=e===$?h(f.HOME$WORKSPACE_GROUP_OTHER):x.get(e)||e.split(`/`).filter(Boolean).pop()||e;n&&i.set(r.length,o),(t.get(e)??[]).forEach(e=>{a.set(r.length,o),r.push(e)})}),{groupedWorkspaces:r,isGrouped:n,headerByFirstIndex:i,groupLabelByIndex:a}},[y,b,x,h]),E=(0,X.useCallback)(e=>{l(e),e&&_(e.name)},[l]),D=(0,X.useCallback)(()=>{E(null),_(``)},[E]),{isOpen:O,getToggleButtonProps:k,getMenuProps:A,getInputProps:j,highlightedIndex:M,getItemProps:N,selectedItem:P,closeMenu:F}=m({items:S,itemToString:e=>e?.name??``,selectedItem:n,onSelectedItemChange:({selectedItem:e})=>{E(e??null)},inputValue:g,onIsOpenChange:({isOpen:e,selectedItem:t})=>{_(e?``:t?.name??``)},stateReducer:(e,t)=>t.type===m.stateChangeTypes.InputClick&&e.isOpen?{...t.changes,isOpen:!0}:t.changes}),I=(e,t,n,r,i)=>(0,Z.jsx)(be,{item:e,index:t,isSelected:r?.id===e.id,getItemProps:i,getDisplayText:e=>e.name,getItemKey:e=>e.id,ariaLabel:C?`${T.get(t)??``}, ${e.name}`.trim():void 0},e.id),L=e=>(0,Z.jsx)(me,{inputValue:e,searchMessage:h(f.HOME$NO_WORKSPACES),emptyMessage:h(f.HOME$NO_WORKSPACES),testId:`workspace-dropdown-empty`}),z=(0,X.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),B=(0,X.useCallback)(e=>{z(e),F(),u()},[F,u,z]),W=(0,X.useCallback)(e=>{z(e),F(),u()},[F,u,z]),G=(0,X.useCallback)(e=>{z(e),F(),p()},[F,p,z]),K=(0,X.useCallback)(e=>{z(e),F(),p()},[F,p,z]),te=(0,X.useMemo)(()=>(0,Z.jsxs)(`div`,{className:H,children:[(0,Z.jsx)(`button`,{type:`button`,"data-testid":`add-workspaces-button`,className:d(U,`cursor-pointer`),onMouseDown:z,onTouchStart:z,onTouchEnd:W,onClick:B,children:h(f.HOME$ADD_WORKSPACES)}),(c??e.length>0)&&(0,Z.jsx)(`button`,{type:`button`,"data-testid":`manage-workspaces-button`,className:d(U,`cursor-pointer`),onMouseDown:z,onTouchStart:z,onTouchEnd:K,onClick:G,children:h(f.HOME$MANAGE_WORKSPACES)})]}),[B,W,G,K,z,h,e.length,c]),q=(0,Z.jsxs)(`div`,{className:d(`relative`,i),children:[(0,Z.jsxs)(`div`,{className:`group relative text-[var(--oh-muted)] hover:text-white`,children:[(0,Z.jsx)(`div`,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 z-10`,children:(0,Z.jsx)(ee,{width:16,height:16})}),(0,Z.jsx)(`input`,{...j({disabled:o,placeholder:O&&n?n.name:r??h(f.HOME$WORKSPACE_PLACEHOLDER),className:d(R,`text-inherit shadow-none pl-7 pr-16 text-sm font-normal leading-5`,`placeholder:text-[var(--oh-muted)]`,`disabled:cursor-not-allowed disabled:opacity-60`),onChange:e=>{_(e.target.value)}}),"data-testid":`workspace-dropdown`}),(0,Z.jsxs)(`div`,{className:`absolute right-1 top-1/2 transform -translate-y-1/2 flex items-center`,children:[n&&(0,Z.jsx)(he,{disabled:o,onClear:D}),(0,Z.jsx)(Oe,{isOpen:O,disabled:o,getToggleButtonProps:k})]})]}),(0,Z.jsx)(Ee,{isOpen:O,filteredItems:S,inputValue:g,highlightedIndex:M,selectedItem:P,getMenuProps:A,getItemProps:N,menuRef:v,renderItem:I,renderItemPrefix:C?(e,t)=>{let n=w.get(t);return n?(0,Z.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,"data-testid":`workspace-group-header`,className:`px-2 pt-2 pb-1 text-xs font-medium text-[var(--oh-muted)] select-none`,children:n}):null}:void 0,renderEmptyState:L,stickyFooterItem:te,testId:`workspace-dropdown-menu`,itemKey:e=>e.id})]});return s?(0,Z.jsx)(V,{content:s,placement:`top`,children:(0,Z.jsx)(`span`,{className:`block`,children:q})}):q}var We=`oh:home-selected-workspace-path`;function Ge(){if(typeof window>`u`)return null;try{let e=window.sessionStorage.getItem(We);return e&&e.length>0?e:null}catch{return null}}function Ke(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(We,e):window.sessionStorage.removeItem(We)}catch{}}function qe({isLoadingSettings:e=!1,onConfirm:t}){let{t:n}=a(`openhands`),{navigate:r}=B(),{data:i,error:o}=T(),c=i?.workspaceParents??[],{mutate:l}=b(),{mutate:u}=D(),{mutate:d}=g(),{mutate:p}=_(),{workspaces:m,parents:v,isLoading:x,isError:C,error:E}=S(),O=h(o??E,n),[k,A]=X.useState(null),[j,M]=X.useState(!1),[N,P]=X.useState(!1),{mutate:F,isPending:I,isSuccess:L}=re(),R=s(),V=I||L||R,H=X.useCallback(e=>{A(e),Ke(e?.path??null)},[]);X.useEffect(()=>{let e=Ge();if(!e)return;let t=m.find(t=>t.path===e);if(t){A(e=>e?.path===t.path?e:t);return}!x&&!C&&!O&&(Ke(null),A(t=>t?.path===e?null:t))},[C,x,m,O]);let U=c.length>0||!!O,W=null;O?W=O:x?W=n(f.HOME$LOADING):C&&(W=n(f.HOME$WORKSPACE_SCAN_ERROR));let G=!!O||e||x&&m.length===0;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[!t&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Z.jsx)(ie,{width:24,height:24}),(0,Z.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:n(f.HOME$WORKSPACES_TAB)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Z.jsx)(Ue,{workspaces:m,parents:v,value:k,placeholder:O?n(f.HOME$WORKSPACES_UNSUPPORTED_PLACEHOLDER):G?n(f.HOME$LOADING):void 0,disabled:G,disabledTooltip:O,showManage:m.length>0||c.length>0,onChange:H,onAddClick:()=>M(!0),onManageClick:()=>P(!0),className:`max-w-auto`},k?.path??`empty-workspace-selection`),U&&W&&(0,Z.jsx)(`p`,{className:`px-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`workspace-status-message`,children:W})]}),(0,Z.jsx)(z,{testId:`workspace-launch-button`,variant:`primary`,type:`button`,isDisabled:!k||!t&&V||e,onClick:()=>{if(k){if(t){t(k);return}F({workingDir:k.path,entryPoint:`home_workspace_form`},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:t?`w-full`:`w-auto absolute bottom-5 left-5 right-5`,children:n(t?f.BUTTON$CONFIRM:V?f.HOME$LOADING:f.BUTTON$LAUNCH)}),(0,Z.jsx)(y,{isOpen:j,onClose:()=>M(!1),onAdd:e=>{let t=e[e.length-1];l(e,{onSuccess:()=>{t&&H(t)}})},onAddParent:e=>d(e)}),(0,Z.jsx)(w,{isOpen:N,workspaces:m,workspaceParents:c,onClose:()=>P(!1),onRemove:e=>{k?.path===e&&H(null),u(e)},onRemoveParent:e=>{k?.parentPath===e&&H(null),p(e)}})]})}function Je({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=a(`openhands`),{isLoadingSettings:i}=K();return e?(0,Z.jsx)(A,{onClose:t,children:(0,Z.jsxs)(j,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Z.jsx)(J,{onClose:t,testId:`close-open-workspace-dialog`}),(0,Z.jsx)(`div`,{className:`w-full pr-6`,children:(0,Z.jsx)(P,{title:r(f.HOME$OPEN_WORKSPACE)})}),(0,Z.jsx)(`div`,{className:`w-full`,"data-testid":`open-workspace-dialog-body`,children:(0,Z.jsx)(qe,{isLoadingSettings:i,onConfirm:e=>{n(e),t()}})})]})}):null}function Ye({onRepoSelection:e,isLoadingSettings:t=!1,onConfirm:n}){let{navigate:r}=B(),[i,o]=X.useState(null),[c,l]=X.useState(null),[u,d]=X.useState(null),{providers:p}=K(),{addRecentRepository:m,setLastSelectedProvider:h,getLastSelectedProvider:g}=te(),{mutate:_,isPending:v,isSuccess:y}=re(),b=s(),{t:x}=a(`openhands`);X.useEffect(()=>{if(p.length!==0){if(p.length===1&&!u){d(p[0]);return}if(p.length>1&&!u){let e=g();e&&p.includes(e)&&d(e)}}},[p,u,g]);let S=v||y||b,C=t=>{t!==u&&(d(t),h(t),o(null),l(null),e?.(null))},w=X.useCallback(e=>{l(e)},[]);return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[!n&&(0,Z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Z.jsx)(ne,{width:24,height:24}),(0,Z.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:x(f.COMMON$OPEN_REPOSITORY)})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:x(f.HOME$SELECT_OR_INSERT_URL)}),p.length<=1?null:(0,Z.jsx)(Ce,{providers:p,value:u,className:`max-w-[500px]`,onChange:C,disabled:t})]}),(0,Z.jsx)(ve,{provider:u||p[0],value:i?.id||null,repositoryName:i?.full_name||null,placeholder:`user/repo`,disabled:!u||t,onChange:t=>{t?(e?.(t),o(t)):(e?.(null),o(null),l(null))},className:`max-w-auto`}),(()=>{let e=i?.main_branch||null;return(0,Z.jsx)(pe,{repository:i?.full_name||null,provider:u||p[0],selectedBranch:c,onBranchSelect:w,defaultBranch:e,className:`max-w-full`,disabled:!i||t})})()]}),(0,Z.jsx)(z,{testId:`repo-launch-button`,variant:`primary`,type:`button`,isDisabled:!i||!c||!n&&S||p.length>1&&!u||t,onClick:()=>{if(!(!i||!c)){if(m(i),n){n({repository:i,branch:c,provider:u});return}_({repository:{name:i.full_name||``,gitProvider:i.git_provider||`github`,branch:c.name||`main`},entryPoint:`home_repo_form`},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:`w-full`,children:x(n?f.BUTTON$CONFIRM:S?f.HOME$LOADING:f.BUTTON$LAUNCH)})]})}function Xe({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=a(`openhands`),{isLoadingSettings:i}=K();return e?(0,Z.jsx)(A,{onClose:t,children:(0,Z.jsxs)(j,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Z.jsx)(J,{onClose:t,testId:`close-open-repository-dialog`}),(0,Z.jsx)(`div`,{className:`w-full pr-6`,children:(0,Z.jsx)(P,{title:r(f.COMMON$OPEN_REPOSITORY)})}),(0,Z.jsx)(`div`,{className:`w-full`,"data-testid":`open-repository-dialog-body`,children:(0,Z.jsx)(Ye,{isLoadingSettings:i,onConfirm:e=>{n(e),t()}})})]})}):null}function Ze(e,t){return e===`new_worktree`?f.COMMON$WORKSPACE_MODE_NEW_WORKTREE:t===`cloud`?f.COMMON$WORKSPACE_MODE_CLOUD_REPO:f.COMMON$WORKSPACE_MODE_LOCAL_REPO}function Qe({mode:e}){return e===`new_worktree`?(0,Z.jsx)(v,{className:`size-3`,strokeWidth:2,"aria-hidden":!0}):(0,Z.jsx)(ne,{width:12,height:12,color:`white`,"aria-hidden":!0})}var $e=[`local_repo`,`new_worktree`];function et({value:e,backendKind:t,onChange:n,disabled:r=!1,testId:i=`workspace-mode-selector`}){let{t:o}=a(`openhands`),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=o(Ze(e,t));return(0,X.useEffect)(()=>{if(!s)return;let e=e=>{l.current&&!l.current.contains(e.target)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),(0,X.useEffect)(()=>{if(!s)return;let e=e=>{e.key===`Escape`&&c(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s]),(0,Z.jsxs)(`div`,{ref:l,className:`relative inline-flex`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-testid":i,"aria-haspopup":`menu`,"aria-expanded":s,"aria-label":u,disabled:r,onClick:()=>c(e=>!e),className:d(`group flex flex-row items-center justify-between gap-2 pl-2.5 pr-2 py-1 rounded-[100px] truncate relative`,`border border-[rgba(71,74,84,0.50)] bg-transparent text-white`,r?`cursor-not-allowed opacity-50`:`cursor-pointer hover:border-[var(--oh-border-subtle)]`),children:[(0,Z.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:(0,Z.jsx)(Qe,{mode:e})}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-normal leading-5`,children:u}),(0,Z.jsx)(p,{className:`size-3 shrink-0 text-white`,"aria-hidden":!0})]}),s?(0,Z.jsx)(`div`,{role:`menu`,"data-testid":`${i}-menu`,className:d(`absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)] p-1 shadow-lg`,H),children:$e.map(r=>{let a=o(Ze(r,t));return(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":r===e,"data-testid":`${i}-option-${r}`,onClick:()=>{n(r),c(!1)},className:W,children:[(0,Z.jsx)(`span`,{className:G,children:(0,Z.jsx)(Qe,{mode:r})}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]},r)})}):null]})}function tt({workspace:e,repository:t,branch:n,provider:r,workspaceMode:i,backendKind:a,onRepoClick:o,onWorkspaceModeChange:s}){let c=e?e.path.replace(/\/+$/,``).split(`/`).pop()||e.path:null;return(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center flex-wrap`,"data-testid":`home-git-control-bar-preview`,children:[(0,Z.jsx)(Te,{selectedRepository:t?.full_name??null,gitProvider:r??null,workspaceName:c,onClick:o}),e?(0,Z.jsx)(et,{value:i,backendKind:a,onChange:s}):null,n?(0,Z.jsx)(Se,{selectedBranch:n.name,selectedRepository:t?.full_name??null,gitProvider:r??null}):null]})}function nt(){let{t:e}=a(`openhands`),{backend:t}=u(),{navigate:n}=B(),r=t.kind===`local`,[i,d]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`local_repo`),[w,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),{mutateAsync:k,isPending:A}=re(),j=s(),M=A||j,{isConfigured:N,isLoading:P}=we(),F=!P&&!N,{images:I,files:L,imagesMarkedUploadAsFile:R,clearAllFiles:z}=q(),{handleUpload:V}=ge(),{error:H}=T({enabled:r}),U=r?h(H,e):null,W=r?!!p:!!g&&!!v,G=xe(null,t=>{let i=t.trim(),a=I.length>0||L.length>0;if(!i&&!a||M||F)return;let s={images:[...I],files:[...L]},u={query:a?void 0:i||void 0,entryPoint:`home_chat_launcher`};r&&p?u={...u,workingDir:p.path,workspaceMode:S}:!r&&g&&v&&(u={...u,repository:{name:g.full_name,gitProvider:g.git_provider,branch:v.name}}),w.length>0&&(u={...u,plugins:w});let d=o.loading(e(f.HOME$CREATING_CONVERSATION),l);(async()=>{try{let t=await k(u);o.dismiss(d);try{sessionStorage.removeItem(fe)}catch{}let l=t.conversation_id,f=l.startsWith(`task-`);if(a)if(!r||f){let e=t.task_id??(f?l.slice(5):null);if(!e){c(null);return}ue(e,{content:i,images:s.images,files:s.files,imagesMarkedUploadAsFile:[...R]}),z(),await Me({conversationId:l,text:i,images:s.images,imagesMarkedUploadAsFile:R}),n(`/conversations/${l}`);return}else try{await ke({conversationId:l,content:i,images:s.images,files:s.files,imagesMarkedUploadAsFile:R,t:e}),z()}catch(e){c(e instanceof Error?e.message:null);return}f&&i&&await Me({conversationId:l,text:i,images:[],imagesMarkedUploadAsFile:[]}),n(`/conversations/${l}`)}catch(e){o.dismiss(d),c(e instanceof Error?e.message:null)}})()});return(0,Z.jsxs)(`div`,{"data-testid":`home-chat-launcher`,className:`flex w-full max-w-[800px] flex-col gap-4 md:px-4`,children:[(0,Z.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,Z.jsx)(Ve,{})}),(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(_e,{onSubmit:G,onFilesPaste:V,disabled:M||F})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-2`,children:[W?(0,Z.jsx)(tt,{workspace:p,repository:g,branch:v,provider:b,workspaceMode:S,backendKind:t.kind,onRepoClick:()=>d(!0),onWorkspaceModeChange:C}):(0,Z.jsx)(He,{kind:r?`local`:`cloud`,onClick:()=>d(!0),disabled:M||!!U,disabledTooltip:U}),(0,Z.jsx)(Be,{count:w.length,onClick:()=>O(!0),disabled:M})]}),r?(0,Z.jsx)(Je,{isOpen:i,onClose:()=>d(!1),onConfirm:e=>{m(e),_(null),y(null),x(null),C(`local_repo`)}}):(0,Z.jsx)(Xe,{isOpen:i,onClose:()=>d(!1),onConfirm:({repository:e,branch:t,provider:n})=>{_(e),y(t),x(n??e.git_provider),m(null),C(`local_repo`)}}),D&&(0,Z.jsx)(ze,{selected:w,onChange:E,onClose:()=>O(!1)})]})}function rt(){let e=x(r().search);return(0,Z.jsxs)(`div`,{"data-testid":`home-screen`,className:`custom-scrollbar-always flex h-full flex-col overflow-y-auto rounded-xl bg-transparent px-4 md:px-0 lg:px-[42px]`,children:[(0,Z.jsx)(`div`,{className:`md:px-4 lg:px-0`,children:(0,Z.jsx)(De,{})}),(0,Z.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col items-center justify-center`,children:(0,Z.jsx)(nt,{})}),e?null:(0,Z.jsx)(E,{})]})}var it=i(rt);export{it as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./home-TFhnmZLx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{n as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{p as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";import{t as o}from"./useMutation-DHLpZ6J0.js";import{Dt as s,Ot as c,R as l,Z as u,ct as d,jt as f,n as ee,ot as p}from"./active-backend-context-mY7Gff5c.js";import{t as m,z as h}from"./utils-DsWhWn2F.js";import{n as g,t as _}from"./vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-C7Yh77RT.js";import{a as v,c as y,d as te,i as b,n as x,o as S,r as C,s as w,t as T}from"./settings-service.api-CTJRrvMu.js";import{n as E}from"./use-settings-DIAo5KFk.js";import{t as ne}from"./modal-backdrop-X-vKo61e.js";import{n as re}from"./modal-classes-DFFO6BMU.js";import{t as ie}from"./brand-button-BUlDL-mz.js";import{t as D}from"./styled-tooltip-B3kIdVyH.js";import{t as ae}from"./modal-close-button-vxkAIRyZ.js";import{t as O}from"./settings-input-BEaTCem1.js";import{t as oe}from"./v4-DDdyfk2q.js";import{t as k}from"./secrets-service-Dbv5Zb8G.js";function A(e){return[...e.sse_servers.map((e,t)=>({id:`sse-${t}`,type:`sse`,name:typeof e==`object`?e.name:void 0,url:typeof e==`string`?e:e.url,headers:typeof e==`object`?e.headers:void 0,auth:typeof e==`object`?e.auth:void 0,enabled:typeof e==`object`?e.enabled:void 0})),...e.stdio_servers.map((e,t)=>({id:`stdio-${t}`,type:`stdio`,name:e.name,command:e.command,args:e.args,env:e.env,enabled:e.enabled})),...e.shttp_servers.map((e,t)=>({id:`shttp-${t}`,type:`shttp`,name:typeof e==`object`?e.name:void 0,url:typeof e==`string`?e:e.url,headers:typeof e==`object`?e.headers:void 0,timeout:typeof e==`object`?e.timeout:void 0,auth:typeof e==`object`?e.auth:void 0,enabled:typeof e==`object`?e.enabled:void 0}))]}var j=e(t()),M=n();function N(e){return e.connectionOptions.filter(e=>e.provider===`mcp`&&!!e.transport)}function P(e){return N(e)[0]}function F(e){if(e.auth.strategy!==`oauth2`)return!0;let t=e.auth.oauth;return t?!t.authorizationUrl&&!t.tokenUrl&&!t.registrationUrl&&!t.additionalAuthorizationParams&&!t.additionalTokenParams:!1}function se(e){return N(e).find(F)}function ce(e){return P(e)?.transport}function le(e){switch(e){case`none`:return`none`;case`body`:return`client_secret_post`;case`basic`:return`client_secret_basic`;default:return}}function ue(e){if(e.auth.strategy!==`oauth2`)return;let t={type:`oauth`},n=le(e.auth.oauth?.clientAuthentication);return n&&(t.client_auth_method=n),e.auth.oauth?.scopes?.length&&(t.scopes=e.auth.oauth.scopes),Object.keys(t).length>1?t:void 0}function de(e){return e.filter(e=>!!P(e))}var fe=e=>{try{return new URL(e)}catch{return null}};function pe(e,t){let n=typeof e==`string`?e:``,r=typeof t==`string`?t:``;if(!n||!r)return!1;let i=fe(n),a=fe(r);return!i||!a?n.replace(/\/+$/,``)===r.replace(/\/+$/,``):i.protocol===a.protocol&&i.host===a.host&&i.pathname.replace(/\/+$/,``)===a.pathname.replace(/\/+$/,``)}function me(e,t){return t.find(t=>ge(e,t))??null}function he(e,t){for(let n of N(e)){let e=me(n.transport,t);if(e)return e}return null}function ge(e,t){if(e.kind===`shttp`){let n=e.url;return t.type===`shttp`&&!!t.url&&pe(t.url,n)}if(e.kind===`sse`){let n=e.url;return t.type===`sse`&&!!t.url&&pe(t.url,n)}return t.type===`stdio`&&t.name===e.serverName}function _e(e){return e.trim().toLowerCase()}function ve(e){return e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>(t.entry.popularityRank??0)-(e.entry.popularityRank??0)||e.index-t.index).map(({entry:e})=>e)}function ye(e,t){return t.find(t=>t.id===e)}function be(e,t){let n=_e(t);return n?[e.name,e.description,e.id,...e.keywords??[]].join(` `).toLowerCase().includes(n):!0}function xe(e,t,n){let r=_e(n);return r?[e.type,`name`in e?e.name:void 0,`command`in e?e.command:void 0,`args`in e?e.args?.join(` `):void 0,`url`in e?e.url:void 0,t?.name,t?.description,t?.id,...t?.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(r):!0}function Se(e,t){return t.find(t=>N(t).some(t=>ge(t.transport,e)))}function I({fieldKey:e,checked:t,onToggle:n}){let{t:r}=i(`openhands`);return(0,M.jsxs)(`label`,{"data-testid":`mcp-install-save-secret-${e}`,className:m(`flex items-center gap-2 px-3 py-2 mt-0.5 rounded-lg border cursor-pointer transition-colors`,t?`border-green-500/35 bg-green-500/10`:`border-[var(--oh-border)] bg-transparent hover:bg-white/[0.03]`),children:[(0,M.jsx)(`input`,{className:`sr-only`,id:`mcp-save-secret-checkbox-${e}`,type:`checkbox`,checked:t,onChange:e=>n(e.target.checked)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,className:m(`relative inline-flex h-[22px] w-[40px] shrink-0 items-center rounded-full border transition-colors duration-200`,t?`border-green-500 bg-green-500`:`border-[var(--oh-border)] bg-surface-raised`),children:(0,M.jsx)(`span`,{className:m(`inline-block size-4 rounded-full transition-transform duration-200`,t?`translate-x-[21px] bg-white`:`translate-x-[2px] bg-[var(--oh-muted)]`)})}),(0,M.jsx)(`span`,{className:`text-sm`,children:r(h.MCP$ALSO_SAVE_AS_SECRET)}),(0,M.jsx)(`code`,{className:m(`ml-auto text-[11px] font-mono tracking-tight border rounded px-1.5 py-0.5`,t?`text-green-500 border-green-500/35 bg-white/[0.04]`:`text-tertiary-alt border-[var(--oh-border)]`),children:e}),(0,M.jsx)(D,{content:r(h.MCP$SAVE_AS_SECRET_TOOLTIP),placement:`top`,children:(0,M.jsx)(`button`,{type:`button`,"aria-label":r(h.MCP$SAVE_AS_SECRET_TOOLTIP),className:`flex items-center justify-center size-[15px] shrink-0 rounded-full border border-[var(--oh-muted)] text-tertiary-alt text-[9px] font-bold cursor-help`,onClick:e=>e.preventDefault(),children:`?`})})]})}var Ce=e=>(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,M.jsx)(`path`,{d:`M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z`,fill:`currentColor`})}),we={xs:`h-4 w-4 rounded [&>svg]:h-2.5 [&>svg]:w-2.5`,sm:`h-5 w-5 rounded-md [&>svg]:h-3 [&>svg]:w-3`,md:`h-10 w-10 rounded-lg [&>svg]:h-5 [&>svg]:w-5`},Te={slack:Ce};function Ee({entry:e,size:t=`md`,className:n,fallback:r,testId:i}){let a=e?Te[e.id]:void 0;return(0,M.jsx)(`span`,{"aria-hidden":`true`,title:e?.name,"data-testid":i,className:m(`inline-flex shrink-0 items-center justify-center overflow-hidden`,`border border-white/10 shadow-[inset_0_1px_0_rgba(255,255,255,0.18)]`,we[t],n),style:{backgroundColor:e?.iconBg??`var(--oh-color-tertiary)`,color:e?.iconColor??`#FFFFFF`},children:a?(0,M.jsx)(a,{}):e?.logoUrl?(0,M.jsx)(`img`,{src:e.logoUrl,alt:`${e.name} logo`,className:`h-full w-full object-contain p-[22%]`,onError:e=>{let t=e.currentTarget;t.style.display=`none`}}):r??(0,M.jsx)(g,{className:`h-5 w-5`,strokeWidth:2.25})})}var De=new Set([`invalid_auth`,`not_authed`,`account_inactive`,`token_revoked`,`token_expired`]),Oe=e=>e.is_error?e.text||`tool call failed`:null,ke={github:{toolCall:{name:`get_me`,arguments:{}},interpret:Oe},linear:{toolCall:{name:`list_teams`,arguments:{}},interpret:Oe},slack:{toolCall:{name:`slack_list_channels`,arguments:{limit:1}},interpret:e=>{if(e.is_error)return e.text||`tool call failed`;try{let t=JSON.parse(e.text);if(t?.ok===!1&&De.has(t.error))return String(t.error)}catch{}return null}}};function L(e){let t=Se(e,de(_));return t?ke[t.id]:void 0}var Ae=4,je=/token|key|secret|auth/i,Me=[/\bgh[pousr]_[A-Za-z0-9]{16,}\b/g,/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,/\bxox[a-z](?:-[A-Za-z0-9]+)+/g,/\blin_api_[A-Za-z0-9]{10,}\b/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\b/g],Ne=/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi;function R(e,t){typeof t==`string`&&(t.length<Ae||t!==`**********`&&e.add(t))}function z(e,t){for(let n of Object.values(t??{}))R(e,n)}function Pe(e,t){if(t)try{let n=new URL(t);R(e,n.username),R(e,n.password),R(e,decodeURIComponent(n.username)),R(e,decodeURIComponent(n.password)),n.searchParams.forEach((t,n)=>{je.test(n)&&R(e,t)})}catch{}}function Fe(e,t){if(t)switch(t.strategy){case`api_key`:case`bearer`:R(e,t.value);break;case`basic`:R(e,t.username),R(e,t.password);break;case`header`:z(e,t.headers);break;case`oauth2`:R(e,t.authentication?.client_secret),z(e,t.state?.tokens);break;default:break}}function Ie(e){let t=new Set;return z(t,e.env),z(t,e.headers),Fe(t,e.auth),Pe(t,e.url),[...t].sort((e,t)=>t.length-e.length)}function B(e,...t){if(!e)return e;let n=e;for(let e of t)if(e)for(let t of Ie(e))n=n.split(t).join(x);n=n.replace(Ne,`Bearer ${x}`);for(let e of Me)n=n.replace(e,x);return n}var Le=[`none`,`api_key`,`bearer`,`basic`,`header`,`oauth2`],Re=e=>!!e&&typeof e==`object`&&!Array.isArray(e),ze=e=>Re(e)&&typeof e.strategy==`string`&&Le.includes(e.strategy),Be=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Ve=e=>{if(!Be(e))return;let t=Object.entries(e).filter(e=>typeof e[1]==`string`);return t.length>0?Object.fromEntries(t):void 0},He=e=>!!e&&Object.values(e).some(e=>e===`**********`),Ue=(e,t)=>e===`sse`?t===`sse`:e===`shttp`?t===void 0||t===`http`||t===`shttp`||t===`streamable-http`:!1,We=e=>{if(!e)return;let t=/^stdio-(\d+)$/.exec(e);return t?Number.parseInt(t[1],10):void 0},Ge=(e,t)=>{let n=We(e);if(n!==void 0)return Object.entries(t).filter(([,e])=>!e.url)[n]?.[1]},Ke=(e,t)=>e.type===`stdio`?Ge(e.id,t)??(e.name?t[e.name]:void 0):e.name&&t[e.name]?t[e.name]:Object.values(t).find(t=>t.url===e.url&&Ue(e.type,t.transport));async function qe(e){let t=(await T.fetchSettingsFromApi(`encrypted`)).agent_settings?.mcp_config;if(Be(t))return Ke(e,t)}async function Je(e){let t=e.type===`stdio`&&He(e.env),n=(e.type===`sse`||e.type===`shttp`)&&C(e.auth);if(!t&&!n)return e;try{let r=await qe(e);if(!r)return e;if(t){let t=Ve(r.env)??{},n=Object.fromEntries(Object.entries(e.env??{}).map(([e,n])=>[e,n===`**********`&&typeof t[e]==`string`?t[e]:n]));return{...e,env:n}}return n&&ze(r.auth)?{...e,auth:r.auth}:e}catch{return e}}var Ye=120;function Xe(e){return e.type===`stdio`?{transport:`stdio`,command:e.command,...e.args?.length&&{args:e.args},...e.env&&Object.keys(e.env).length>0&&{env:e.env}}:{transport:e.type===`sse`?`sse`:`http`,url:e.url,...e.headers&&Object.keys(e.headers).length>0&&{headers:e.headers},...e.auth?{auth:e.auth}:{}}}function Ze(e){return e.auth?.strategy===`oauth2`?Ye:e.timeout}async function Qe(e){let t=L(e),n=await Je(e),r=Xe(n),i=Ze(e);return{request:{server:r,...e.name?{name:e.name}:{},...i===void 0?{}:{timeout:i},...t?{tool_call:t.toolCall}:{}},substituted:n}}function $e(e,t){return e.ok?e.tool_result?{...e,tool_result:{...e.tool_result,text:B(e.tool_result.text,...t)}}:e:{...e,error:B(e.error,...t)}}function et(e,t,n){let r=$e(e,n);if(r.ok&&t&&r.tool_result&&r.tools.includes(t.toolCall.name)){let e=t.interpret(r.tool_result);if(e)return{ok:!1,error:e,error_kind:`credentials`}}return r}function tt(){if(p().backend.kind===`local`){let{host:e,apiKey:t}=u();return{host:e,...t?{apiKey:t}:{}}}let e=d().find(e=>e.kind===`local`&&e.host);if(e)return{host:e.host.replace(/\/+$/,``),...e.apiKey?{apiKey:e.apiKey}:{}};throw Error(`OAuth authorization requires a reachable local backend.`)}function V(){let{host:e,apiKey:t}=tt();return new a({host:e,...t?{apiKey:t}:{},timeout:125e3})}function nt(e){return e.status===`succeeded`?{ok:!0,tools:e.tools??[],...e.tool_result!==void 0&&{tool_result:e.tool_result},...e.oauth_state!==void 0&&{oauth_state:e.oauth_state}}:{ok:!1,error:e.error||`OAuth authorization did not complete`,error_kind:e.error_kind||`unknown`}}var rt=e=>new Promise(t=>{window.setTimeout(t,e)}),H=class e{static async testServer(e){if(p().backend.kind===`cloud`)return{ok:!0,tools:[]};let t=L(e),{host:n,apiKey:r}=u(),i=new a({host:n,...r?{apiKey:r}:{}});try{let{request:n,substituted:r}=await Qe(e);return et(await i.testServer(n),t,[r,e])}finally{i.close()}}static async startOAuth(t){let n=V();try{return await e.startOAuthWithClient(n,t)}finally{n.close()}}static async getOAuthStatus(t){let n=V();try{return await e.getOAuthStatusWithClient(n,t)}finally{n.close()}}static async submitOAuthCallback(t,n){let r=V();try{return await e.submitOAuthCallbackWithClient(r,t,n)}finally{r.close()}}static async authorizeOAuth(t){let n=L(t),r=e=>et(e,n,[t]),i=window.open(`about:blank`,`_blank`),a=V();try{let n=await e.startOAuthWithClient(a,t);if(!n.ok||!n.job_id||!n.authorization_url)return i?.close(),r({ok:!1,error:n.error||`Could not start OAuth authorization`,error_kind:n.error_kind||`unknown`});let o=await e.getOAuthStatusWithClient(a,n.job_id);for(let t=0;t<20;t+=1){if(o.status===`succeeded`||o.status===`failed`)return i?.close(),r(nt(o));if(o.callback_ready)break;await rt(250),o=await e.getOAuthStatusWithClient(a,n.job_id)}i&&(i.location.href=n.authorization_url);for(let t=0;t<Ye;t+=1)if(await rt(1e3),o=await e.getOAuthStatusWithClient(a,n.job_id),o.status===`succeeded`||o.status===`failed`)return i?.close(),r(nt(o));return{ok:!1,error:`OAuth authorization timed out`,error_kind:`timeout`}}finally{a.close()}}static async startOAuthWithClient(e,t){let{request:n}=await Qe(t);return e.startOAuth(n)}static async getOAuthStatusWithClient(e,t){return await e.getOAuthStatus(t)}static async submitOAuthCallbackWithClient(e,t,n){return await e.submitOAuthCallback(t,{callback_url:n})}},U=e=>Object.keys(e??{}).sort();function W(e){return e.type===`stdio`?JSON.stringify({type:e.type,name:e.name??``,command:e.command??``,args:e.args??[],envKeys:U(e.env)}):JSON.stringify({type:e.type,name:e.name??``,url:e.url??``,headerKeys:U(e.headers),authStrategy:e.auth?.strategy??``,authHeaderName:e.auth?.strategy===`api_key`?e.auth.header_name??``:``,authHeaderKeys:e.auth?.strategy===`header`?U(e.auth.headers):[]})}var G={},K=new Set,it=1;function q(e){G=e,K.forEach(e=>e())}function at(){return G}function ot(e){return K.add(e),()=>{K.delete(e)}}function st(e){let t=it;return it+=1,q({...G,[e]:{status:`checking`,checkId:t}}),t}function J(e,t,n){let r=G[e];r?.status!==`checking`||r.checkId!==t||q({...G,[e]:n})}function ct(e,t){q({...G,[e]:t})}function lt(e){if(!(e in G))return;let{[e]:t,...n}=G;q(n)}var ut=/\b(401|403)\b|unauthorized|forbidden|invalid[ _-]?(token|credentials?|api[ _-]?key)/i;function dt(e,t){return{status:`failed`,kind:`unknown`,error:B(t instanceof Error?t.message:String(t),e),checkedAt:Date.now()}}function Y(e,t){let n=Date.now();if(!t.ok)return{status:`failed`,kind:(t.error_kind===`connection`||t.error_kind===`unknown`)&&ut.test(t.error)?`credentials`:t.error_kind,error:t.error,checkedAt:n};let r=L(e);return{status:`healthy`,verification:r&&t.tools.includes(r.toolCall.name)&&t.tool_result&&!t.tool_result.is_error?`verified`:`connectivity-only`,toolCount:t.tools.length,checkedAt:n}}async function ft(e){let t=W(e),n=st(t),r;try{r=Y(e,await H.testServer(e))}catch(t){r=dt(e,t)}J(t,n,r)}async function pt(e){let t=W(e),n=st(t);try{let r=await H.authorizeOAuth(e);return J(t,n,Y(e,r)),r}catch(r){return J(t,n,dt(e,r)),null}}function X(e,t,n){let r=W(e);n.some(e=>W(e)===r)||ct(r,Y(e,t))}function mt(){let e=r(),{data:t}=E();return o({mutationFn:async e=>{if(!t)return;let n=b(t.agent_settings?.mcp_config),r={sse_servers:[...n.sse_servers],stdio_servers:[...n.stdio_servers],shttp_servers:[...n.shttp_servers]};e.type===`sse`?r.sse_servers.push(S(e)):e.type===`stdio`?r.stdio_servers.push(w(e)):e.type===`shttp`&&r.shttp_servers.push(v(e)),await T.saveSettings({agent_settings_diff:{mcp_config:y(r)}})},onSuccess:()=>{e.invalidateQueries({queryKey:l.personal()})}})}function ht(){return o({mutationFn:e=>H.testServer(e)})}function gt(e){return e.length<=3?e.join(`, `):`${e.slice(0,3).join(`, `)} … (+${e.length-3})`}function _t(){let{t:e}=i(`openhands`),t=r();return(0,j.useCallback)((n,r,i)=>{let a=n.filter(e=>i[e.key]&&(r[e.key]??``).trim());return a.length===0?Promise.resolve():Promise.allSettled(a.map(e=>k.createSecret(e.key,r[e.key].trim(),e.label))).then(n=>{let r=a.filter((e,t)=>n[t].status===`fulfilled`).map(e=>e.key),i=a.filter((e,t)=>n[t].status===`rejected`).map(e=>e.key);r.length>0&&(t.invalidateQueries({queryKey:[`secrets-search`]}),t.invalidateQueries({queryKey:[`secrets`]}),c(e(h.MCP$SECRETS_SAVED,{keys:gt(r)}))),i.length>0&&s(e(h.MCP$SECRETS_SAVE_FAILED,{keys:gt(i)}))})},[e,t])}function Z(e,t,n){switch(t){case`timeout`:return e(h.MCP$TEST_ERROR_TIMEOUT);case`connection`:return e(h.MCP$TEST_ERROR_CONNECTION);case`credentials`:return e(h.MCP$TEST_ERROR_CREDENTIALS,{error:n});default:return e(h.MCP$TEST_ERROR_UNKNOWN,{error:n})}}function Q(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,n=[],r=0;for(let i of e.matchAll(t))i.index>r&&n.push(e.slice(r,i.index)),n.push((0,M.jsx)(`a`,{href:/^https?:\/\//i.test(i[2])?i[2]:`#`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-white transition-colors`,children:i[1]},i.index)),r=i.index+i[0].length;return r<e.length&&n.push(e.slice(r)),n}function vt(e){return e?.transport.kind!==`shttp`&&e?.transport.kind!==`sse`?!1:[`api_key`,`bearer`].includes(e.auth.strategy)}function yt(e){return!!e&&e.auth.strategy===`oauth2`}function bt(e){return e.transport.kind===`stdio`?e.auth.apiKeyOptional??!1:e.auth.apiKeyOptional??e.transport.apiKeyOptional??!1}function $(e){return e?.transport.kind!==`shttp`&&e?.transport.kind!==`sse`?[]:e.transport.headerFields??[]}function xt(e){let t={},n={},r=se(e),i=r?.transport;if(i?.kind===`stdio`){for(let e of i.envFields??[])t[e.key]=``,n[e.key]=e.type===`password`;for(let e of i.argFields??[])t[e.key]=``}else if(i?.kind===`shttp`||i?.kind===`sse`){t.url=i.url;for(let e of $(r))t[e.key]=``,n[e.key]=e.type===`password`;vt(r)&&(t.api_key=``,r?.auth.credentialSecretName&&(n.api_key=r.auth.saveCredentialAsSecretByDefault??!1))}return{values:t,errors:{},savedAsSecret:n}}function St({entry:e,existingServers:t,onClose:n,onSuccess:r}){let{t:a}=i(`openhands`),{mutate:o,isPending:s}=mt(),{mutate:l,isPending:u}=ht(),d=_t(),{backend:p}=ee(),m=p.kind===`cloud`,[g,_]=j.useState(()=>xt(e)),v=j.useRef(g);v.current=g;let[y,b]=j.useState(null),[x,S]=j.useState(!1),[C,w]=j.useState(!1),T=se(e),E=T?.transport,D=u||C||s||x,k=(e,t)=>{_(n=>({...n,values:{...n.values,[e]:t},errors:{...n.errors,[e]:null}})),b(null)},A=(e,t)=>{_(n=>({...n,savedAsSecret:{...n.savedAsSecret,[e]:t}}))},N=()=>{let e=T?.auth.credentialSecretName,t=v.current.values.api_key?.trim();return!e||!t||!v.current.savedAsSecret.api_key?Promise.resolve():d([{key:e,label:T.auth.credentialLabel??e,type:`password`,required:!0}],{[e]:t},{[e]:!0})},P=()=>E?.kind===`stdio`?d(E.envFields??[],v.current.values,v.current.savedAsSecret):E?.kind===`shttp`||E?.kind===`sse`?Promise.all([N(),d($(T),v.current.values,v.current.savedAsSecret)]).then(()=>void 0):Promise.resolve(),F=i=>{if(i.auth?.strategy===`oauth2`){w(!0),H.authorizeOAuth(i).then(s=>{if(!s.ok){b(Z(a,s.error_kind,s.error));return}let l=s.oauth_state?{...i,auth:{...i.auth,state:s.oauth_state}}:i;o(l,{onSuccess:()=>{m||X(l,s,t),c(a(h.MCP$INSTALL_SUCCESS)),S(!0),(async()=>{try{await P()}finally{r?.(e),n()}})()},onError:e=>{b(f(e)||a(h.ERROR$GENERIC))}})}).catch(e=>{b(f(e)||a(h.ERROR$GENERIC))}).finally(()=>w(!1));return}l(i,{onSuccess:s=>{if(!s.ok){b(Z(a,s.error_kind,s.error));return}let l=s.oauth_state&&i.auth?.strategy===`oauth2`?{...i,auth:{...i.auth,state:s.oauth_state}}:i;o(l,{onSuccess:()=>{m||X(l,s,t),c(a(h.MCP$INSTALL_SUCCESS)),S(!0),(async()=>{try{await P()}finally{r?.(e),n()}})()},onError:e=>{b(f(e)||a(h.ERROR$GENERIC))}})},onError:e=>{b(f(e)||a(h.ERROR$GENERIC))}})},ce=()=>{if(E?.kind!==`shttp`&&E?.kind!==`sse`||!T)return;let t=g.values.api_key?.trim()??``,n=E.urlEditable?g.values.url?.trim()??``:E.url,r=yt(T),i=vt(T),o=$(T),s={};if(!n)s.url=a(h.SETTINGS$MCP_ERROR_URL_REQUIRED);else try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s.url=a(h.SETTINGS$MCP_ERROR_URL_INVALID_PROTOCOL))}catch{s.url=a(h.SETTINGS$MCP_ERROR_URL_INVALID)}for(let e of o)e.required&&!(g.values[e.key]??``).trim()&&(s[e.key]=a(h.MCP$ERROR_FIELD_REQUIRED));if(!r&&i&&!bt(T)&&!t&&(s.api_key=a(h.MCP$ERROR_FIELD_REQUIRED)),Object.values(s).some(Boolean)){_(e=>({...e,errors:s}));return}let c=r?ue(T):void 0,l=Object.fromEntries(o.map(e=>[e.key,g.values[e.key]?.trim()??``]).filter(([,e])=>e)),u=Object.keys(l).length>0,d;r?d={strategy:`oauth2`,...c&&{authentication:c}}:i&&t?d=T.auth.strategy===`api_key`?{strategy:`api_key`,value:t,...T.auth.apiKeyHeaderName&&{header_name:T.auth.apiKeyHeaderName}}:{strategy:`bearer`,value:t}:u&&(d={strategy:`header`,headers:l}),F({id:`${E.kind}-${oe()}`,type:E.kind,name:te(e.id),url:n,...d&&{auth:d},...u&&d?.strategy!==`header`&&{headers:l}})},le=()=>{if(E?.kind!==`stdio`)return;let e=E,t={};for(let n of e.envFields??[])n.required&&!(g.values[n.key]??``).trim()&&(t[n.key]=a(h.MCP$ERROR_FIELD_REQUIRED));for(let n of e.argFields??[])n.required&&!(g.values[n.key]??``).trim()&&(t[n.key]=a(h.MCP$ERROR_FIELD_REQUIRED));if(Object.values(t).some(Boolean)){_(e=>({...e,errors:t}));return}let n={};for(let t of e.envFields??[]){let e=g.values[t.key]?.trim();e&&(n[t.key]=e)}let r=[];for(let t of e.argFields??[]){let e=g.values[t.key]?.trim();if(e)for(let t of e.split(/\s+/))t&&r.push(t)}F({id:`stdio-${oe()}`,type:`stdio`,name:e.serverName,command:e.command,args:[...e.args,...r],...Object.keys(n).length>0&&{env:n}})};return(0,M.jsx)(ne,{onClose:n,"aria-label":e.name,children:(0,M.jsxs)(`form`,{"data-testid":`mcp-install-modal`,"data-marketplace-id":e.id,onSubmit:e=>(e.preventDefault(),b(null),E?.kind===`shttp`||E?.kind===`sse`?ce():le()),className:`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] w-[520px] max-w-[90vw] max-h-[85vh] overflow-y-auto custom-scrollbar`,children:[(0,M.jsx)(ae,{onClose:n,testId:`mcp-install-modal-close`,disabled:D}),(0,M.jsxs)(`div`,{className:`flex items-start gap-3 pr-6`,children:[(0,M.jsx)(Ee,{entry:e}),(0,M.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,M.jsx)(`h2`,{className:re,children:e.name}),(0,M.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:e.description})]})]}),e.installHint&&(0,M.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:e.installHint}),e.docsUrl&&(0,M.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-xs text-[var(--oh-muted)] hover:text-white hover:underline self-start transition-colors`,children:a(h.MCP$VIEW_DOCS)}),(0,M.jsx)(`div`,{className:`flex flex-col gap-3`,children:(()=>{if(E?.kind===`shttp`||E?.kind===`sse`){let e=yt(T),t=vt(T),n=T?bt(T):!1,r=T?.auth.credentialSecretName,i=$(T);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(O,{testId:`mcp-install-field-url`,name:`url`,type:`url`,label:a(h.SETTINGS$MCP_URL),value:g.values.url??E.url,onChange:e=>k(`url`,e),isDisabled:!E.urlEditable,className:`w-full`}),g.errors.url&&(0,M.jsx)(`p`,{className:`text-xs text-red-500`,children:g.errors.url}),i.map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(O,{testId:`mcp-install-field-${e.key}`,name:e.key,type:e.type===`password`?`password`:`text`,label:e.label,value:g.values[e.key]??``,onChange:t=>k(e.key,t),placeholder:e.placeholder,required:e.required,showOptionalTag:!e.required,className:`w-full`}),e.helperText&&(0,M.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Q(e.helperText)}),g.errors[e.key]&&(0,M.jsx)(`p`,{className:`text-xs text-red-500`,children:g.errors[e.key]}),e.key in g.savedAsSecret&&(0,M.jsx)(I,{fieldKey:e.key,checked:g.savedAsSecret[e.key]??!1,onToggle:t=>A(e.key,t)})]},e.key)),e?(0,M.jsxs)(`div`,{"data-testid":`mcp-install-oauth-info`,className:`flex flex-col gap-2 p-3 rounded-lg border border-[var(--oh-border)] bg-base-tertiary`,children:[(0,M.jsx)(`p`,{className:`text-sm text-secondary-light`,children:a(h.MCP$OAUTH_CONNECT_INFO)}),(0,M.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:a(h.MCP$OAUTH_CONNECT_HINT)})]}):t?(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(O,{testId:`mcp-install-field-api_key`,name:`api_key`,type:`password`,label:T?.auth.credentialLabel??a(h.SETTINGS$MCP_API_KEY),value:g.values.api_key??``,onChange:e=>k(`api_key`,e),placeholder:T?.auth.credentialPlaceholder??a(h.SETTINGS$MCP_API_KEY_PLACEHOLDER),showOptionalTag:n,required:!n,className:`w-full`}),T?.auth.credentialHelp&&(0,M.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Q(T.auth.credentialHelp)}),g.errors.api_key&&(0,M.jsx)(`p`,{className:`text-xs text-red-500`,children:g.errors.api_key}),r&&(0,M.jsx)(I,{fieldKey:r,checked:g.savedAsSecret.api_key??!1,onToggle:e=>A(`api_key`,e)})]}):null]})}if(E?.kind!==`stdio`)return null;let e=E;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(O,{testId:`mcp-install-field-command-readonly`,name:`command-readonly`,type:`text`,label:a(h.MCP$COMMAND_LABEL),value:`${e.command} ${e.args.join(` `)}`.trim(),onChange:()=>{},isDisabled:!0,className:`w-full`}),(e.envFields??[]).map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(O,{testId:`mcp-install-field-${e.key}`,name:e.key,type:e.type===`password`?`password`:`text`,label:e.label,value:g.values[e.key]??``,onChange:t=>k(e.key,t),placeholder:e.placeholder,required:e.required,showOptionalTag:!e.required,className:`w-full`}),e.helperText&&(0,M.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Q(e.helperText)}),g.errors[e.key]&&(0,M.jsx)(`p`,{className:`text-xs text-red-500`,children:g.errors[e.key]}),e.key in g.savedAsSecret&&(0,M.jsx)(I,{fieldKey:e.key,checked:g.savedAsSecret[e.key],onToggle:t=>A(e.key,t)})]},e.key)),(e.argFields??[]).map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(O,{testId:`mcp-install-field-${e.key}`,name:e.key,type:e.type===`password`?`password`:`text`,label:e.label,value:g.values[e.key]??``,onChange:t=>k(e.key,t),placeholder:e.placeholder,required:e.required,showOptionalTag:!e.required,className:`w-full`}),e.helperText&&(0,M.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Q(e.helperText)}),g.errors[e.key]&&(0,M.jsx)(`p`,{className:`text-xs text-red-500`,children:g.errors[e.key]})]},e.key))]})})()}),y&&(0,M.jsx)(`p`,{"data-testid":`mcp-install-modal-error`,className:`text-sm text-red-500 whitespace-pre-wrap`,children:y}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2`,children:[(0,M.jsx)(ie,{type:`button`,variant:`secondary`,onClick:n,testId:`mcp-install-cancel`,isDisabled:D,children:a(h.BUTTON$CANCEL)}),(0,M.jsx)(ie,{type:`submit`,variant:`primary`,isDisabled:D,testId:`mcp-install-submit`,children:a(u||C?h.MCP$VERIFYING:s||x?h.SETTINGS$SAVING:h.MCP$INSTALL_BUTTON)})]})]})})}export{A as C,be as S,ce as _,ft as a,de as b,lt as c,W as d,H as f,he as g,Se as h,mt as i,at as l,Ee as m,Z as n,pt as o,Je as p,ht as r,X as s,St as t,ot as u,ve as v,xe as x,ye as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{H as r,R as i,U as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as s,z as c}from"./utils-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{H as r,R as i,U as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as s,z as c}from"./utils-DsWhWn2F.js";import{t as l}from"./modal-backdrop-X-vKo61e.js";import{r as u,t as d}from"./modal-body-C3bGicn4.js";import{t as f}from"./brand-button-BUlDL-mz.js";import{t as p}from"./modal-close-button-vxkAIRyZ.js";import{t as m}from"./settings-input-BEaTCem1.js";import{n as h}from"./use-create-conversation-CakhLF0X.js";import{r as g}from"./typography-B1UxuuEC.js";import{n as _,t as v}from"./vendor~launch-ChXCOGw8.js";var y=e(t(),1),b=n();function x({pluginIndex:e,paramKey:t,paramValue:n,onParameterChange:r}){let i=`plugin-${e}-param-${t}`;return typeof n==`boolean`?(0,b.jsxs)(`label`,{htmlFor:i,className:`flex w-full cursor-pointer items-center gap-2.5`,children:[(0,b.jsx)(`input`,{id:i,"data-testid":i,type:`checkbox`,checked:n,onChange:n=>r(e,t,n.target.checked),className:`h-4 w-4 shrink-0 rounded`}),(0,b.jsx)(`span`,{className:`text-sm`,children:t})]}):typeof n==`number`?(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`number`,label:t,value:String(n),className:`w-full`,onChange:n=>r(e,t,n===``?0:parseFloat(n)||0)}):(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`text`,label:t,value:String(n??``),className:`w-full`,onChange:n=>r(e,t,n)})}function S({plugin:e,originalIndex:t,isExpanded:n,onToggle:r,getPluginDisplayName:i,onParameterChange:a}){let{t:s}=o(`openhands`);return e.parameters&&Object.keys(e.parameters).length>0?(0,b.jsxs)(`div`,{className:`rounded-lg border border-[var(--oh-border)] bg-tertiary`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer`,"data-testid":`plugin-section-${t}`,children:[(0,b.jsx)(g.Text,{className:`text-base font-normal`,children:i(e)}),n?(0,b.jsx)(v,{className:`h-5 w-5 text-white`}):(0,b.jsx)(_,{className:`h-5 w-5 text-white`})]}),n&&(0,b.jsxs)(`div`,{className:`border-t border-[var(--oh-border-subtle)] px-4 pb-3`,children:[e.ref&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[s(c.LAUNCH$PLUGIN_REF),` `,e.ref]}),e.repo_path&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[s(c.LAUNCH$PLUGIN_PATH),` `,e.repo_path]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(e.parameters||{}).map(([e,n])=>(0,b.jsx)(x,{pluginIndex:t,paramKey:e,paramValue:n,onParameterChange:a},e))})]})]}):null}function C({plugins:e,message:t,isLoading:n=!1,onStartConversation:r,onClose:i}){let{t:a}=o(`openhands`),[m,h]=y.useState(e),[_,v]=y.useState(()=>{let t={};return e.forEach((e,n)=>{e.parameters&&Object.keys(e.parameters).length>0&&(t[n]=!0)}),t}),[x,C]=y.useState(!1),w=m.filter(e=>e.parameters&&Object.keys(e.parameters).length>0),T=m.filter(e=>!e.parameters||Object.keys(e.parameters).length===0),E=e=>{v(t=>({...t,[e]:!t[e]}))},D=(e,t,n)=>{h(r=>{let i=[...r],a={...i[e]};return a.parameters={...a.parameters,[t]:n},i[e]=a,i})},O=e=>{let{source:t,repo_path:n}=e;if(n){let e=n.split(`/`);return e[e.length-1]}if(t.startsWith(`github:`))return t.replace(`github:`,``);if(t.includes(`/`)){let e=t.split(`/`);return e[e.length-1].replace(`.git`,``)}return t},k=e=>{let{source:t}=e;return t.startsWith(`github:`)?t.replace(`github:`,``):t.includes(`github.com/`)&&t.split(`github.com/`)[1]?.replace(`.git`,``)||t},A=()=>{let e=m.map(e=>k(e));return[...new Set(e)]},j=()=>{r(m,t)},M=m.length===1?O(m[0]):a(c.LAUNCH$MODAL_TITLE_GENERIC);return(0,b.jsx)(l,{onClose:i,children:(0,b.jsxs)(`div`,{"data-testid":`plugin-launch-modal`,className:s(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] max-h-[80vh]`,u(`md`),d),children:[(0,b.jsx)(p,{onClose:i,testId:`close-button`}),(0,b.jsxs)(g.H2,{className:`pr-6`,children:[a(c.LAUNCH$MODAL_TITLE),` `,M]}),t&&(0,b.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:[w.length>0&&(0,b.jsx)(`div`,{className:`space-y-3`,children:m.map((e,t)=>(0,b.jsx)(S,{plugin:e,originalIndex:t,isExpanded:!!_[t],onToggle:()=>E(t),getPluginDisplayName:O,onParameterChange:D},`plugin-${t}`))}),T.length>0&&(0,b.jsxs)(`div`,{className:s(w.length>0&&`mt-4`),children:[(0,b.jsx)(g.H3,{className:`mb-2 text-white`,children:w.length>0?a(c.LAUNCH$ADDITIONAL_PLUGINS):a(c.LAUNCH$PLUGINS)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:T.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-md bg-tertiary px-3 py-2 text-sm`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:O(e)}),(0,b.jsxs)(`div`,{className:`text-xs text-white mt-1`,children:[k(e),e.repo_path&&(0,b.jsxs)(`span`,{className:`ml-1`,children:[`/ `,e.repo_path]}),e.ref&&(0,b.jsxs)(`span`,{className:`ml-2`,children:[`@ `,e.ref]})]})]},`simple-plugin-${t}`))})]})]}),(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[var(--oh-border-subtle)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,b.jsx)(`input`,{id:`trust-checkbox`,"data-testid":`trust-checkbox`,type:`checkbox`,checked:x,onChange:e=>C(e.target.checked),className:`mt-1 h-4 w-4 flex-shrink-0`}),(0,b.jsx)(`label`,{htmlFor:`trust-checkbox`,className:`text-sm text-white`,children:a(c.LAUNCH$TRUST_SKILL_CHECKBOX,{sources:A().join(`, `),interpolation:{escapeValue:!1}})})]}),(0,b.jsx)(`div`,{className:`flex w-full justify-end mt-8`,children:(0,b.jsx)(f,{testId:`start-conversation-button`,type:`button`,variant:`primary`,onClick:j,isDisabled:n||!x,className:`px-4`,children:a(n?c.LAUNCH$STARTING:c.LAUNCH$START_CONVERSATION)})})]})]})})}function w(e){if(e)return e.replace(/<[^>]*>/g,``).slice(0,500)||void 0}function T(e){let t=e.get(`plugins`);if(t)try{let n=atob(t),r=JSON.parse(n);if(!Array.isArray(r))return{plugins:[],error:`invalid_format`};let i=[];for(let e of r){if(typeof e!=`object`||!e||typeof e.source!=`string`)return{plugins:[],error:`invalid_format`};i.push({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null,parameters:e.parameters??null})}return i.length===0?{plugins:[],error:`no_plugins`}:{plugins:i,message:w(e.get(`message`))}}catch{return{plugins:[],error:`invalid_format`}}let n=e.get(`plugin_source`);return n?{plugins:[{source:n,ref:e.get(`plugin_ref`)??null,repo_path:e.get(`plugin_repo_path`)??null,parameters:null}],message:w(e.get(`message`))}:{plugins:[],error:`no_plugins`}}function E({errorType:e,onGoHome:t,onTryAgain:n}){let{t:r}=o(`openhands`),i={no_plugins:r(c.LAUNCH$ERROR_NO_PLUGINS),invalid_format:r(c.LAUNCH$ERROR_INVALID_FORMAT),creation_failed:r(c.LAUNCH$ERROR_CREATION_FAILED)};return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center`,"data-testid":`launch-error`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-lg bg-[var(--oh-surface)] p-6 text-center`,children:[(0,b.jsx)(`h2`,{className:`mb-4 text-xl font-medium text-red-400`,children:r(c.LAUNCH$ERROR_TITLE)}),(0,b.jsx)(`p`,{className:`mb-6 text-[var(--oh-text-tertiary)]`,children:i[e]}),(0,b.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md bg-tertiary px-4 py-2 text-sm text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`go-home-button`,children:r(c.LAUNCH$GO_HOME)}),n&&(0,b.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700`,"data-testid":`try-again-button`,children:r(c.LAUNCH$TRY_AGAIN)})]})]})})}var D=a(function(){let[e]=r(),t=i(),{t:n}=o(`openhands`),a=h(),[s,l]=y.useState(null),u=y.useMemo(()=>T(e),[e]),d=async(e,r)=>{l(null);try{t(`/conversations/${(await a.mutateAsync({plugins:e,query:r,entryPoint:`launch_deeplink`})).conversation_id}`)}catch{l(n(c.LAUNCH$ERROR_CREATION_UNKNOWN))}},f=()=>{t(`/conversations`)};return u.error?(0,b.jsx)(E,{errorType:u.error,onGoHome:f}):s?(0,b.jsx)(E,{errorType:`creation_failed`,onGoHome:f,onTryAgain:()=>{l(null),window.location.reload()}}):(0,b.jsx)(`div`,{className:`h-full`,"data-testid":`launch-route`,children:(0,b.jsx)(C,{plugins:u.plugins,message:u.message,isLoading:a.isPending,onStartConversation:d,onClose:f})})});export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-
|
|
1
|
+
import{E as e}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CYPMCkX1.js";var t=e(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]);export{t};
|