@openhands/agent-canvas 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{Trans-De9RwQhA.js → Trans-Ch-OVWEA.js} +1 -1
- package/build/assets/{acp-providers-D_D8VUpP.js → acp-providers-Sy2LKyMa.js} +1 -1
- package/build/assets/active-backend-context-hxq31W25.js +1 -0
- package/build/assets/{add-backend-modal-DIEyAkA4.js → add-backend-modal-Bgy8anoR.js} +1 -1
- package/build/assets/{agent-profiles-settings-BovdV4N8.js → agent-profiles-settings-3mmXljZX.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-BP73yONA.js → agent-server-conversation-service.api-CuSdr4Qb.js} +4 -4
- package/build/assets/{agent-settings-Ofbh6UTD.js → agent-settings-B-W10B4E.js} +1 -1
- package/build/assets/agent-settings-D_yOy8XB.js +1 -0
- package/build/assets/{alert-banner-BW0wRYw6.js → alert-banner-Bpf2NQJq.js} +1 -1
- package/build/assets/{api-key-entry-screen-CZIdRmUJ.js → api-key-entry-screen-Dl0qVYi4.js} +1 -1
- package/build/assets/{app-settings-BHJ9nKti.js → app-settings-yVizGXox.js} +1 -1
- package/build/assets/automation-detail-dvJfLs5u.js +2 -0
- package/build/assets/automation-export-BPcgLqPD.js +2 -0
- package/build/assets/automations-list-CUXogTe0.js +1 -0
- package/build/assets/{back-nav-button-BYmxFxGt.js → back-nav-button-CUS2mi-U.js} +1 -1
- package/build/assets/backend-form-modal-CQJGmItq.js +1 -0
- package/build/assets/{backend-synced-settings-badge-Bs3FSXsS.js → backend-synced-settings-badge-D9hZx05w.js} +1 -1
- package/build/assets/{base-modal-CC5Pp8CF.js → base-modal-BuF2f0YL.js} +1 -1
- package/build/assets/{brand-button-DKPMEKcW.js → brand-button-vMVuyDXu.js} +1 -1
- package/build/assets/{browser-B39N74jU.js → browser-BifzWIBd.js} +1 -1
- package/build/assets/{browser-tab-aiDg7aEn.js → browser-tab-CkkqJnqw.js} +1 -1
- package/build/assets/{chat-send-button-DxuZIoW8.js → chat-send-button-B_jc5z5C.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-T3eAIuPQ.js → circle-plus-check-toggle-C5YxjxvI.js} +1 -1
- package/build/assets/{combobox-caret-CLGvOs32.js → combobox-caret-DoObzqf4.js} +1 -1
- package/build/assets/{command-menu-DKrLCRla.js → command-menu-D-JV3Wqm.js} +1 -1
- package/build/assets/{condenser-settings-D_5vY4m3.js → condenser-settings-Ca8fYZ_Z.js} +1 -1
- package/build/assets/{confirmation-modal-BK1F0A68.js → confirmation-modal-BGLu6XJN.js} +1 -1
- package/build/assets/{context-menu-list-item-DBFzplWW.js → context-menu-list-item-BD5_EaKN.js} +1 -1
- package/build/assets/conversation-9NBSRoR9.js +1 -0
- package/build/assets/conversation-BXg6Oti2.js +89 -0
- package/build/assets/conversation-panel-CZri9Rup.js +1 -0
- package/build/assets/{conversation-service.api-CqZcHr1c.js → conversation-service.api-DPBQvTKD.js} +1 -1
- package/build/assets/{conversation-tab-empty-state-m8IUkfMj.js → conversation-tab-empty-state-B2dDYEwf.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-Aj9wFmt2.js → copy-to-clipboard-button-CaR52OnA.js} +1 -1
- package/build/assets/declaration-gq8V5eTU.js +1 -0
- package/build/assets/{device-verify-B5YCrvSu.js → device-verify-Dj6I4Iqe.js} +1 -1
- package/build/assets/{dropdown-classes-CgQ45JmQ.js → dropdown-classes-DJSXeLqc.js} +1 -1
- package/build/assets/{ellipsis-button-1BV9Sga8.js → ellipsis-button-C5Z-tPFp.js} +1 -1
- package/build/assets/{entry.client-Dy--3GeA.js → entry.client-2_3ePAm0.js} +2 -2
- package/build/assets/{enum-filter-dropdown-DCITiYVi.js → enum-filter-dropdown-DXbVwiNZ.js} +1 -1
- package/build/assets/{environment-switch-overlay-DUnKILNH.js → environment-switch-overlay-DZQfRGTx.js} +1 -1
- package/build/assets/{extensions-hub-CksKNpP9.js → extensions-hub-CLjmOGqS.js} +1 -1
- package/build/assets/{extensions-navigation-Di9rJ-b5.js → extensions-navigation-B5MeUiMq.js} +1 -1
- package/build/assets/files-tab-UVoray88.js +1 -0
- package/build/assets/{form-control-classes-9rkU4usZ.js → form-control-classes-ChpNBe9n.js} +1 -1
- package/build/assets/{git-provider-icon-aQRcUVI-.js → git-provider-icon-o6hdnJUB.js} +1 -1
- package/build/assets/home-D1IHvGTN.js +1 -0
- package/build/assets/{install-server-modal-BRab9inF.js → install-server-modal-BbuQaA2w.js} +1 -1
- package/build/assets/{launch-1TJRKkkX.js → launch-V_3Rp7WS.js} +1 -1
- package/build/assets/lesson-plan-jC0HBoe6.js +4 -0
- package/build/assets/{llm-not-configured-banner-BrU5uHto.js → llm-not-configured-banner-DoARbcdL.js} +4 -4
- package/build/assets/{llm-settings-BpdU51Jo.js → llm-settings-4JMLV8mq.js} +1 -1
- package/build/assets/llm-settings-D91gMw3U.js +1 -0
- package/build/assets/{loading-spinner-DHAIPZkP.js → loading-spinner-BLdswi6q.js} +1 -1
- package/build/assets/{manage-backends-modal-BREySP-J.js → manage-backends-modal-DkWAMSle.js} +1 -1
- package/build/assets/manifest-aa5c29f6.js +1 -0
- package/build/assets/{markdown-renderer-D8mayGjI.js → markdown-renderer-DMT7Zkpd.js} +1 -1
- package/build/assets/{mcp-XXf8k6mb.js → mcp-BQufNPZ6.js} +1 -1
- package/build/assets/{messages-D2oZb47Z.js → messages-BnJCqnFf.js} +11 -11
- package/build/assets/{modal-body-Dcu5McCa.js → modal-body-DouOE5KH.js} +1 -1
- package/build/assets/{modal-classes-DPqxSyuP.js → modal-classes-Cf-4tbHz.js} +1 -1
- package/build/assets/{modal-close-button-CTCX4nCH.js → modal-close-button-B6CfxxJj.js} +1 -1
- package/build/assets/{model-selector-VDHBytb6.js → model-selector-BfqpMkSJ.js} +1 -1
- package/build/assets/onboarding-Bu-HN1ze.js +1 -0
- package/build/assets/{onboarding-modal-C084vkv7.js → onboarding-modal-CZgjs5Bx.js} +1 -1
- package/build/assets/{option-service.api-Cl5VLGyw.js → option-service.api-BrZ5q87N.js} +1 -1
- package/build/assets/{organization-service.api-CnynNoT-.js → organization-service.api-Bk4pCGU1.js} +1 -1
- package/build/assets/{path-utils-BeOmjIcE.js → path-utils-CSmuZoix.js} +1 -1
- package/build/assets/{plan-components-j9X4AxYM.js → plan-components-CcCBmCzW.js} +1 -1
- package/build/assets/{planner-tab-AZMjJx31.js → planner-tab-Dhyqcqmb.js} +1 -1
- package/build/assets/{plugins-management-service-BAp70KN7.js → plugins-management-service-BRBLxvUl.js} +1 -1
- package/build/assets/{profiles-service.api-CeYEmSM3.js → profiles-service.api-BMXQ9pZC.js} +1 -1
- package/build/assets/providers-BpO967xS.js +1 -0
- package/build/assets/{proxy-CHmFkV16.js → proxy-BgJLtxu7.js} +1 -1
- package/build/assets/{recommended-automations-launcher-Bk8tQ-Cn.js → recommended-automations-launcher-CTcGTl4d.js} +1 -1
- package/build/assets/root-BM5WgQ4_.js +2 -0
- package/build/assets/root-V8fkplMy.css +1 -0
- package/build/assets/root-layout-BdoyoobY.js +2 -0
- package/build/assets/{runtime-waiting-state-DkzLgvMn.js → runtime-waiting-state-BsXLElvN.js} +1 -1
- package/build/assets/{schema-field-nvq_Juo2.js → schema-field-BSHrUMme.js} +1 -1
- package/build/assets/{sdk-section-page-CgT70FaZ.js → sdk-section-page-t82gsOqa.js} +1 -1
- package/build/assets/{sdk-settings-schema-BjBkMHzZ.js → sdk-settings-schema-Cv7M9eSe.js} +1 -1
- package/build/assets/{secrets-service-CZYjNxFw.js → secrets-service-B2GqPV0N.js} +1 -1
- package/build/assets/{secrets-settings-BCxk9p9s.js → secrets-settings-Cx6yJlyb.js} +1 -1
- package/build/assets/{segmented-toggle-Cen5AMUc.js → segmented-toggle-DyQqPhoD.js} +1 -1
- package/build/assets/{settings-CedTdtb5.js → settings-DmPLkgq0.js} +1 -1
- package/build/assets/{settings-dropdown-input-xzoZwgUe.js → settings-dropdown-input-BjunGXJb.js} +1 -1
- package/build/assets/{settings-index-Cct3PJSP.js → settings-index-D6sxWSRk.js} +1 -1
- package/build/assets/{settings-input-DYs7t3oK.js → settings-input-bD6npsDm.js} +1 -1
- package/build/assets/{settings-list-classes-DvQr5jVS.js → settings-list-classes-Dp_OgzN0.js} +1 -1
- package/build/assets/{settings-modal-DwLybV_O.js → settings-modal-CwrZKrTq.js} +1 -1
- package/build/assets/settings-service.api-Ce-ub11I.js +1 -0
- package/build/assets/{settings-switch-C2N2xqEb.js → settings-switch-5cuxl8Dc.js} +1 -1
- package/build/assets/{shared-conversation-DnDwfLgg.js → shared-conversation-BDREQPnE.js} +1 -1
- package/build/assets/{sidebar-layout-BtpUSN3j.js → sidebar-layout-DuzJMMw-.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-B8k3qu84.js → sidebar-mobile-menu-toggle-VvvX32iF.js} +1 -1
- package/build/assets/{sidebar-nav-link-CIB3NBRW.js → sidebar-nav-link-5AlTT5-j.js} +1 -1
- package/build/assets/{skill-card-pill-row-D2bUe2kB.js → skill-card-pill-row-eTIkE4nz.js} +1 -1
- package/build/assets/{skills-plugins-B68ay6Pu.js → skills-plugins-2Y44YHbO.js} +1 -1
- package/build/assets/{skills-settings-A6sUy0T7.js → skills-settings-BUv04tSc.js} +1 -1
- package/build/assets/{styled-tooltip-DsKsFjuq.js → styled-tooltip-CgX2oRaK.js} +1 -1
- package/build/assets/{suspense-X5dBsJzn.js → suspense-BO1Tl_Vf.js} +1 -1
- package/build/assets/{task-list-tab-BAThr9Ex.js → task-list-tab-0k9PhuqO.js} +1 -1
- package/build/assets/{terminal-BmT0_gIH.js → terminal-B61WrJdS.js} +1 -1
- package/build/assets/{toggle-switch-DBlOOzBr.js → toggle-switch-2j5wwR85.js} +1 -1
- package/build/assets/{typography-YGPBGzOG.js → typography-D8mHDeNG.js} +1 -1
- package/build/assets/{use-acp-credential-form-Bs6s0DTU.js → use-acp-credential-form-MzZM6D7D.js} +1 -1
- package/build/assets/{use-activate-agent-profile-CKtTToSx.js → use-activate-agent-profile-20v1xU0H.js} +1 -1
- package/build/assets/{use-active-agent-profile-CWLPpOtK.js → use-active-agent-profile-BkJN7Xsy.js} +1 -1
- package/build/assets/{use-active-conversation-DI5S5M1w.js → use-active-conversation-DOZVSVtU.js} +1 -1
- package/build/assets/{use-agent-profiles-DPcaYLpm.js → use-agent-profiles-DwZxnwO5.js} +1 -1
- package/build/assets/{use-agent-state-Buh3bQDh.js → use-agent-state-DHZO1obC.js} +1 -1
- package/build/assets/{use-backends-health-CxkvJy2N.js → use-backends-health-CRHzuvxO.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-DeX2Mfje.js → use-can-manage-org-profiles-C-OhWVBS.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-D_PQGfmT.js → use-cloud-current-user-id-utFreJ0i.js} +1 -1
- package/build/assets/use-config-mJrtZHP1.js +1 -0
- package/build/assets/{use-create-conversation-D9OWYcte.js → use-create-conversation-DdqsP78F.js} +1 -1
- package/build/assets/{use-create-secret-CVFSlhlR.js → use-create-secret-D0HCOZFu.js} +1 -1
- package/build/assets/{use-event-store-YSOxy9FC.js → use-event-store-DjgU4wfO.js} +1 -1
- package/build/assets/{use-handle-plan-click-Dug8egQl.js → use-handle-plan-click-DyRASKMC.js} +1 -1
- package/build/assets/use-is-authed-B6M0mcGL.js +1 -0
- package/build/assets/use-llm-profiles-RC-PkpBl.js +1 -0
- package/build/assets/{use-plugins-marketplace-BGb-KgfD.js → use-plugins-marketplace-FHlbeQ4c.js} +1 -1
- package/build/assets/use-runtime-is-ready-RKj2WmEh.js +1 -0
- package/build/assets/use-save-agent-profile-tvDP15mh.js +1 -0
- package/build/assets/{use-save-settings-CChDyjOB.js → use-save-settings-BGlSfuYn.js} +1 -1
- package/build/assets/{use-settings-dX4fKUPF.js → use-settings-CH5LzXD8.js} +1 -1
- package/build/assets/{use-settings-nav-items-D6pHnvxg.js → use-settings-nav-items-Dwktv8wo.js} +1 -1
- package/build/assets/{use-skills-Dqo-pDDx.js → use-skills-CSzSL6HG.js} +1 -1
- package/build/assets/{use-task-list-CmWGElgb.js → use-task-list-AVBLbbcR.js} +1 -1
- package/build/assets/{use-tracking-GtXCHmTv.js → use-tracking-BIXzagSI.js} +1 -1
- package/build/assets/{use-user-conversation-6uOXFP95.js → use-user-conversation-zpx7I18x.js} +1 -1
- package/build/assets/{useMutation-DCE9RcgK.js → useMutation-DrCAVg5w.js} +1 -1
- package/build/assets/{useMutationState-BUab8Kxr.js → useMutationState-D8QN0ZCy.js} +1 -1
- package/build/assets/{useQueries-CRzaAqzH.js → useQueries-DClgUTc7.js} +1 -1
- package/build/assets/{useQuery-CpjHYtZc.js → useQuery-CRBP8vIS.js} +1 -1
- package/build/assets/{useTranslation-Cgy4JA_g.js → useTranslation-CDRCKC9-.js} +1 -1
- package/build/assets/{utils-CE0lDWtb.js → utils-D3U3rlqr.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js} +1 -1
- package/build/assets/{verification-settings-D_zsNB_c.js → verification-settings-D576N2xa.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +24 -0
- package/build/locales/ca/openhands.json +24 -0
- package/build/locales/de/openhands.json +24 -0
- package/build/locales/en/openhands.json +25 -1
- package/build/locales/es/openhands.json +24 -0
- package/build/locales/fr/openhands.json +24 -0
- package/build/locales/it/openhands.json +24 -0
- package/build/locales/ja/openhands.json +24 -0
- package/build/locales/ko-KR/openhands.json +24 -0
- package/build/locales/no/openhands.json +24 -0
- package/build/locales/pt/openhands.json +24 -0
- package/build/locales/tr/openhands.json +24 -0
- package/build/locales/uk/openhands.json +24 -0
- package/build/locales/zh-CN/openhands.json +24 -0
- package/build/locales/zh-TW/openhands.json +24 -0
- package/config/defaults.json +4 -4
- package/dist/api/automation-service/automation-service.api.d.ts +2 -1
- package/dist/api/event-service/event-service.api.cjs +1 -1
- package/dist/api/event-service/event-service.api.cjs.map +1 -1
- package/dist/api/event-service/event-service.api.js +1 -1
- package/dist/api/event-service/event-service.api.js.map +1 -1
- package/dist/api/event-service/event-service.types.d.ts +6 -0
- package/dist/api/git-service/agent-server-git-service.api.cjs +1 -1
- package/dist/api/git-service/agent-server-git-service.api.cjs.map +1 -1
- package/dist/api/git-service/agent-server-git-service.api.js +2 -2
- package/dist/api/git-service/agent-server-git-service.api.js.map +1 -1
- package/dist/api/git-service/git-service.api.cjs +1 -1
- package/dist/api/git-service/git-service.api.cjs.map +1 -1
- package/dist/api/git-service/git-service.api.js +2 -2
- package/dist/api/git-service/git-service.api.js.map +1 -1
- package/dist/components/conversation-events/chat/event-thought-helpers.cjs +1 -1
- package/dist/components/conversation-events/chat/event-thought-helpers.js +1 -1
- package/dist/components/features/automations/automation-card.d.ts +2 -1
- package/dist/components/features/automations/automation-group.d.ts +2 -1
- package/dist/components/features/automations/automation-list-row.d.ts +2 -1
- package/dist/components/features/automations/build-automation-menu-items.d.ts +2 -1
- package/dist/components/features/automations/detail/detail-header.d.ts +3 -1
- package/dist/components/features/automations/import-automation-modal.d.ts +10 -0
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +3 -1
- package/dist/components/features/backends/backend-form-modal.js +17 -16
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.cjs +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-name-context-menu.d.ts +2 -1
- package/dist/components/features/conversation/conversation-name-context-menu.js +74 -63
- package/dist/components/features/conversation/conversation-name-context-menu.js.map +1 -1
- package/dist/components/features/conversation/conversation-name.cjs +1 -1
- package/dist/components/features/conversation/conversation-name.cjs.map +1 -1
- package/dist/components/features/conversation/conversation-name.js +73 -61
- package/dist/components/features/conversation/conversation-name.js.map +1 -1
- package/dist/components/features/conversation/transcript-export-modal.cjs +2 -0
- package/dist/components/features/conversation/transcript-export-modal.cjs.map +1 -0
- package/dist/components/features/conversation/transcript-export-modal.d.ts +10 -0
- package/dist/components/features/conversation/transcript-export-modal.js +140 -0
- package/dist/components/features/conversation/transcript-export-modal.js.map +1 -0
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.cjs.map +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js +1 -1
- package/dist/components/features/conversation-panel/conversation-card/conversation-card-context-menu.js.map +1 -1
- package/dist/components/features/home/shared/dropdown-item.cjs +1 -1
- package/dist/components/features/home/shared/dropdown-item.cjs.map +1 -1
- package/dist/components/features/home/shared/dropdown-item.d.ts +7 -1
- package/dist/components/features/home/shared/dropdown-item.js +2 -1
- package/dist/components/features/home/shared/dropdown-item.js.map +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.cjs +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.cjs.map +1 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.d.ts +8 -1
- package/dist/components/features/home/shared/generic-dropdown-menu.js +18 -10
- package/dist/components/features/home/shared/generic-dropdown-menu.js.map +1 -1
- package/dist/components/features/home/workspace-dropdown/workspace-dropdown.d.ts +11 -2
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +4 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/hooks/query/use-automations.d.ts +2 -1
- package/dist/hooks/query/use-resolved-workspaces.cjs +1 -1
- package/dist/hooks/query/use-resolved-workspaces.cjs.map +1 -1
- package/dist/hooks/query/use-resolved-workspaces.d.ts +9 -1
- package/dist/hooks/query/use-resolved-workspaces.js +1 -0
- package/dist/hooks/query/use-resolved-workspaces.js.map +1 -1
- package/dist/hooks/query/use-workspace-file-content.cjs +1 -1
- package/dist/hooks/query/use-workspace-file-content.cjs.map +1 -1
- package/dist/hooks/query/use-workspace-file-content.js +61 -55
- package/dist/hooks/query/use-workspace-file-content.js.map +1 -1
- package/dist/hooks/query/use-workspace-files.cjs +1 -1
- package/dist/hooks/query/use-workspace-files.cjs.map +1 -1
- package/dist/hooks/query/use-workspace-files.d.ts +11 -4
- package/dist/hooks/query/use-workspace-files.js +39 -18
- package/dist/hooks/query/use-workspace-files.js.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.cjs.map +1 -1
- package/dist/hooks/use-auto-refresh-files-on-edit.d.ts +9 -0
- package/dist/hooks/use-auto-refresh-files-on-edit.js +15 -11
- package/dist/hooks/use-auto-refresh-files-on-edit.js.map +1 -1
- package/dist/hooks/use-tracking.cjs +1 -1
- package/dist/hooks/use-tracking.cjs.map +1 -1
- package/dist/hooks/use-tracking.d.ts +7 -0
- package/dist/hooks/use-tracking.js +9 -0
- package/dist/hooks/use-tracking.js.map +1 -1
- package/dist/i18n/declaration.cjs +1 -1
- package/dist/i18n/declaration.cjs.map +1 -1
- package/dist/i18n/declaration.d.ts +24 -0
- package/dist/i18n/declaration.js +1 -1
- package/dist/i18n/declaration.js.map +1 -1
- package/dist/i18n/translation.cjs +2 -2
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +409 -1
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +24 -0
- package/dist/locales/ca/openhands.json +24 -0
- package/dist/locales/de/openhands.json +24 -0
- package/dist/locales/en/openhands.json +25 -1
- package/dist/locales/es/openhands.json +24 -0
- package/dist/locales/fr/openhands.json +24 -0
- package/dist/locales/it/openhands.json +24 -0
- package/dist/locales/ja/openhands.json +24 -0
- package/dist/locales/ko-KR/openhands.json +24 -0
- package/dist/locales/no/openhands.json +24 -0
- package/dist/locales/pt/openhands.json +24 -0
- package/dist/locales/tr/openhands.json +24 -0
- package/dist/locales/uk/openhands.json +24 -0
- package/dist/locales/zh-CN/openhands.json +24 -0
- package/dist/locales/zh-TW/openhands.json +24 -0
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/routes/files-tab.cjs +1 -1
- package/dist/routes/files-tab.js +10 -10
- package/dist/types/automation.d.ts +8 -0
- package/dist/utils/custom-toast-handlers.cjs.map +1 -1
- package/dist/utils/custom-toast-handlers.d.ts +1 -0
- package/dist/utils/custom-toast-handlers.js.map +1 -1
- package/dist/utils/mcp-server-name.cjs +1 -1
- package/dist/utils/mcp-server-name.cjs.map +1 -1
- package/dist/utils/mcp-server-name.js +2 -2
- package/dist/utils/mcp-server-name.js.map +1 -1
- package/dist/utils/transcript-export/index.cjs +72 -0
- package/dist/utils/transcript-export/index.cjs.map +1 -0
- package/dist/utils/transcript-export/index.d.ts +10 -0
- package/dist/utils/transcript-export/index.js +302 -0
- package/dist/utils/transcript-export/index.js.map +1 -0
- package/dist/utils/transcript-export/load-complete-events.cjs +2 -0
- package/dist/utils/transcript-export/load-complete-events.cjs.map +1 -0
- package/dist/utils/transcript-export/load-complete-events.d.ts +22 -0
- package/dist/utils/transcript-export/load-complete-events.js +39 -0
- package/dist/utils/transcript-export/load-complete-events.js.map +1 -0
- package/package.json +1 -1
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/dev-safe.mjs +2 -2
- package/build/assets/active-backend-context-u2tdYRgH.js +0 -1
- package/build/assets/agent-settings-FGL3Yvkp.js +0 -1
- package/build/assets/automation-detail-DwYGzLkp.js +0 -2
- package/build/assets/automations-list-CuAfJmMW.js +0 -1
- package/build/assets/backend-form-modal-BiaOB2C4.js +0 -1
- package/build/assets/conversation-DnVC6vRV.js +0 -1
- package/build/assets/conversation-panel-ZEz-z3az.js +0 -1
- package/build/assets/conversation-xkBS3AHC.js +0 -19
- package/build/assets/declaration-B9kpCaYl.js +0 -1
- package/build/assets/edit-automation-modal-B6U96gVV.js +0 -1
- package/build/assets/files-tab-61Vaihc6.js +0 -1
- package/build/assets/home-5gOtUe-n.js +0 -1
- package/build/assets/lesson-plan-BtrZUCuj.js +0 -4
- package/build/assets/llm-settings-DsInf6yD.js +0 -1
- package/build/assets/manifest-a5bb7568.js +0 -1
- package/build/assets/onboarding-D32kiGME.js +0 -1
- package/build/assets/providers-vX9jk9Vy.js +0 -1
- package/build/assets/root-CxWZUXTQ.css +0 -1
- package/build/assets/root-layout-CoWw4kpz.js +0 -2
- package/build/assets/root-tuEPDx-i.js +0 -2
- package/build/assets/settings-service.api-DldkFI1x.js +0 -1
- package/build/assets/use-config-ur0RbjCP.js +0 -1
- package/build/assets/use-is-authed-_dhQ2Xuj.js +0 -1
- package/build/assets/use-llm-profiles-DjackuP1.js +0 -1
- package/build/assets/use-runtime-is-ready-Diiq65Q-.js +0 -1
- package/build/assets/use-save-agent-profile-aKKLqDJM.js +0 -1
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js} +0 -0
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ docker run -it --rm \
|
|
|
97
97
|
-p 8000:8000 \
|
|
98
98
|
-v "$HOME/.openhands:/home/openhands/.openhands" \
|
|
99
99
|
-v "${PROJECTS_PATH}:/projects" \
|
|
100
|
-
ghcr.io/openhands/agent-canvas:1.
|
|
100
|
+
ghcr.io/openhands/agent-canvas:1.4.0 # x-release-please-version
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
**Windows (PowerShell / Windows Terminal):** See [README.windows.md](./README.windows.md) for the equivalent commands.
|
package/README.windows.md
CHANGED
|
@@ -12,7 +12,7 @@ For the main install options and overall context, see [README.md](./README.md).
|
|
|
12
12
|
- A host directory for `PROJECTS_PATH` containing the project folders you want the agent to access (create it before starting the container)
|
|
13
13
|
|
|
14
14
|
```powershell
|
|
15
|
-
docker pull ghcr.io/openhands/agent-canvas:1.
|
|
15
|
+
docker pull ghcr.io/openhands/agent-canvas:1.4.0 # x-release-please-version
|
|
16
16
|
|
|
17
17
|
$env:PROJECTS_PATH = Join-Path $HOME "projects" # directory containing your project folders
|
|
18
18
|
New-Item -ItemType Directory -Force -Path $env:PROJECTS_PATH, (Join-Path $env:USERPROFILE ".openhands") | Out-Null
|
|
@@ -21,7 +21,7 @@ docker run -it --rm `
|
|
|
21
21
|
-p 8000:8000 `
|
|
22
22
|
-v "$($env:USERPROFILE)\.openhands:/home/openhands/.openhands" `
|
|
23
23
|
-v "$($env:PROJECTS_PATH):/projects" `
|
|
24
|
-
ghcr.io/openhands/agent-canvas:1.
|
|
24
|
+
ghcr.io/openhands/agent-canvas:1.4.0 # x-release-please-version
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
The agent will be able to access any project under `PROJECTS_PATH`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n}from"./vendor-styling-CI0PQ3ab.js";import{s as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n}from"./vendor-styling-CI0PQ3ab.js";import{s as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js";import{a as i,i as a,n as o,r as s}from"./useTranslation-CDRCKC9-.js";import{a as c,n as l,o as u,s as d}from"./declaration-gq8V5eTU.js";var f=t(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}})),p=e(n()),m=e(f()),h=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function g(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(m.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(h),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var _=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,v=/^\s*$/,y=Object.create(null);function b(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(b,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var x={parse:function(e,t){t||={},t.components||=y;var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(_,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=g(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=g(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),_=e.slice(f,h===-1?void 0:h);v.test(_)&&(_=` `),(h>-1&&a+l.length>=0||_!==` `)&&l.push({type:`text`,content:_})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+b(``,t)},``)}},S=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},C=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?T(t):t},w=e=>Array.isArray(e)&&e.every(p.isValidElement),T=e=>Array.isArray(e)?e:[e],E=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},D=e=>{let t={};if(!e)return t;let n=e=>{T(e).forEach(e=>{s(e)||(S(e)?n(C(e)):o(e)&&!(0,p.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},O=(e,t,n,r)=>{if(!e)return``;let i=``,c=T(e),l=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return c.forEach((e,c)=>{if(s(e)){i+=`${e}`;return}if((0,p.isValidElement)(e)){let{props:a,type:o}=e,u=Object.keys(a).length,d=l.indexOf(o)>-1,f=a.children;if(!f&&d&&!u){i+=`<${o}/>`;return}if(!f&&(!d||u)||a.i18nIsDynamicList){i+=`<${c}></${c}>`;return}if(d&&u<=1){let e=s(f)?f:O(f,t,n,r);i+=`<${o}>${e}</${o}>`;return}let p=O(f,t,n,r);i+=`<${c}>${p}</${c}>`;return}if(e===null){a(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(o(e)){let{format:t,...o}=e,s=Object.keys(o);if(s.length===1){let e=t?`${s[0]}, ${t}`:s[0];i+=`{{${e}}}`;return}a(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}a(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},k=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`<`,o+=1)}else a+=e[o],o+=1;return a},A=(e,t,n,r,i,a,c)=>{if(n===``)return[];let l=i.transKeepBasicHtmlNodesFor||[],f=n&&new RegExp(l.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!f&&!c)return[n];let m=t??{},h=e=>{T(e).forEach(e=>{s(e)||(S(e)?h(C(e)):o(e)&&!(0,p.isValidElement)(e)&&Object.assign(m,e))})};h(e);let g=k(n,l,m),_=x.parse(`<0>${g}</0>`),v={...m,...a},y=(e,t,n)=>{let r=C(e),i=D(r,t.children,n);return w(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},b=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,p.cloneElement)(e,{key:r},i?void 0:t))):n.push(...p.Children.map([e],e=>{if(e.type===p.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,p.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,p.cloneElement)(e,n,i?null:t)}))},D=(e,n,a)=>{let m=T(e),h=T(n),g={};return h.reduce((e,n,h)=>{let _=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,v,r.language);if(n.type===`tag`){let u=m[parseInt(n.name,10)];!u&&t&&(u=t[n.name]),a.length===1&&!u&&(u=a[0][n.name]),u||={};let x={...n.attrs};c&&Object.keys(x).forEach(e=>{let t=x[e];s(t)&&(x[e]=d(t))});let w=Object.keys(x).length===0?u:E({props:x},u),O=(0,p.isValidElement)(w),k=O&&S(n,!0)&&!n.voidElement,A=f&&o(w)&&w.dummy&&!O,j=o(t)&&Object.hasOwnProperty.call(t,n.name);if(s(w)){let t=r.services.interpolator.interpolate(w,v,r.language);e.push(t)}else if(S(w)||k)b(w,y(w,n,a),e,h);else if(A)b(w,D(m,n.children,a),e,h);else if(Number.isNaN(parseFloat(n.name)))if(j)b(w,y(w,n,a),e,h,n.voidElement);else if(i.transSupportBasicHtmlNodes&&l.indexOf(n.name)>-1)if(n.voidElement)e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`}));else{let t=g[n.name]||0;g[n.name]=t+1;let r,i=0;for(let e=0;e<m.length;e+=1){let a=m[e];if((0,p.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=D(r?T(C(r)):m,n.children,a);e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=D(m,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(o(w)&&!O){let t=n.children[0]?_:null;t&&e.push(t)}else b(w,_,e,h,n.children.length!==1||!_)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:u().unescape,o=c?a(r.services.interpolator.interpolate(n.content,v,r.language)):r.services.interpolator.interpolate(n.content,v,r.language);t?e.push((0,p.createElement)(t,{key:`${n.name}-${h}`},o)):e.push(o)}return e},[])};return C(D([{dummy:!0,children:e||[]}],_,T(e||[]))[0])},j=(e,t,n)=>{let r=e.key||t,i=(0,p.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,p.createElement)(p.Fragment,null,i)}return(0,p.createElement)(a,{key:r})},M=(e,t)=>e.map((e,n)=>j(e,n,t)),N=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:j(e[r],r,t)})}),n},P=(e,t,n,r)=>e?Array.isArray(e)?M(e,t):o(e)?N(e,t):(i(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,F=e=>!o(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function I({children:e,count:t,parent:n,i18nKey:a,context:o,tOptions:l={},values:d,defaults:f,components:m,ns:h,i18n:g,t:_,shouldUnescape:v,...y}){let b=g||c();if(!b)return i(b,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:a}),e;let x=_||b.t.bind(b)||(e=>e),S={...u(),...b.options?.react},C=h||x.ns||b.options?.defaultNS;C=s(C)?[C]:C||[`translation`];let{transDefaultProps:w}=S,T=w?.tOptions?{...w.tOptions,...l}:l,E=v??w?.shouldUnescape,k=w?.values?{...w.values,...d}:d,j=w?.components?{...w.components,...m}:m,M=O(e,S,b,a),N=f||T?.defaultValue||M||S.transEmptyNodeValue||(typeof a==`function`?r(a):a),{hashTransKey:I}=S,L=a||(I?I(M||N):M||N);d=b.options?.interpolation?.defaultVariables?k&&Object.keys(k).length>0?{...k,...b.options.interpolation.defaultVariables}:{...b.options.interpolation.defaultVariables}:k;let R=D(e);R&&typeof R.count==`number`&&t===void 0&&(t=R.count);let z=d||t!==void 0&&!b.options?.interpolation?.alwaysFormat||!e?T.interpolation:{interpolation:{...T.interpolation,prefix:`#$?`,suffix:`?$#`}},B={...T,context:o||T.context,count:t,...d,...z,defaultValue:N,ns:C},V=L?x(L,B):N;V===L&&N&&(V=N);let H=P(j,V,b,a),U=H||e,W=null;F(H)&&(W=H,U=e);let G=A(U,W,V,b,S,B,E),K=n??S.defaultTransParent;return K?(0,p.createElement)(K,y,G):G}function L({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:u,ns:d,i18n:f,t:m,shouldUnescape:h,...g}){let{i18n:_,defaultNS:v}=(0,p.useContext)(l)||{},y=f||_||c(),b=m||y?.t.bind(y);return I({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:u,ns:d||b?.ns||v||y?.options?.defaultNS,i18n:y,t:m,shouldUnescape:h,...g})}export{L as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./declaration-
|
|
1
|
+
import{t as e}from"./declaration-gq8V5eTU.js";import{n as t}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js";var n=`cli-generic`;function r(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t===`acp-managed`?null:t}function i(e){for(let t of[e.runtimeName,e.runtimeId,e.configured,e.sdkLlm]){let e=r(t);if(e)return e}return e.providerDefault??null}var a={"claude-code":{icon:`claude-code`,description_key:e.ONBOARDING$AGENT_CLAUDE_CODE_DESCRIPTION},codex:{icon:`codex`,description_key:e.ONBOARDING$AGENT_CODEX_DESCRIPTION},"gemini-cli":{icon:`gemini`,description_key:e.ONBOARDING$AGENT_GEMINI_CLI_DESCRIPTION}},o=Object.entries(a).map(([e,n])=>{let r=t(e);return{key:e,display_name:r?.display_name??e,default_command:r?[...r.default_command]:[],available_models:r?.available_models?.map(e=>({id:e.id,label:e.label})),default_model:r?.default_model??void 0,description_key:n.description_key,icon:n.icon}}),s=`custom`,c={codex:[{name:`CODEX_AUTH_JSON`,secret:!0,multiline:!0,hint_key:e.ONBOARDING$ACP_SECRET_FILE_BLOB_HINT,hint_values:{file:`~/.codex/auth.json`}}],"claude-code":[{name:`CLAUDE_CODE_OAUTH_TOKEN`,secret:!0,hint_key:e.ONBOARDING$ACP_SECRET_OAUTH_TOKEN_HINT}],"gemini-cli":[{name:`GOOGLE_APPLICATION_CREDENTIALS_JSON`,secret:!0,multiline:!0,hint_key:e.ONBOARDING$ACP_SECRET_FILE_BLOB_HINT,hint_values:{file:`~/.config/gcloud/application_default_credentials.json`}},{name:`GOOGLE_CLOUD_PROJECT`,hint_key:e.ONBOARDING$ACP_SECRET_GCP_PROJECT_HINT},{name:`GOOGLE_CLOUD_LOCATION`,hint_key:e.ONBOARDING$ACP_SECRET_GCP_LOCATION_HINT},{name:`GOOGLE_GENAI_USE_VERTEXAI`,hint_key:e.ONBOARDING$ACP_SECRET_VERTEXAI_FLAG_HINT}]},l={"claude-code":[[`CLAUDE_CODE_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`],[`CLAUDE_CODE_OAUTH_TOKEN`,`ANTHROPIC_BASE_URL`]]};function u(e,t){return e?(l[e]??[]).filter(([e,n])=>t(e)&&t(n)):[]}var d=`gemini-2.5-pro`;function f(e){return e===`gemini-cli`?d:m(e)?.default_model??null}function p(n){if(!n)return[];let r=t(n);if(!r)return[];let i=[...c[n]??[]];return r.api_key_env_var&&i.push({name:r.api_key_env_var,secret:!0,hint_key:e.ONBOARDING$ACP_SECRET_API_KEY_HINT}),r.base_url_env_var&&i.push({name:r.base_url_env_var,hint_key:e.ONBOARDING$ACP_SECRET_BASE_URL_HINT}),i}function m(e){if(e)return o.find(t=>t.key===e)}function h(e){let t=m(e);return t?t.display_name:null}function g(e){return m(e)?.icon??`cli-generic`}function _(e,t){return t?m(e)?.available_models?.find(e=>e.id===t)?.label??t:null}function v(e,t={}){if(e===`openhands`)return{agent_kind:`openhands`};let n=e===s,r=n?void 0:m(e);if(!n&&!r&&!t.allowUnknownServer)return null;let i=t.model===void 0?f(e):t.model;return{agent_kind:`acp`,acp_server:e,acp_command:t.command??[],acp_args:[],acp_model:i??null}}export{u as a,h as c,g as d,i as f,v as i,p as l,o as n,f as o,n as r,m as s,s as t,_ as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{a as r,c as i,i as a,l as o,n as s,o as ee,r as te,u as ne}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js";import{i as re,t as c}from"./declaration-gq8V5eTU.js";import{m as ie,o as ae,v as oe}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{I as se,t as ce}from"./utils-D3U3rlqr.js";import{E as l,c as u,d,f,g as le,h as p,l as m,m as h,n as ue,p as de,s as fe,u as pe,v as me}from"./agent-server-client-options-DVLRd9sw.js";var g=e(t(),1),_=`openhands`,he=[{label:`English`,value:`en`},{label:`日本語`,value:`ja`},{label:`简体中文`,value:`zh-CN`},{label:`繁體中文`,value:`zh-TW`},{label:`한국어`,value:`ko-KR`},{label:`Norsk`,value:`no`},{label:`Arabic`,value:`ar`},{label:`Deutsch`,value:`de`},{label:`Français`,value:`fr`},{label:`Italiano`,value:`it`},{label:`Português`,value:`pt`},{label:`Español`,value:`es`},{label:`Català`,value:`ca`},{label:`Türkçe`,value:`tr`},{label:`Українська`,value:`uk`}],v=new WeakMap,ge=e=>{if(!v.has(e)){let t=e.use(r).use(a).use(re).init({fallbackLng:`en`,debug:!1,supportedLngs:he.map(e=>e.value),nonExplicitSupportedLngs:!1,ns:[_],defaultNS:_,fallbackNS:_,backend:{loadPath:`/locales/{{lng}}/{{ns}}.json`},interpolation:{escapeValue:!1}});v.set(e,t)}return e},_e=()=>ge(ee()),y=null,b=null,x=()=>(y||=_e(),y),S=()=>b??x(),ve=e=>(b=e??x(),b),ye=async(e=x())=>(await v.get(e),e),be=e=>e?typeof e==`object`&&!Array.isArray(e)?{ns:_,...e}:e:{ns:_},C=new Proxy({},{get:(e,t)=>{let n=S();if(t===`t`)return(e,t)=>n.t(e,be(t));if(t===`exists`)return(e,t)=>n.exists(e,be(t));let r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=S();return Reflect.set(r,t,n,r)}}),xe=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`error`in e.response.data&&typeof e.response?.data?.error==`string`,Se=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`message`in e.response.data&&typeof e.response?.data?.message==`string`,Ce=`Disconnected (check URL or network). Check that the backend URL is correct and the backend server is reachable. If the backend is on another origin, check that it allows this frontend origin.`,we=`Disconnected (request timed out). Check that the backend URL is correct and reachable.`,Te=4;function Ee(e){return typeof e==`object`&&!!e}function De(e){let t=[],n=new Set,r=e,i=0;for(;r!=null&&i<Te&&!n.has(r);){if(n.add(r),r instanceof Error)r.message&&t.push(r.message),r=r.cause;else if(typeof r==`string`){r&&t.push(r);break}else if(Ee(r)){let e=r.message;typeof e==`string`&&e&&t.push(e),r=r.cause}else break;i+=1}return t}function w(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`disconnected (check cors or network)`)||t.includes(`disconnected (check url or network)`)||t.includes(`blocked by cors`)||t.includes(`failed to fetch`)||t.includes(`network error`)||t.includes(`load failed`)||t.includes(`networkerror when attempting to fetch resource`)||t.includes(`cors`)&&t.includes(`blocked`)}function Oe(e){return De(e).some(w)}function T(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`request timeout`)||t.includes(`timeout after`)||t.includes(`backend request timed out`)}function E(e){let t=De(e);return t.some(w)?Ce:t.some(T)?we:t[0]??null}function ke(e){return typeof e==`object`&&!!e&&`isAxiosError`in e&&e.isAxiosError===!0}var D=e=>{let t=null,n=!1;return ke(e)?(n=!0,t=xe(e)&&e.response?.data.error?e.response?.data.error:Se(e)&&e.response?.data.message?e.response?.data.message:e.message):t=e instanceof Error?e.message:typeof e==`string`?e:null,E(n?t??e:e)??t??``},O=(e,t=5e3,n=1e4)=>{if(!e)return t;let r=e.length/(1e3/60)*1e3*1.5;return Math.min(Math.max(r,t),n)},k=n(),A={background:`var(--oh-color-tertiary)`,border:`1px solid var(--oh-border-input)`,color:`#fff`,borderRadius:`var(--oh-radius)`,maxWidth:`400px`,wordBreak:`break-word`,overflowWrap:`anywhere`,whiteSpace:`pre-wrap`},j={position:`top-right`,style:A},Ae={...A,color:`var(--oh-muted)`};function je({message:e}){let t=g.useRef(null),[n,r]=g.useState(!1);return g.useLayoutEffect(()=>{let e=t.current;if(!e)return;let n=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){r(!1);return}r(e.getBoundingClientRect().height>t*1.5)};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),(0,k.jsxs)(`div`,{className:ce(`flex min-w-0 gap-2`,n?`items-start`:`items-center`),children:[(0,k.jsx)(te,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:se}}),(0,k.jsx)(`span`,{ref:t,className:`min-w-0 flex-1 text-sm leading-5 [word-break:break-word] [overflow-wrap:anywhere]`,children:e})]})}var Me={...j,icon:null,style:Ae},M=e=>{let t=e||C.t(c.STATUS$ERROR);w(t)?t=C.t(c.ERROR$CORS_OR_NETWORK):T(t)&&(t=C.t(c.ERROR$BACKEND_REQUEST_TIMEOUT));let n=O(t,4e3);s((0,k.jsx)(je,{message:t}),{...Me,duration:n})},Ne=e=>{let t=O(e,5e3);s.success((0,k.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...j,duration:t})},Pe=(e,t,n)=>{let r=O(`${e} ${t}`,5e3);s.success((0,k.jsxs)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:[e,` `,(0,k.jsx)(`a`,{className:`underline hover:no-underline`,href:n,children:t})]}),{...j,duration:r})},Fe=e=>{let t=O(e,6e3);s((0,k.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...j,icon:`⚠️`,duration:t})},N=`openhands-backend-health`,P=500;function Ie(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.consecutiveFailures)&&t.consecutiveFailures>=0&&t.consecutiveFailures<=5&&(t.lastError===null||typeof t.lastError==`string`)&&(t.lastFailureAt===null||typeof t.lastFailureAt==`number`)&&typeof t.disabled==`boolean`}function Le(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(N);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&e.length>0&&Ie(r)&&(n[e]=r);return n}catch{return{}}}function Re(e){if(!(typeof window>`u`))try{if(Object.keys(e).length===0){window.localStorage.removeItem(N);return}window.localStorage.setItem(N,JSON.stringify(e))}catch{}}function ze(e){let t=E(e)??`Unknown error`;return t.length>P?`${t.slice(0,P)}…`:t}var F=Le(),I=new Set;function Be(){I.forEach(e=>e())}function L(e){F=e,Re(e),Be()}function Ve(){return F}function He(e){return I.add(e),()=>{I.delete(e)}}function Ue(e,t){let n=F[e],r=Math.min((n?.consecutiveFailures??0)+1,5),i=n?.disabled===!0||r>=5,a={consecutiveFailures:r,lastError:ze(t),lastFailureAt:Date.now(),disabled:i};L({...F,[e]:a})}function R(e){if(!(e in F))return;let{[e]:t,...n}=F;L(n)}function We(e){if(!(e in F))return;let{[e]:t,...n}=F;L(n)}function Ge(e){if(!(e in F))return;let{[e]:t,...n}=F;L(n)}var Ke=(e,t)=>{(e?.response?.status===401||e?.status===401)&&t.invalidateQueries({queryKey:[`user`,`authenticated`]})},z=e=>{if(!(e instanceof oe)||e.response?.status!==401&&e.status!==401)return!1;let t=u().backend;if(t.kind!==`cloud`)return!1;let n=e.config?.url;return!n||n.startsWith(t.host.replace(/\/+$/,``))},B=new Set,qe=()=>{let e=new i({queryCache:new o({onSuccess:(e,t)=>{let n=t.meta?.backendId??t.options.meta?.backendId;typeof n==`string`&&R(n)},onError:(t,n)=>{if(n.queryKey[0]===`user`&&n.queryKey[1]===`authenticated`||Ke(t,e),!(n.meta?.disableToast??n.options.meta?.disableToast)&&!z(t)){let e=D(t);B.has(e||``)||(M(e||C.t(c.ERROR$GENERIC)),B.add(e||``),setTimeout(()=>{B.delete(e||``)},3e3))}}}),mutationCache:new ne({onError:(t,n,r,i)=>{Ke(t,e),!(i?.meta?.disableToast??i?.options.meta?.disableToast)&&!z(t)&&M(D(t)||C.t(c.ERROR$GENERIC))}})});return e},V=null,H=null,U=()=>(V||=qe(),V),W=()=>H??U(),Je=e=>(H=e??U(),H),G=new Proxy({},{get:(e,t)=>{let n=W(),r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=W();return Reflect.set(r,t,n,r)}}),Ye={_comment:`Single source of truth for version pins, ports, paths, and defaults shared across the npm and Docker install paths. Read by scripts/dev-safe.mjs, scripts/dev-with-automation.mjs, docker/entrypoint.sh (via generated defaults.env), and .github/workflows/docker.yml.`,versions:{agentServer:`1.35.0`,agentCanvas:`1.4.0`,automation:`1.1.6`},compatibility:{minimumAgentServer:`1.28.0`},constraints:{_comment:`Temporary upper bound on the agent-client-protocol (acp) transitive dependency. openhands-sdk 1.35.0 requires agent-client-protocol>=0.10.1 with no upper bound, but acp 0.11.0 reordered the ACP prompt() arguments and breaks the SDK's ACP client (a PromptRequest validation error surfaces as 'ACP error: 2 validation errors for PromptRequest'). Pin acp <0.11 until a fixed openhands-sdk ships. Consumed by scripts/dev-safe.mjs (agent-server uvx install) and .github/workflows/mock-llm-e2e.yml (mock ACP server venv).`,agentClientProtocol:`agent-client-protocol<0.11`},images:{agentServer:`ghcr.io/openhands/agent-server`,agentCanvas:`ghcr.io/openhands/agent-canvas`},ports:{agentServer:18e3,automation:18001,proxy:8e3},paths:{stateSubdir:`agent-canvas`,conversations:`agent-canvas/conversations`,bashEvents:`agent-canvas/bash_events`,automationDb:`automation/automations.db`},packages:{agentServer:`openhands-agent-server`,automation:`openhands-automation`,tools:`openhands-tools`,workspace:`openhands-workspace`}},Xe=5e3,Ze=`unknown`,K=Ye.compatibility.minimumAgentServer,Qe=`AGENT_SERVER_UNSUPPORTED_VERSION`,$e=`AGENT_SERVER_UNKNOWN_VERSION`,q=null,et=e=>Array.isArray(e?.usable_tools)?e.usable_tools:null,J=class extends Error{details;noBackendConfigured;constructor(e,t){let n=t?.noBackendConfigured??!1;super(n?`No agent server backend is configured yet. Add a backend to get started.`:`Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.`),this.name=`AgentServerUnavailableError`,this.details=e??null,this.noBackendConfigured=n}},tt=e=>e instanceof J||typeof e==`object`&&!!e&&`name`in e&&e.name===`AgentServerUnavailableError`,nt=class extends J{code=Qe;actualVersion;requiredVersion=K;constructor(e){let t=`Agent Canvas requires agent-server ${K} or newer; this backend is running ${e}. Please upgrade the agent-server backend.`;super(t),this.name=`AgentServerUnsupportedVersionError`,this.message=t,this.actualVersion=e}},Y=class extends J{code=$e;actualVersion;requiredVersion=K;constructor(e){let t=`Could not determine this backend's agent-server version.${e?` It reported "${e}".`:``} Agent Canvas requires agent-server ${K} or newer, but this backend did not return a valid version from /server_info. Restart or rebuild the agent-server backend, then try again.`;super(t),this.name=`AgentServerUnknownVersionError`,this.message=t,this.actualVersion=e}},rt=e=>l()&&Z(e,401);function X(){q=null}function it(e){let t=et(q);return Array.isArray(t)?t.includes(e):!0}function at(e){return e instanceof Error&&e.name===`HttpError`&&`status`in e&&typeof e.status==`number`}function Z(e,t){return at(e)&&e.status===t}function ot(e){return typeof e.version==`string`&&e.version.trim()||null}function st(e){let t=ot(e);return!t||t.toLowerCase()===Ze?null:t}function ct(e){let t=st(e);return!t||!Q(t)?null:t}function lt(e,t){let n=Q(e),r=Q(t);if(!n||!r)return null;for(let e of[`major`,`minor`,`patch`]){if(n[e]>r[e])return 1;if(n[e]<r[e])return-1}return n.prerelease&&!r.prerelease?-1:!n.prerelease&&r.prerelease?1:n.prerelease&&r.prerelease?n.prerelease.localeCompare(r.prerelease):0}function Q(e){let[t]=e.trim().replace(/^v/,``).split(`+`),[n,r]=t.split(`-`,2),i=n.split(`.`);if(i.length!==3)return null;let[a,o,s]=i.map(e=>Number(e));return[a,o,s].every(e=>Number.isInteger(e)&&e>=0)?{major:a,minor:o,patch:s,prerelease:r}:null}function ut(e){let t=st(e);if(!t)throw X(),new Y(ot(e));let n=lt(t,K);if(n===null)throw X(),new Y(t);if(n<0)throw X(),new nt(t)}async function dt(){let e=pe();if(!e){if(X(),de(u().backend))throw new J(`No backend configured`,{noBackendConfigured:!0});return null}let t=ue({host:e.host,sessionApiKey:e.apiKey||null,timeout:Xe}),n;try{n=await new ie(t).getServerInfo()}catch(e){throw X(),Z(e,401)?e:new J(e instanceof Error?e.message:null)}if(ut(n),l())try{await new ae(t).getSettings()}catch(e){if(Z(e,401))throw e;console.warn(`[agent-server] getSettings() probe failed (non-401):`,e)}return q=n,n}var ft={WEB_CLIENT_CONFIG:[`web-client-config`]},pt={all:[`settings`],byScope:e=>[`settings`,e],personal:()=>[`settings`,`personal`]},mt={all:[`llm-profiles`]},ht={all:[`agent-profiles`]},gt={retry:!1},_t={all:[`llm-subscription`],openaiStatus:[`llm-subscription`,`openai`,`status`],openaiModels:[`llm-subscription`,`openai`,`models`]},vt={all:[`local-workspaces`]},yt={marketplace:[`plugins-marketplace`],installed:[`plugins-installed`],local:[`plugins-local`]},bt={staleTime:1e3*60*5,gcTime:1e3*60*15},$=g.createContext(null);function xt(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`backend-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function St({children:e}){let t=g.useSyncExternalStore(le,f,f),n=g.useCallback(()=>{X(),G.invalidateQueries({queryKey:ft.WEB_CLIENT_CONFIG})},[]),r=g.useCallback((e,t)=>{let r=m()?.backendId??null,i=m()?.orgId??null,a=t??null;e===r&&a===i||(h({backendId:e,orgId:a}),n())},[n]),i=g.useCallback(e=>{let t={...e,id:xt()};return p([...d(),t]),h({backendId:t.id}),n(),t},[n]),a=g.useCallback((e,t)=>{let r=d().find(t=>t.id===e),i=m()?.backendId??null;p(d().map(n=>n.id===e?{...n,...t}:n));let a=t.host!==void 0&&r!==void 0&&t.host!==r.host,o=t.apiKey!==void 0&&r!==void 0&&t.apiKey!==r.apiKey;(a||o)&&(We(e),i===e&&n())},[n]),o=g.useCallback(e=>{p(d().filter(t=>t.id!==e)),Ge(e),n()},[n]),s=g.useMemo(()=>({backends:t.backends,active:t.active,setActive:r,addBackend:i,updateBackend:a,removeBackend:o}),[t,r,i,a,o]);return(0,k.jsx)($.Provider,{value:s,children:e})}function Ct(){let e=g.useContext($);if(!e)throw Error(`useActiveBackendContext must be used inside <ActiveBackendProvider>`);return e}function wt(){let e=g.useContext($);return e?e.active:{backend:me()??fe,orgId:null}}export{M as A,_ as B,G as C,R as D,Ue as E,E as F,ye as G,S as H,T as I,Oe as L,Pe as M,Fe as N,He as O,D as P,w as R,W as S,Ve as T,C as U,x as V,ve as W,it as _,gt as a,dt as b,_t as c,ft as d,pt as f,rt as g,ct as h,ht as i,Ne as j,j as k,vt as l,X as m,wt as n,bt as o,ut as p,Ct as r,mt as s,St as t,yt as u,tt as v,Je as w,U as x,Z as y,he as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{bt as t}from"./vendor-styling-CI0PQ3ab.js";import{r as n}from"./backend-form-modal-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{bt as t}from"./vendor-styling-CI0PQ3ab.js";import{r as n}from"./backend-form-modal-CQJGmItq.js";var r=e({AddBackendModal:()=>a}),i=t();function a({onClose:e}){return(0,i.jsx)(n,{mode:`add`,onClose:e})}export{r as n,a as t};
|
package/build/assets/{agent-profiles-settings-BovdV4N8.js → agent-profiles-settings-3mmXljZX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{L as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{t as o}from"./useMutation-DCE9RcgK.js";import{t as s}from"./useTranslation-Cgy4JA_g.js";import{t as c}from"./declaration-B9kpCaYl.js";import{A as l,N as u,i as d,j as f}from"./active-backend-context-u2tdYRgH.js";import{t as p}from"./back-nav-button-BYmxFxGt.js";import{t as m}from"./utils-CE0lDWtb.js";import{t as h}from"./brand-button-DKPMEKcW.js";import{t as g}from"./loading-spinner-DHAIPZkP.js";import{i as _}from"./dropdown-classes-CgQ45JmQ.js";import{t as v}from"./use-llm-profiles-DjackuP1.js";import{n as y,t as b}from"./use-agent-profiles-DPcaYLpm.js";import{r as x,t as S}from"./ellipsis-button-1BV9Sga8.js";import{t as C}from"./u-edit-DJ90xc8Z.js";import{t as w}from"./settings-dropdown-input-xzoZwgUe.js";import{r as T}from"./typography-YGPBGzOG.js";import{o as E}from"./extension-module-card-classes-9V3J9J_b.js";import{a as D,i as O,n as k,r as A,s as j,t as M}from"./use-can-manage-org-profiles-DeX2Mfje.js";import{t as N}from"./u-check-circle-BqoIxNz_.js";import{i as P,n as F,r as I,t as L}from"./settings-list-classes-DvQr5jVS.js";import{n as R}from"./settings-section-header-context-COMOIaxV.js";import{t as z}from"./use-save-agent-profile-aKKLqDJM.js";import{n as B}from"./use-activate-agent-profile-CKtTToSx.js";import{i as V,t as H}from"./agent-settings-Ofbh6UTD.js";var U=e(t(),1),W=e(r(),1),G=n();function K({onEdit:e,onSetActive:t,onDelete:n,isActive:r,isActivating:i,onClose:a,anchorRef:o}){let{t:l}=s(`openhands`),u=(0,U.useRef)(null),d=(0,U.useRef)([]),f=o?.current??null,[p,h]=(0,U.useState)();(0,U.useLayoutEffect)(()=>{if(!f)return;let e=()=>{let e=f.getBoundingClientRect();e&&h({position:`fixed`,zIndex:9999,top:e.bottom+8,right:window.innerWidth-e.right,width:`max-content`})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[f]),(0,U.useEffect)(()=>{d.current[0]?.focus()},[]),(0,U.useEffect)(()=>{let e=e=>{let t=e.target;u.current&&!u.current.contains(t)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let g=e=>{e(),a()},v=(0,U.useCallback)((e,t)=>{if(e.key===`Tab`){a();return}let n=d.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;d.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;d.current[r]?.focus()}},[a]),y=r||i,b=!!f,S=(0,G.jsxs)(`div`,{ref:u,className:m(`absolute right-0 top-full z-10 mt-2 w-[160px] rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 shadow-lg`,_,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`agent-profile-actions-menu`,children:[(0,G.jsx)(A,{index:0,icon:(0,G.jsx)(C,{width:16,height:16}),label:l(c.SETTINGS$PROFILE_EDIT),onClick:()=>g(e),onKeyDown:v,menuItemsRef:d,testId:`agent-profile-edit`}),(0,G.jsx)(A,{index:1,icon:(0,G.jsx)(N,{width:16,height:16}),label:l(c.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>g(t),onKeyDown:v,menuItemsRef:d,disabled:y,testId:`agent-profile-set-active`}),(0,G.jsx)(A,{index:2,icon:(0,G.jsx)(x,{width:16,height:16}),label:l(c.BUTTON$DELETE),onClick:()=>g(n),onKeyDown:v,menuItemsRef:d,testId:`agent-profile-delete`})]});return b?typeof document>`u`||!p?null:W.createPortal((0,G.jsx)(`div`,{style:p,children:S}),document.body):S}function q({profile:e,isActive:t,canManage:n,onActivate:r,onEdit:i,onDelete:a,isActivating:o}){let{t:l}=s(`openhands`),[u,d]=(0,U.useState)(!1),f=(0,U.useRef)(null),p=e.agent_kind===`openhands`?e.llm_profile_ref:l(c.SETTINGS$AGENT_TYPE_ACP);return(0,G.jsxs)(`div`,{"data-testid":`agent-profile-row`,className:m(P,`justify-between gap-3`),children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),p?(0,G.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:p,children:p}):null,t&&(0,G.jsx)(k,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`agent-profile-active-badge`,children:l(c.SETTINGS$PROFILE_ACTIVE)})]}),n&&(0,G.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,G.jsx)(S,{ref:f,onClick:()=>d(e=>!e),ariaLabel:l(c.SETTINGS$PROFILE_MENU),testId:`agent-profile-menu-trigger`,className:I}),u&&(0,G.jsx)(K,{anchorRef:f,onEdit:()=>i(e),onSetActive:()=>r(e),onDelete:()=>a(e),isActive:t,isActivating:o,onClose:()=>d(!1)})]})]})}function J({isLoading:e,loadError:t,profiles:n,activeId:r,canManage:i,onActivate:a,onEdit:o,onDelete:l,isActivating:u}){let{t:d}=s(`openhands`);return e?(0,G.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,G.jsx)(g,{size:`large`})}):t?(0,G.jsx)(`div`,{"data-testid":`agent-profiles-load-error`,className:E,children:(0,G.jsx)(`p`,{className:`text-sm text-red-400`,children:d(c.SETTINGS$PROFILES_LOAD_ERROR)})}):n.length===0?(0,G.jsx)(`div`,{"data-testid":`agent-profiles-empty`,className:E,children:(0,G.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:d(c.SETTINGS$PROFILES_EMPTY)})}):(0,G.jsx)(`div`,{className:m(L,F),children:n.map(e=>(0,G.jsx)(q,{profile:e,isActive:!!e.id&&e.id===r,canManage:i,onActivate:a,onEdit:o,onDelete:l,isActivating:u},e.name))})}function Y(){let e=a();return o({mutationFn:e=>y.deleteProfile(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:d.all})},meta:{disableToast:!0}})}function X({profile:e,onClose:t}){let{t:n}=s(`openhands`),r=Y(),i=(0,U.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),f(n(c.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){l(e instanceof Error?e.message:n(c.ERROR$GENERIC))}},o=()=>{r.isPending||t()},u=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(h,{ref:i,type:`button`,variant:`tertiary`,onClick:o,isDisabled:r.isPending,children:n(c.BUTTON$CANCEL)}),(0,G.jsx)(h,{testId:`delete-agent-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(g,{size:`small`}),(0,G.jsx)(`span`,{className:`sr-only`,children:n(c.BUTTON$DELETE)})]}):n(c.BUTTON$DELETE)})]});return(0,G.jsx)(O,{isOpen:!0,title:n(c.SETTINGS$PROFILE_DELETE_TITLE),footer:u,onClose:o,initialFocusRef:i,children:(0,G.jsx)(`p`,{className:`text-sm break-all`,children:n(c.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}function Z({onAddProfile:e,onEditProfile:t}){let{t:n}=s(`openhands`),{data:r,isLoading:i,error:a}=b(),o=B(),l=M(),[u,d]=(0,U.useState)(null),p=r?.profiles??[],m=r?.active_agent_profile_id??null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(c.SETTINGS$AVAILABLE_PROFILES)}),e&&l?(0,G.jsx)(h,{testId:`add-agent-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(c.SETTINGS$ADD_AGENT_PROFILE)}):null]}),(0,G.jsx)(J,{isLoading:i,loadError:a??null,profiles:p,activeId:m,canManage:l,onActivate:async e=>{if(e.id)try{await o.mutateAsync(e.id),f(n(c.SETTINGS$PROFILE_ACTIVATED,{name:e.name}))}catch(e){console.error(`Failed to activate agent profile:`,e)}},onEdit:e=>t?.(e),onDelete:d,isActivating:o.isPending})]}),(0,G.jsx)(X,{profile:u,onClose:()=>d(null)})]})}function Q(e,t){if(!e||e.agent_kind!==t.agent_kind)return t;let{id:n,name:r,revision:i,...a}=e;return{...a,...t}}function $(){let e=a();return o({mutationFn:({name:e,newName:t})=>y.renameProfile(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:d.all})},meta:{disableToast:!0}})}function ee(e){return e.agent_kind===`acp`?{agent_kind:`acp`,acp_server:e.acp_server,acp_command:e.acp_command?V(e.acp_command):[],acp_args:e.acp_args??[],acp_model:e.acp_model??``}:{agent_kind:`openhands`,enable_sub_agents:e.enable_sub_agents,tool_concurrency_limit:e.tool_concurrency_limit}}function te(){let{t:e}=s(`openhands`),{setHideSectionHeader:t}=R(),n=z(),r=$(),{data:i}=b(),{data:a,isLoading:o}=v(),[d,m]=(0,U.useState)(`list`),[g,_]=(0,U.useState)(``),[x,S]=(0,U.useState)(null),[C,E]=(0,U.useState)(null),[O,k]=(0,U.useState)(``),[A,M]=(0,U.useState)(null),[N,P]=(0,U.useState)(!1);(0,U.useEffect)(()=>(t(d!==`list`),()=>t(!1)),[d,t]);let F=a?.profiles??[],I=a?.active_profile??F[0]?.name??``,L=(0,U.useMemo)(()=>new Set(i?.profiles?.map(e=>e.name)??[]),[i]),B=(0,U.useMemo)(()=>!(!j(g,{isRequired:!0})||d===`create`&&L.has(g)||d===`edit`&&g!==x?.name&&L.has(g)),[g,d,L,x?.name]),V=(0,U.useCallback)(()=>{_(``),S(null),E({agent_kind:`openhands`}),k(I),M(null),m(`create`)},[I]),W=(0,U.useCallback)(async t=>{try{let e=(await y.getProfile(t.name,`encrypted`)).profile;S(e),E(ee(e)),e.agent_kind===`openhands`?k(o||F.some(t=>t.name===e.llm_profile_ref)?e.llm_profile_ref:I):k(``),_(e.name),M(null),m(`edit`)}catch(t){console.error(`Failed to fetch agent profile:`,t),l(e(c.ERROR$GENERIC))}},[e,F,o,I]),K=(0,U.useCallback)(()=>{m(`list`),S(null),_(``),E(null),M(null)},[]),q=(0,U.useCallback)(async()=>{if(!A||!B)return;let t;try{let n=A.buildAgentProfileFields();if(n.agent_kind===`openhands`){if(!O){l(e(c.SETTINGS$AGENT_PROFILE_LLM_REQUIRED));return}t={...n,llm_profile_ref:O}}else t=n}catch(t){l(t instanceof Error?t.message:e(c.ERROR$GENERIC));return}let i=g.trim(),a=x?.name,o=d===`edit`&&a&&a!==i;P(!0);try{if(A.credentials.isDirty){if(!await A.credentials.save({silent:!0}))return;A.credentials.reset()}o&&await r.mutateAsync({name:a,newName:i});let s=Q(d===`edit`?x:null,t);await n.mutateAsync({name:i,profile:s}),f(e(d===`create`?c.SETTINGS$PROFILE_CREATED:c.SETTINGS$PROFILE_UPDATED,{name:i})),K()}catch(t){l(u(t)||e(c.ERROR$GENERIC))}finally{P(!1)}},[A,B,O,g,d,x,n,r,e,K]);if(d===`list`)return(0,G.jsx)(Z,{onAddProfile:V,onEditProfile:W});let J=e(d===`edit`?c.SETTINGS$EDIT_AGENT_PROFILE:c.SETTINGS$ADD_AGENT_PROFILE),Y=d===`edit`&&x?e(c.SETTINGS$PROFILE_LOADED,{name:x.name}):e(c.SETTINGS$PROFILE_SAVE_HINT),X=A?.agentType!==`acp`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(p,{testId:`back-to-agent-profiles`,onClick:K,children:e(c.BUTTON$BACK)}),(0,G.jsx)(T.H2,{testId:`agent-profile-editor-title`,children:J}),(0,G.jsx)(`p`,{"data-testid":`agent-profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:Y})]}),(0,G.jsx)(D,{testId:`agent-profile-name-input`,value:g,onChange:_,isRequired:!0}),(0,G.jsx)(H,{embedded:!0,agentSettingsOverride:C,onSaveControlChange:M},d===`edit`?`edit-${x?.id}`:`new-profile`),X&&(F.length>0?(0,G.jsx)(w,{testId:`agent-profile-llm-selector`,name:`agent-profile-llm`,label:e(c.SETTINGS$AGENT_PROFILE_LLM_LABEL),items:F.map(e=>({key:e.name,label:e.model?`${e.name} (${e.model})`:e.name})),selectedKey:O,onSelectionChange:e=>e&&k(String(e))}):(0,G.jsx)(`p`,{"data-testid":`agent-profile-no-llm`,className:`text-sm text-red-400`,children:e(c.SETTINGS$AGENT_PROFILE_NO_LLM)})),(0,G.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,G.jsx)(h,{testId:`cancel-agent-profile-btn`,type:`button`,variant:`secondary`,onClick:K,children:e(c.BUTTON$CANCEL)}),(0,G.jsx)(h,{testId:`save-agent-profile-btn`,type:`button`,variant:`primary`,onClick:q,isDisabled:!B||N||!A?.isValid,"aria-busy":N,children:e(N?c.SETTINGS$SAVING:c.BUTTON$SAVE)})]})]})}var ne={hideTitle:!1},re=i(function(){return(0,G.jsx)(te,{})});export{re as default,ne as handle};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{L as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as o}from"./useMutation-DrCAVg5w.js";import{t as s}from"./useTranslation-CDRCKC9-.js";import{t as c}from"./declaration-gq8V5eTU.js";import{A as l,P as u,i as d,j as f}from"./active-backend-context-hxq31W25.js";import{t as p}from"./back-nav-button-CUS2mi-U.js";import{t as m}from"./utils-D3U3rlqr.js";import{t as h}from"./brand-button-vMVuyDXu.js";import{t as g}from"./loading-spinner-BLdswi6q.js";import{i as _}from"./dropdown-classes-DJSXeLqc.js";import{t as v}from"./use-llm-profiles-RC-PkpBl.js";import{n as y,t as b}from"./use-agent-profiles-DwZxnwO5.js";import{r as x,t as S}from"./ellipsis-button-C5Z-tPFp.js";import{t as C}from"./u-edit-DJ90xc8Z.js";import{t as w}from"./settings-dropdown-input-BjunGXJb.js";import{r as T}from"./typography-D8mHDeNG.js";import{o as E}from"./extension-module-card-classes-9V3J9J_b.js";import{a as D,i as O,n as k,r as A,s as j,t as M}from"./use-can-manage-org-profiles-C-OhWVBS.js";import{t as N}from"./u-check-circle-BqoIxNz_.js";import{i as P,n as F,r as I,t as L}from"./settings-list-classes-Dp_OgzN0.js";import{n as R}from"./settings-section-header-context-COMOIaxV.js";import{t as z}from"./use-save-agent-profile-tvDP15mh.js";import{n as B}from"./use-activate-agent-profile-20v1xU0H.js";import{i as V,t as H}from"./agent-settings-B-W10B4E.js";var U=e(t(),1),W=e(r(),1),G=n();function K({onEdit:e,onSetActive:t,onDelete:n,isActive:r,isActivating:i,onClose:a,anchorRef:o}){let{t:l}=s(`openhands`),u=(0,U.useRef)(null),d=(0,U.useRef)([]),f=o?.current??null,[p,h]=(0,U.useState)();(0,U.useLayoutEffect)(()=>{if(!f)return;let e=()=>{let e=f.getBoundingClientRect();e&&h({position:`fixed`,zIndex:9999,top:e.bottom+8,right:window.innerWidth-e.right,width:`max-content`})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[f]),(0,U.useEffect)(()=>{d.current[0]?.focus()},[]),(0,U.useEffect)(()=>{let e=e=>{let t=e.target;u.current&&!u.current.contains(t)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let g=e=>{e(),a()},v=(0,U.useCallback)((e,t)=>{if(e.key===`Tab`){a();return}let n=d.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;d.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;d.current[r]?.focus()}},[a]),y=r||i,b=!!f,S=(0,G.jsxs)(`div`,{ref:u,className:m(`absolute right-0 top-full z-10 mt-2 w-[160px] rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 shadow-lg`,_,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`agent-profile-actions-menu`,children:[(0,G.jsx)(A,{index:0,icon:(0,G.jsx)(C,{width:16,height:16}),label:l(c.SETTINGS$PROFILE_EDIT),onClick:()=>g(e),onKeyDown:v,menuItemsRef:d,testId:`agent-profile-edit`}),(0,G.jsx)(A,{index:1,icon:(0,G.jsx)(N,{width:16,height:16}),label:l(c.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>g(t),onKeyDown:v,menuItemsRef:d,disabled:y,testId:`agent-profile-set-active`}),(0,G.jsx)(A,{index:2,icon:(0,G.jsx)(x,{width:16,height:16}),label:l(c.BUTTON$DELETE),onClick:()=>g(n),onKeyDown:v,menuItemsRef:d,testId:`agent-profile-delete`})]});return b?typeof document>`u`||!p?null:W.createPortal((0,G.jsx)(`div`,{style:p,children:S}),document.body):S}function q({profile:e,isActive:t,canManage:n,onActivate:r,onEdit:i,onDelete:a,isActivating:o}){let{t:l}=s(`openhands`),[u,d]=(0,U.useState)(!1),f=(0,U.useRef)(null),p=e.agent_kind===`openhands`?e.llm_profile_ref:l(c.SETTINGS$AGENT_TYPE_ACP);return(0,G.jsxs)(`div`,{"data-testid":`agent-profile-row`,className:m(P,`justify-between gap-3`),children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),p?(0,G.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:p,children:p}):null,t&&(0,G.jsx)(k,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`agent-profile-active-badge`,children:l(c.SETTINGS$PROFILE_ACTIVE)})]}),n&&(0,G.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,G.jsx)(S,{ref:f,onClick:()=>d(e=>!e),ariaLabel:l(c.SETTINGS$PROFILE_MENU),testId:`agent-profile-menu-trigger`,className:I}),u&&(0,G.jsx)(K,{anchorRef:f,onEdit:()=>i(e),onSetActive:()=>r(e),onDelete:()=>a(e),isActive:t,isActivating:o,onClose:()=>d(!1)})]})]})}function J({isLoading:e,loadError:t,profiles:n,activeId:r,canManage:i,onActivate:a,onEdit:o,onDelete:l,isActivating:u}){let{t:d}=s(`openhands`);return e?(0,G.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,G.jsx)(g,{size:`large`})}):t?(0,G.jsx)(`div`,{"data-testid":`agent-profiles-load-error`,className:E,children:(0,G.jsx)(`p`,{className:`text-sm text-red-400`,children:d(c.SETTINGS$PROFILES_LOAD_ERROR)})}):n.length===0?(0,G.jsx)(`div`,{"data-testid":`agent-profiles-empty`,className:E,children:(0,G.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:d(c.SETTINGS$PROFILES_EMPTY)})}):(0,G.jsx)(`div`,{className:m(L,F),children:n.map(e=>(0,G.jsx)(q,{profile:e,isActive:!!e.id&&e.id===r,canManage:i,onActivate:a,onEdit:o,onDelete:l,isActivating:u},e.name))})}function Y(){let e=a();return o({mutationFn:e=>y.deleteProfile(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:d.all})},meta:{disableToast:!0}})}function X({profile:e,onClose:t}){let{t:n}=s(`openhands`),r=Y(),i=(0,U.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),f(n(c.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){l(e instanceof Error?e.message:n(c.ERROR$GENERIC))}},o=()=>{r.isPending||t()},u=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(h,{ref:i,type:`button`,variant:`tertiary`,onClick:o,isDisabled:r.isPending,children:n(c.BUTTON$CANCEL)}),(0,G.jsx)(h,{testId:`delete-agent-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(g,{size:`small`}),(0,G.jsx)(`span`,{className:`sr-only`,children:n(c.BUTTON$DELETE)})]}):n(c.BUTTON$DELETE)})]});return(0,G.jsx)(O,{isOpen:!0,title:n(c.SETTINGS$PROFILE_DELETE_TITLE),footer:u,onClose:o,initialFocusRef:i,children:(0,G.jsx)(`p`,{className:`text-sm break-all`,children:n(c.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}function Z({onAddProfile:e,onEditProfile:t}){let{t:n}=s(`openhands`),{data:r,isLoading:i,error:a}=b(),o=B(),l=M(),[u,d]=(0,U.useState)(null),p=r?.profiles??[],m=r?.active_agent_profile_id??null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(c.SETTINGS$AVAILABLE_PROFILES)}),e&&l?(0,G.jsx)(h,{testId:`add-agent-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(c.SETTINGS$ADD_AGENT_PROFILE)}):null]}),(0,G.jsx)(J,{isLoading:i,loadError:a??null,profiles:p,activeId:m,canManage:l,onActivate:async e=>{if(e.id)try{await o.mutateAsync(e.id),f(n(c.SETTINGS$PROFILE_ACTIVATED,{name:e.name}))}catch(e){console.error(`Failed to activate agent profile:`,e)}},onEdit:e=>t?.(e),onDelete:d,isActivating:o.isPending})]}),(0,G.jsx)(X,{profile:u,onClose:()=>d(null)})]})}function Q(e,t){if(!e||e.agent_kind!==t.agent_kind)return t;let{id:n,name:r,revision:i,...a}=e;return{...a,...t}}function $(){let e=a();return o({mutationFn:({name:e,newName:t})=>y.renameProfile(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:d.all})},meta:{disableToast:!0}})}function ee(e){return e.agent_kind===`acp`?{agent_kind:`acp`,acp_server:e.acp_server,acp_command:e.acp_command?V(e.acp_command):[],acp_args:e.acp_args??[],acp_model:e.acp_model??``}:{agent_kind:`openhands`,enable_sub_agents:e.enable_sub_agents,tool_concurrency_limit:e.tool_concurrency_limit}}function te(){let{t:e}=s(`openhands`),{setHideSectionHeader:t}=R(),n=z(),r=$(),{data:i}=b(),{data:a,isLoading:o}=v(),[d,m]=(0,U.useState)(`list`),[g,_]=(0,U.useState)(``),[x,S]=(0,U.useState)(null),[C,E]=(0,U.useState)(null),[O,k]=(0,U.useState)(``),[A,M]=(0,U.useState)(null),[N,P]=(0,U.useState)(!1);(0,U.useEffect)(()=>(t(d!==`list`),()=>t(!1)),[d,t]);let F=a?.profiles??[],I=a?.active_profile??F[0]?.name??``,L=(0,U.useMemo)(()=>new Set(i?.profiles?.map(e=>e.name)??[]),[i]),B=(0,U.useMemo)(()=>!(!j(g,{isRequired:!0})||d===`create`&&L.has(g)||d===`edit`&&g!==x?.name&&L.has(g)),[g,d,L,x?.name]),V=(0,U.useCallback)(()=>{_(``),S(null),E({agent_kind:`openhands`}),k(I),M(null),m(`create`)},[I]),W=(0,U.useCallback)(async t=>{try{let e=(await y.getProfile(t.name,`encrypted`)).profile;S(e),E(ee(e)),e.agent_kind===`openhands`?k(o||F.some(t=>t.name===e.llm_profile_ref)?e.llm_profile_ref:I):k(``),_(e.name),M(null),m(`edit`)}catch(t){console.error(`Failed to fetch agent profile:`,t),l(e(c.ERROR$GENERIC))}},[e,F,o,I]),K=(0,U.useCallback)(()=>{m(`list`),S(null),_(``),E(null),M(null)},[]),q=(0,U.useCallback)(async()=>{if(!A||!B)return;let t;try{let n=A.buildAgentProfileFields();if(n.agent_kind===`openhands`){if(!O){l(e(c.SETTINGS$AGENT_PROFILE_LLM_REQUIRED));return}t={...n,llm_profile_ref:O}}else t=n}catch(t){l(t instanceof Error?t.message:e(c.ERROR$GENERIC));return}let i=g.trim(),a=x?.name,o=d===`edit`&&a&&a!==i;P(!0);try{if(A.credentials.isDirty){if(!await A.credentials.save({silent:!0}))return;A.credentials.reset()}o&&await r.mutateAsync({name:a,newName:i});let s=Q(d===`edit`?x:null,t);await n.mutateAsync({name:i,profile:s}),f(e(d===`create`?c.SETTINGS$PROFILE_CREATED:c.SETTINGS$PROFILE_UPDATED,{name:i})),K()}catch(t){l(u(t)||e(c.ERROR$GENERIC))}finally{P(!1)}},[A,B,O,g,d,x,n,r,e,K]);if(d===`list`)return(0,G.jsx)(Z,{onAddProfile:V,onEditProfile:W});let J=e(d===`edit`?c.SETTINGS$EDIT_AGENT_PROFILE:c.SETTINGS$ADD_AGENT_PROFILE),Y=d===`edit`&&x?e(c.SETTINGS$PROFILE_LOADED,{name:x.name}):e(c.SETTINGS$PROFILE_SAVE_HINT),X=A?.agentType!==`acp`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(p,{testId:`back-to-agent-profiles`,onClick:K,children:e(c.BUTTON$BACK)}),(0,G.jsx)(T.H2,{testId:`agent-profile-editor-title`,children:J}),(0,G.jsx)(`p`,{"data-testid":`agent-profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:Y})]}),(0,G.jsx)(D,{testId:`agent-profile-name-input`,value:g,onChange:_,isRequired:!0}),(0,G.jsx)(H,{embedded:!0,agentSettingsOverride:C,onSaveControlChange:M},d===`edit`?`edit-${x?.id}`:`new-profile`),X&&(F.length>0?(0,G.jsx)(w,{testId:`agent-profile-llm-selector`,name:`agent-profile-llm`,label:e(c.SETTINGS$AGENT_PROFILE_LLM_LABEL),items:F.map(e=>({key:e.name,label:e.model?`${e.name} (${e.model})`:e.name})),selectedKey:O,onSelectionChange:e=>e&&k(String(e))}):(0,G.jsx)(`p`,{"data-testid":`agent-profile-no-llm`,className:`text-sm text-red-400`,children:e(c.SETTINGS$AGENT_PROFILE_NO_LLM)})),(0,G.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,G.jsx)(h,{testId:`cancel-agent-profile-btn`,type:`button`,variant:`secondary`,onClick:K,children:e(c.BUTTON$CANCEL)}),(0,G.jsx)(h,{testId:`save-agent-profile-btn`,type:`button`,variant:`primary`,onClick:q,isDisabled:!B||N||!A?.isValid,"aria-busy":N,children:e(N?c.SETTINGS$SAVING:c.BUTTON$SAVE)})]})]})}var ne={hideTitle:!1},re=i(function(){return(0,G.jsx)(te,{})});export{re as default,ne as handle};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-
|
|
2
|
-
import{St as e}from"./vendor-styling-CI0PQ3ab.js";import{d as t,f as n,r,s as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
3
|
-
`)}function we(e){let{host:t}=u();return`${t}/api/conversations/${e}`}function R(e){return`Conversation ${e.slice(0,5)}`}function z(e){let t=
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-B2GqPV0N.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js","assets/vendor-styling-CI0PQ3ab.js","assets/agent-server-client-options-DVLRd9sw.js","assets/proxy-BgJLtxu7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{St as e}from"./vendor-styling-CI0PQ3ab.js";import{d as t,f as n,r,s as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{_ as a}from"./active-backend-context-hxq31W25.js";import{t as o}from"./common-Dh7OqABE.js";import{a as s,b as c,c as l,n as u,t as ee,u as d,w as f}from"./agent-server-client-options-DVLRd9sw.js";import{n as p,t as m}from"./proxy-BgJLtxu7.js";import{t as h}from"./settings-mQUckT0g.js";import{t as te}from"./settings-service.api-Ce-ub11I.js";import{r as g,t as _}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js";import{t as v}from"./v4-DbCkTSoU.js";import{t as y}from"./profiles-service.api-BMXQ9pZC.js";import{t as b}from"./vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js";import{f as x,o as S,s as ne}from"./acp-providers-Sy2LKyMa.js";import{d as re,f as C,r as ie}from"./llm-subscription-DtsX5Lhg.js";import{t as ae}from"./llm-subscription-service-CKyaV24y.js";var w=new Map;function oe(e){return/^([/\\]|[a-zA-Z]:[/\\])/.test(e)}function se(e,t){return`${e.replace(/[/\\]+$/,``)}/${t.replace(/^[/\\]+/,``)}`}async function T(e={}){let n=u(e),r=n.host,i=w.get(r);if(i)return i;let a=(async()=>{let{home:e}=await new t(n).getHome();if(!e||typeof e!=`string`)throw Error(`Agent server returned an empty home directory`);return e.replace(/[/\\]+$/,``)})();w.set(r,a);try{return await a}catch(e){throw w.delete(r),e}}async function ce(e,t={}){let n=e.replace(/[/\\]+$/,``);return n?oe(n)?n:se(await T(t),n):T(t)}var E=`openhands-agent-server-conversation-metadata`,D=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(E);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},le=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(E);return}window.localStorage.setItem(E,JSON.stringify(e))}},O=e=>D()[e]??null,k=(e,t)=>{let n=D();n[e]=t,le(n)},A=e=>{let t=D();e in t&&(delete t[e],le(t))};function j(e){if(!e?.id)return e;let t=O(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function M(){let e=l().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function ue(e=20,t){let n=M(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await m({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>j(e)),next_page_id:i?.next_page_id??null}}async function N(e){if(e.length===0)return[];let t=M(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await m({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(j)}async function de(e){return await m({backend:M(),method:`POST`,path:`/api/v1/app-conversations`,body:e})}async function fe(e){return m({backend:M(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function pe(e){await m({backend:M(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function me(e,t){return await m({backend:M(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function he(e){await m({backend:M(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function ge(e){await m({backend:M(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function P(e,t){let n=M(),r=new URLSearchParams;return r.append(`file_path`,t),await m({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function _e(e){let t=M(),n=new URLSearchParams;return n.set(`ids`,e),(await m({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}var F=`canvas_ui`,ve=`canvas_ui_tool`,ye=[`terminal`,`file_editor`,`task_tracker`,F],I=`browser_tool_set`,L=`task_tool_set`;function be(){return!0}function xe(){let e=(void 0)?.trim();if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_RUNTIME_SERVICES_INFO__;if(typeof e==`string`)return e.trim()||null}return null}function Se(){let e=xe();if(!e)return null;try{let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function Ce(){let e=Se();if(!e?.services)return;let t=[];t.push(`<RUNTIME_SERVICES>`),e.mode?t.push(`You are running inside an agent-canvas dev stack started in '${e.mode}' mode.`):t.push(`You are running inside an agent-canvas dev stack.`),t.push(`The following services are reachable from your sandbox. URLs are written`,`from your point of view (i.e., as you should curl/fetch them).`,``);let{agent_server:n,ingress:r,automation:i}=e.services,{frontend:a}=e.services;n?.url_from_agent&&t.push(`* Agent Server (you): ${n.url_from_agent}`,` ${n.description??`The agent-server hosting your tool calls.`}`),r?.url_from_agent&&t.push(`* Ingress: ${r.url_from_agent}`,` ${r.description??`Unified entry point for browser-facing traffic.`}`),a?.url_from_agent&&t.push(`* Frontend: ${a.url_from_agent}`,` ${a.description??`Frontend dev server.`}`),i?.url_from_agent?(t.push(`* Automation backend: ${i.url_from_agent}`,` ${i.description??`OpenHands Automations service.`}`),i.docs_url&&t.push(` Docs: ${i.docs_url}`),i.openapi_url&&t.push(` OpenAPI: ${i.openapi_url}`),i.auth_env_var&&t.push(` Auth: header 'X-Session-API-Key: $${i.auth_env_var}'`)):t.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let o=n?.url_from_agent;return t.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),o&&t.push(`In particular, ${o} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),t.push(`</RUNTIME_SERVICES>`),t.join(`
|
|
3
|
+
`)}function we(e){let{host:t}=u();return`${t}/api/conversations/${e}`}function R(e){return`Conversation ${e.slice(0,5)}`}function z(e){let t=O(e.id),n=e.agent?.kind===`ACPAgent`,r=n?e.tags?.acpserver??e.agent?.acp_server??null:null;return{id:e.id,created_by_user_id:null,selected_repository:t?.selected_repository??null,selected_branch:t?.selected_branch??null,git_provider:t?.git_provider??null,selected_workspace:t?.selected_workspace??null,active_profile:t?.active_profile??null,title:e.title?.trim()?e.title:R(e.id),trigger:null,pr_number:[],agent_kind:n?`acp`:`openhands`,acp_server:r,llm_model:n?x({runtimeName:e.current_model_name,runtimeId:e.current_model_id,configured:e.agent?.acp_model,sdkLlm:e.agent?.llm?.model}):e.agent?.llm?.model??h.llm_model,metrics:e.metrics?{accumulated_cost:e.metrics.accumulated_cost??null,max_budget_per_task:e.metrics.max_budget_per_task??null,accumulated_token_usage:e.metrics.accumulated_token_usage?{prompt_tokens:e.metrics.accumulated_token_usage.prompt_tokens??0,completion_tokens:e.metrics.accumulated_token_usage.completion_tokens??0,cache_read_tokens:e.metrics.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:e.metrics.accumulated_token_usage.cache_write_tokens??0,context_window:e.metrics.accumulated_token_usage.context_window??0,per_turn_token:e.metrics.accumulated_token_usage.per_turn_token??0}:null}:null,created_at:e.created_at,updated_at:e.updated_at,execution_status:e.execution_status??o.IDLE,sandbox_status:e.sandbox_status??null,conversation_url:we(e.id),session_api_key:u().apiKey??null,sandbox_id:null,workspace:{working_dir:e.workspace?.working_dir??f()},public:!1,sub_conversation_ids:[]}}function Te(e){return{items:e.items.map(z),next_page_id:e.next_page_id??null}}var Ee=`acpserver`,De=`gAAAAA`,Oe=new Set([`schema_version`,`agent_settings`,`workspace`,`conversation_id`,`initial_message`,`plugins`]);function B(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:structuredClone(e)}function V(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function H(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function U(e){return typeof e==`string`?e.startsWith(De):Array.isArray(e)?e.some(U):H(e)?Object.values(e).some(U):!1}function ke(e){return H(e)?Object.values(e).some(U):!1}function Ae(e){return e.confirmation_mode===!0?e.security_analyzer===`llm`?{kind:`ConfirmRisky`,threshold:`HIGH`,confirm_unknown:!0}:{kind:`AlwaysConfirm`}:{kind:`NeverConfirm`}}function je(e){switch(e.security_analyzer){case`llm`:return{kind:`LLMSecurityAnalyzer`};case`pattern`:return{kind:`PatternSecurityAnalyzer`};case`policy_rail`:return{kind:`PolicyRailSecurityAnalyzer`};default:return}}function Me(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.name==`string`}function W(e,t){return e===F?a(e):e===I?be()&&a(e):e===L?t.enable_sub_agents===!0&&a(e):!0}function Ne(e){let t=new Map;for(let n of ye)W(n,e)&&t.set(n,{name:n,params:{}});for(let n of[I,L])W(n,e)&&t.set(n,{name:n,params:{}});let n=e.tools;if(Array.isArray(n)&&n.every(e=>Me(e)))for(let r of n)W(r.name,e)&&t.set(r.name,{name:r.name,params:B(r.params)});return Array.from(t.values())}function Pe(e,t){let n=[e?.trim(),t?.trim()].filter(Boolean);return n.length===0?null:{role:`user`,content:[{type:`text`,text:n.join(`
|
|
4
4
|
|
|
5
|
-
`)}],run:!0}}function Fe(){return b.map(e=>{let t=e.triggers?.length>0?{type:`keyword`,keywords:e.triggers}:null,n=`/home/runner/work/agent-canvas/agent-canvas/node_modules/@openhands/extensions/skills/${e.name}/SKILL.md`;return{name:e.name,content:e.content,trigger:t,source:n,description:e.description??null,is_agentskills_format:!0,...e.license?{license:e.license}:{},...e.compatibility?{compatibility:e.compatibility}:{}}})}function G(e){let t=Ce(),n=B(e.agent_context),r=[...Array.isArray(n.skills)?n.skills:[],...Fe()];return{...n,skills:r,load_public_skills:!1,load_user_skills:!0,load_project_skills:!0,...t?{system_message_suffix:t}:{}}}function K(e){return B(e.agent_settings).agent_kind===`acp`}function Ie(e){let t=B(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function Le(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=ne(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Re(e){let t=B(e.agent_settings),n={agent_kind:`acp`,agent_context:G(t)};for(let e of _){if(e===`acp_model`||e===`acp_env`)continue;let r=e===`acp_command`?Le(t):t[e];r!=null&&(n[e]=r)}let r=B(t.mcp_config);Object.keys(r).length>0&&(n.mcp_config=r);let i=typeof t.acp_server==`string`?t.acp_server:void 0,a=x({configured:t.acp_model,providerDefault:S(i)});return a&&(n.acp_model=a),n}function ze(e){let t=B(e.agent_settings),n=B(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:h.llm_model,n.stream=!0;let r=V(n.api_key);r?n.api_key=r:delete n.api_key;let i=V(n.base_url);i?n.base_url=i:delete n.base_url,C(n)?(n.auth_type=ie,n.subscription_vendor=re,delete n.api_key,delete n.base_url):(delete n.auth_type,delete n.subscription_vendor);let a=B(t.mcp_config);Object.keys(a).length===0&&delete t.mcp_config,delete t.acp_server;for(let e of _)delete t[e];return delete t.acp_env,{...t,llm:n,agent_context:G(t),tools:Ne(t)}}function Be(e){return K(e)?Re(e):ze(e)}function Ve(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=B(t.conversation_settings),s=Pe(n,r);return Oe.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??f()},...s?{initial_message:s}:{},...i?.length?{plugins:i.map(e=>({source:e.source,...e.ref?{ref:e.ref}:{},...e.repo_path?{repo_path:e.repo_path}:{}}))}:{}}}function He(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=K(t),r=Be(t),i=n?Ie(t):void 0,o=Ve(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),s={...e.agentProfileId?{agent_profile_id:e.agentProfileId}:{agent_settings:r},workspace:o.workspace,confirmation_policy:Ae(o),max_iterations:typeof o.max_iterations==`number`?o.max_iterations:500,stuck_detection:!0,autotitle:!0,worktree:e.worktree??!0};!e.agentProfileId&&i&&(s.tags={[Ee]:i}),!e.agentProfileId&&e.secretsEncrypted&&(!n||ke(r.mcp_config))&&(s.secrets_encrypted=!0),e.conversationId&&(s.conversation_id=e.conversationId);let c=je(o);c&&(s.security_analyzer=c),o.initial_message&&(s.initial_message=o.initial_message),o.plugins&&(s.plugins=o.plugins),o.hook_config&&(s.hook_config=o.hook_config);let l={},u=a(F);if(u&&(l[F]=ve),Object.assign(l,o.tool_module_qualnames??{}),u||delete l[F],Object.keys(l).length>0&&(s.tool_module_qualnames=l),o.agent_definitions&&(s.agent_definitions=o.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=d(),n=t?p(t):{},r={};for(let t of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(t.name)}`,description:t.description};Object.keys(n).length>0&&(e.headers=n),r[t.name]=e}s.secrets=r}return s}var Ue=`Connect your ChatGPT subscription before starting a conversation with this LLM profile.`;async function q(e){if(C(B(e.llm))&&!(await ae.getOpenAIStatus()).connected)throw Error(Ue)}async function We(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-CZYjNxFw.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5])),[r,i]=await Promise.all([te.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return t.agentProfileId||await q(a),He({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Ge(){return{hooks:[]}}var Ke=`1970-01-01T00:00:00.000Z`,qe=`Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.`;function J(){return Error(qe)}function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e){return typeof e==`number`?e:null}function Z(e){return typeof e==`number`?e:0}function Q(e){return typeof e==`string`?e:null}function Je(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:Ke}function Ye(e){return Y(e)?{prompt_tokens:Z(e.prompt_tokens),completion_tokens:Z(e.completion_tokens),cache_read_tokens:Z(e.cache_read_tokens),cache_write_tokens:Z(e.cache_write_tokens),context_window:Z(e.context_window),per_turn_token:Z(e.per_turn_token)}:null}function Xe(e){return Y(e)?{accumulated_cost:X(e.accumulated_cost),max_budget_per_task:X(e.max_budget_per_task),accumulated_token_usage:Ye(e.accumulated_token_usage)}:null}function Ze(e){if(!Y(e))return null;let t=Y(e.llm)?{model:Q(e.llm.model)}:null;return{kind:Q(e.kind),acp_server:Q(e.acp_server),acp_model:Q(e.acp_model),llm:t}}function Qe(e){return Y(e)?{working_dir:Q(e.working_dir)}:null}function $e(e){if(!Y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function et(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function tt(e,t){let n=et(e),r=et(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function nt(e){if(!Y(e)||typeof e.id!=`string`||!e.id.trim())throw J();return{id:e.id.trim(),title:Q(e.title),created_at:Je(e,`created_at`,`createdAt`),updated_at:Je(e,`updated_at`,`updatedAt`),execution_status:Q(e.execution_status),sandbox_status:Q(e.sandbox_status),metrics:Xe(e.metrics),agent:Ze(e.agent),workspace:Qe(e.workspace),tags:$e(e.tags),current_model_id:Q(e.current_model_id),current_model_name:Q(e.current_model_name)}}function $(e){if(!Array.isArray(e))throw J();return e.map(nt)}function rt(e){if(Array.isArray(e))return{items:$(e),next_page_id:null};if(!Y(e))throw J();return{items:$(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var it=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function at(e){let t=e??`idle`;return it.has(t)?t:`idle`}function ot(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var st=class{static async sendMessage(e,t,r){let i=l().backend,a=r?.conversationUrl??null,o=r?.sessionApiKey??null;if(i.kind===`cloud`){if(!a||!o){let[t]=await P([e]);a=t?.conversation_url?.trim()??null,o=t?.session_api_key?.trim()??null}if(!a||!o)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await m({backend:i,method:`POST`,hostOverride:s(a),path:`/api/conversations/${e}/events`,body:{...t,run:!0},authMode:`session-api-key`,sessionApiKey:o}),t}return await new n(u({conversationUrl:a,sessionApiKey:o})).sendEvent(e,t,{run:!0}),t}static async createConversation(e,t,r,i,a,o,s,f,p,m){if(l().backend.kind===`cloud`)return ue({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:t??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:s??null,agent_type:f,sandbox_id:p??null,agent_profile_id:m??null});let h=await te.getSettings(),g=v(),_=await E(a??c(g)),y=o??(a?`local_repo`:`new_worktree`),b=await We({settings:h,query:e,conversationInstructions:t,plugins:r,conversationId:g,workingDir:_,worktree:y===`new_worktree`,agentProfileId:m}),x=await new n(u()).createConversation(b),S=d();if(!S)throw new ee;return(i?.selected_repository||a)&&A(x.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:a??null,workspace_mode:y}),{id:x.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:x.id,agent_server_url:S.host,request:{initial_message:b.initial_message,plugins:r??null},created_at:x.created_at,updated_at:x.updated_at}}static async getStartTask(e){return l().backend.kind===`cloud`?_e(e):null}static async getVSCodeUrl(e,t,n){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new r(u({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??f()}static async batchGetAppConversations(e){return e.length===0?[]:l().backend.kind===`cloud`?P(e):$(await new n(u()).getConversations(e)).map(e=>z(e))}static async updateConversationPublicFlag(e,t){if(l().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return pe(e,t)}static async updateConversationRepository(e,t,n,r){t?A(e,{...k(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):j(e);let[i]=await this.batchGetAppConversations([e]);return ot(i,e)}static async readConversationFile(e,n){if(l().backend.kind===`cloud`)return ge(e,tt(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let r=await this.resolveConversationWorkingDir(e),i=tt(n??`${r}/.agents_tmp/PLAN.md`,r);return new t(u()).downloadTextFile(i)}static async downloadConversation(e){return l().backend.kind===`cloud`?de(e):new t(u()).downloadTrajectory(e)}static async getHooks(e){return Ge()}static async getRuntimeConversation(e,t,r){let i=l().backend,a=i.kind===`cloud`&&t?await m({backend:i,method:`GET`,hostOverride:s(t),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:r}):await new n(u({conversationUrl:t,sessionApiKey:r})).getConversation(e),o=nt(a),c=Y(a)?a.stats:null;return{id:o.id,title:o.title?.trim()?o.title:R(o.id),metrics:Xe(o.metrics),created_at:o.created_at,updated_at:o.updated_at,status:at(o.execution_status),stats:Y(c)?c:{usage_to_metrics:{}}}}static async searchConversations(e=20,t){return l().backend.kind===`cloud`?le(e,t):Te(rt(await new n(u()).searchConversations({limit:e,page_id:t,sort_order:g.UPDATED_AT_DESC})))}static async deleteConversation(e){l().backend.kind===`cloud`?await fe(e):await new n(u()).deleteConversation(e),j(e)}static async updateConversationTitle(e,t){await new n(u()).updateConversation(e,{title:t});let[r]=await this.batchGetAppConversations([e]);return ot(r,e)}static async forkConversation(e,t,r){if(l().backend.kind===`cloud`)throw Error(`Branching a conversation isn't supported on the cloud backend yet.`);let i=await new n(u()).forkConversation(e,{from_event_id:t,...r?{title:r}:{}}),a=k(e);return a&&A(i.id,a),i}static async getEventParentId(e,t){return(await new n(u()).getEvent(e,t)).parent_id??void 0}static async switchProfile(e,t){let{backend:r}=l();if(r.kind===`cloud`){if(!e){await y.activateProfile(t);return}await m({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_profile`,body:{profile_name:t}});return}if(!e){await new i(u()).activateProfile(t);return}let a=u(),o=new n(a),s=await new i(a).getProfile(t,{exposeSecrets:`encrypted`}),c=typeof s.config.model==`string`?s.config.model:``;if(!c)throw Error(`Profile '${t}' has no model.`);await q({llm:s.config}),await o.switchLLM(e,{...s.config,model:c,stream:!0,usage_id:`profile:${t}:${v()}`})}static async switchAcpModel(e,t){let{backend:r}=l();if(r.kind===`cloud`){await m({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_acp_model`,body:{model:t}});return}await new n(u()).switchAcpModel(e,t)}};export{k as a,he as i,P as n,A as o,me as r,E as s,st as t};
|
|
5
|
+
`)}],run:!0}}function Fe(){return b.map(e=>{let t=e.triggers?.length>0?{type:`keyword`,keywords:e.triggers}:null,n=`/home/runner/work/agent-canvas/agent-canvas/node_modules/@openhands/extensions/skills/${e.name}/SKILL.md`;return{name:e.name,content:e.content,trigger:t,source:n,description:e.description??null,is_agentskills_format:!0,...e.license?{license:e.license}:{},...e.compatibility?{compatibility:e.compatibility}:{}}})}function G(e){let t=Ce(),n=B(e.agent_context),r=[...Array.isArray(n.skills)?n.skills:[],...Fe()];return{...n,skills:r,load_public_skills:!1,load_user_skills:!0,load_project_skills:!0,...t?{system_message_suffix:t}:{}}}function K(e){return B(e.agent_settings).agent_kind===`acp`}function Ie(e){let t=B(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function Le(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=ne(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Re(e){let t=B(e.agent_settings),n={agent_kind:`acp`,agent_context:G(t)};for(let e of _){if(e===`acp_model`||e===`acp_env`)continue;let r=e===`acp_command`?Le(t):t[e];r!=null&&(n[e]=r)}let r=B(t.mcp_config);Object.keys(r).length>0&&(n.mcp_config=r);let i=typeof t.acp_server==`string`?t.acp_server:void 0,a=x({configured:t.acp_model,providerDefault:S(i)});return a&&(n.acp_model=a),n}function ze(e){let t=B(e.agent_settings),n=B(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:h.llm_model,n.stream=!0;let r=V(n.api_key);r?n.api_key=r:delete n.api_key;let i=V(n.base_url);i?n.base_url=i:delete n.base_url,C(n)?(n.auth_type=ie,n.subscription_vendor=re,delete n.api_key,delete n.base_url):(delete n.auth_type,delete n.subscription_vendor);let a=B(t.mcp_config);Object.keys(a).length===0&&delete t.mcp_config,delete t.acp_server;for(let e of _)delete t[e];return delete t.acp_env,{...t,llm:n,agent_context:G(t),tools:Ne(t)}}function Be(e){return K(e)?Re(e):ze(e)}function Ve(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=B(t.conversation_settings),s=Pe(n,r);return Oe.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??f()},...s?{initial_message:s}:{},...i?.length?{plugins:i.map(e=>({source:e.source,...e.ref?{ref:e.ref}:{},...e.repo_path?{repo_path:e.repo_path}:{}}))}:{}}}function He(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=K(t),r=Be(t),i=n?Ie(t):void 0,o=Ve(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),s={...e.agentProfileId?{agent_profile_id:e.agentProfileId}:{agent_settings:r},workspace:o.workspace,confirmation_policy:Ae(o),max_iterations:typeof o.max_iterations==`number`?o.max_iterations:500,stuck_detection:!0,autotitle:!0,worktree:e.worktree??!0};!e.agentProfileId&&i&&(s.tags={[Ee]:i}),!e.agentProfileId&&e.secretsEncrypted&&(!n||ke(r.mcp_config))&&(s.secrets_encrypted=!0),e.conversationId&&(s.conversation_id=e.conversationId);let c=je(o);c&&(s.security_analyzer=c),o.initial_message&&(s.initial_message=o.initial_message),o.plugins&&(s.plugins=o.plugins),o.hook_config&&(s.hook_config=o.hook_config);let l={},u=a(F);if(u&&(l[F]=ve),Object.assign(l,o.tool_module_qualnames??{}),u||delete l[F],Object.keys(l).length>0&&(s.tool_module_qualnames=l),o.agent_definitions&&(s.agent_definitions=o.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=d(),n=t?p(t):{},r={};for(let t of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(t.name)}`,description:t.description};Object.keys(n).length>0&&(e.headers=n),r[t.name]=e}s.secrets=r}return s}var Ue=`Connect your ChatGPT subscription before starting a conversation with this LLM profile.`;async function q(e){if(C(B(e.llm))&&!(await ae.getOpenAIStatus()).connected)throw Error(Ue)}async function We(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-B2GqPV0N.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5])),[r,i]=await Promise.all([te.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return t.agentProfileId||await q(a),He({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Ge(){return{hooks:[]}}var Ke=`1970-01-01T00:00:00.000Z`,qe=`Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.`;function J(){return Error(qe)}function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e){return typeof e==`number`?e:null}function Z(e){return typeof e==`number`?e:0}function Q(e){return typeof e==`string`?e:null}function Je(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:Ke}function Ye(e){return Y(e)?{prompt_tokens:Z(e.prompt_tokens),completion_tokens:Z(e.completion_tokens),cache_read_tokens:Z(e.cache_read_tokens),cache_write_tokens:Z(e.cache_write_tokens),context_window:Z(e.context_window),per_turn_token:Z(e.per_turn_token)}:null}function Xe(e){return Y(e)?{accumulated_cost:X(e.accumulated_cost),max_budget_per_task:X(e.max_budget_per_task),accumulated_token_usage:Ye(e.accumulated_token_usage)}:null}function Ze(e){if(!Y(e))return null;let t=Y(e.llm)?{model:Q(e.llm.model)}:null;return{kind:Q(e.kind),acp_server:Q(e.acp_server),acp_model:Q(e.acp_model),llm:t}}function Qe(e){return Y(e)?{working_dir:Q(e.working_dir)}:null}function $e(e){if(!Y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function et(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function tt(e,t){let n=et(e),r=et(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function nt(e){if(!Y(e)||typeof e.id!=`string`||!e.id.trim())throw J();return{id:e.id.trim(),title:Q(e.title),created_at:Je(e,`created_at`,`createdAt`),updated_at:Je(e,`updated_at`,`updatedAt`),execution_status:Q(e.execution_status),sandbox_status:Q(e.sandbox_status),metrics:Xe(e.metrics),agent:Ze(e.agent),workspace:Qe(e.workspace),tags:$e(e.tags),current_model_id:Q(e.current_model_id),current_model_name:Q(e.current_model_name)}}function $(e){if(!Array.isArray(e))throw J();return e.map(nt)}function rt(e){if(Array.isArray(e))return{items:$(e),next_page_id:null};if(!Y(e))throw J();return{items:$(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var it=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function at(e){let t=e??`idle`;return it.has(t)?t:`idle`}function ot(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var st=class{static async sendMessage(e,t,r){let i=l().backend,a=r?.conversationUrl??null,o=r?.sessionApiKey??null;if(i.kind===`cloud`){if(!a||!o){let[t]=await N([e]);a=t?.conversation_url?.trim()??null,o=t?.session_api_key?.trim()??null}if(!a||!o)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await m({backend:i,method:`POST`,hostOverride:s(a),path:`/api/conversations/${e}/events`,body:{...t,run:!0},authMode:`session-api-key`,sessionApiKey:o}),t}return await new n(u({conversationUrl:a,sessionApiKey:o})).sendEvent(e,t,{run:!0}),t}static async createConversation(e,t,r,i,a,o,s,f,p,m){if(l().backend.kind===`cloud`)return de({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:t??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:s??null,agent_type:f,sandbox_id:p??null,agent_profile_id:m??null});let h=await te.getSettings(),g=v(),_=await ce(a??c(g)),y=o??(a?`local_repo`:`new_worktree`),b=await We({settings:h,query:e,conversationInstructions:t,plugins:r,conversationId:g,workingDir:_,worktree:y===`new_worktree`,agentProfileId:m}),x=await new n(u()).createConversation(b),S=d();if(!S)throw new ee;return(i?.selected_repository||a)&&k(x.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:a??null,workspace_mode:y}),{id:x.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:x.id,agent_server_url:S.host,request:{initial_message:b.initial_message,plugins:r??null},created_at:x.created_at,updated_at:x.updated_at}}static async getStartTask(e){return l().backend.kind===`cloud`?_e(e):null}static async getVSCodeUrl(e,t,n){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new r(u({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??f()}static async batchGetAppConversations(e){return e.length===0?[]:l().backend.kind===`cloud`?N(e):$(await new n(u()).getConversations(e)).map(e=>z(e))}static async updateConversationPublicFlag(e,t){if(l().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return me(e,t)}static async updateConversationRepository(e,t,n,r){t?k(e,{...O(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):A(e);let[i]=await this.batchGetAppConversations([e]);return ot(i,e)}static async readConversationFile(e,n){if(l().backend.kind===`cloud`)return P(e,tt(n??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let r=await this.resolveConversationWorkingDir(e),i=tt(n??`${r}/.agents_tmp/PLAN.md`,r);return new t(u()).downloadTextFile(i)}static async downloadConversation(e){return l().backend.kind===`cloud`?fe(e):new t(u()).downloadTrajectory(e)}static async getHooks(e){return Ge()}static async getRuntimeConversation(e,t,r){let i=l().backend,a=i.kind===`cloud`&&t?await m({backend:i,method:`GET`,hostOverride:s(t),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:r}):await new n(u({conversationUrl:t,sessionApiKey:r})).getConversation(e),o=nt(a),c=Y(a)?a.stats:null;return{id:o.id,title:o.title?.trim()?o.title:R(o.id),metrics:Xe(o.metrics),created_at:o.created_at,updated_at:o.updated_at,status:at(o.execution_status),stats:Y(c)?c:{usage_to_metrics:{}}}}static async searchConversations(e=20,t){return l().backend.kind===`cloud`?ue(e,t):Te(rt(await new n(u()).searchConversations({limit:e,page_id:t,sort_order:g.UPDATED_AT_DESC})))}static async deleteConversation(e){l().backend.kind===`cloud`?await pe(e):await new n(u()).deleteConversation(e),A(e)}static async updateConversationTitle(e,t){await new n(u()).updateConversation(e,{title:t});let[r]=await this.batchGetAppConversations([e]);return ot(r,e)}static async forkConversation(e,t,r){if(l().backend.kind===`cloud`)throw Error(`Branching a conversation isn't supported on the cloud backend yet.`);let i=await new n(u()).forkConversation(e,{from_event_id:t,...r?{title:r}:{}}),a=O(e);return a&&k(i.id,a),i}static async getEventParentId(e,t){return(await new n(u()).getEvent(e,t)).parent_id??void 0}static async switchProfile(e,t){let{backend:r}=l();if(r.kind===`cloud`){if(!e){await y.activateProfile(t);return}await m({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_profile`,body:{profile_name:t}});return}if(!e){await new i(u()).activateProfile(t);return}let a=u(),o=new n(a),s=await new i(a).getProfile(t,{exposeSecrets:`encrypted`}),c=typeof s.config.model==`string`?s.config.model:``;if(!c)throw Error(`Profile '${t}' has no model.`);await q({llm:s.config}),await o.switchLLM(e,{...s.config,model:c,stream:!0,usage_id:`profile:${t}:${v()}`})}static async switchAcpModel(e,t){let{backend:r}=l();if(r.kind===`cloud`){await m({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_acp_model`,body:{model:t}});return}await new n(u()).switchAcpModel(e,t)}};export{ge as a,ce as c,P as i,N as n,O as o,he as r,k as s,st as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{L as i,s as a}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as o}from"./useTranslation-
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{L as i,s as a}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as o}from"./useTranslation-CDRCKC9-.js";import{t as s}from"./declaration-gq8V5eTU.js";import{A as c,P as l,j as u}from"./active-backend-context-hxq31W25.js";import{t as d}from"./utils-D3U3rlqr.js";import"./form-control-classes-ChpNBe9n.js";import{t as f}from"./brand-button-vMVuyDXu.js";import{t as p}from"./settings-input-bD6npsDm.js";import{r as m}from"./use-settings-CH5LzXD8.js";import{c as h,i as ee,n as g,o as _,s as v,t as te}from"./acp-providers-Sy2LKyMa.js";import{t as ne}from"./use-save-settings-BGlSfuYn.js";import{d as re,h as ie,i as ae,m as oe}from"./sdk-settings-schema-Cv7M9eSe.js";import{n as se,r as ce}from"./schema-field-BSHrUMme.js";import{t as y}from"./settings-dropdown-input-BjunGXJb.js";import{r as b}from"./typography-D8mHDeNG.js";import{t as le}from"./settings-switch-5cuxl8Dc.js";import{a as x,i as ue,n as S,r as de,t as fe}from"./use-acp-credential-form-MzZM6D7D.js";var C=e(n(),1),w=r();function pe({form:e,providerKey:t}){let{t:n}=o(`openhands`),{fields:r,values:i,setValue:a,secretExists:c,conflicts:l}=e,{status:u,isChecking:d}=S(t),f=h(t)??t;return r.length===0?null:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(b.Text,{className:`text-sm font-medium text-white`,children:n(s.SETTINGS$ACP_CREDENTIALS_TITLE)}),(0,w.jsx)(b.Text,{className:`text-xs text-[#717888]`,children:n(s.SETTINGS$ACP_CREDENTIALS_DESCRIPTION)})]}),(0,w.jsx)(ue,{status:u,isChecking:d,providerName:f,testIdPrefix:`settings-acp-auth`}),(0,w.jsx)(`div`,{className:`flex flex-col gap-5`,children:r.map(e=>(0,w.jsx)(de,{field:e,value:i[e.name]??``,onChange:t=>a(e.name,t),alreadySet:c(e.name),testId:`settings-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,w.jsx)(x,{conflicts:l})]})}var T=t(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,`$1\\$2`)}).join(` `)}})),E=t(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`"((\\\\"|[^"])*?)"`,o=`'((\\\\'|[^'])*?)'`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r.push(i),t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function ee(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function g(e,t,d){d||={};var f=d.escape||`\\`,p=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,m=h(e,new RegExp([`(`+n+`)`,`(`+p+`|`+a+`|`+o+`)+`].join(`|`),`g`));if(m.length===0)return[];t||={};var g=!1;return m.map(function(n){var i=n[0];if(!i||g)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,p=!1,m;function h(){m+=1;var e,n,r=i.charAt(m);if(r===`{`){if(m+=1,i.charAt(m)===`}`)throw Error(`Bad substitution: `+i.slice(m-2,m+1));if(e=i.indexOf(`}`,m),e<0)throw Error(`Bad substitution: `+i.slice(m));n=i.slice(m,e),m=e}else if(/[*@#?$!_-]/.test(r))n=r,m+=1;else{var a=i.slice(m);e=a.match(/[^\w\d_]/),e?(n=a.slice(0,e.index),m+=e.index-1):(n=a,m=i.length)}return ee(t,``,n)}for(m=0;m<i.length;m++){var _=i.charAt(m);if(p||=!a&&(_===`*`||_===`?`),o)d+=_,o=!1;else if(a)_===a?a=!1:a==c?d+=_:_===f?(m+=1,_=i.charAt(m),_===l||_===f||_===u?d+=_:d+=f+_):_===u?d+=h():d+=_;else if(_===l||_===c)a=_;else if(r.test(_))return{op:i};else if(s.test(_)){g=!0;var v={comment:e.slice(n.index+m+1)};return d.length?[d,v]:[v]}else _===f?o=!0:_===u?d+=h():d+=_}return p?{op:`glob`,pattern:d}:d}).reduce(function(e,t){return t===void 0?e:e.concat(t)},[])}t.exports=function(e,t,n){var r=g(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e.concat(t);var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?e.concat(n[0]):e.concat(n.filter(Boolean).map(function(e){return m.test(e)?JSON.parse(e.split(d)[1]):e}))},[]):r}})),{quote:D}=e(t((e=>{e.quote=T(),e.parse=E()}))(),1);function O(e){let t=[],n=0,r=``,i=!1;for(;n<e.length;){let a=e[n];if(a===` `||a===` `||a===`
|
|
2
2
|
`||a===`\r`){i&&=(t.push(r),r=``,!1),n+=1;continue}if(a===`'`){for(i=!0,n+=1;n<e.length&&e[n]!==`'`;)r+=e[n],n+=1;n<e.length&&(n+=1);continue}if(a===`"`){for(i=!0,n+=1;n<e.length&&e[n]!==`"`;){if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`\\`){r+=t,n+=2;continue}}r+=e[n],n+=1}n<e.length&&(n+=1);continue}if(a===`\\`&&n+1<e.length){i=!0,r+=e[n+1],n+=2;continue}i=!0,r+=a,n+=1}return i&&t.push(r),t}var k=/[\s"'\\$`&|;<>(){}*?#!~[\]]/;function A(e){return e.map(e=>k.test(e)||e===``?D([e]):e).join(` `)}var j={hideTitle:!0},me=`enable_sub_agents`,he=`tool_concurrency_limit`,ge=`npx -y <package-name>`,M=`__custom_model__`;function _e(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function N(e,t){let n=O(e).join(` `);for(let e of t)if(n===e.default_command.join(` `))return e.key;return te}function ve(e){return e?.find(e=>e.key===me)}function ye(e,t){return typeof e==`boolean`?e:t?.default===!0}function be(e,t){return e?.available_models?.some(({id:e})=>e===t.trim())??!1}function xe(e){let{isAcp:t,selectedPreset:n,isDefaultProviderCommand:r,commandTokens:i,acpModel:a,subAgentsEnabled:o,toolConcurrencyField:s,toolConcurrency:c}=e;if(t){let e=r&&n!==`custom`;return{agent_kind:`acp`,acp_server:n,acp_model:a.trim()||null,acp_command:e?null:A(i)||null,acp_args:null}}let l={agent_kind:`openhands`,enable_sub_agents:o};if(s){let e=ae(s,c),t=typeof s.default==`number`?s.default:1;l.tool_concurrency_limit=e==null?t:Number(e)}return l}function P({embedded:e=!1,agentSettingsOverride:t=null,onSaveControlChange:n}={}){let{t:r}=o(`openhands`),{data:i,isLoading:a}=m(),h=t??i?.agent_settings??null,{mutate:x,isPending:ue}=ne(),{data:S}=ce(i?.agent_settings_schema),de=C.useMemo(()=>S?.sections.flatMap(e=>e.fields),[S]),T=ve(de),E=C.useMemo(()=>ye(h?.[me],T),[T,h]),[D,k]=(0,C.useState)(E),j=de?.find(e=>e.key===he),P=C.useMemo(()=>{if(!j)return``;let e=h?.[he];return re(j,e)},[j,h]),[F,Se]=(0,C.useState)(P),[I,L]=(0,C.useState)(`openhands`),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[Ce,H]=(0,C.useState)(!1),[we,U]=(0,C.useState)(!1),W=I===`acp`?N(R,g):null,G=fe(W&&W!==`custom`?W:null),Te=(0,C.useRef)(null),K=(0,C.useRef)(null),q=(0,C.useRef)(``);(0,C.useEffect)(()=>{let e=t??i?.agent_settings??null;if(!e&&!i)return;let n=t??i;if(Te.current!==n){if(Te.current=n,e?.agent_kind===`acp`){L(`acp`);let t=e?.acp_server,n=typeof t==`string`?t:void 0,r=v(n),i=_e(e?.acp_command),a=[...i.length>0?i:r?.default_command??[],..._e(e?.acp_args)],o=a.length>0?A(a):``;z(o),K.current=n??null,q.current=o;let s=e?.acp_model,c=typeof s==`string`?s.trim():``;V(c||_(n)||``),H(!!c&&(!r||!be(r,c)))}else L(`openhands`),z(``),V(``),K.current=null,q.current=``,H(!1);U(!1)}},[i,t]),(0,C.useEffect)(()=>{k(E)},[E]),(0,C.useEffect)(()=>{Se(P)},[P]);let Ee=(0,C.useRef)(()=>({agent_kind:`openhands`,enable_sub_agents:!1})),De=(0,C.useCallback)(()=>Ee.current(),[]),J=(0,C.useRef)(G);J.current=G;let Oe=(0,C.useCallback)(e=>J.current.save(e),[]),ke=(0,C.useCallback)(()=>J.current.reset(),[]),Ae=I===`acp`&&O(R).length===0,je=G.isDirty;if((0,C.useEffect)(()=>{!e||!n||n({agentType:I,isValid:!Ae,buildAgentProfileFields:De,credentials:{isDirty:je,save:Oe,reset:ke}})},[e,n,I,Ae,je,De,Oe,ke]),a)return null;let Y=I===`acp`,X=O(R),Me=Y&&X.length===0,Z=N(R,g),Q=v(Z),Ne=Q?.available_models??[],Pe=Ne.length>0,Fe=be(Q,B),Ie=Ce||!Fe?M:B,Le=!!Q&&X.join(` `)===Q.default_command.join(` `),Re=A(g[0]?.default_command??[])||ge;Ee.current=()=>xe({isAcp:Y,selectedPreset:Z,isDefaultProviderCommand:Le,commandTokens:X,acpModel:B,subAgentsEnabled:D,toolConcurrencyField:j,toolConcurrency:F});let ze=we||!Y&&(D!==E||F!==P),Be=G.isDirty,Ve=ze||Be,$=ue||G.isSaving,He=async()=>{if(G.isDirty){if(!await G.save({silent:ze}))return;G.reset()}if(ze)if(Y){let e=!!(Q&&Le),t=K.current,n=R===q.current,i=!!t&&t!==`custom`&&!g.some(e=>e.key===t),a=Y&&n&&i,o=ee(a?t:Q&&Le?Q.key:te,{command:e?[]:X,model:B.trim()||void 0,allowUnknownServer:a});if(!o)return;x({agent_settings_diff:o},{onError:e=>{c(l(e)||r(s.ERROR$GENERIC))},onSuccess:()=>{u(r(s.SETTINGS$SAVED)),U(!1)}})}else{let e={agent_kind:`openhands`,enable_sub_agents:D};if(j){let t;try{t=ae(j,F)}catch(e){c(e instanceof Error?e.message:r(s.ERROR$GENERIC));return}t!=null&&(e[he]=t)}x({agent_settings_diff:e},{onError:e=>{c(l(e)||r(s.ERROR$GENERIC))},onSuccess:()=>{u(r(s.SETTINGS$SAVED)),U(!1)}})}},Ue=T?ie(r,T.key,T.label):r(s.SCHEMA$ENABLE_SUB_AGENTS$LABEL),We=T?oe(r,T.key,T.description):r(s.SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION);return(0,w.jsxs)(`div`,{"data-testid":`agent-settings-screen`,className:`flex flex-col gap-6 pb-8 max-w-2xl`,children:[!e&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(b.H2,{className:`mb-2`,children:r(s.SETTINGS$NAV_AGENT)}),(0,w.jsx)(b.Paragraph,{className:`text-sm text-[#A3A3A3]`,children:r(s.SETTINGS$AGENT_PAGE_DESCRIPTION)})]}),(0,w.jsx)(y,{testId:`agent-type-selector`,name:`agent-type`,label:r(s.SETTINGS$NAV_AGENT),items:[{key:`openhands`,label:r(s.SETTINGS$AGENT_TYPE_OPENHANDS)},{key:`acp`,label:r(s.SETTINGS$AGENT_TYPE_ACP)}],selectedKey:I,onSelectionChange:e=>{if(!e)return;let t=e;if(L(t),t===`acp`&&!R){let e=g[0];e&&(z(A(e.default_command)),V(_(e.key)??``),H(!1))}else t===`openhands`&&H(!1);U(!0)}}),!Y&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(le,{testId:`agent-settings-enable-sub-agents`,isToggled:D,onToggle:e=>{k(e)},children:Ue}),We?(0,w.jsx)(b.Paragraph,{className:d(`pl-12`,`text-tertiary-alt text-xs leading-5`),children:We}):null]}),!Y&&j?(0,w.jsx)(se,{field:j,value:F,isDisabled:$,onChange:Se}):null,Y&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y,{testId:`agent-preset-selector`,name:`agent-preset`,label:r(s.SETTINGS$AGENT_PRESET),items:[...g.map(e=>({key:e.key,label:e.display_name})),{key:`custom`,label:r(s.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Z,onSelectionChange:e=>{if(!e)return;let t=String(e),n=v(t);n?(z(A(n.default_command)),V(_(t)??``),H(!1)):t===`custom`&&(z(``),V(``),H(!0)),U(!0)}}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,w.jsx)(b.Text,{className:`text-sm`,children:r(s.SETTINGS$AGENT_COMMAND)}),(0,w.jsx)(`textarea`,{"data-testid":`agent-command-input`,className:`bg-tertiary border border-[#717888] rounded-sm p-2 text-sm font-mono text-white placeholder:text-[#717888] min-h-[60px] resize-y focus:outline-none focus:border-white`,value:R,placeholder:Re,onChange:e=>{let t=e.target.value,n=N(R,g),r=N(t,g);r!==n&&(V(_(r)??``),H(!1)),z(t),U(!0)}}),(0,w.jsx)(b.Text,{className:`text-xs text-[#717888]`,children:r(s.SETTINGS$AGENT_COMMAND_HINT)})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Pe&&(0,w.jsx)(y,{testId:`agent-model-selector`,name:`agent-model`,label:r(s.SETTINGS$AGENT_MODEL),items:[...Ne.map(e=>({key:e.id,label:e.label})),{key:M,label:r(s.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Ie,onSelectionChange:e=>{if(!e)return;let t=String(e);t===M?(H(!0),V(``)):(H(!1),V(t)),U(!0)}}),Ie===M&&(0,w.jsx)(p,{testId:`agent-model-input`,label:r(Pe?s.SETTINGS$AGENT_CUSTOM_MODEL:s.SETTINGS$AGENT_MODEL),type:`text`,className:`w-full`,value:B,showOptionalTag:!0,onChange:e=>{V(e),U(!0)}}),(0,w.jsx)(b.Text,{className:`text-xs text-[#717888]`,children:r(s.SETTINGS$AGENT_MODEL_HINT)})]})]}),Y&&Z!==`custom`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`hr`,{className:`border-[#3D4046]`}),(0,w.jsx)(pe,{form:G,providerKey:Z})]}),!e&&(0,w.jsx)(`div`,{children:(0,w.jsx)(f,{testId:`agent-save-button`,type:`button`,variant:`primary`,isDisabled:$||!Ve||Me,onClick:He,children:r($?s.SETTINGS$SAVING:s.SETTINGS$SAVE_CHANGES)})})]})}var F=i(function(){return(0,w.jsx)(a,{to:`/settings/agents`,replace:!0})});export{O as i,F as n,j as r,P as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./agent-settings-B-W10B4E.js";export{e as default,t as handle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{t as a}from"./utils-D3U3rlqr.js";import{n as o}from"./navigation-context-DPs2G0X8.js";import{c as s}from"./vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js";import{t as c}from"./close-p3Op5lxI.js";import{r as l}from"./typography-D8mHDeNG.js";import{t as u}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var d=e(t(),1),f=n();function p({maintenanceStartTime:e,faultyModels:t,errorMessage:n,updatedAt:p}){let{t:m}=r(`openhands`),[h,g]=u(`alert_banner_dismissed_at`,null),{currentPath:_}=o(),v=e?(e=>new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}))(e):null,y=!!e,b=t&&t.length>0,x=n&&n.trim().length>0,S=y||b||x,C=(0,d.useMemo)(()=>S?h!==p:!1,[h,p,S]),w=(0,d.useMemo)(()=>{if(!n)return null;let e=m(n);return e===n?n:e},[n,m]);return C?(0,f.jsxs)(`div`,{"data-testid":`alert-banner`,className:a(`bg-base border border-primary text-white p-4 rounded`,`flex flex-row items-center justify-between m-1`,_===`/`&&`mt-3 mr-3`),children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:`flex-shrink-0`,children:(0,f.jsx)(s,{className:`text-primary align-middle`})}),(0,f.jsx)(`div`,{className:`ml-3 flex flex-col gap-1`,children:(()=>{let e=[];return y&&v&&e.push((0,f.jsx)(l.Paragraph,{className:`text-sm font-medium`,children:m(i.MAINTENANCE$SCHEDULED_MESSAGE,{time:v})},`maintenance`)),b&&e.push((0,f.jsxs)(l.Paragraph,{className:`text-sm font-medium`,children:[m(i.ALERT$FAULTY_MODELS_MESSAGE),` `,t.join(`, `)]},`faulty-models`)),x&&w&&e.push((0,f.jsx)(l.Paragraph,{className:`text-sm font-medium`,children:w},`error-message`)),e})()})]}),(0,f.jsx)(`button`,{type:`button`,"data-testid":`dismiss-button`,onClick:()=>g(p),className:a(`bg-base rounded-full w-5 h-5 flex items-center justify-center cursor-pointer`),children:(0,f.jsx)(c,{})})]}):null}export{p as AlertBanner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{o as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{r as o,y as s}from"./active-backend-context-hxq31W25.js";import{t as c}from"./utils-D3U3rlqr.js";import{n as l,p as u}from"./agent-server-client-options-DVLRd9sw.js";import{r as d,t as f}from"./modal-body-DouOE5KH.js";import{t as p}from"./brand-button-vMVuyDXu.js";import{n as m,o as h}from"./backend-form-modal-CQJGmItq.js";var g=e(t(),1),_=n();function v(){let{t:e}=r(`openhands`),{active:t,addBackend:n,updateBackend:v}=o(),y=window.location.origin,[b,x]=g.useState(!1),[S,C]=g.useState(`idle`),[w,T]=g.useState(null),E=g.useCallback(async r=>{x(!0),C(`idle`),T(null);try{await new a(l({host:r.host,sessionApiKey:r.apiKey,timeout:5e3})).getSettings(),C(`success`),u(t.backend)?n(r):v(t.backend.id,r),window.location.reload()}catch(t){if(C(`error`),s(t,401))T(e(i.AUTH$INVALID_KEY));else{let n=t instanceof Error?t.message:String(t);T(`${e(i.AUTH$CONNECTION_FAILED)}${n?`: ${n}`:``}`)}x(!1)}},[t.backend,n,v,e]);return(0,_.jsx)(`div`,{"data-testid":`api-key-entry-screen`,className:`flex min-h-screen items-center justify-center bg-base px-6`,children:(0,_.jsxs)(`div`,{className:c(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,d(`md`),f),children:[(0,_.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(i.BACKEND$ADD_TITLE)})}),(0,_.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:(0,_.jsx)(m,{mode:`add`,backend:{...t.backend,host:y,apiKey:``,name:``},onSubmitted:()=>{},testIdRoot:`api-key-entry`,hostReadOnly:!0,requireApiKey:!0,onSubmitOverride:E,renderActions:({canSubmit:t,testIdRoot:n})=>(0,_.jsxs)(_.Fragment,{children:[S!==`idle`&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,_.jsx)(h,{isConnected:S===`success`}),(0,_.jsx)(`span`,{"data-testid":`${n}-status`,className:S===`error`?`text-red-400`:`text-green-400`,children:S===`error`?w:e(i.ONBOARDING$BACKEND_STATUS_CONNECTED)})]}),(0,_.jsx)(p,{type:`submit`,variant:`secondary`,isDisabled:!t||b,testId:`${n}-submit`,className:`w-full text-center`,children:e(b?i.ONBOARDING$BACKEND_STATUS_CHECKING:i.BACKEND$CONNECT)})]})})})]})})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as i}from"./useTranslation-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as i}from"./useTranslation-CDRCKC9-.js";import{t as a}from"./declaration-gq8V5eTU.js";import{A as o,P as s,j as c,z as l}from"./active-backend-context-hxq31W25.js";import{n as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js";import{t as d}from"./brand-button-vMVuyDXu.js";import{i as f,n as p,r as m,t as h}from"./color-themes-DPBzNtVg.js";import{t as g}from"./settings-input-bD6npsDm.js";import{t as _}from"./settings-mQUckT0g.js";import{r as v}from"./use-settings-CH5LzXD8.js";import{t as y}from"./handle-capture-consent-CPMXU29K.js";import{t as b}from"./use-save-settings-BGlSfuYn.js";import{t as x}from"./settings-dropdown-input-BjunGXJb.js";import{n as S,t as C}from"./switch-skeleton-DqQwalyu.js";import{t as w}from"./settings-switch-5cuxl8Dc.js";var T=e(t(),1),E=n();function D({defaultKey:e,onChange:t,name:n}){let{t:r}=i(`openhands`);return(0,E.jsx)(x,{testId:n,name:n,onInputChange:t,label:r(a.SETTINGS$LANGUAGE),items:l.map(e=>({key:e.value,label:e.label})),defaultSelectedKey:e,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function O(){let{t:e}=i(`openhands`),t=T.useCallback(e=>{if(!e)return;let t=e;p(t),m(t)},[]);return(0,E.jsx)(x,{testId:`color-theme-input`,name:`color-theme-input`,label:e(a.SETTINGS$COLOR_THEME),items:h.map(e=>({key:e.key,label:e.label})),defaultSelectedKey:f(),onSelectionChange:t,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function k(){return(0,E.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,E.jsx)(S,{}),(0,E.jsx)(C,{}),(0,E.jsx)(C,{})]})}function A(){let e=u(),{t}=i(`openhands`),{mutate:n,isPending:r}=b(),{data:f,isLoading:p}=v(),[m,h]=T.useState(!1),[x,S]=T.useState(!1),[C,A]=T.useState(!1),[j,M]=T.useState(!1),[N,P]=T.useState(!1),F=r=>{let i=r.get(`language-input`)?.toString(),u=l.find(({label:e})=>e===i)?.value||_.language,d=r.get(`enable-analytics-switch`)?.toString()===`on`;n({language:u,user_consents_to_analytics:d,enable_sound_notifications:r.get(`enable-sound-notifications-switch`)?.toString()===`on`,git_user_name:r.get(`git-user-name-input`)?.toString()||_.git_user_name,git_user_email:r.get(`git-user-email-input`)?.toString()||_.git_user_email},{onSuccess:()=>{y(e,d),c(t(a.SETTINGS$SAVED))},onError:e=>{o(s(e)||t(a.ERROR$GENERIC))},onSettled:()=>{h(!1),S(!1),A(!1),M(!1),P(!1)}})},I=e=>{let t=l.find(({label:t})=>t===e)?.label,n=l.find(({value:e})=>e===f?.language)?.label;h(t!==n)},L=e=>{S(e!==(f?.user_consents_to_analytics??!0))},R=e=>{A(e!==!!f?.enable_sound_notifications)},z=e=>{let t=f?.git_user_name;M(e!==t)},B=e=>{let t=f?.git_user_email;P(e!==t)},V=!m&&!x&&!C&&!j&&!N,H=!f||p||r;return(0,E.jsxs)(`form`,{"data-testid":`app-settings-screen`,action:F,className:`flex flex-col gap-6`,children:[H&&(0,E.jsx)(k,{}),!H&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsx)(D,{name:`language-input`,defaultKey:f.language,onChange:I}),(0,E.jsx)(O,{}),(0,E.jsx)(w,{testId:`enable-analytics-switch`,name:`enable-analytics-switch`,defaultIsToggled:f.user_consents_to_analytics??!0,onToggle:L,children:t(a.ANALYTICS$SEND_ANONYMOUS_DATA)}),(0,E.jsx)(w,{testId:`enable-sound-notifications-switch`,name:`enable-sound-notifications-switch`,defaultIsToggled:!!f.enable_sound_notifications,onToggle:R,children:t(a.SETTINGS$SOUND_NOTIFICATIONS)}),(0,E.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,E.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:t(a.SETTINGS$GIT_SETTINGS)}),(0,E.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:t(a.SETTINGS$GIT_SETTINGS_DESCRIPTION)}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsx)(g,{testId:`git-user-name-input`,name:`git-user-name-input`,type:`text`,label:t(a.SETTINGS$GIT_USERNAME),defaultValue:f.git_user_name||``,onChange:z,placeholder:t(a.SETTINGS$GIT_USERNAME_PLACEHOLDER),className:`w-full min-w-0`}),(0,E.jsx)(g,{testId:`git-user-email-input`,name:`git-user-email-input`,type:`email`,label:t(a.SETTINGS$GIT_EMAIL),defaultValue:f.git_user_email||``,onChange:B,placeholder:t(a.SETTINGS$GIT_EMAIL_PLACEHOLDER),className:`w-full min-w-0`})]}),(0,E.jsx)(`div`,{className:`flex justify-start pt-4`,children:(0,E.jsxs)(d,{testId:`submit-button`,variant:`primary`,type:`submit`,isDisabled:r||V,children:[!r&&t(a.SETTINGS$SAVE_CHANGES),r&&t(a.SETTINGS$SAVING)]})})]})]})]})}var j=r(A);export{j as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r,P as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as a}from"./useQuery-CRBP8vIS.js";import{t as o}from"./useTranslation-CDRCKC9-.js";import{t as s}from"./declaration-gq8V5eTU.js";import{b as c,p as l,y as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{A as d,j as f,n as p}from"./active-backend-context-hxq31W25.js";import{t as m}from"./back-nav-button-CUS2mi-U.js";import{i as h,t as g}from"./utils-D3U3rlqr.js";import{a as _,c as v,n as y}from"./agent-server-client-options-DVLRd9sw.js";import{t as b}from"./proxy-BgJLtxu7.js";import{r as x}from"./modal-classes-Cf-4tbHz.js";import{t as S}from"./brand-button-vMVuyDXu.js";import{n as C}from"./navigation-context-DPs2G0X8.js";import{t as w}from"./use-tracking-BIXzagSI.js";import{t as T}from"./use-create-conversation-DdqsP78F.js";import{t as E}from"./u-edit-DJ90xc8Z.js";import{t as D}from"./terminal-BuLtIrb9.js";import{t as O}from"./use-user-conversation-zpx7I18x.js";import{t as k}from"./toggle-switch-2j5wwR85.js";import{t as ee}from"./x-mark-Batp6gXa.js";import{t as A}from"./code-tag-DYlAhEQY.js";import{t as j}from"./link-external-DfKQroKX.js";import{C as te,D as M,E as ne,O as re,S as ie,T as ae,_ as N,a as oe,b as se,c as P,d as F,f as I,g as L,h as ce,i as le,l as ue,m as R,o as de,p as fe,r as pe,s as me,t as he,u as ge}from"./automation-export-BPcgLqPD.js";import{t as z}from"./automation-BU8zu-FP.js";var B=e(t()),V=n();function H(){let{t:e}=o(`openhands`);return(0,V.jsx)(m,{to:`/automations`,children:e(s.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var U=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function _e({active:e}){let{t}=o(`openhands`);return(0,V.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:g(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?s.AUTOMATIONS$DETAIL$ACTIVE:s.AUTOMATIONS$DETAIL$INACTIVE)})}function ve({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:a,onRunNow:c,isRunningNow:l=!1}){let{t:u}=o(`openhands`),d=L(`manage_automations`),f=[...n?[{label:u(s.AUTOMATIONS$EDIT),icon:(0,V.jsx)(E,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?u(s.AUTOMATIONS$TURN_OFF):u(s.AUTOMATIONS$TURN_ON),icon:(0,V.jsx)(ge,{className:`size-4`}),onClick:t},{label:u(s.AUTOMATIONS$EXPORT),icon:(0,V.jsx)(U,{className:`size-4`}),onClick:i},{label:u(s.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,V.jsx)(U,{className:`size-4`}),onClick:a},{label:u(s.AUTOMATIONS$DELETE),icon:(0,V.jsx)(ue,{className:`size-4`}),onClick:r}];return(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,V.jsx)(_e,{active:e.enabled})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&c&&(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:l||!e.enabled,onClick:c,children:[(0,V.jsx)(ce,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),u(l?s.AUTOMATIONS$STARTING:s.AUTOMATIONS$RUN_NOW)]}),d&&(0,V.jsx)(k,{enabled:e.enabled,label:e.enabled?u(s.AUTOMATIONS$TURN_OFF):u(s.AUTOMATIONS$TURN_ON),onToggle:t}),d&&(0,V.jsx)(N,{items:f})]})]})})}function W({icon:e,title:t,children:n}){return(0,V.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,V.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,V.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,V.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var ye=240,be=`max-h-60`;function xe({prompt:e}){let{t}=o(`openhands`),[n,r]=B.useState(!1),[i,a]=B.useState(!1),c=B.useRef(null),l=i&&!n;return B.useLayoutEffect(()=>{let e=c.current;if(!e)return;let t=()=>{a(e.scrollHeight>ye)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,V.jsx)(W,{icon:(0,V.jsx)(D,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$PROMPT),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`p`,{ref:c,className:g(`whitespace-pre-wrap text-sm leading-6 text-content`,l&&g(be,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),l?(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,V.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?s.COMMON$VIEW_LESS:s.COMMON$VIEW_MORE)}):null]})})}var Se=e=>(0,V.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),Ce=e=>(0,V.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,V.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,V.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,V.jsx)(`circle`,{cx:9,cy:18,r:2})]}),G=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),K=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),we=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function q({icon:e,label:t,children:n}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,V.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,V.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function Te({branch:e}){return(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var J=60;function Ee({filter:e}){let{t}=o(`openhands`),[n,r]=(0,B.useState)(!1),i=e.length>J;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`break-all`,children:i&&!n?`${e.slice(0,J)}…`:e}),i&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?s.SETTINGS$SKILLS_SHOW_LESS:s.SETTINGS$SKILLS_SHOW_MORE)})]})}function De({automation:e}){let{t}=o(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?s.AUTOMATIONS$DETAIL$TRIGGER_EVENT:s.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,V.jsx)(W,{icon:(0,V.jsx)(Se,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,V.jsx)(q,{icon:(0,V.jsx)(Ce,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,V.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,V.jsx)(Te,{branch:e.branch})]})}),(0,V.jsx)(q,{icon:(0,V.jsx)(G,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,V.jsx)(q,{icon:(0,V.jsx)(K,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,V.jsx)(q,{icon:(0,V.jsx)(fe,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,V.jsx)(q,{icon:(0,V.jsx)(j,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_TYPE),children:F(e.trigger.on)}),n&&e.trigger.filter&&(0,V.jsx)(q,{icon:(0,V.jsx)(A,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,V.jsx)(Ee,{filter:e.trigger.filter})}),(0,V.jsx)(q,{icon:(0,V.jsx)(I,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$MODEL),children:e.model??t(s.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,V.jsx)(q,{icon:(0,V.jsx)(we,{className:`size-3.5`}),label:t(s.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var Oe=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function ke({name:e}){return(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function Ae({plugins:e}){let{t}=o(`openhands`);return(0,V.jsx)(W,{icon:(0,V.jsx)(Oe,{className:`size-4`}),title:t(s.AUTOMATIONS$DETAIL$PLUGINS),children:(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,V.jsx)(ke,{name:e},e))})})}var Y=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function X(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function je(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?n(s.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(s.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(s.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):o===1?n(s.AUTOMATIONS$DETAIL$TIME_YESTERDAY):o<7?n(s.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:o}):X(e,t)}function Me({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=o(`openhands`),i=r.language;return(0,V.jsx)(W,{icon:(0,V.jsx)(Y,{className:`size-4`}),title:n(s.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,V.jsx)(q,{icon:(0,V.jsx)(K,{className:`size-3.5`}),label:n(s.AUTOMATIONS$DETAIL$CREATED),children:X(e,i)}),(0,V.jsx)(q,{icon:(0,V.jsx)(R,{className:`size-3.5`}),label:n(s.AUTOMATIONS$DETAIL$LAST_RUN),children:t?je(t,i,n):n(s.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Ne=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Pe={[z.COMPLETED]:{label:s.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[z.FAILED]:{label:s.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[z.PENDING]:{label:s.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[z.RUNNING]:{label:s.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Fe({status:e}){switch(e){case z.COMPLETED:return(0,V.jsx)(G,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case z.FAILED:return(0,V.jsx)(Ne,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,V.jsx)(R,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Ie({status:e}){let{t}=o(`openhands`),n=Pe[e];return(0,V.jsxs)(`span`,{className:g(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,V.jsx)(Fe,{status:e}),t(n.label)]})}var Le=20;function Re(e){return e.kind===`BashOutput`}var ze=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Le;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{Re(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=v().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),b({backend:r,method:`GET`,hostOverride:_(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new l(y({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Be=[`bash-command-logs`];function Ve(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function He(e){if(!c.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function Ue(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=p(),o=O(r?t??null:null),s=o.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=i.backend.kind===`cloud`,d=o.isFetched,f=null,m=!1;u&&d&&(s?f=Ve(s.sandbox_status)??(s.conversation_url?null:`missing`):m=!0);let h=r&&!!n&&(u?!!c:!0)&&!f&&!m,g=a({queryKey:[...Be,n,c,l,i.backend.id,i.orgId],queryFn:()=>ze.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?He(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&o.isPending,conversationMissing:m,sandboxIssue:v}}var We=4e3;function Ge(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function Ke({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?Ge(a,We):`No error output was captured for this run.`,s=e?.trim(),c=[`${s?`The scheduled automation "${s}" failed during a run.`:`A scheduled automation failed during a run.`} Please investigate the error and fix the root cause.`],l=t?.trim();return l&&c.push(``,`What the automation was set up to do:`,l),c.push(``,`Error output from the failed run (run ${i}):`,o,``,`Please diagnose why it failed and propose or implement a fix.`),c.join(`
|
|
2
|
+
`)}function qe({run:e,automation:t,stderr:n}){let{t:r}=o(`openhands`),{navigate:i}=C(),a=T();return(0,V.jsx)(S,{testId:`debug-automation-button`,type:`button`,variant:`primary`,onClick:()=>{if(a.isPending)return;let r=Ke({automationName:t?.name,automationPrompt:t?.prompt,errorDetail:e.error_detail,stderr:n,runId:e.id});a.mutate({query:r},{onSuccess:e=>{i(`/conversations/${e.conversation_id}`)}})},isDisabled:a.isPending,"aria-busy":a.isPending,children:r(s.AUTOMATIONS$DETAIL$DEBUG_WITH_OPENHANDS)})}var Je={missing:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:s.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function Z(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function Ye({conversationId:e,bashCommandId:t,isOpen:n,onClose:r,run:i,automation:a}){let{t:c}=o(`openhands`),[l,u]=(0,B.useState)(`stdout`),{data:d,isFetching:f,isResolvingConversation:p,sandboxIssue:m,conversationMissing:h,error:_}=Ue({conversationId:e,bashCommandId:t,enabled:n});(0,B.useEffect)(()=>{n&&u(`stdout`)},[n,t]),(0,B.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:v,stderr:y}=(0,B.useMemo)(()=>d?{stdout:Z(d,`stdout`),stderr:Z(d,`stderr`)}:{stdout:``,stderr:``},[d]);if(!n)return null;let b=p||f&&!d,S=!t,C=l===`stdout`?v:y,w=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,T=`border-[var(--oh-primary)] text-white`,E=`border-transparent text-muted hover:text-content`;return(0,V.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":c(s.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,V.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,V.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":c(s.AUTOMATIONS$CANCEL),children:(0,V.jsx)(ee,{className:`size-5`})}),(0,V.jsx)(`h2`,{className:g(`pr-8`,x),children:c(s.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,V.jsxs)(`div`,{role:`tablist`,"aria-label":c(s.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,V.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:l===`stdout`?0:-1,onClick:()=>u(`stdout`),className:`${w} ${l===`stdout`?T:E}`,children:c(s.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,V.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:l===`stderr`?0:-1,onClick:()=>u(`stderr`),className:`${w} ${l===`stderr`?T:E}`,children:c(s.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,V.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${l}`,"aria-labelledby":`run-logs-tab-${l}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[S&&(0,V.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!S&&h&&(0,V.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!S&&!h&&m&&(0,V.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${m}`,className:`text-muted italic`,children:c(Je[m])}),!S&&!h&&!m&&b&&(0,V.jsx)(`p`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!S&&!h&&!m&&!b&&_&&!d&&(0,V.jsxs)(`p`,{className:`text-danger`,children:[c(s.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(_)]}),!b&&!m&&d&&(0,V.jsx)(`pre`,{"data-testid":`run-logs-output-${l}`,className:`whitespace-pre-wrap break-words ${l===`stderr`?`text-danger`:`text-content`}`,children:C.length>0?C:(0,V.jsx)(`span`,{className:`text-muted italic`,children:c(s.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]}),i?.status===z.FAILED&&(0,V.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,V.jsx)(qe,{run:i,automation:a,stderr:y})})]})]})}function Xe(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ze(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function Qe(e){return`/conversations/${e}`}function $e({run:e,automation:t}){let{t:n,i18n:r}=o(`openhands`),i=!!e.conversation_id,a=!!e.bash_command_id,c=e.status===z.COMPLETED||e.status===z.FAILED,l=!i&&c,[u,d]=(0,B.useState)(!1),[f]=(0,B.useState)(()=>new Date().toISOString()),p=Xe(Ze(e.started_at)?f:e.started_at,r.language),m=a?(0,V.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),d(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":n(s.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:p}),title:n(s.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,V.jsx)(D,{className:`size-4`})}):null,h=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-content`,children:p}),l&&(0,V.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,n(s.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,V.jsx)(Ie,{status:e.status})]})]});return(0,V.jsxs)(V.Fragment,{children:[i&&e.conversation_id?(0,V.jsx)(`a`,{href:Qe(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${p}`,children:h}):(0,V.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:h}),a&&(0,V.jsx)(Ye,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:u,onClose:()=>d(!1),run:e,automation:t})]})}var Q=20;function et({automation:e}){let{t}=o(`openhands`),[n,r]=(0,B.useState)(Q),{data:i,isLoading:a}=M({id:e.id,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,V.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,V.jsx)(`span`,{className:`size-4 text-muted`,children:(0,V.jsx)(Y,{className:`size-4`})}),(0,V.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(s.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),a&&(0,V.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,V.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!a&&i?.runs.length===0&&(0,V.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(s.AUTOMATIONS$DETAIL$NO_RUNS)}),!a&&i&&i.runs.length>0&&(0,V.jsxs)(`div`,{children:[i.runs.map((t,n)=>(0,V.jsx)(`div`,{className:n>0?`border-t border-[var(--oh-border)]`:``,children:(0,V.jsx)($e,{run:t,automation:e})},t.id)),c&&(0,V.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Q),className:`text-sm text-muted hover:text-foreground`,children:t(s.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function $({className:e}){return(0,V.jsx)(`div`,{className:g(`animate-pulse rounded bg-surface-raised`,e)})}function tt(){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,V.jsx)($,{className:`h-5 w-40`}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)($,{className:`h-6 w-48`}),(0,V.jsx)($,{className:`h-6 w-16 rounded-full`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)($,{className:`h-6 w-11 rounded-full`}),(0,V.jsx)($,{className:`h-8 w-8`})]})]}),(0,V.jsx)($,{className:`h-5 w-96`}),(0,V.jsx)($,{className:`h-36 w-full rounded-2xl`}),(0,V.jsx)($,{className:`h-72 w-full rounded-2xl`}),(0,V.jsx)($,{className:`h-32 w-full rounded-2xl`}),(0,V.jsx)($,{className:`h-40 w-full rounded-2xl`})]})}function nt(){let{t:e}=o(`openhands`);return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,V.jsx)(P,{className:`size-12 text-muted`}),(0,V.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(s.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(s.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,V.jsx)(`div`,{className:`mt-6`,children:(0,V.jsx)(H,{})})]})}var rt=r(function(){let{t:e}=o(`openhands`),{automationId:t}=i(),{navigate:n}=C(),[r,a]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),{data:m,isLoading:g,refetch:_}=se(),v=m?.status===`ok`,y=p(),b=(0,B.useRef)(y.backend.id).current!==y.backend.id,{data:x,isLoading:S,isError:T,error:E,refetch:D}=ne({id:t??``,enabled:v&&!b}),{trackPrebuiltAutomationEnabled:O,trackAutomationExported:k}=w(),ee=ae(),A=ie(),j=te(),M=T&&u(E)&&E.response?.status===404;if(g)return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsx)(tt,{})})});if(!v)return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsx)(de,{onRetry:_})})});if(S)return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsx)(tt,{})})});if(M)return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsx)(nt,{})})});if(T||!x)return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsx)(me,{onRetry:()=>D()})})});let N=()=>{let e=!x.enabled;ee.mutate({id:x.id,enabled:e}),e&&O({automationId:x.id,automationName:x.name})},P=()=>{A.mutate(x.id,{onSuccess:()=>{n?.(`/automations`)}})},F=()=>{j.mutate(x.id,{onSuccess:()=>{f(e(s.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{d(u(t)?t.response?.data?.message||t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(s.AUTOMATIONS$RUN_NOW_ERROR))}})},I=()=>{let e=`${JSON.stringify(pe(x),null,2)}\n`;h(new Blob([e],{type:`application/json`}),he(x)),k({backendKind:y.backend.kind})},L=y.backend.kind===`local`;return(0,V.jsx)(`div`,{className:`min-h-full`,children:(0,V.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(H,{}),(0,V.jsx)(ve,{automation:x,onToggle:N,onEdit:L?()=>l(!0):void 0,onDelete:()=>a(!0),onExport:I,onDownloadTarball:()=>re.downloadTarball(x.id,x.name),onRunNow:F,isRunningNow:j.isPending}),x.prompt&&(0,V.jsx)(xe,{prompt:x.prompt}),(0,V.jsx)(De,{automation:x}),x.plugins&&x.plugins.length>0&&(0,V.jsx)(Ae,{plugins:x.plugins}),(0,V.jsx)(Me,{createdAt:x.created_at,lastRunAt:x.last_triggered_at}),(0,V.jsx)(et,{automation:x}),(0,V.jsx)(oe,{automationName:x.name,isOpen:r,onConfirm:P,onCancel:()=>a(!1)}),L&&(0,V.jsx)(le,{automation:x,isOpen:c,onClose:()=>l(!1)})]})})})});export{rt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as a}from"./useMutation-DrCAVg5w.js";import{t as o}from"./useQuery-CRBP8vIS.js";import{t as s}from"./useTranslation-CDRCKC9-.js";import{t as c}from"./declaration-gq8V5eTU.js";import{b as l,y as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{A as d,j as ee,n as f}from"./active-backend-context-hxq31W25.js";import{t as p}from"./utils-D3U3rlqr.js";import{c as m,t as h,u as g}from"./agent-server-client-options-DVLRd9sw.js";import{t as _}from"./proxy-BgJLtxu7.js";import{r as v}from"./modal-classes-Cf-4tbHz.js";import{f as te,l as ne}from"./form-control-classes-ChpNBe9n.js";import{t as y}from"./brand-button-vMVuyDXu.js";import{r as b,u as x}from"./dropdown-classes-DJSXeLqc.js";import{t as re}from"./settings-input-bD6npsDm.js";import{t as S}from"./use-tracking-BIXzagSI.js";import{t as ie}from"./use-llm-profiles-RC-PkpBl.js";import{n as C,t as ae}from"./context-menu-list-item-BD5_EaKN.js";import{t as w}from"./settings-dropdown-input-BjunGXJb.js";import{t as T}from"./x-mark-Batp6gXa.js";import{t as E}from"./automation-BU8zu-FP.js";var D=`/api/automation`,O=l.create();O.interceptors.request.use(e=>{if(e.baseURL)return e;let t=g();if(!t)throw new h;e.baseURL=t.host;let n=t.apiKey?.trim();return n&&e.headers.set(`X-Session-API-Key`,n),e});function k(e,t){let n=new URLSearchParams;return n.set(`limit`,String(e)),n.set(`offset`,String(t)),n.toString()}function oe(e){return e.trigger.type===`event`?{type:`event`,source:e.trigger.source,on:e.trigger.on,...e.trigger.filter&&{filter:e.trigger.filter}}:{type:`cron`,schedule:e.trigger.schedule,timezone:e.timezone??e.trigger.timezone??`UTC`}}function se(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`pending.${crypto.randomUUID()}`:`pending.${Date.now()}.${Math.random().toString(36).slice(2,10)}`}function ce(e){if(!e.prompt)throw Error(`An automation prompt is required for import.`);let t=e.repository?[{url:e.repository,...e.branch&&{ref:e.branch},...!e.repository.includes(`://`)&&!e.repository.startsWith(`git@`)&&{provider:`github`}}]:void 0;return{path:`${D}/v1/preset/${e.plugins?.length?`plugin`:`prompt`}`,body:{name:e.name,prompt:e.prompt,trigger:{type:`event`,source:`agent-canvas-import`,on:se()},...e.model&&{model:e.model},...t&&{repos:t},...e.plugins?.length&&{plugins:e.plugins.map(e=>({source:e}))}}}}function A(e){let t=e.apiKey.trim();return{baseURL:e.host,...t&&{headers:{"X-Session-API-Key":t}}}}function j(e){return e.orgId?{"X-Org-Id":e.orgId}:void 0}var M=class e{static async listAutomations(e={}){let{limit:t=50,offset:n=0}=e,r=m().backend;if(r.kind===`cloud`)return _({backend:r,method:`GET`,path:`${D}/v1?${k(t,n)}`});let{data:i}=await O.get(`${D}/v1`,{params:{limit:t,offset:n}});return i}static async getAutomations(t=50,n=0){return e.listAutomations({limit:t,offset:n})}static async getAutomation(e){let t=m().backend,n=`${D}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`)return _({backend:t,method:`GET`,path:n});let{data:r}=await O.get(n);return r}static async createAutomation(e){let t=m(),{path:n,body:r}=ce(e),i;if(t.backend.kind===`cloud`)i=await _({backend:t.backend,method:`POST`,path:n,body:r,headers:j(t)});else{let{data:e}=await O.post(n,r,A(t.backend));i=e}let a=`${D}/v1/${encodeURIComponent(i.id)}`,o={trigger:oe(e),enabled:!1};try{if(t.backend.kind===`cloud`)return await _({backend:t.backend,method:`PATCH`,path:a,body:o,headers:j(t)});let{data:e}=await O.patch(a,o,A(t.backend));return e}catch(e){try{t.backend.kind===`cloud`?await _({backend:t.backend,method:`DELETE`,path:a,headers:j(t)}):await O.delete(a,A(t.backend))}catch(t){throw AggregateError([e,t],`Failed to disable the imported automation and clean it up.`)}throw e}}static async updateAutomation(e,t){let n=m().backend,r=`${D}/v1/${encodeURIComponent(e)}`;if(n.kind===`cloud`)return _({backend:n,method:`PATCH`,path:r,body:t});let{data:i}=await O.patch(r,t);return i}static async deleteAutomation(e){let t=m().backend,n=`${D}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`){await _({backend:t,method:`DELETE`,path:n});return}await O.delete(n)}static async dispatchAutomation(e){let t=m().backend,n=`${D}/v1/${encodeURIComponent(e)}/dispatch`;if(t.kind===`cloud`)return _({backend:t,method:`POST`,path:n});let{data:r}=await O.post(n);return r}static async listAutomationRuns(e,t={}){let{limit:n=50,offset:r=0}=t,i=m().backend,a=`${D}/v1/${encodeURIComponent(e)}/runs`;if(i.kind===`cloud`)return _({backend:i,method:`GET`,path:`${a}?${k(n,r)}`});let{data:o}=await O.get(a,{params:{limit:n,offset:r}});return o}static async getAutomationRuns(t,n=50,r=0){return e.listAutomationRuns(t,{limit:n,offset:r})}static async toggleAutomation(t,n){return e.updateAutomation(t,{enabled:n})}static async downloadTarball(e,t){let n=m().backend,r=`${D}/v1/${encodeURIComponent(e)}/tarball`,i;if(n.kind===`cloud`)i=await _({backend:n,method:`GET`,path:r,responseType:`blob`});else{let{data:e}=await O.get(r,{responseType:`blob`});i=e}let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${t}.tar`,o.click(),URL.revokeObjectURL(a)}static async checkHealth(){let e=m().backend,t=`${D}/health`;try{if(e.kind===`cloud`)return await _({backend:e,method:`GET`,path:t,timeoutSeconds:5});let{data:n}=await O.get(t,{timeout:5e3});return n}catch{return{status:`error`}}}},N=e(t()),le=e(r(),1),P=n(),F=[`automation-detail`],I=[`automation-runs`];function ue(e){let{id:t,enabled:n=!0}=e,r=f();return o({queryKey:[...F,t,r.backend.id,r.orgId],queryFn:()=>M.getAutomation(t),staleTime:300*1e3,enabled:!!t&&n})}function de(e){let{id:t,limit:n=20,offset:r=0,enabled:i=!0}=e,a=f();return o({queryKey:[...I,t,{limit:n,offset:r},a.backend.id,a.orgId],queryFn:()=>M.getAutomationRuns(t,n,r),staleTime:60*1e3,enabled:!!t&&i,refetchInterval:e=>{let t=e.state.data;return t&&t.runs.some(e=>e.status===E.PENDING||e.status===E.RUNNING)?3e3:!1}})}var L=[`automations`];function fe(e={}){let{limit:t=50,offset:n=0,enabled:r=!0}=e,i=f();return o({queryKey:[...L,{limit:t,offset:n},i.backend.id,i.orgId],queryFn:()=>M.getAutomations(t,n),staleTime:0,enabled:r})}function pe(){let e=i(),t=f(),{trackAutomationDeactivated:n}=S();return a({mutationFn:({id:e,enabled:t})=>M.toggleAutomation(e,t),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),i.enabled||n({backendKind:t.backend.kind})}})}function R(){let e=i(),t=f(),{trackAutomationImported:n}=S();return a({mutationFn:e=>M.createAutomation({...e,enabled:!1}),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})}})}function z(){let e=i(),t=f(),{trackAutomationEdited:n}=S();return a({mutationFn:({id:e,body:t})=>M.updateAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),n({backendKind:t.backend.kind})}})}function B(){let e=i(),t=f(),{trackAutomationDeleted:n}=S();return a({mutationFn:e=>M.deleteAutomation(e),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})}})}function me(){let e=i(),t=f(),{trackAutomationExecuted:n}=S();return a({mutationFn:e=>M.dispatchAutomation(e),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),e.invalidateQueries({queryKey:[...I,i]}),n({backendKind:t.backend.kind})}})}var he=[`automation-health`];function ge(){let e=f();return o({queryKey:[...he,e.backend.id,e.orgId],queryFn:()=>M.checkHealth(),staleTime:30*1e3,retry:!1})}var _e=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 20 20`,...e,children:(0,P.jsx)(`path`,{d:`M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z`})}),V=p(`inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,b),ve=p(`inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,b);function ye({icon:e,label:t}){return(0,P.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,P.jsx)(`span`,{className:p(`[&_svg]:size-4`,x),"aria-hidden":!0,children:e}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}function be({items:e}){let{t}=s(`openhands`),[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(),o=(0,N.useRef)(null),l=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{if(!n||!o.current)return;let e=()=>{let e=o.current?.getBoundingClientRect();e&&a({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),(0,N.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||l.current?.contains(t)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let u=n&&i?(0,P.jsx)(C,{ref:l,theme:`popover`,className:`min-w-[10rem]`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(ae,{onClick:t=>{t.stopPropagation(),e.onClick(),r(!1)},isDisabled:e.disabled,className:`group`,children:(0,P.jsx)(ye,{icon:e.icon,label:e.label})})},e.label))}):null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{ref:o,type:`button`,onClick:e=>{e.stopPropagation(),r(e=>!e)},className:V,"aria-label":t(c.AUTOMATIONS$ACTIONS_MENU),"aria-expanded":n,"aria-haspopup":`menu`,children:(0,P.jsx)(_e,{className:`size-4`})}),n&&i&&typeof document<`u`?le.createPortal((0,P.jsx)(`div`,{style:i,children:u}),document.body):null]})}function xe(e){return!0}var Se=e=>(0,P.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,P.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,P.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,P.jsx)(`defs`,{children:(0,P.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,P.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]}),H=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),Ce=e=>(0,P.jsx)(`svg`,{viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.4375 9C2.4375 5.37563 5.37563 2.4375 9 2.4375C12.6244 2.4375 15.5625 5.37563 15.5625 9C15.5625 12.6244 12.6244 15.5625 9 15.5625C5.37563 15.5625 2.4375 12.6244 2.4375 9ZM4.13812 6.5625C4.81317 5.21867 6.02897 4.19333 7.49996 3.77204C7.15155 4.17641 6.85182 4.65395 6.60713 5.17892C6.40828 5.60556 6.24263 6.06975 6.11494 6.5625H4.13812ZM3.72196 7.6875C3.61778 8.10783 3.5625 8.54746 3.5625 9C3.5625 9.45254 3.61778 9.89217 3.72196 10.3125H5.89738C5.84161 9.88758 5.8125 9.44852 5.8125 8.99998C5.8125 8.55142 5.84161 8.11239 5.89737 7.6875H3.72196ZM7.0333 7.6875C6.97087 8.10689 6.9375 8.54634 6.9375 8.99998C6.9375 9.45367 6.97087 9.89313 7.0333 10.3125H10.9667C11.0291 9.89311 11.0625 9.45367 11.0625 9.00002C11.0625 8.54637 11.0291 8.1069 10.9667 7.6875H7.0333ZM12.1026 7.6875C12.1584 8.1124 12.1875 8.55145 12.1875 9.00002C12.1875 9.44858 12.1584 9.88762 12.1026 10.3125H14.278C14.3822 9.89217 14.4375 9.45254 14.4375 9C14.4375 8.54746 14.3822 8.10783 14.278 7.6875H12.1026ZM13.8619 6.5625H11.885C11.7574 6.06976 11.5917 5.6056 11.3929 5.17897C11.1482 4.65397 10.8484 4.1764 10.5 3.77203C11.971 4.19331 13.1868 5.21866 13.8619 6.5625ZM10.7171 6.5625H7.28293C7.38007 6.23971 7.49559 5.93571 7.62681 5.65419C7.99835 4.85708 8.48101 4.26914 8.99997 3.92442C9.51895 4.26913 10.0016 4.8571 10.3732 5.65424C10.5044 5.93575 10.6199 6.23973 10.7171 6.5625ZM4.13812 11.4375H6.11496C6.24963 11.9572 6.42655 12.4452 6.64015 12.8909C6.87835 13.3879 7.16685 13.8413 7.50006 14.228C6.02902 13.8067 4.81318 12.7814 4.13812 11.4375ZM10.7171 11.4375H7.28295C7.3869 11.7829 7.51191 12.1068 7.65465 12.4047C8.02305 13.1733 8.49456 13.7398 9.00007 14.0756C9.51902 13.7308 10.0017 13.1429 10.3732 12.3458C10.5044 12.0643 10.6199 11.7603 10.7171 11.4375ZM11.3929 12.8211C11.5917 12.3944 11.7574 11.9303 11.8851 11.4375H13.8619C13.1868 12.7813 11.971 13.8067 10.5 14.228C10.8485 13.8236 11.1482 13.346 11.3929 12.8211Z`,fill:`currentColor`})}),we=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z`})}),Te=/^(\d+)$/;function U(e,t,n){let r=e.match(Te);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function Ee(e){let t=(e??``).trim();if(!t)return{kind:`custom`,raw:``};let n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=U(r,0,59),l=U(i,0,23);if(c===null||l===null)return{kind:`custom`,raw:t};if(a!==`*`||o!==`*`)return{kind:`custom`,raw:t,hour:l,minute:c};if(s===`*`||s===`0-6`)return{kind:`daily`,hour:l,minute:c};if(s===`1-5`)return{kind:`weekdays`,hour:l,minute:c};let u=U(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function De(e){let{kind:t,hour:n,minute:r,weekday:i}=e;switch(t){case`daily`:return`${r} ${n} * * *`;case`weekdays`:return`${r} ${n} * * 1-5`;case`weekly`:return`${r} ${n} * * ${i??1}`;default:return t}}function W(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function G(e){let t=e.match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return Number.isNaN(n)||Number.isNaN(r)||n<0||n>23||r<0||r>59?null:{hour:n,minute:r}}function K(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var Oe=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})}),ke=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),q=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z`})});function Ae({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,P.jsx)(q,{className:`size-12 text-danger`}),(0,P.jsx)(`p`,{className:`mt-4 text-sm text-muted`,children:t(c.AUTOMATIONS$ERROR_TITLE)}),(0,P.jsx)(`button`,{type:`button`,onClick:e,className:`mt-4 rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:t(c.AUTOMATIONS$ERROR_RETRY)})]})}function je({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,P.jsx)(q,{className:`size-12 text-[var(--oh-warning)]`}),(0,P.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-content`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted text-center max-w-md`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_MESSAGE)}),(0,P.jsx)(y,{type:`button`,variant:`secondary`,className:`mt-6`,onClick:e,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_RETRY)})]})}function Me({automationName:e,isOpen:t,onConfirm:n,onCancel:r}){let{t:i}=s(`openhands`);return t?(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(c.BUTTON$CLOSE),children:(0,P.jsx)(T,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:v,children:i(c.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:i(c.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:i(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:i(c.AUTOMATIONS$DELETE)})]})]})]}):null}var J=`__active__`,Ne=[c.AUTOMATIONS$WEEKDAY_SUN,c.AUTOMATIONS$WEEKDAY_MON,c.AUTOMATIONS$WEEKDAY_TUE,c.AUTOMATIONS$WEEKDAY_WED,c.AUTOMATIONS$WEEKDAY_THU,c.AUTOMATIONS$WEEKDAY_FRI,c.AUTOMATIONS$WEEKDAY_SAT];function Pe(e){if(e.trigger.type===`event`)return{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:``,isCustomSchedule:!0,rawSchedule:``};let t=Ee(e.trigger.schedule);return t.kind===`custom`?{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:t.hour!==void 0&&t.minute!==void 0?W(t.hour,t.minute):``,isCustomSchedule:!0,rawSchedule:t.raw}:{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:t.kind,weekday:t.kind===`weekly`?t.weekday??1:1,timeOfDay:W(t.hour,t.minute),isCustomSchedule:!1,rawSchedule:e.trigger.schedule??``}}function Fe({automation:e,isOpen:t,onClose:n}){let{t:r}=s(`openhands`),i=z(),{data:a,isLoading:o}=ie(),l=a?.profiles??[],f=[{key:J,label:r(c.COMMON$ACTIVE_PROFILE)},...l.map(e=>({key:e.name,label:e.name}))],m=(0,N.useMemo)(()=>Pe(e),[e]),[h,g]=(0,N.useState)(m),[_,b]=(0,N.useState)(null);if((0,N.useEffect)(()=>{t&&(g(m),b(null))},[t,m]),!t)return null;let x=[{key:`daily`,label:r(c.AUTOMATIONS$FREQUENCY_DAILY)},{key:`weekdays`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKDAYS)},{key:`weekly`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKLY)},...h.isCustomSchedule?[{key:`custom`,label:r(c.AUTOMATIONS$FREQUENCY_CUSTOM)}]:[]],S=Ne.map((e,t)=>({key:String(t),label:r(e)})),C=!h.isCustomSchedule||G(h.timeOfDay)!==null||h.timeOfDay===``;return(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-md rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":r(c.AUTOMATIONS$CANCEL),children:(0,P.jsx)(T,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:v,children:r(c.AUTOMATIONS$EDIT_TITLE)}),(0,P.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let a=h.name.trim();if(!a){b(r(c.AUTOMATIONS$NAME_REQUIRED));return}b(null);let o={};a!==e.name&&(o.name=a);let s=h.prompt.trim();s!==(e.prompt??``).trim()&&(o.prompt=s.length===0?null:s);let l=h.model.trim();if(l!==(e.model??``)&&(o.model=l===``?null:l),!h.isCustomSchedule&&h.frequency!==`custom`){let t=G(h.timeOfDay);if(t){let n=De({kind:h.frequency,hour:t.hour,minute:t.minute,weekday:h.frequency===`weekly`?h.weekday:void 0});n!==e.trigger.schedule&&(o.trigger={...e.trigger,schedule:n})}}if(Object.keys(o).length===0){n();return}i.mutate({id:e.id,body:o},{onSuccess:()=>{ee(r(c.AUTOMATIONS$EDIT_SUCCESS)),n()},onError:e=>{d(u(e)?e.response?.data?.message||e.message||r(c.AUTOMATIONS$EDIT_ERROR):e.message||r(c.AUTOMATIONS$EDIT_ERROR))}})},className:`mt-4 flex flex-col gap-4`,"aria-label":r(c.AUTOMATIONS$EDIT_TITLE),children:[(0,P.jsx)(re,{testId:`edit-automation-name`,name:`name`,type:`text`,label:r(c.AUTOMATIONS$NAME),value:h.name,onChange:e=>g(t=>({...t,name:e})),error:_??void 0,showRequiredTag:!0}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$PROMPT)}),(0,P.jsx)(`textarea`,{"data-testid":`edit-automation-prompt`,name:`prompt`,value:h.prompt,onChange:e=>g(t=>({...t,prompt:e.target.value})),rows:4,className:p(ne,`placeholder:italic`)}),(0,P.jsx)(`span`,{className:`text-xs text-muted`,children:r(c.AUTOMATIONS$EDIT_PROMPT_HINT)})]}),(o||l.length>0)&&(0,P.jsx)(w,{testId:`edit-automation-model`,name:`model`,label:r(c.AUTOMATIONS$DETAIL$MODEL),items:f,selectedKey:h.model||J,isLoading:o,placeholder:r(c.COMMON$ACTIVE_PROFILE),onSelectionChange:e=>g(t=>({...t,model:e&&e!==J?String(e):``}))}),e.trigger.type===`event`?(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER_EVENT)})]}),e.trigger.source&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_SOURCE)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:e.trigger.source})]}),e.trigger.on&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_TYPE)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content`,children:K(e.trigger.on)})]}),e.trigger.filter&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_FILTER)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content break-all`,children:e.trigger.filter})]})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{testId:`edit-automation-frequency`,name:`frequency`,label:r(c.AUTOMATIONS$FREQUENCY),items:x,selectedKey:h.frequency,isDisabled:h.isCustomSchedule,onSelectionChange:e=>{!e||h.isCustomSchedule||g(t=>({...t,frequency:e}))}}),h.frequency===`weekly`&&!h.isCustomSchedule&&(0,P.jsx)(w,{testId:`edit-automation-weekday`,name:`weekday`,label:r(c.AUTOMATIONS$WEEKDAY),items:S,selectedKey:String(h.weekday),onSelectionChange:e=>{e!==null&&g(t=>({...t,weekday:Number(e)}))}}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$TIME_OF_DAY)}),(0,P.jsx)(`input`,{"data-testid":`edit-automation-time`,name:`timeOfDay`,type:`time`,value:h.timeOfDay,onChange:e=>g(t=>({...t,timeOfDay:e.target.value})),disabled:h.isCustomSchedule&&!C,className:p(te,`disabled:bg-[var(--oh-surface-raised)]`)}),e.timezone&&(0,P.jsxs)(`span`,{className:`text-xs text-muted`,children:[r(c.AUTOMATIONS$TIMEZONE),`: `,e.timezone]})]}),h.isCustomSchedule&&(0,P.jsxs)(`p`,{className:`text-xs text-muted`,"data-testid":`custom-schedule-hint`,children:[r(c.AUTOMATIONS$CUSTOM_SCHEDULE_HINT),h.rawSchedule&&(0,P.jsxs)(P.Fragment,{children:[` `,(0,P.jsx)(`code`,{className:`text-xs text-content`,children:h.rawSchedule})]})]})]}),(0,P.jsxs)(`div`,{className:`mt-2 flex justify-end gap-3`,children:[(0,P.jsx)(y,{testId:`edit-automation-cancel`,type:`button`,variant:`secondary`,onClick:n,isDisabled:i.isPending,children:r(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(y,{testId:`edit-automation-save`,type:`submit`,variant:`primary`,isDisabled:i.isPending,"aria-busy":i.isPending,children:i.isPending?r(c.AUTOMATIONS$SAVING):r(c.AUTOMATIONS$SAVE)})]})]})]})]})}var Y=new Set([`cron`,`schedule`,`event`]),X=class extends Error{issues;constructor(e){super(e.join(`
|
|
2
|
+
`)),this.name=`AutomationFileValidationError`,this.issues=e}};function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e,t,n,r){let i=e[t];if(typeof i!=`string`||i.trim().length===0){r.push(`${n}: expected a non-empty string`);return}return i}function $(e,t,n,r){let i=e[t];if(i!==void 0){if(typeof i!=`string`){r.push(`${n}: expected a string`);return}return i}}function Ie(e,t){if(!Z(e)){t.push(`spec.trigger: expected an object`);return}let n=Q(e,`type`,`spec.trigger.type`,t);n&&!Y.has(n)&&t.push(`spec.trigger.type: expected one of "cron", "schedule", or "event"`);let r=$(e,`schedule`,`spec.trigger.schedule`,t),i=$(e,`schedule_human`,`spec.trigger.schedule_human`,t),a=$(e,`timezone`,`spec.trigger.timezone`,t),o=$(e,`source`,`spec.trigger.source`,t),s=$(e,`filter`,`spec.trigger.filter`,t),c;if(e.on!==void 0&&(typeof e.on==`string`||Array.isArray(e.on)&&e.on.length>0&&e.on.every(e=>typeof e==`string`&&e.trim().length>0)?c=e.on:t.push(`spec.trigger.on: expected a string or a non-empty array of strings`)),(n===`cron`||n===`schedule`)&&!r?.trim()&&t.push(`spec.trigger.schedule: required for a scheduled trigger`),n===`event`&&(o?.trim()||t.push(`spec.trigger.source: required for an event trigger`),(c===void 0||typeof c==`string`&&c.trim().length===0)&&t.push(`spec.trigger.on: required for an event trigger`)),!(!n||!Y.has(n)))return{type:n,...r!==void 0&&{schedule:r},...i!==void 0&&{schedule_human:i},...a!==void 0&&{timezone:a},...o!==void 0&&{source:o},...c!==void 0&&{on:c},...s!==void 0&&{filter:s}}}function Le(e){let t=e.timezone??e.trigger.timezone;return{version:1,kind:`automation`,spec:{name:e.name,trigger:{...e.trigger},enabled:e.enabled,prompt:e.prompt,...e.repository!==void 0&&{repository:e.repository},...e.model!==void 0&&{model:e.model},...e.branch!==void 0&&{branch:e.branch},...e.plugins!==void 0&&{plugins:[...e.plugins]},...e.notification!==void 0&&{notification:e.notification},...t!==void 0&&{timezone:t}}}}function Re(e){return`${e.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||e.id}.automation.json`}function ze(e){let t=[];if(!Z(e))throw new X([`file: expected a JSON object`]);if(e.version!==1&&t.push(`version: expected 1`),e.kind!==`automation`&&t.push(`kind: expected "automation"`),!Z(e.spec))throw t.push(`spec: expected an object`),new X(t);let n=Q(e.spec,`name`,`spec.name`,t),r=Q(e.spec,`prompt`,`spec.prompt`,t),i=Ie(e.spec.trigger,t),a=e.spec.enabled;typeof a!=`boolean`&&t.push(`spec.enabled: expected a boolean`);let o=$(e.spec,`repository`,`spec.repository`,t),s=$(e.spec,`branch`,`spec.branch`,t),c=$(e.spec,`notification`,`spec.notification`,t),l=$(e.spec,`timezone`,`spec.timezone`,t),u;e.spec.model===null||e.spec.model===void 0||typeof e.spec.model==`string`&&e.spec.model.trim().length>0?u=e.spec.model:t.push(`spec.model: expected a non-empty string or null`);let d;if(e.spec.plugins!==void 0&&(Array.isArray(e.spec.plugins)&&e.spec.plugins.every(e=>typeof e==`string`&&e.trim().length>0)?d=[...e.spec.plugins]:t.push(`spec.plugins: expected an array of non-empty strings`)),t.length>0||!n||!r||!i)throw new X(t);return{name:n,prompt:r,trigger:i,enabled:a,...o!==void 0&&{repository:o},...u!==void 0&&{model:u},...s!==void 0&&{branch:s},...d!==void 0&&{plugins:d},...c!==void 0&&{notification:c},...l!==void 0&&{timezone:l}}}export{me as C,de as D,ue as E,M as O,B as S,pe as T,be as _,Me as a,ge as b,q as c,K as d,we as f,xe as g,Se as h,Fe as i,ke as l,H as m,ze as n,je as o,Ce as p,Le as r,Ae as s,Re as t,Oe as u,V as v,R as w,fe as x,ve as y};
|