@openhands/agent-canvas 1.18.0 → 1.19.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/acp-providers-BQ4o4vqy.js +1 -0
- package/build/assets/{active-backend-context-BnH4-L8h.js → active-backend-context-BsLfwrXB.js} +1 -1
- package/build/assets/{agent-context-settings-D3peZkjX.js → agent-context-settings-D9i6ezoJ.js} +1 -1
- package/build/assets/{agent-profiles-service.api-DkeZaqIl.js → agent-profiles-service.api-U-9YzDFU.js} +1 -1
- package/build/assets/{agent-profiles-settings-7yMWYjGF.js → agent-profiles-settings-D-bUV2PX.js} +1 -1
- package/build/assets/agent-server-conversation-service.api-BaVQ6NpE.js +88 -0
- package/build/assets/agent-settings-BZJHtaIK.js +2 -0
- package/build/assets/agent-settings-D4snDd6u.js +1 -0
- package/build/assets/{alert-banner-eYyqvHL3.js → alert-banner-BkVt_8Or.js} +1 -1
- package/build/assets/{api-key-entry-screen-CCBvBD8u.js → api-key-entry-screen-fAIld-n7.js} +1 -1
- package/build/assets/{app-settings-BtYDs-Be.js → app-settings-DITbrM2u.js} +1 -1
- package/build/assets/automation-detail-DawHmaOl.js +3 -0
- package/build/assets/automation-disabled-reason-DtgC8Ppt.js +1 -0
- package/build/assets/{automation-export-BJsfi7n2.js → automation-export-Kv6e0bHx.js} +1 -1
- package/build/assets/{automation-git-sync-B7o_Nbl-.js → automation-git-sync-Dd98G_Oz.js} +1 -1
- package/build/assets/{automation-setup-route-qaJ6lLCf.js → automation-setup-route-Cdc109ZD.js} +1 -1
- package/build/assets/{automation-templates-Bb98r-kx.js → automation-templates-Xhr-FDAB.js} +1 -1
- package/build/assets/automations-list-BeP1LuzQ.js +1 -0
- package/build/assets/{back-nav-button-B2yBiVMB.js → back-nav-button-DWNiN277.js} +1 -1
- package/build/assets/backend-form-modal-DeaUJIik.js +1 -0
- package/build/assets/{backend-synced-settings-badge-DLEp6cq7.js → backend-synced-settings-badge-Br85iWIY.js} +1 -1
- package/build/assets/{badge-ehL-kgeO.js → badge-Cdnei7Ly.js} +1 -1
- package/build/assets/{base-modal-C1a0TsSx.js → base-modal-Ds7grR67.js} +1 -1
- package/build/assets/{brand-button-CUMfjb99.js → brand-button-mQq2Ld1I.js} +1 -1
- package/build/assets/{browser-SE24Tk8g.js → browser-Bfum8fkE.js} +2 -2
- package/build/assets/{browser-tab-HjJxHA0V.js → browser-tab-CmYT4j_r.js} +1 -1
- package/build/assets/{canvas-extension-page-BsUGBb1T.js → canvas-extension-page-CokKSVRG.js} +1 -1
- package/build/assets/{canvas-extensions-C9Tm6s_E.js → canvas-extensions-BoQEYG-2.js} +1 -1
- package/build/assets/{canvas-extensions-runtime-B8kxM4rO.js → canvas-extensions-runtime-Du2M5iEX.js} +1 -1
- package/build/assets/{chat-send-button-CGvc2wpE.js → chat-send-button-DM3JgMc2.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-BDX_ctNs.js → circle-plus-check-toggle-BbYBiUwv.js} +1 -1
- package/build/assets/{cloud-funnel-analytics-D5uJ_4JE.js → cloud-funnel-analytics-D02kgq1s.js} +1 -1
- package/build/assets/{cog-CAEugqtV.js → cog-Dy1eWbSZ.js} +1 -1
- package/build/assets/{command-menu-CQxs4mtX.js → command-menu-mehU3Evb.js} +1 -1
- package/build/assets/{commits-tab-D0xgjipP.js → commits-tab-DhQW8CXi.js} +1 -1
- package/build/assets/{condenser-settings-D63NJRBT.js → condenser-settings-eRk6Fkx6.js} +1 -1
- package/build/assets/{confirmation-modal-78sd9Vny.js → confirmation-modal-BmVt_c0I.js} +1 -1
- package/build/assets/{context-menu-list-item-Cm7-7Y-7.js → context-menu-list-item-lx2zk9G7.js} +1 -1
- package/build/assets/{conversation-B_nweu5p.js → conversation-BOj0ENI6.js} +4 -4
- package/build/assets/conversation-SouWlGvs.js +1 -0
- package/build/assets/conversation-panel-SouWlGvs.js +1 -0
- package/build/assets/{conversation-state-store-9D_3P7q4.js → conversation-state-store-C6YncQNo.js} +1 -1
- package/build/assets/{conversation-tab-empty-state-B3dpJXX0.js → conversation-tab-empty-state-DIhwCC2J.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-B1ljgNxO.js → copy-to-clipboard-button-DVNXLylP.js} +1 -1
- package/build/assets/{device-verify-D5QRIS_x.js → device-verify-LP-x7nra.js} +1 -1
- package/build/assets/{dropdown-classes-BGvOvW2_.js → dropdown-classes-goDldkiu.js} +1 -1
- package/build/assets/edit-automation-modal-BJJR9wSW.js +1 -0
- package/build/assets/empty-state-Cd-TFe7i.js +1 -0
- package/build/assets/{entry.client-BMafTpjO.js → entry.client-CJdjIvMZ.js} +2 -2
- package/build/assets/{enum-filter-dropdown-UNaom12H.js → enum-filter-dropdown-pocrz9AL.js} +1 -1
- package/build/assets/{environment-switch-overlay-COibRUA-.js → environment-switch-overlay-Dwe78wRl.js} +1 -1
- package/build/assets/{error-state-Cf8LRuuY.js → error-state-SuWwztxV.js} +1 -1
- package/build/assets/{extensions-hub-C_6ahIua.js → extensions-hub-O0esK3Er.js} +1 -1
- package/build/assets/{extensions-navigation-C5GfpzFe.js → extensions-navigation-CgCVSXje.js} +1 -1
- package/build/assets/{files-tab-D5PPIWI1.js → files-tab-B_6t8ljw.js} +1 -1
- package/build/assets/{form-control-classes-Dbq-7YP_.js → form-control-classes-lQfLxzH4.js} +1 -1
- package/build/assets/{get-git-path-jU2zjqIB.js → get-git-path-Bp5rsUkl.js} +1 -1
- package/build/assets/git-repo-dropdown-CbD0_LPN.js +1 -0
- package/build/assets/{git-repo-dropdown-uxlFw2gn.js → git-repo-dropdown-DPQVumZg.js} +1 -1
- package/build/assets/{highlighted-source-view-C7pAXrT0.js → highlighted-source-view-Bp0sgK-f.js} +1 -1
- package/build/assets/home-BghzJd-D.js +1 -0
- package/build/assets/home-CXZ8zawS.js +1 -0
- package/build/assets/home-automation-run-tooltip-BdpCckKO.js +1 -0
- package/build/assets/{home-store-DCbei3DX.js → home-store-DNQpfIEO.js} +1 -1
- package/build/assets/{hooks-service-Dnmhqc0Z.js → hooks-service-DkxnQa4N.js} +1 -1
- package/build/assets/index-home-Ca6Q5CtT.js +1 -0
- package/build/assets/{install-server-modal-B81I-5OE.js → install-server-modal-DvxxYKia.js} +1 -1
- package/build/assets/{key-O84CMFHb.js → key-CwTE6XJj.js} +1 -1
- package/build/assets/{launch-ZLxI4opd.js → launch-jsRGPRBx.js} +1 -1
- package/build/assets/link-external-B4gx3EeM.js +1 -0
- package/build/assets/{llm-not-configured-banner-Dh_ajcM8.js → llm-not-configured-banner-DMdL1vaX.js} +4 -4
- package/build/assets/{llm-settings-CODhjQzy.js → llm-settings-dkQ5Oq7W.js} +1 -1
- package/build/assets/llm-settings-lNDerSlu.js +1 -0
- package/build/assets/{llm-subscription-service-CgIDc38n.js → llm-subscription-service-BiQaZbvv.js} +1 -1
- package/build/assets/{loading-spinner-BeLV0IXf.js → loading-spinner-DK1sAwVg.js} +1 -1
- package/build/assets/{manage-backends-modal-cMXqCb-B.js → manage-backends-modal-DqCJohsX.js} +1 -1
- package/build/assets/manifest-ff93dc8c.js +1 -0
- package/build/assets/{manifest-subpage-layout-CVZgVKoY.js → manifest-subpage-layout-sxuPqfUr.js} +1 -1
- package/build/assets/{markdown-renderer-DyFl9-mL.js → markdown-renderer-BH5pqDuJ.js} +1 -1
- package/build/assets/mcp-BtaJDXnP.js +1 -0
- package/build/assets/mcp-installed-servers-Br4ZLsjr.js +1 -0
- package/build/assets/mcp-marketplace-utils-BwEnDYqm.js +1 -0
- package/build/assets/mcp-page-DwbnQpVs.js +9 -0
- package/build/assets/{messages-Bk1xhbU2.js → messages-DmFJlW6c.js} +4 -4
- package/build/assets/{modal-body-C24WsdFb.js → modal-body-DBweM2EN.js} +1 -1
- package/build/assets/{modal-classes-B0b9eiL8.js → modal-classes-jvG85nkU.js} +1 -1
- package/build/assets/{modal-close-button-DfqfB2Nj.js → modal-close-button-BrM5fNnn.js} +1 -1
- package/build/assets/onboarding-CQ8T6T0U.js +1 -0
- package/build/assets/{onboarding-modal-BT3Gx_sZ.js → onboarding-modal-CnliiaSN.js} +1 -1
- package/build/assets/{organization-service.api-B5CvmnYQ.js → organization-service.api-DmFUEmu5.js} +1 -1
- package/build/assets/parse-git-remote-url-BG8pcKL8.js +1 -0
- package/build/assets/{planner-tab-CstoOlAB.js → planner-tab-CXph_C9F.js} +1 -1
- package/build/assets/{plugins-management-service-5rqVPEGN.js → plugins-management-service-CcEpfNKz.js} +1 -1
- package/build/assets/{profiles-service.api-D1XKMgr0.js → profiles-service.api-DdF_4Zhe.js} +1 -1
- package/build/assets/{providers-XmZ9HM4Q.js → providers-BWRnl31s.js} +1 -1
- package/build/assets/{proxy-XP6U1Dhv.js → proxy-DbEf3Nqr.js} +1 -1
- package/build/assets/recommended-automations-launcher-r0oI91HN.js +1 -0
- package/build/assets/root-j2fFRlWS.js +2 -0
- package/build/assets/{root-layout-DUquNZTU.js → root-layout-CfGgm2lo.js} +2 -2
- package/build/assets/root-sEWn3ha1.css +1 -0
- package/build/assets/{schema-field-Y3F8JvXd.js → schema-field-c3Ncgm4x.js} +1 -1
- package/build/assets/{sdk-section-page-CNZTLwH9.js → sdk-section-page-DFEiuiFQ.js} +1 -1
- package/build/assets/{secret-form-9-BoGA40.js → secret-form-WXXNFqTM.js} +1 -1
- package/build/assets/{secrets-service-BOIsfD9j.js → secrets-service-DU6wh3wX.js} +1 -1
- package/build/assets/{secrets-settings-CBJgFr42.js → secrets-settings-BEqbPvjy.js} +1 -1
- package/build/assets/{settings-D4hdToD4.js → settings-DjaSQwFh.js} +1 -1
- package/build/assets/{settings-dropdown-input-DBvsZ7-Q.js → settings-dropdown-input-BRR2OZwi.js} +1 -1
- package/build/assets/{settings-index-DeQphyBK.js → settings-index-DHv4XFcM.js} +1 -1
- package/build/assets/{settings-input-dVuzapBA.js → settings-input-Cm4VxUon.js} +1 -1
- package/build/assets/{settings-list-classes-DhAPuXm6.js → settings-list-classes-CaUfKZ33.js} +1 -1
- package/build/assets/{settings-modal-tHiJ8iYV.js → settings-modal-djXuAnBO.js} +1 -1
- package/build/assets/{settings-nav-GAQjW1a-.js → settings-nav-DFb3hBMr.js} +1 -1
- package/build/assets/{settings-service.api-C1vZH9Vh.js → settings-service.api-Q9lKW1TX.js} +1 -1
- package/build/assets/{settings-switch-DDd1cQ8t.js → settings-switch-seaSJc7t.js} +1 -1
- package/build/assets/{shared-conversation-Cyg7m7ns.js → shared-conversation-x3rxVCon.js} +1 -1
- package/build/assets/{sidebar-layout-DH0E-5KW.js → sidebar-layout-B6mcvvdV.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-CQ4iky__.js → sidebar-mobile-menu-toggle-CEqS8KnA.js} +1 -1
- package/build/assets/{sidebar-nav-link-oLQiKUBu.js → sidebar-nav-link-BTHX11LG.js} +1 -1
- package/build/assets/{sidebar-onboarding-checklist-storage-TfvNNnnr.js → sidebar-onboarding-checklist-storage-BP1kzn6p.js} +1 -1
- package/build/assets/{skill-card-pill-row-DfjIfj0K.js → skill-card-pill-row-TD39nfP3.js} +1 -1
- package/build/assets/{skill-filter-DsNLmn76.js → skill-filter-CdBbbwjm.js} +1 -1
- package/build/assets/{skill-icon-badge-0MK_68Nc.js → skill-icon-badge-vUEp7gsC.js} +1 -1
- package/build/assets/{skill-scope-BE-H9TSZ.js → skill-scope-BTRBQt0-.js} +1 -1
- package/build/assets/{skills-plugins-vzSdxSk_.js → skills-plugins-k1tUNAw4.js} +1 -1
- package/build/assets/{skills-settings-BiPOH9H9.js → skills-settings-CENviPT7.js} +1 -1
- package/build/assets/{styled-tooltip-CejG0rqv.js → styled-tooltip-DVAlWYnL.js} +1 -1
- package/build/assets/{task-list-tab-OkZSqnTp.js → task-list-tab-BLKF_x9f.js} +1 -1
- package/build/assets/{terminal-Dph60VFZ.js → terminal-Ckbnqb23.js} +1 -1
- package/build/assets/{toggle-switch-B2uXaAUS.js → toggle-switch-DeiG9Mf6.js} +1 -1
- package/build/assets/trash-CXN2R54L.js +1 -0
- package/build/assets/{typography-DgcLGdHk.js → typography-NarNyelM.js} +1 -1
- package/build/assets/{usage-tab-MCmNRAnR.js → usage-tab-Drd3O006.js} +1 -1
- package/build/assets/{use-acp-credential-form-ychoGqjC.js → use-acp-credential-form-CJ5wPsQm.js} +1 -1
- package/build/assets/{use-activate-agent-profile-8L8Xdghy.js → use-activate-agent-profile-iQZ0U3qV.js} +1 -1
- package/build/assets/{use-agent-profiles-Bi8hSkze.js → use-agent-profiles-LCvb5OXT.js} +1 -1
- package/build/assets/{use-automation-health-U99vvHxx.js → use-automation-health-DdgSa8sA.js} +1 -1
- package/build/assets/{use-automation-permissions-Buus0R6h.js → use-automation-permissions-D3kEeieu.js} +1 -1
- package/build/assets/{use-automations-Bq5hVuv0.js → use-automations-CEubcYTD.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-MzIeEV8F.js → use-can-manage-org-profiles-CB8ybxFK.js} +1 -1
- package/build/assets/{use-canvas-extensions-Ca9KoVEm.js → use-canvas-extensions-BMacwi2v.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-B4ZLUZSa.js → use-cloud-current-user-id-BEKRd6XZ.js} +1 -1
- package/build/assets/{use-config-l5tkDHyD.js → use-config-3WYcJsgC.js} +1 -1
- package/build/assets/{use-create-conversation-i_PdFdIs.js → use-create-conversation-Be-eVpFp.js} +1 -1
- package/build/assets/use-create-secret-Bk9ZxTjl.js +1 -0
- package/build/assets/{use-free-models-gCsJ5BV0.js → use-free-models-Ci3FkKEm.js} +1 -1
- package/build/assets/{use-get-secrets-CMTuWEp_.js → use-get-secrets-fqS0kxt6.js} +1 -1
- package/build/assets/{use-llm-configured-Dl4zg8ht.js → use-llm-configured-B71ZEVg2.js} +1 -1
- package/build/assets/{use-llm-profiles-SWsuFmFu.js → use-llm-profiles-xtCBMbef.js} +1 -1
- package/build/assets/{use-manifest-capabilities-CdqYfUAC.js → use-manifest-capabilities-Bso6A_-A.js} +1 -1
- package/build/assets/{use-onboarding-completion-Xl63ZvzQ.js → use-onboarding-completion-CEgjL02y.js} +1 -1
- package/build/assets/{use-pinned-home-route-BXDIUaxQ.js → use-pinned-home-route-pK4IlJ-p.js} +1 -1
- package/build/assets/{use-plugins-marketplace-BIIaPiaB.js → use-plugins-marketplace-B8-ZEB34.js} +1 -1
- package/build/assets/{use-save-agent-profile-D-ZHHE94.js → use-save-agent-profile-D7hJuW_u.js} +1 -1
- package/build/assets/{use-save-settings-Dapkf4cC.js → use-save-settings-CikTu5xV.js} +1 -1
- package/build/assets/{use-settings-C2KKQKVC.js → use-settings-BWIH5EuN.js} +1 -1
- package/build/assets/{use-settings-nav-items-TOc0Rsfd.js → use-settings-nav-items-DSKwLDnd.js} +1 -1
- package/build/assets/use-tracking-ChnSFChv.js +3 -0
- package/build/assets/{use-user-conversation-5UFqMoO4.js → use-user-conversation-C_l65DqW.js} +1 -1
- package/build/assets/utils-D-gOfhmN.js +1 -0
- package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-D6owle9R.js +2 -0
- package/build/assets/vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-BFRW8wt-.js +48 -0
- package/build/assets/{verification-settings-DdBpaVPz.js → verification-settings-PKtoIUUY.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +10 -0
- package/build/locales/ca/openhands.json +10 -0
- package/build/locales/de/openhands.json +10 -0
- package/build/locales/en/openhands.json +10 -0
- package/build/locales/es/openhands.json +10 -0
- package/build/locales/fr/openhands.json +10 -0
- package/build/locales/it/openhands.json +10 -0
- package/build/locales/ja/openhands.json +10 -0
- package/build/locales/ko-KR/openhands.json +10 -0
- package/build/locales/no/openhands.json +10 -0
- package/build/locales/pt/openhands.json +10 -0
- package/build/locales/tr/openhands.json +10 -0
- package/build/locales/uk/openhands.json +10 -0
- package/build/locales/zh-CN/openhands.json +10 -0
- package/build/locales/zh-TW/openhands.json +10 -0
- package/config/defaults.json +3 -3
- package/dist/components/conversation-events/chat/event-content-helpers/get-skill-ready-content.cjs +3 -3
- package/dist/components/conversation-events/chat/event-content-helpers/get-skill-ready-content.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/get-skill-ready-content.js +12 -16
- package/dist/components/conversation-events/chat/event-content-helpers/get-skill-ready-content.js.map +1 -1
- package/dist/components/features/automations/detail/disabled-reason-banner.d.ts +16 -0
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.cjs +1 -1
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.cjs.map +1 -1
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.js +38 -29
- package/dist/components/features/home/featured-automations/home-automation-run-tooltip.js.map +1 -1
- package/dist/components/features/settings/agent-profiles/profile-scope-list.d.ts +20 -0
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +3 -3
- package/dist/config/defaults.js.map +1 -1
- package/dist/constants/acp-providers.cjs +1 -1
- package/dist/constants/acp-providers.cjs.map +1 -1
- package/dist/constants/acp-providers.d.ts +0 -5
- package/dist/constants/acp-providers.js +20 -16
- package/dist/constants/acp-providers.js.map +1 -1
- package/dist/constants/profile-scope.d.ts +21 -0
- package/dist/hooks/query/use-automation-sdk-version.cjs +1 -1
- package/dist/hooks/query/use-automation-sdk-version.cjs.map +1 -1
- package/dist/hooks/query/use-automation-sdk-version.js +3 -1
- package/dist/hooks/query/use-automation-sdk-version.js.map +1 -1
- package/dist/hooks/use-drag-resize.cjs +1 -1
- package/dist/hooks/use-drag-resize.cjs.map +1 -1
- package/dist/hooks/use-drag-resize.js +8 -9
- package/dist/hooks/use-drag-resize.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 +10 -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 +170 -0
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +10 -0
- package/dist/locales/ca/openhands.json +10 -0
- package/dist/locales/de/openhands.json +10 -0
- package/dist/locales/en/openhands.json +10 -0
- package/dist/locales/es/openhands.json +10 -0
- package/dist/locales/fr/openhands.json +10 -0
- package/dist/locales/it/openhands.json +10 -0
- package/dist/locales/ja/openhands.json +10 -0
- package/dist/locales/ko-KR/openhands.json +10 -0
- package/dist/locales/no/openhands.json +10 -0
- package/dist/locales/pt/openhands.json +10 -0
- package/dist/locales/tr/openhands.json +10 -0
- package/dist/locales/uk/openhands.json +10 -0
- package/dist/locales/zh-CN/openhands.json +10 -0
- package/dist/locales/zh-TW/openhands.json +10 -0
- package/dist/manifests/manifest-validation.cjs +1 -1
- package/dist/manifests/manifest-validation.cjs.map +1 -1
- package/dist/manifests/manifest-validation.js +2 -2
- package/dist/manifests/manifest-validation.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/agent-server-compatibility.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/agent-server-compatibility.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/agent-server-compatibility.js +15 -8
- package/dist/node_modules/@openhands/typescript-client/dist/client/agent-server-compatibility.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/bash-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/bash-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/bash-client.js +11 -13
- package/dist/node_modules/@openhands/typescript-client/dist/client/bash-client.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/conversation-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/conversation-client.js +6 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/conversation-client.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js +3 -6
- package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/file-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/file-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/file-client.js +9 -12
- package/dist/node_modules/@openhands/typescript-client/dist/client/file-client.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/runtime-transport.cjs +2 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/runtime-transport.cjs.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/runtime-transport.js +41 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/runtime-transport.js.map +1 -0
- package/dist/node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/vscode-client.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/client/vscode-client.js +3 -6
- package/dist/node_modules/@openhands/typescript-client/dist/client/vscode-client.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/clients.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/clients.js +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js +199 -61
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp-providers.js.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/workspace/remote-workspace.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/workspace/remote-workspace.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/workspace/remote-workspace.js +9 -8
- package/dist/node_modules/@openhands/typescript-client/dist/workspace/remote-workspace.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/dist/routes/agent-settings.d.ts +5 -0
- package/dist/types/automation.cjs.map +1 -1
- package/dist/types/automation.d.ts +23 -1
- package/dist/types/automation.js.map +1 -1
- package/dist/utils/automation-disabled-reason.cjs +2 -0
- package/dist/utils/automation-disabled-reason.cjs.map +1 -0
- package/dist/utils/automation-disabled-reason.d.ts +32 -0
- package/dist/utils/automation-disabled-reason.js +19 -0
- package/dist/utils/automation-disabled-reason.js.map +1 -0
- package/dist/utils/parse-git-remote-url.cjs +1 -1
- package/dist/utils/parse-git-remote-url.cjs.map +1 -1
- package/dist/utils/parse-git-remote-url.d.ts +5 -1
- package/dist/utils/parse-git-remote-url.js +20 -13
- package/dist/utils/parse-git-remote-url.js.map +1 -1
- package/package.json +2 -2
- package/scripts/check-sdk-version-sync.mjs +79 -8
- package/scripts/dev-safe.mjs +1 -1
- package/scripts/static-server.mjs +24 -7
- package/build/assets/acp-providers-DcY_mKYa.js +0 -1
- package/build/assets/agent-server-conversation-service.api-jiCopc2E.js +0 -88
- package/build/assets/agent-settings-BF8hM6wb.js +0 -2
- package/build/assets/agent-settings-YPutBAeR.js +0 -1
- package/build/assets/automation-detail-BxXhb_m2.js +0 -3
- package/build/assets/automations-list-DEPVNud3.js +0 -1
- package/build/assets/backend-form-modal-DxisQV_6.js +0 -1
- package/build/assets/conversation-edjzrv5w.js +0 -1
- package/build/assets/conversation-panel-edjzrv5w.js +0 -1
- package/build/assets/edit-automation-modal-D_JWSmxT.js +0 -1
- package/build/assets/empty-state-FK_s1B60.js +0 -1
- package/build/assets/git-repo-dropdown-BoDDWXfX.js +0 -1
- package/build/assets/home-BM5_Wz_R.js +0 -1
- package/build/assets/home-Ivfm7KC4.js +0 -1
- package/build/assets/home-automation-run-tooltip-B1N2uO9p.js +0 -1
- package/build/assets/index-home-td9BN2T3.js +0 -1
- package/build/assets/kebab-menu-item-content-SCJBwZnp.js +0 -1
- package/build/assets/link-external-BNZzCM1I.js +0 -1
- package/build/assets/llm-settings-CZaXYgtw.js +0 -1
- package/build/assets/manifest-bfeccb98.js +0 -1
- package/build/assets/mcp-CraxoXQv.js +0 -1
- package/build/assets/mcp-marketplace-utils-C7PYr293.js +0 -1
- package/build/assets/mcp-page-CteH_K0N.js +0 -9
- package/build/assets/onboarding-DXFBRqEy.js +0 -1
- package/build/assets/parse-git-remote-url-DpDM9bK6.js +0 -1
- package/build/assets/recommended-automations-launcher-DEHRKIAg.js +0 -1
- package/build/assets/root-CM6IZHlg.css +0 -1
- package/build/assets/root-DdFkodKW.js +0 -2
- package/build/assets/trash-Ckh7yCaB.js +0 -1
- package/build/assets/use-create-secret-CjWq0J4O.js +0 -1
- package/build/assets/use-tracking-j4uo9VEW.js +0 -3
- package/build/assets/utils-BgLSZdyy.js +0 -1
- package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-Z0lly3FE.js +0 -2
- package/build/assets/vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-CnsDDzeE.js +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openhands/agent-canvas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Agent Canvas UI for OpenHands - run AI coding agents with a visual interface",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@microlink/react-json-view": "1.31.25",
|
|
25
25
|
"@monaco-editor/react": "4.7.0",
|
|
26
26
|
"@openhands/extensions": "0.20.0",
|
|
27
|
-
"@openhands/typescript-client": "1.
|
|
27
|
+
"@openhands/typescript-client": "1.48.0",
|
|
28
28
|
"@react-router/node": "7.18.2",
|
|
29
29
|
"@react-router/serve": "7.18.2",
|
|
30
30
|
"@tailwindcss/vite": "4.3.3",
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Check SDK Version Sync
|
|
5
5
|
*
|
|
6
|
-
* Verifies
|
|
7
|
-
*
|
|
6
|
+
* Verifies two things against versions.agentServer in config/defaults.json:
|
|
7
|
+
*
|
|
8
|
+
* 1. The local @openhands/typescript-client pin in package.json. Canvas renders
|
|
9
|
+
* the ACP provider picker from that generated registry mirror but launches
|
|
10
|
+
* the adapter through the agent-server image, so a skew ships a picker
|
|
11
|
+
* offering models and launch commands agent-server does not implement.
|
|
12
|
+
*
|
|
13
|
+
* 2. That the released automation package (openhands-automation on PyPI)
|
|
14
|
+
* uses the SDK version expected for that automation release for all agent SDK libraries:
|
|
8
15
|
* - openhands-sdk
|
|
9
16
|
* - openhands-tools
|
|
10
17
|
* - openhands-workspace
|
|
@@ -19,7 +26,7 @@
|
|
|
19
26
|
*
|
|
20
27
|
* Usage:
|
|
21
28
|
* node scripts/check-sdk-version-sync.mjs
|
|
22
|
-
* EXPECTED_SDK_VERSION=1.
|
|
29
|
+
* EXPECTED_SDK_VERSION=1.48.0 node scripts/check-sdk-version-sync.mjs
|
|
23
30
|
* node scripts/check-sdk-version-sync.mjs --check-pypi
|
|
24
31
|
*
|
|
25
32
|
* Environment variables:
|
|
@@ -78,7 +85,7 @@ Triggering from other repos:
|
|
|
78
85
|
-H "Authorization: token \$GITHUB_TOKEN" \\
|
|
79
86
|
-H "Accept: application/vnd.github.v3+json" \\
|
|
80
87
|
https://api.github.com/repos/OpenHands/OpenHands/dispatches \\
|
|
81
|
-
-d '{"event_type": "sdk-version-check", "client_payload": {"version": "1.
|
|
88
|
+
-d '{"event_type": "sdk-version-check", "client_payload": {"version": "1.48.0"}}'
|
|
82
89
|
`);
|
|
83
90
|
process.exit(0);
|
|
84
91
|
}
|
|
@@ -101,6 +108,11 @@ const SDK_PACKAGES = [
|
|
|
101
108
|
"openhands-agent-server",
|
|
102
109
|
];
|
|
103
110
|
|
|
111
|
+
// Mirrors the SDK's ACP provider registry. Must track versions.agentServer:
|
|
112
|
+
// the picker is rendered from this pin but the adapter is launched by that
|
|
113
|
+
// image, so a skew advertises models the running agent-server cannot run.
|
|
114
|
+
const CLIENT_PACKAGE_NAME = "@openhands/typescript-client";
|
|
115
|
+
|
|
104
116
|
// Configurable automation package (can be overridden via env)
|
|
105
117
|
const AUTOMATION_PACKAGE_NAME = process.env.AUTOMATION_PACKAGE_NAME || "openhands-automation";
|
|
106
118
|
|
|
@@ -173,6 +185,34 @@ function getExpectedVersion() {
|
|
|
173
185
|
};
|
|
174
186
|
}
|
|
175
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Compare the local typescript-client pin against the expected SDK version.
|
|
190
|
+
* Returns a mismatch descriptor, or null when they agree.
|
|
191
|
+
*/
|
|
192
|
+
function findClientPinMismatch(pinnedVersion, expectedVersion) {
|
|
193
|
+
if (!pinnedVersion) {
|
|
194
|
+
return { package: CLIENT_PACKAGE_NAME, expected: expectedVersion, actual: null };
|
|
195
|
+
}
|
|
196
|
+
// A range would reintroduce the skew this check exists to catch.
|
|
197
|
+
if (!/^[0-9]/.test(pinnedVersion)) {
|
|
198
|
+
return { package: CLIENT_PACKAGE_NAME, expected: expectedVersion, actual: pinnedVersion };
|
|
199
|
+
}
|
|
200
|
+
if (versionsEqual(pinnedVersion, expectedVersion)) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return { package: CLIENT_PACKAGE_NAME, expected: expectedVersion, actual: pinnedVersion };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Read the typescript-client pin from package.json.
|
|
208
|
+
*/
|
|
209
|
+
function readClientPin() {
|
|
210
|
+
const pkg = JSON.parse(
|
|
211
|
+
readFileSync(join(projectRoot, "package.json"), "utf-8"),
|
|
212
|
+
);
|
|
213
|
+
return pkg.dependencies?.[CLIENT_PACKAGE_NAME] ?? null;
|
|
214
|
+
}
|
|
215
|
+
|
|
176
216
|
/**
|
|
177
217
|
* Fetch the latest version of a package from PyPI
|
|
178
218
|
*/
|
|
@@ -260,9 +300,9 @@ async function fetchPyPIDependencies(packageName, version) {
|
|
|
260
300
|
* Parse PyPI requires_dist array and extract SDK package versions
|
|
261
301
|
*
|
|
262
302
|
* PyPI returns dependencies in PEP 508 format like:
|
|
263
|
-
* "openhands-sdk>=1.
|
|
264
|
-
* "openhands-tools==1.
|
|
265
|
-
* "openhands-workspace (>=1.
|
|
303
|
+
* "openhands-sdk>=1.48.0,<2.0.0"
|
|
304
|
+
* "openhands-tools==1.48.0"
|
|
305
|
+
* "openhands-workspace (>=1.48.0)"
|
|
266
306
|
*/
|
|
267
307
|
function parseSdkVersionsFromRequiresDist(requiresDist) {
|
|
268
308
|
const versions = {};
|
|
@@ -276,7 +316,7 @@ function parseSdkVersionsFromRequiresDist(requiresDist) {
|
|
|
276
316
|
}
|
|
277
317
|
|
|
278
318
|
// Extract the version number - look for patterns like:
|
|
279
|
-
// ">=1.
|
|
319
|
+
// ">=1.48.0", "==1.48.0", "(>=1.48.0)", "~=1.48.0"
|
|
280
320
|
// After the package name and before any comma or closing paren
|
|
281
321
|
const versionPattern = /[><=~!]+\s*([0-9]+(?:\.[0-9]+)*)/;
|
|
282
322
|
const match = dep.match(versionPattern);
|
|
@@ -308,6 +348,34 @@ async function main() {
|
|
|
308
348
|
`Expected automation SDK version: ${colors.green}${expectedVersion}${colors.reset} (from ${versionSource})`,
|
|
309
349
|
);
|
|
310
350
|
|
|
351
|
+
// Offline, so it runs first and fails fast without the PyPI round trip.
|
|
352
|
+
const clientMismatch = findClientPinMismatch(readClientPin(), expectedVersion);
|
|
353
|
+
if (clientMismatch) {
|
|
354
|
+
console.log("");
|
|
355
|
+
console.log(
|
|
356
|
+
` ${CLIENT_PACKAGE_NAME.padEnd(30)} ${colors.red}✗ ${clientMismatch.actual ?? "(absent)"} (expected ${expectedVersion})${colors.reset}`,
|
|
357
|
+
);
|
|
358
|
+
console.log("");
|
|
359
|
+
console.log(`${colors.red}Version mismatch detected!${colors.reset}`);
|
|
360
|
+
console.log("");
|
|
361
|
+
console.log(
|
|
362
|
+
`${CLIENT_PACKAGE_NAME} mirrors the SDK's ACP provider registry that Canvas renders the`,
|
|
363
|
+
);
|
|
364
|
+
console.log(
|
|
365
|
+
`ACP picker from, but the adapter is launched by agent-server ${expectedVersion}. A skew ships a`,
|
|
366
|
+
);
|
|
367
|
+
console.log("picker offering models and launch commands that agent-server does not implement.");
|
|
368
|
+
console.log("");
|
|
369
|
+
console.log("To fix, update one of the following:");
|
|
370
|
+
console.log(` 1. Pin ${CLIENT_PACKAGE_NAME} to ${expectedVersion} in package.json`);
|
|
371
|
+
console.log(" 2. Update versions.agentServer in config/defaults.json");
|
|
372
|
+
console.log("");
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
console.log(
|
|
376
|
+
`Client registry pin: ${colors.green}${CLIENT_PACKAGE_NAME}@${expectedVersion}${colors.reset} (matches versions.agentServer)`,
|
|
377
|
+
);
|
|
378
|
+
|
|
311
379
|
// Get automation version from env var or config/defaults.json
|
|
312
380
|
const { version: automationVersion, source: automationSource } = getAutomationVersion();
|
|
313
381
|
console.log(
|
|
@@ -422,7 +490,10 @@ export {
|
|
|
422
490
|
normalizeVersion,
|
|
423
491
|
versionsEqual,
|
|
424
492
|
parseSdkVersionsFromRequiresDist,
|
|
493
|
+
findClientPinMismatch,
|
|
494
|
+
readClientPin,
|
|
425
495
|
SDK_PACKAGES,
|
|
496
|
+
CLIENT_PACKAGE_NAME,
|
|
426
497
|
AUTOMATION_PACKAGE_NAME,
|
|
427
498
|
};
|
|
428
499
|
|
package/scripts/dev-safe.mjs
CHANGED
|
@@ -421,7 +421,7 @@ export const AGENT_SERVER_IMPORT_MODULES = "canvas_ui_tool";
|
|
|
421
421
|
* edits are picked up without a manual reinstall. The agent-server itself
|
|
422
422
|
* is rebuilt from local source on each invocation (--reinstall).
|
|
423
423
|
* - OH_AGENT_SERVER_GIT_REF: Git commit SHA or branch name
|
|
424
|
-
* - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.
|
|
424
|
+
* - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.48.0")
|
|
425
425
|
*
|
|
426
426
|
* If none are set, defaults to the released version specified by
|
|
427
427
|
* DEFAULT_AGENT_SERVER_VERSION. Set OH_AGENT_SERVER_GIT_REF to use a
|
|
@@ -345,6 +345,23 @@ ROUTING:
|
|
|
345
345
|
* `isDoNotTrackEnabled()` in `#/services/telemetry`. Enabled by
|
|
346
346
|
* AGENT_CANVAS_DISABLE_TELEMETRY=1 or the --disable-telemetry flag.
|
|
347
347
|
*/
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Serialize a value into a safe JavaScript literal for inclusion in an inline <script> tag.
|
|
351
|
+
* Escapes characters that could terminate or manipulate the surrounding HTML context:
|
|
352
|
+
* - '<' -> \u003c (prevents </script> breakout)
|
|
353
|
+
* - '>' -> \u003e (prevents premature tag closing in some contexts)
|
|
354
|
+
* - '\u2028' -> \u2028 (prevents syntax errors in JS parsers)
|
|
355
|
+
* - '\u2029' -> \u2029 (prevents syntax errors in JS parsers)
|
|
356
|
+
*/
|
|
357
|
+
export function serializeForInlineScript(value) {
|
|
358
|
+
return JSON.stringify(value)
|
|
359
|
+
.replace(/</g, "\\u003c")
|
|
360
|
+
.replace(/>/g, "\\u003e")
|
|
361
|
+
.replace(/\u2028/g, "\\u2028")
|
|
362
|
+
.replace(/\u2029/g, "\\u2029");
|
|
363
|
+
}
|
|
364
|
+
|
|
348
365
|
function makeConfigInjectionScript(
|
|
349
366
|
sessionApiKey,
|
|
350
367
|
authRequired,
|
|
@@ -357,7 +374,7 @@ function makeConfigInjectionScript(
|
|
|
357
374
|
const parts = [];
|
|
358
375
|
|
|
359
376
|
if (sessionApiKey) {
|
|
360
|
-
const keyLiteral =
|
|
377
|
+
const keyLiteral = serializeForInlineScript(sessionApiKey);
|
|
361
378
|
// Window global — read at module init by getBakedSessionApiKey().
|
|
362
379
|
// Set first so it's available even if the localStorage write throws.
|
|
363
380
|
parts.push(`window.__AGENT_CANVAS_SESSION_API_KEY__=${keyLiteral};`);
|
|
@@ -383,28 +400,28 @@ function makeConfigInjectionScript(
|
|
|
383
400
|
if (runtimeServicesInfo) {
|
|
384
401
|
// Stored as the raw JSON string so the browser-side parser
|
|
385
402
|
// (parseRuntimeServicesInfo) can JSON.parse it exactly like the
|
|
386
|
-
// VITE_RUNTIME_SERVICES_INFO env var.
|
|
403
|
+
// VITE_RUNTIME_SERVICES_INFO env var. serializeForInlineScript produces a safe JS
|
|
387
404
|
// string literal for the inline <script>.
|
|
388
405
|
parts.push(
|
|
389
|
-
`window.__AGENT_CANVAS_RUNTIME_SERVICES_INFO__=${
|
|
406
|
+
`window.__AGENT_CANVAS_RUNTIME_SERVICES_INFO__=${serializeForInlineScript(runtimeServicesInfo)};`,
|
|
390
407
|
);
|
|
391
408
|
}
|
|
392
409
|
|
|
393
410
|
if (lockToCloud) {
|
|
394
411
|
parts.push(
|
|
395
|
-
`window.__AGENT_CANVAS_LOCK_TO_CLOUD__=${
|
|
412
|
+
`window.__AGENT_CANVAS_LOCK_TO_CLOUD__=${serializeForInlineScript(lockToCloud)};`,
|
|
396
413
|
);
|
|
397
414
|
}
|
|
398
415
|
|
|
399
416
|
if (basePath && basePath !== "/") {
|
|
400
417
|
parts.push(
|
|
401
|
-
`window.__AGENT_CANVAS_BASE_PATH__=${
|
|
418
|
+
`window.__AGENT_CANVAS_BASE_PATH__=${serializeForInlineScript(basePath)};`,
|
|
402
419
|
);
|
|
403
420
|
}
|
|
404
421
|
|
|
405
422
|
if (vscodeBasePath) {
|
|
406
423
|
parts.push(
|
|
407
|
-
`window.__AGENT_CANVAS_VSCODE_BASE_PATH__=${
|
|
424
|
+
`window.__AGENT_CANVAS_VSCODE_BASE_PATH__=${serializeForInlineScript(vscodeBasePath)};`,
|
|
408
425
|
);
|
|
409
426
|
}
|
|
410
427
|
|
|
@@ -463,7 +480,7 @@ async function serveInjectedIndexHtml(
|
|
|
463
480
|
res.writeHead(200, {
|
|
464
481
|
"Content-Type": "text/html; charset=utf-8",
|
|
465
482
|
"Content-Length": buf.length,
|
|
466
|
-
"Cache-Control": "no-cache",
|
|
483
|
+
"Cache-Control": sessionApiKey ? "no-store" : "no-cache",
|
|
467
484
|
});
|
|
468
485
|
if (req.method === "HEAD") {
|
|
469
486
|
res.end();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./utils-BgLSZdyy.js";import{n as t}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-CnsDDzeE.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||!m(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};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/profiles-service.api-D1XKMgr0.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-Z0lly3FE.js","assets/vendor-styling-Ck5D_A2Q.js","assets/agent-server-client-options-EHB23gyx.js","assets/agent-server-config-C_x8Otd9.js","assets/proxy-XP6U1Dhv.js","assets/agent-profiles-service.api-DkeZaqIl.js","assets/secrets-service-BOIsfD9j.js","assets/active-backend-context-BnH4-L8h.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ew9ih1s8-40UR63Gt.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js","assets/utils-BgLSZdyy.js","assets/hooks-service-Dnmhqc0Z.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{xt as e}from"./vendor-styling-Ck5D_A2Q.js";import{K as t,X as n,f as r,w as i}from"./active-backend-context-BnH4-L8h.js";import{D as a}from"./utils-BgLSZdyy.js";import{a as o,c as s,d as c,n as l,t as u,u as ee}from"./agent-server-client-options-EHB23gyx.js";import{d as te,n as ne,s as d}from"./agent-server-config-C_x8Otd9.js";import{l as f,p,v as m,x as re,y as h}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-Z0lly3FE.js";import{t as g}from"./proxy-XP6U1Dhv.js";import{r as ie,t as _}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-CnsDDzeE.js";import{n as ae}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~jz4f6vo2-C7HiY4Ae.js";import{t as v}from"./settings-CKqk8ZnH.js";import{t as oe}from"./settings-service.api-C1vZH9Vh.js";import{t as se}from"./profiles-service.api-D1XKMgr0.js";import{f as y,o as ce,s as b}from"./acp-providers-DcY_mKYa.js";import{c as x,n as S,r as C}from"./skill-enablement-DXeaImBz.js";import{d as w,f as le,r as ue}from"./llm-subscription-DTqtBCWz.js";import{t as de}from"./llm-subscription-service-CgIDc38n.js";var T=[];for(let e=0;e<256;++e)T.push((e+256).toString(16).slice(1));function fe(e,t=0){return(T[e[t+0]]+T[e[t+1]]+T[e[t+2]]+T[e[t+3]]+`-`+T[e[t+4]]+T[e[t+5]]+`-`+T[e[t+6]]+T[e[t+7]]+`-`+T[e[t+8]]+T[e[t+9]]+`-`+T[e[t+10]]+T[e[t+11]]+T[e[t+12]]+T[e[t+13]]+T[e[t+14]]+T[e[t+15]]).toLowerCase()}var pe=new Uint8Array(16);function me(){return crypto.getRandomValues(pe)}function E(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():he(e,t,n)}function he(e,t,n){e||={};let r=e.random??e.rng?.()??me();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return fe(r)}var D=new Map;function ge(e){return/^([/\\]|[a-zA-Z]:[/\\])/.test(e)}function _e(e,t){return`${e.replace(/[/\\]+$/,``)}/${t.replace(/^[/\\]+/,``)}`}async function ve(e={}){let t=l(e),n=t.host,r=D.get(n);if(r)return r;let i=(async()=>{let{home:e}=await new m(t).getHome();if(!e||typeof e!=`string`)throw Error(`Agent server returned an empty home directory`);return e.replace(/[/\\]+$/,``)})();D.set(n,i);try{return await i}catch(e){throw D.delete(n),e}}async function O(e,t={}){let n=e.replace(/[/\\]+$/,``);return n?ge(n)?n:_e(await ve(t),n):ve(t)}var k=`openhands-agent-server-conversation-metadata`,ye=e=>({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null}),A=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(k);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},be=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(k);return}window.localStorage.setItem(k,JSON.stringify(e))}},j=e=>A()[e]??null,M=(e,t)=>{let n=A();n[e]=t,be(n)},xe=(e,t)=>{M(e,{selected_repository:null,selected_branch:null,git_provider:null,...j(e)??{},...t})},N=e=>{let t=A();e in t&&(delete t[e],be(t))};function Se(e){if(!e?.id)return e;let t=j(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 P(){let e=s().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}function Ce(){let e=s().backend;return e.kind===`cloud`?e:c().find(e=>e.kind===`cloud`&&!!e.apiKey)??null}async function we(e=20,t){let n=P(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>Se(e)),next_page_id:i?.next_page_id??null}}async function F(e){if(e.length===0)return[];let t=P(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(Se)}async function Te(e,t){return await g({backend:t??P(),method:`POST`,path:`/api/v1/app-conversations`,body:e,headers:i})}async function Ee(e){return g({backend:P(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function De(e){await g({backend:P(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function Oe(e,t){return await g({backend:P(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function ke(e,t){return g({backend:P(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{title:t}})}async function Ae(e){await g({backend:P(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function je(e){await g({backend:P(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function Me(e,t){let n=P(),r=new URLSearchParams;return r.append(`file_path`,t),await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function Ne(e,t){let n=P(),r=new URLSearchParams;r.append(`path`,t);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/files?${r.toString()}`});return Array.isArray(i)?i:[]}async function Pe(e,t){let n=t??P(),r=new URLSearchParams;return r.set(`ids`,e),(await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${r.toString()}`}))?.[0]??null}function Fe(e){return e.kind===`cloud`&&e.authMode===`cookie`||!e.apiKey?{}:e.kind===`cloud`?{Authorization:`Bearer ${e.apiKey}`}:{"X-Session-API-Key":e.apiKey}}function Ie(e){if(!e?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let t=0,n=null,r=null;for(let i of Object.values(e.usage_to_metrics))t+=i.accumulated_cost,n===null&&i.max_budget_per_task!==null&&(n=i.max_budget_per_task),i.accumulated_token_usage&&(r=r===null?{...i.accumulated_token_usage}:{prompt_tokens:r.prompt_tokens+i.accumulated_token_usage.prompt_tokens,completion_tokens:r.completion_tokens+i.accumulated_token_usage.completion_tokens,cache_read_tokens:r.cache_read_tokens+i.accumulated_token_usage.cache_read_tokens,cache_write_tokens:r.cache_write_tokens+i.accumulated_token_usage.cache_write_tokens,context_window:Math.max(r.context_window,i.accumulated_token_usage.context_window),per_turn_token:Math.max(r.per_turn_token,i.accumulated_token_usage.per_turn_token)});return{accumulated_cost:t,max_budget_per_task:n,accumulated_token_usage:r}}function Le(e){return Ie(e.stats)}var Re=`canvas_ui`,I=`canvas_ui_control`,ze=`ClientAction_${I}`,Be={name:I,description:`The user is interacting with you inside Agent Canvas — a web UI with a chat panel on the left and a tabbed right-side panel (files, terminal, browser, vscode, planner, tasklist). This tool lets you drive that right-side panel so the user sees what you just produced.
|
|
3
|
-
|
|
4
|
-
They will NOT see the files you wrote, the terminal output, or the browser
|
|
5
|
-
unless you call this tool to switch the right-side panel to the relevant
|
|
6
|
-
tab. Call this every time you finish work that produces something the user
|
|
7
|
-
should look at — don't rely on them noticing on their own.
|
|
8
|
-
|
|
9
|
-
When to call (pick the most specific option that matches your last action):
|
|
10
|
-
|
|
11
|
-
* You wrote or modified a single file (ANY language, ANY size — including
|
|
12
|
-
small scripts like a hello-world bash file) →
|
|
13
|
-
command="navigate_to_file", path=<workspace-relative path of that file>
|
|
14
|
-
|
|
15
|
-
* You generated an HTML page, image, SVG, PDF, markdown report, or other
|
|
16
|
-
previewable artifact →
|
|
17
|
-
command="show_preview", path=<that file>
|
|
18
|
-
|
|
19
|
-
* You finished editing multiple files in one logical step →
|
|
20
|
-
command="open_tab", tab="files"
|
|
21
|
-
(The Files tab automatically renders a diff view when the workspace has
|
|
22
|
-
uncommitted git changes, which covers the "highlight changes" case.)
|
|
23
|
-
|
|
24
|
-
* You ran a long-running terminal command, or one whose output the user
|
|
25
|
-
should inspect →
|
|
26
|
-
command="open_tab", tab="terminal"
|
|
27
|
-
|
|
28
|
-
* You browsed to a URL the user should see →
|
|
29
|
-
First call browser_get_state(include_screenshot=true) after your final
|
|
30
|
-
browser interaction so Agent Canvas has a screenshot to display, then call
|
|
31
|
-
command="open_tab", tab="browser"
|
|
32
|
-
(browser_navigate alone only updates the URL; without browser_get_state,
|
|
33
|
-
the Browser tab will open without a screenshot.)
|
|
34
|
-
|
|
35
|
-
Call this BEFORE writing your chat-message summary of the change, so the
|
|
36
|
-
artifact is visible while the user reads what you did. One canvas_ui_control
|
|
37
|
-
call per logical step is enough — don't repeat it for the same file or tab in
|
|
38
|
-
the same turn.`,parameters:{type:`object`,additionalProperties:!1,properties:{command:{type:`string`,enum:[`navigate_to_file`,`open_tab`,`show_preview`],description:`UI command to dispatch.`},path:{type:`string`,description:`Workspace-relative file path. Required for navigate_to_file and show_preview; ignored otherwise.`},tab:{type:`string`,enum:[`files`,`browser`,`vscode`,`terminal`,`planner`,`tasklist`],description:`Tab to open. Required for open_tab; ignored otherwise.`}},required:[`command`]},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},L=`launch_child_conversation`,Ve=`ClientAction_${L}`,He=`[child-conversation] `,Ue=[`local`,`cloud`],We=[`worktree`,`shared`],Ge=`1.37.1`,Ke={name:L,description:`Start a NEW, independent conversation to work on a well-scoped task in parallel with this one, without the user having to run any CLI command. The new conversation is recorded as a child of this one.
|
|
39
|
-
|
|
40
|
-
The child runs on its own. It does not block you, you do not see its output,
|
|
41
|
-
and it cannot see this conversation's history — everything it needs must be in
|
|
42
|
-
the task brief.
|
|
43
|
-
|
|
44
|
-
Choosing target:
|
|
45
|
-
|
|
46
|
-
* target="local" — runs on the same machine, in this conversation's workspace.
|
|
47
|
-
Fast, no repository clone, no sandbox provisioning. Use this by default when
|
|
48
|
-
the work is on code that is already checked out here.
|
|
49
|
-
|
|
50
|
-
* target="cloud" — runs on OpenHands Cloud in its own isolated sandbox, from a
|
|
51
|
-
git repository. Use this when the work should not touch the user's machine or
|
|
52
|
-
when it needs a repository that is not checked out locally. Requires the user
|
|
53
|
-
to have an OpenHands Cloud backend connected in Agent Canvas; if none is
|
|
54
|
-
connected you will be told so and should fall back to target="local".
|
|
55
|
-
|
|
56
|
-
Writing the task brief:
|
|
57
|
-
|
|
58
|
-
* Put everything the child needs in "task": the goal, the relevant file paths,
|
|
59
|
-
the constraints, the expected deliverable, and how it should report back.
|
|
60
|
-
* Keep each child's scope independent of its siblings so parallel children do
|
|
61
|
-
not fight over the same files.
|
|
62
|
-
* One call per delegated task. Do NOT call this tool twice for the same task.
|
|
63
|
-
|
|
64
|
-
Parameter rules (a call that breaks one of these launches nothing and comes
|
|
65
|
-
back with corrective guidance):
|
|
66
|
-
|
|
67
|
-
* "repository" and "branch" apply to target="cloud" only. A local child always
|
|
68
|
-
inherits this conversation's workspace, so do not pass them with
|
|
69
|
-
target="local".
|
|
70
|
-
* "isolation" applies to target="local" only. Cloud sandboxes are always
|
|
71
|
-
isolated, so do not pass it with target="cloud".
|
|
72
|
-
* isolation="worktree" (the default) gives the child its own git worktree and
|
|
73
|
-
branch, cut from the repository's default branch — it will NOT see this
|
|
74
|
-
conversation's uncommitted or committed work. isolation="shared" puts the
|
|
75
|
-
child in this conversation's exact directory; only choose it when the child
|
|
76
|
-
genuinely must see work in progress, and expect the two agents to conflict.
|
|
77
|
-
|
|
78
|
-
What comes back: this tool is acknowledged immediately, before the conversation
|
|
79
|
-
exists. The real outcome arrives moments later as a follow-up message starting
|
|
80
|
-
with "${He.trim()}" that carries the child's
|
|
81
|
-
conversation id, URL, target and initial status — or an error with guidance.
|
|
82
|
-
Wait for it, then tell the user what you launched and give them the URL. If it
|
|
83
|
-
reports an error, fix the parameters and call this tool again.`,parameters:{type:`object`,additionalProperties:!1,properties:{target:{type:`string`,enum:[...Ue],description:`Where the child runs. 'local' reuses this machine and this conversation's workspace; 'cloud' runs in an isolated OpenHands Cloud sandbox.`},task:{type:`string`,description:`Self-contained task brief, sent as the child's first message. The child cannot see this conversation, so state the goal, constraints, expected output and handoff criteria.`},title:{type:`string`,description:`Optional short title for the child conversation. Omit to let it title itself from the task.`},repository:{type:`string`,description:`target='cloud' only. Repository to clone into the sandbox, as 'owner/repo'. Defaults to this conversation's repository when it has one.`},branch:{type:`string`,description:`target='cloud' only, and only together with 'repository'. Defaults to the repository's default branch.`},isolation:{type:`string`,enum:[...We],description:`target='local' only. 'worktree' (default) gives the child its own git worktree and branch; 'shared' runs it in this conversation's exact directory.`}},required:[`target`,`task`]},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},qe=`.agents_tmp/PLAN.md`,Je=`system_prompt_planning.j2`,Ye=`planning_file_editor`,R=`plannerparent`,Xe=`PLAN.MD`,Ze=[`The plan must follow this structure exactly:`,``,`1. OBJECTIVE`,` * Summarize the goal of the plan in one or two sentences.`,` * Restate the problem in clear operational terms.`,``,`2. CONTEXT SUMMARY`,` * Briefly describe the relevant system components, files, or data involved.`,` * Mention any dependencies or constraints (technical, organizational, or external).`,``,`3. APPROACH OVERVIEW`,` * Outline the chosen approach at a high level.`,` * Mention why it was selected (short rationale) if alternatives were considered.`,``,`4. IMPLEMENTATION STEPS`,` * Provide a step-by-step plan for execution.`,` * Each step should include:`,` - a **goal** (what this step accomplishes),`,` - a **method** (how to do it, briefly),`,` - and optionally a **reference** (file, module, or function impacted).`,``,`5. TESTING AND VALIDATION`,` * Describe how the implementation can be verified or validated.`,` * This section should describe what success looks like — expected outputs, behaviors, or conditions.`].join(`
|
|
84
|
-
`),Qe=[`<IMPORTANT_PLANNING_BOUNDARIES>`,`You are a Planning Agent that can ONLY create plans - you CANNOT execute code or make changes.`,``,`Create or update the plan for the current task in the configured PLAN.md file.`,``,`After you finalize the plan in PLAN.md:`,`- Do NOT ask "Ready to proceed?" or offer to execute the plan`,`- Do NOT attempt to run any implementation commands`,`- Instead, tell the user they can click the **Build** button below the plan preview to switch to the code agent and execute the plan.`,``,`Your role ends when the plan is finalized. Implementation is handled by the code agent.`,`</IMPORTANT_PLANNING_BOUNDARIES>`].join(`
|
|
85
|
-
`);function $e(e){return`${e.replace(/\/+$/,``)}/${qe}`}function et(e){if(!e)return!1;let t=e.replace(/\\/g,`/`).toUpperCase();return t===Xe||t.endsWith(`/${Xe}`)}function tt(e,t){return e?.tags?.[R]===t}function nt(e,t){return t?e?.find(e=>tt(e,t))?.id??null:null}var rt=[`terminal`,`file_editor`,`task_tracker`],it=`browser_tool_set`,at=`task_tool_set`,ot=500;function st(e){return typeof e==`number`?e:ot}function ct(){return!0}function z(e){if(typeof e==`string`){let t=e.trim();if(!t)return null;try{return z(JSON.parse(t))}catch{return null}}if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;return!t.services||typeof t.services!=`object`?null:t}async function lt(){let e;try{e=l({timeout:3e3})}catch{return null}let n=z(t({host:e.host})?.runtime_services);if(n)return n;try{return z((await new re(e).getServerInfo()).runtime_services)}catch{return null}}function ut(e){let t=z(e);if(!t?.services)return;let n=[];n.push(`<RUNTIME_SERVICES>`),t.mode?n.push(`You are running inside an agent-canvas dev stack started in '${t.mode}' mode.`):n.push(`You are running inside an agent-canvas dev stack.`),n.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:r,ingress:i,automation:a}=t.services,{frontend:o}=t.services;r?.url_from_agent&&n.push(`* Agent Server (you): ${r.url_from_agent}`,` ${r.description??`The agent-server hosting your tool calls.`}`),i?.url_from_agent&&n.push(`* Ingress: ${i.url_from_agent}`,` ${i.description??`Unified entry point for browser-facing traffic.`}`),o?.url_from_agent&&n.push(`* Frontend: ${o.url_from_agent}`,` ${o.description??`Frontend dev server.`}`),a?.url_from_agent?(n.push(`* Automation backend: ${a.url_from_agent}`,` ${a.description??`OpenHands Automations service.`}`),a.docs_url&&n.push(` Docs: ${a.docs_url}`),a.openapi_url&&n.push(` OpenAPI: ${a.openapi_url}`),a.auth_env_var&&n.push(` Auth: header 'X-Session-API-Key: $${a.auth_env_var}'`)):n.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let s=r?.url_from_agent;return n.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),s&&n.push(`In particular, ${s} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),n.push(`</RUNTIME_SERVICES>`),n.join(`
|
|
86
|
-
`)}function dt(e){let{host:t}=l();return`${t}/api/conversations/${e}`}function ft(e){return`Conversation ${e.slice(0,5)}`}function B(e){let t=j(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:ft(e.id),trigger:null,pr_number:[],agent_kind:n?`acp`:`openhands`,acp_server:r,tags:e.tags??null,launched_agent_profile:e.launched_agent_profile??null,llm_model:n?y({runtimeName:e.current_model_name,runtimeId:e.current_model_id,configured:e.agent?.acp_model,sdkLlm:e.agent?.llm?.model}):e.agent?.llm?.model??v.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}:Ie(e.stats),created_at:e.created_at,updated_at:e.updated_at,execution_status:e.execution_status??a.IDLE,sandbox_status:e.sandbox_status??null,conversation_url:dt(e.id),session_api_key:l().apiKey??null,sandbox_id:null,workspace:{working_dir:e.workspace?.working_dir??d()},public:!1,sub_conversation_ids:e.sub_conversation_ids??[]}}function pt(e){return{items:e.items.filter(e=>!e.tags?.[R]).map(B),next_page_id:e.next_page_id??null}}var mt=`acpserver`,V=`clientsource`,ht=`agentcanvas`,gt=`automationtrigger`,_t=`automationid`,H=`automationname`,vt=`automationrunid`,yt=[gt,_t,H,vt],bt=new Set([mt,V,gt,_t,H,vt,`title`,`git_provider`,`repo_name`,`repo`,`repository`,`selected_branch`,`branch`,`archiveworkspacepath`,`workspace`,`working_dir`,R]),xt=[`origin`];function St(e){if(!e)return[];let t=e=>{let t=xt.indexOf(e.trim().toLowerCase());return t===-1?1/0:t};return Object.entries(e).filter(([e,t])=>!bt.has(e.trim().toLowerCase())&&typeof t==`string`&&(t===``||t.trim().length>0)).sort(([e],[n])=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})}var Ct=`gAAAAA`,wt=new Set([`schema_version`,`agent_settings`,`workspace`,`conversation_id`,`initial_message`,`plugins`]);function U(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:structuredClone(e)}function Tt(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function Et(e){let t=U(e);t.model=typeof t.model==`string`&&t.model.trim().length>0?t.model:v.llm_model;let n=Tt(t.api_key);n?t.api_key=n:delete t.api_key;let r=Tt(t.base_url);return r?t.base_url=r:delete t.base_url,le(t)?(t.auth_type=ue,t.subscription_vendor=w,delete t.api_key):(delete t.auth_type,delete t.subscription_vendor),t}function W(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function G(e){return typeof e==`string`?e.startsWith(Ct):Array.isArray(e)?e.some(G):W(e)?Object.values(e).some(G):!1}function Dt(e){return W(e)?Object.values(e).some(G):!1}function Ot(e){return e.confirmation_mode===!0?e.security_analyzer===`llm`?{kind:`ConfirmRisky`,threshold:`HIGH`,confirm_unknown:!0}:{kind:`AlwaysConfirm`}:{kind:`NeverConfirm`}}function kt(e){switch(e.security_analyzer){case`llm`:return{kind:`LLMSecurityAnalyzer`};case`pattern`:return{kind:`PatternSecurityAnalyzer`};case`policy_rail`:return{kind:`PolicyRailSecurityAnalyzer`};default:return}}function At(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.name==`string`}function K(e,t){return e===it?ct()&&n(e):e===at?t.enable_sub_agents===!0&&n(e):!0}function jt(e){let t=new Map;for(let n of rt)K(n,e)&&t.set(n,{name:n,params:{}});for(let n of[it,at])K(n,e)&&t.set(n,{name:n,params:{}});let n=e.tools;if(Array.isArray(n)&&n.every(e=>At(e)))for(let r of n)K(r.name,e)&&t.set(r.name,{name:r.name,params:U(r.params)});return Array.from(t.values())}function Mt(e,t){let n=[e?.trim(),t?.trim()].filter(Boolean);return n.length===0?null:{role:`user`,content:[{type:`text`,text:n.join(`
|
|
87
|
-
|
|
88
|
-
`)}],run:!0}}function Nt(){return ae.map(e=>{let t=e.triggers?.length>0?{type:`keyword`,keywords:e.triggers}:null,n=`/home/runner/work/OpenHands/OpenHands/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 q(e,t,n={},r){let i=ut(t),a=U(e.agent_context),o=Array.isArray(a.skills)?a.skills:[],s=n.disabledSkills??[],c=new Set(s),l=S(n),u=[...o.filter(e=>typeof e.name!=`string`||!c.has(e.name)),...Nt().filter(e=>e.name===r||l(e.name))];return{...a,skills:u,load_public_skills:!1,load_user_skills:!0,load_project_skills:!0,disabled_skills:s,...i?{system_message_suffix:i}:{}}}function Pt(e){return U(e.agent_settings).agent_kind===`acp`}function Ft(e){let t=U(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function It(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=b(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Lt(e,t,n){let r=U(e.agent_settings),i={agent_kind:`acp`,agent_context:q(r,t,x(e),C(n))};for(let e of _){if(e===`acp_model`||e===`acp_env`)continue;let t=e===`acp_command`?It(r):r[e];t!=null&&(i[e]=t)}let a=U(r.mcp_config);Object.keys(a).length>0&&(i.mcp_config=a);let o=typeof r.acp_server==`string`?r.acp_server:void 0,s=y({configured:r.acp_model,providerDefault:ce(o)});return s&&(i.acp_model=s),i}function Rt(e,t,n){let r=U(e.agent_settings),i=Et(r.llm);i.stream=!0;let a=U(r.mcp_config);Object.keys(a).length===0&&delete r.mcp_config,delete r.acp_server;for(let e of _)delete r[e];return delete r.acp_env,{...r,llm:i,agent_context:q(r,t,x(e),C(n)),tools:jt(r)}}function zt(e,t,n){return Pt(e)?Lt(e,t,n):Rt(e,t,n)}function Bt(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=U(t.conversation_settings),s=Mt(n,r);return wt.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??d()},...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 Vt(e){if(!e?.length)return;let t=ee(),n=t?Fe(t):{},r={};for(let t of e){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}return r}function Ht(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=Pt(t),r=e.agentProfileId?e.agentProfileKind:n?`acp`:`openhands`,i=zt(t,e.runtimeServicesInfo,e.query),a=n?Ft(t):void 0,o=Bt(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),s={...e.agentProfileId?{agent_profile_id:e.agentProfileId}:{agent_settings:i},workspace:o.workspace,client_tools:r===`openhands`?[Be,Ke]:[],confirmation_policy:Ot(o),max_iterations:st(o.max_iterations),stuck_detection:!0,autotitle:!0,...e.titleLlmProfile?{title_llm_profile:e.titleLlmProfile}:{},worktree:e.worktree??!0};!e.agentProfileId&&a?s.tags={[mt]:a,[V]:ht}:s.tags={[V]:ht},!e.agentProfileId&&e.secretsEncrypted&&(!n||Dt(i.mcp_config))&&(s.secrets_encrypted=!0),e.conversationId&&(s.conversation_id=e.conversationId),e.parentConversationId&&(s.parent_conversation_id=e.parentConversationId);let c=kt(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:e.workspaceHookConfig&&(s.hook_config=e.workspaceHookConfig);let l={...o.tool_module_qualnames??{}};delete l[Re],delete l[I],delete l[L],Object.keys(l).length>0&&(s.tool_module_qualnames=l),o.agent_definitions&&(s.agent_definitions=o.agent_definitions);let u=Vt(e.customSecrets);return u&&(s.secrets=u),s}function Ut(e){let t=U(e.encryptedAgentSettings),n=Et(t.llm);n.stream=!0;let r=$e(e.workingDir),i=q(t,void 0,e.skillEnablement),a=i.system_message_suffix;i.system_message_suffix=typeof a==`string`?`${Qe}\n\n${a}`:Qe;let o=Mt(e.initialMessage),s={agent:{kind:`Agent`,llm:n,tools:[{name:`glob`,params:{}},{name:`grep`,params:{}},{name:Ye,params:{plan_path:r}}],system_prompt_filename:Je,system_prompt_kwargs:{plan_structure:Ze},agent_context:i,condenser:{kind:`LLMSummarizingCondenser`,llm:{...n,usage_id:`planning_condenser`},max_size:100,keep_first:6}},workspace:{kind:`LocalWorkspace`,working_dir:e.workingDir},client_tools:[],confirmation_policy:{kind:`NeverConfirm`},max_iterations:e.maxIterations??ot,stuck_detection:!0,autotitle:!1,worktree:!1,parent_conversation_id:e.parentConversationId,tags:{[R]:e.parentConversationId},...o?{initial_message:o}:{}};e.secretsEncrypted&&(s.secrets_encrypted=!0);let c=Vt(e.customSecrets);return c&&(s.secrets=c),s}async function Wt(t){try{let{default:n}=await e(async()=>{let{default:e}=await import(`./profiles-service.api-D1XKMgr0.js`).then(e=>e.n);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6])),r=await n.getProfile(t,`encrypted`);return W(r.config)?r.config:null}catch(e){return console.warn(`Falling back: could not resolve LLM profile ${t}`,e),null}}async function Gt(t){try{let{default:n}=await e(async()=>{let{default:e}=await import(`./agent-profiles-service.api-DkeZaqIl.js`).then(e=>e.r);return{default:e}},__vite__mapDeps([7,1,2,3,4,5,6])),{profiles:r}=await n.listProfiles(),i=r.find(e=>e.id===t&&e.llm_profile_ref);return i?.llm_profile_ref?await Wt(i.llm_profile_ref):null}catch(e){return console.warn(`Falling back to global agent settings: could not resolve the LLM for agent profile ${t}`,e),null}}async function Kt(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-BOIsfD9j.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([8,1,9,3,2,10,11,12,4,5,13,6])),[r,i]=await Promise.all([oe.getSettingsForConversation(),n.getSecrets()]),a=(t.parentActiveProfileName?await Wt(t.parentActiveProfileName):null)??(t.parentAgentProfileId?await Gt(t.parentAgentProfileId):null),o=a?{...r.agentSettings,llm:a}:r.agentSettings;await J(o);let s=st(r.conversationSettings.max_iterations);return Ut({...t,encryptedAgentSettings:o,secretsEncrypted:r.secretsEncrypted,customSecrets:i,maxIterations:s,skillEnablement:r.skillEnablement})}var qt=`Connect your ChatGPT subscription before starting a conversation with this LLM profile.`;async function J(e){if(le(U(e.llm))&&!(await de.getOpenAIStatus()).connected)throw Error(qt)}async function Jt(t){let[{SecretsService:n},{default:r}]=await Promise.all([e(()=>import(`./secrets-service-BOIsfD9j.js`).then(e=>e.n),__vite__mapDeps([8,1,9,3,2,10,11,12,4,5,13,6])),e(()=>import(`./hooks-service-Dnmhqc0Z.js`),__vite__mapDeps([14,2,1,3,4,5]))]),[i,a,o,s]=await Promise.all([oe.getSettingsForConversation(),n.getSecrets(),lt(),r.loadWorkspaceHooks(t.hooksProjectDir)]),{agentSettings:c,conversationSettings:l,secretsEncrypted:u}=i;return t.agentProfileId||await J(c),Ht({...t,encryptedAgentSettings:c,encryptedConversationSettings:l,secretsEncrypted:u,customSecrets:a,runtimeServicesInfo:o,workspaceHookConfig:s})}function Yt(){return{hooks:[]}}function Xt(e,t){if(!t)return;let n=new Set(t.profiles.map(e=>e.name));if(e&&n.has(e))return e;if(t.active_profile&&n.has(t.active_profile))return t.active_profile}var Zt=`1970-01-01T00:00:00.000Z`,Qt=300*1e3,$t=`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 Y(){return Error($t)}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function en(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 tn(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:Zt}function nn(e){return X(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 rn(e){return X(e)?{accumulated_cost:en(e.accumulated_cost),max_budget_per_task:en(e.max_budget_per_task),accumulated_token_usage:nn(e.accumulated_token_usage)}:null}function an(e){return X(e)?e:null}function on(e){if(!X(e))return null;let t=X(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 sn(e){return X(e)?{working_dir:Q(e.working_dir)}:null}function cn(e){if(!X(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function ln(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):null}function un(e){if(!X(e))return null;let{agent_profile_id:t,revision:n}=e;return typeof t!=`string`||typeof n!=`number`?null:{agent_profile_id:t,revision:n}}function dn(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 fn(e,t){let n=dn(e),r=dn(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function pn(e){if(!X(e)||typeof e.id!=`string`||!e.id.trim())throw Y();return{id:e.id.trim(),title:Q(e.title),created_at:tn(e,`created_at`,`createdAt`),updated_at:tn(e,`updated_at`,`updatedAt`),execution_status:Q(e.execution_status),sandbox_status:Q(e.sandbox_status),metrics:rn(e.metrics),stats:an(e.stats),agent:on(e.agent),workspace:sn(e.workspace),tags:cn(e.tags),launched_agent_profile:un(e.launched_agent_profile),sub_conversation_ids:ln(e.sub_conversation_ids),current_model_id:Q(e.current_model_id),current_model_name:Q(e.current_model_name)}}function mn(e){if(!Array.isArray(e))throw Y();return e.map(pn)}function hn(e){if(Array.isArray(e))return{items:mn(e),next_page_id:null};if(!X(e))throw Y();return{items:mn(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var gn=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function _n(e){let t=e??`idle`;return gn.has(t)?t:`idle`}function $(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var vn=class{static async sendMessage(e,t,n){let r=s().backend,i=n?.conversationUrl??null,a=n?.sessionApiKey??null;if(r.kind===`cloud`){if(!i||!a){let[t]=await F([e]);i=t?.conversation_url?.trim()??null,a=t?.session_api_key?.trim()??null}if(!i||!a)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await g({backend:r,method:`POST`,hostOverride:o(i),path:`/api/conversations/${e}/events`,body:{...t,run:!0},authMode:`session-api-key`,sessionApiKey:a}),t}return await new h(l({conversationUrl:i,sessionApiKey:a})).sendEvent(e,t,{run:!0}),t}static async createConversation(e={}){let{initialUserMsg:t,conversationInstructions:n,plugins:i,metadata:a,workingDirOverride:o,workspaceMode:c,parentConversationId:d,agentType:f,sandboxId:p,agentProfileId:m,agentProfileKind:re}=e;if(s().backend.kind===`cloud`)return Te({initial_message:t?{role:`user`,content:[{type:`text`,text:t}]}:null,title:n??null,selected_repository:a?.selected_repository??null,selected_branch:a?.selected_branch??null,git_provider:a?.git_provider??null,plugins:i??null,parent_conversation_id:d??null,agent_type:f,sandbox_id:p??null,agent_profile_id:m??null,trigger:`gui`});let[g,ie]=await Promise.all([oe.getSettings(),se.listProfiles().catch(()=>void 0)]),_=Xt(g.title_llm_profile,ie),ae=E(),v=s().backend.host,y=await O(o??ne(ae,v)),ce=o?y:await O(te(v)),b=c??(o?`local_repo`:`new_worktree`),x=await Jt({settings:g,query:t,conversationInstructions:n,plugins:i,conversationId:ae,parentConversationId:d,workingDir:y,hooksProjectDir:ce,worktree:b===`new_worktree`,agentProfileId:m,agentProfileKind:re,titleLlmProfile:_}),S=await r(),C=await new h(l({timeout:Qt})).createConversation({...x,...S?{user_id:S}:{}}),w=ee();if(!w)throw new u;return(a?.selected_repository||o)&&M(C.id,{selected_repository:a?.selected_repository??null,selected_branch:a?.selected_branch??null,git_provider:a?.git_provider??null,selected_workspace:o??null,workspace_mode:b}),{id:C.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:C.id,agent_server_url:w.host,request:{initial_message:x.initial_message,plugins:i??null},created_at:C.created_at,updated_at:C.updated_at}}static async createLocalPlanningConversation(e,t){if(s().backend.kind===`cloud`)throw Error(`Local planning conversations require a local backend.`);let[n]=await this.batchGetAppConversations([e]),r=await Kt({workingDir:n?.workspace?.working_dir??d(),parentConversationId:e,parentActiveProfileName:n?.agent_kind===`openhands`?n?.active_profile??null:null,parentAgentProfileId:n?.launched_agent_profile?.agent_profile_id??null,initialMessage:t}),i=await new h(l()).createConversation(r);return xe(e,{local_planning_conversation_id:i.id}),B(i)}static async getLocalPlanningConversationIds(e){if(s().backend.kind===`cloud`)return[];let t=new Set;try{let[n]=await this.batchGetAppConversations([e]),r=n?.sub_conversation_ids??[];if(r.length>0){let n=await this.batchGetAppConversations(r);for(let r of n)r&&tt(r,e)&&t.add(r.id)}}catch(t){console.warn(`Failed to read sub-conversations of ${e}`,t)}let n=j(e)?.local_planning_conversation_id;return n&&t.add(n),[...t]}static async getStartTask(e){return s().backend.kind===`cloud`?Pe(e):null}static async getVSCodeUrl(e,t,n){let r=await this.resolveConversationWorkingDir(e);return{vscode_url:await new f(l({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async getVSCodeStatus(e,t){return new f(l({conversationUrl:e,sessionApiKey:t})).getStatus()}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??d()}static async batchGetAppConversations(e){return e.length===0?[]:s().backend.kind===`cloud`?F(e):mn(await new h(l()).getConversations(e)).map(e=>B(e))}static async updateConversationPublicFlag(e,t){if(s().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return Oe(e,t)}static async updateConversationRepository(e,t,n,r){t?M(e,{...j(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):N(e);let[i]=await this.batchGetAppConversations([e]);return $(i,e)}static async readConversationFile(e,t){if(s().backend.kind===`cloud`)return Me(e,fn(t??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let n=await this.resolveConversationWorkingDir(e),r=fn(t??`${n}/.agents_tmp/PLAN.md`,n);return new m(l()).downloadTextFile(r)}static async downloadConversation(e){return s().backend.kind===`cloud`?Ee(e):new m(l()).downloadTrajectory(e)}static async getHooks(e){return Yt()}static async getRuntimeConversation(e,t,n){let r=pn(await new h(l({conversationUrl:t,sessionApiKey:n})).getConversation(e));return{id:r.id,title:r.title?.trim()?r.title:ft(r.id),metrics:rn(r.metrics),created_at:r.created_at,updated_at:r.updated_at,status:_n(r.execution_status),stats:r.stats??{usage_to_metrics:{}}}}static async condenseConversation(e,t,n){let r=s().backend;if(r.kind===`cloud`&&t){await g({backend:r,method:`POST`,hostOverride:o(t),path:`/api/conversations/${e}/condense`,authMode:`session-api-key`,sessionApiKey:n});return}await new h(l({conversationUrl:t,sessionApiKey:n})).condenseConversation(e)}static async searchConversations(e=20,t){return s().backend.kind===`cloud`?we(e,t):pt(hn(await new h(l()).searchConversations({limit:e,page_id:t,sort_order:ie.UPDATED_AT_DESC})))}static async deleteConversation(e){if(s().backend.kind===`cloud`){await De(e),N(e);return}let t=await this.getLocalPlanningConversationIds(e),n=new h(l());await Promise.all(t.map(async e=>{try{await n.deleteConversation(e)}catch(t){console.warn(`Failed to delete planning conversation ${e}`,t)}N(e)})),await n.deleteConversation(e),N(e)}static async updateConversationTitle(e,t){if(s().backend.kind===`cloud`)return ke(e,t);await new h(l()).updateConversation(e,{title:t});let[n]=await this.batchGetAppConversations([e]);return $(n,e)}static async updateConversationTags(e,t){await new h(l()).updateConversation(e,{tags:t});let[n]=await this.batchGetAppConversations([e]);return $(n,e)}static async forkConversation(e,t,n){if(s().backend.kind===`cloud`)throw Error(`Branching a conversation isn't supported on the cloud backend yet.`);let r=await new h(l()).forkConversation(e,{from_event_id:t,...n?{title:n}:{}}),i=j(e);return i&&M(r.id,i),r}static async getEventParentId(e,t){return(await new h(l()).getEvent(e,t)).parent_id??void 0}static async switchProfile(e,t){let{backend:n}=s();if(n.kind===`cloud`){if(!e){await se.activateProfile(t);return}await g({backend:n,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_profile`,body:{profile_name:t}});return}if(!e){await new p(l()).activateProfile(t);return}let r=l(),i=new h(r),a=await new p(r).getProfile(t,{exposeSecrets:`encrypted`}),o=typeof a.config.model==`string`?a.config.model:``;if(!o)throw Error(`Profile '${t}' has no model.`);await J({llm:a.config}),await i.switchLLM(e,{...a.config,model:o,stream:!0,usage_id:`profile:${t}:${E()}`})}static async switchAcpModel(e,t){let{backend:n}=s();if(n.kind===`cloud`){await g({backend:n,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_acp_model`,body:{model:t}});return}await new h(l()).switchAcpModel(e,t)}};export{O as A,Ce as C,xe as D,j as E,M as O,Ae as S,je as T,Le as _,St as a,Pe as b,We as c,Ve as d,L as f,Re as g,I as h,bt as i,E as j,ye as k,He as l,ze as m,H as n,nt as o,Ge as p,yt as r,et as s,vn as t,Ue as u,F as v,Me as w,Ne as x,Te as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-Cyuzqnbw.js";import{St as n,yt as r}from"./vendor-styling-Ck5D_A2Q.js";import{U as i,f as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{t as o}from"./useTranslation-CCgUjPJF.js";import{G as s,ct as c,dt as l,q as u,st as d}from"./active-backend-context-BnH4-L8h.js";import{K as f,t as p}from"./utils-BgLSZdyy.js";import{a as m,i as h,n as g,r as _,t as v}from"./use-acp-credential-form-ychoGqjC.js";import{n as y}from"./use-settings-C2KKQKVC.js";import{t as ee}from"./use-save-settings-Dapkf4cC.js";import{h as te}from"./form-control-classes-Dbq-7YP_.js";import{t as ne}from"./brand-button-CUMfjb99.js";import{t as re}from"./settings-dropdown-input-DBvsZ7-Q.js";import{t as ie}from"./settings-input-dVuzapBA.js";import{c as b,i as ae,n as x,o as S,s as oe,t as se}from"./acp-providers-DcY_mKYa.js";import{_ as ce,g as le,h as ue,n as de,o as fe,v as pe}from"./schema-field-Y3F8JvXd.js";import{r as C}from"./typography-DgcLGdHk.js";import{t as me}from"./settings-switch-DDd1cQ8t.js";var w=e(n(),1),T=r();function he({form:e,providerKey:t}){let{t:n}=o(`openhands`),{fields:r,values:i,setValue:a,secretExists:s,conflicts:c,credentialsConfigured:l}=e,{status:u,isChecking:d}=g(t),p=b(t)??t;return r.length===0?null:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,T.jsx)(C.Text,{className:`text-sm font-medium text-white`,children:n(f.SETTINGS$ACP_CREDENTIALS_TITLE)}),(0,T.jsx)(C.Text,{className:`text-xs text-[#717888]`,children:n(f.SETTINGS$ACP_CREDENTIALS_DESCRIPTION)})]}),(0,T.jsx)(h,{status:u,isChecking:d,credentialsConfigured:l,providerName:p,testIdPrefix:`settings-acp-auth`}),(0,T.jsx)(`div`,{className:`flex flex-col gap-5`,children:r.map(e=>(0,T.jsx)(_,{field:e,value:i[e.name]??``,onChange:t=>a(e.name,t),alreadySet:s(e.name),testId:`settings-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,T.jsx)(m,{conflicts:c})]})}var E=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(`op`in e&&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(`op`in e&&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(`comment`in e&&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(` `)}})),D=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[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(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 _(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 _=!1;return m.map(function(n){var i=n[0];if(!i||_)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 g(t,``,n)}for(m=0;m<i.length;m++){var v=i.charAt(m);if(p||=!a&&(v===`*`||v===`?`),o)d+=v,o=!1;else if(a)v===a?a=!1:a==c?d+=v:v===f?(m+=1,v=i.charAt(m),v===l||v===f||v===u?d+=v:d+=f+v):v===u?d+=h():d+=v;else if(v===l||v===c)a=v;else if(r.test(v))return{op:i};else if(s.test(v)){_=!0;var y={comment:e.slice(n.index+m+1)};return d.length?[d,y]:[y]}else v===f?o=!0:v===u?d+=h():d+=v}return p?{op:`glob`,pattern:d}:d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}})),{quote:O}=e(t((e=>{e.quote=E(),e.parse=D()}))(),1);function k(e){let t=[],n=0,r=``,i=!1;for(;n<e.length;){let a=e[n];if(a===` `||a===` `||a===`
|
|
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 A=/[\s"'\\$`&|;<>(){}*?#!~[\]]/;function j(e){return e.map(e=>A.test(e)||e===``?O([e]):e).join(` `)}var M=`1.31.0`;function ge(){let e=u();if(!e)return!0;let t=s(e,M);return t===null?!0:t>=0}var N={hideTitle:!0},_e=`enable_sub_agents`,ve=`enable_switch_llm_tool`,ye=`tool_concurrency_limit`,be=`npx -y <package-name>`,P=`__custom_model__`,xe={agentType:`openhands`,commandText:``,acpModel:``,isCustomAcpModel:!1};function Se(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function F(e,t){let n=k(e).join(` `);for(let e of t)if(n===e.default_command.join(` `))return e.key;return se}function Ce(e){return e?.find(e=>e.key===_e)}function we(e,t){return typeof e==`boolean`?e:t?.default===!0}function Te(e,t){return typeof e==`boolean`?e:t?.default===!0}function Ee(e,t){return e?.available_models?.some(({id:e})=>e===t.trim())??!1}function De(e){let{isAcp:t,selectedPreset:n,isDefaultProviderCommand:r,commandTokens:i,acpModel:a,subAgentsEnabled:o,switchLlmToolField:s,switchLlmToolEnabled:c,switchLlmToolSupportedOnProfile:l,toolConcurrencyField:u,toolConcurrency:d}=e;if(t){let e=r&&n!==`custom`;return{agent_kind:`acp`,acp_server:n,acp_model:a.trim()||null,acp_command:e?null:j(i)||null,acp_args:null}}let f={agent_kind:`openhands`,enable_sub_agents:o};if(s&&l&&(f.enable_switch_llm_tool=c),u){let e=fe(u,d),t=typeof u.default==`number`?u.default:1;f.tool_concurrency_limit=e==null?t:Number(e)}return f}function Oe({embedded:e=!1,agentSettingsOverride:t=null,onSaveControlChange:n}={}){let{t:r}=o(`openhands`),{data:i,isLoading:a}=y(),s=t??i?.agent_settings??null,{mutate:u,isPending:m}=ee(),{data:h}=pe(i?.agent_settings_schema),g=w.useMemo(()=>h?.sections.flatMap(e=>e.fields),[h]),_=Ce(g),b=w.useMemo(()=>we(s?.[_e],_),[_,s]),[E,D]=(0,w.useState)(b),O=g?.find(e=>e.key===ve),A=w.useMemo(()=>Te(s?.[ve],O),[O,s]),[M,N]=(0,w.useState)(A),Oe=ge(),ke=!!O&&(!e||Oe),I=g?.find(e=>e.key===ye),L=w.useMemo(()=>{if(!I)return``;let e=s?.[ye];return ue(I,e)},[I,s]),[R,Ae]=(0,w.useState)(L),[z,je]=(0,w.useState)(`openhands`),[B,V]=(0,w.useState)(``),[H,U]=(0,w.useState)(``),[Me,W]=(0,w.useState)(!1),Ne=z===`acp`?F(B,x):null,G=v(Ne&&Ne!==`custom`?Ne:null),Pe=(0,w.useRef)(null),Fe=(0,w.useRef)(null),K=(0,w.useRef)(``),[q,J]=(0,w.useState)(xe);(0,w.useEffect)(()=>{let e=t??i?.agent_settings??null;if(!e&&!i)return;let n=t??i;if(Pe.current!==n)if(Pe.current=n,e?.agent_kind===`acp`){je(`acp`);let t=e?.acp_server,n=typeof t==`string`?t:void 0,r=oe(n),i=Se(e?.acp_command),a=[...i.length>0?i:r?.default_command??[],...Se(e?.acp_args)],o=a.length>0?j(a):``;V(o),Fe.current=n??null,K.current=o;let s=e?.acp_model,c=typeof s==`string`?s.trim():``,l=c||S(n)||``,u=!!c&&(!r||!Ee(r,c));U(l),W(u),J({agentType:`acp`,commandText:o,acpModel:l,isCustomAcpModel:u})}else je(`openhands`),V(``),U(``),Fe.current=null,K.current=``,W(!1),J(xe)},[i,t]),(0,w.useEffect)(()=>{D(b)},[b]),(0,w.useEffect)(()=>{N(A)},[A]),(0,w.useEffect)(()=>{Ae(L)},[L]);let Ie=(0,w.useRef)(()=>({agent_kind:`openhands`,enable_sub_agents:!1})),Le=(0,w.useCallback)(()=>Ie.current(),[]),Re=(0,w.useRef)(G);Re.current=G;let ze=(0,w.useCallback)(e=>Re.current.save(e),[]),Be=(0,w.useCallback)(()=>Re.current.reset(),[]),Ve=z===`acp`&&k(B).length===0,He=z!==q.agentType||(z===`acp`?B!==q.commandText||H!==q.acpModel||Me!==q.isCustomAcpModel:E!==b||M!==A||R!==L),Ue=G.isDirty,We=He||Ue;if((0,w.useEffect)(()=>{!e||!n||n({agentType:z,isValid:!Ve,isDirty:We,buildAgentProfileFields:Le,credentials:{isDirty:Ue,save:ze,reset:Be}})},[e,n,z,Ve,We,Ue,Le,ze,Be]),a)return null;let Y=z===`acp`,X=k(B),Ge=Y&&X.length===0,Z=F(B,x),Q=oe(Z),Ke=Q?.available_models??[],qe=Ke.length>0,Je=Ee(Q,H),Ye=Me||!Je?P:H,Xe=!!Q&&X.join(` `)===Q.default_command.join(` `),Ze=j(x[0]?.default_command??[])||be;Ie.current=()=>De({isAcp:Y,selectedPreset:Z,isDefaultProviderCommand:Xe,commandTokens:X,acpModel:H,subAgentsEnabled:E,switchLlmToolField:O,switchLlmToolEnabled:M,switchLlmToolSupportedOnProfile:Oe,toolConcurrencyField:I,toolConcurrency:R});let $=m||G.isSaving,Qe=async()=>{if(G.isDirty){if(!await G.save({silent:He}))return;G.reset()}if(He)if(Y){let e=!!(Q&&Xe),t=Fe.current,n=B===K.current,i=!!t&&t!==`custom`&&!x.some(e=>e.key===t),a=Y&&n&&i,o=ae(a?t:Q&&Xe?Q.key:se,{command:e?[]:X,model:H.trim()||void 0,allowUnknownServer:a});if(!o)return;u({agent_settings_diff:o},{onError:e=>{d(l(e)||r(f.ERROR$GENERIC))},onSuccess:()=>{c(r(f.SETTINGS$SAVED)),J({agentType:z,commandText:B,acpModel:H,isCustomAcpModel:Me}),K.current=B}})}else{let e={agent_kind:`openhands`,enable_sub_agents:E};if(O&&(e[ve]=M),I){let t;try{t=fe(I,R)}catch(e){d(e instanceof Error?e.message:r(f.ERROR$GENERIC));return}t!=null&&(e[ye]=t)}u({agent_settings_diff:e},{onError:e=>{d(l(e)||r(f.ERROR$GENERIC))},onSuccess:()=>{c(r(f.SETTINGS$SAVED)),J({agentType:`openhands`,commandText:``,acpModel:``,isCustomAcpModel:!1})}})}},$e=_?ce(r,_.key,_.label):r(f.SCHEMA$ENABLE_SUB_AGENTS$LABEL),et=_?le(r,_.key,_.description):r(f.SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION),tt=O?ce(r,O.key,O.label):r(f.SCHEMA$ENABLE_SWITCH_LLM_TOOL$LABEL),nt=O?le(r,O.key,O.description):r(f.SCHEMA$ENABLE_SWITCH_LLM_TOOL$DESCRIPTION);return(0,T.jsxs)(`div`,{"data-testid":`agent-settings-screen`,className:`flex flex-col gap-6 pb-8 max-w-2xl`,children:[!e&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(C.H2,{className:`mb-2`,children:r(f.SETTINGS$NAV_AGENT)}),(0,T.jsx)(C.Paragraph,{className:`text-sm text-[#A3A3A3]`,children:r(f.SETTINGS$AGENT_PAGE_DESCRIPTION)})]}),(0,T.jsx)(re,{testId:`agent-type-selector`,name:`agent-type`,label:r(f.SETTINGS$NAV_AGENT),items:[{key:`openhands`,label:r(f.SETTINGS$AGENT_TYPE_OPENHANDS)},{key:`acp`,label:r(f.SETTINGS$AGENT_TYPE_ACP)}],selectedKey:z,onSelectionChange:e=>{if(!e)return;let t=e;if(je(t),t===`acp`&&!B){let e=x[0];e&&(V(j(e.default_command)),U(S(e.key)??``),W(!1))}else t===`openhands`&&W(!1)}}),!Y&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(me,{testId:`agent-settings-enable-sub-agents`,isToggled:E,onToggle:e=>{D(e)},children:$e}),et?(0,T.jsx)(C.Paragraph,{className:p(`pl-12`,`text-tertiary-alt text-xs leading-5`),children:et}):null]}),!Y&&ke?(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(me,{testId:`agent-settings-enable-switch-llm-tool`,isToggled:M,onToggle:e=>{N(e)},children:tt}),nt?(0,T.jsx)(C.Paragraph,{className:p(te,`text-tertiary-alt text-xs leading-5`),children:nt}):null]}):null,!Y&&I?(0,T.jsx)(de,{field:I,value:R,isDisabled:$,onChange:Ae}):null,Y&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(re,{testId:`agent-preset-selector`,name:`agent-preset`,label:r(f.SETTINGS$AGENT_PRESET),items:[...x.map(e=>({key:e.key,label:e.display_name})),{key:`custom`,label:r(f.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Z,onSelectionChange:e=>{if(!e)return;let t=String(e),n=oe(t);n?(V(j(n.default_command)),U(S(t)??``),W(!1)):t===`custom`&&(V(``),U(``),W(!0))}}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,T.jsx)(C.Text,{className:`text-sm`,children:r(f.SETTINGS$AGENT_COMMAND)}),(0,T.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:B,placeholder:Ze,onChange:e=>{let t=e.target.value,n=F(B,x),r=F(t,x);r!==n&&(U(S(r)??``),W(!1)),V(t)}}),(0,T.jsx)(C.Text,{className:`text-xs text-[#717888]`,children:r(f.SETTINGS$AGENT_COMMAND_HINT)})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[qe&&(0,T.jsx)(re,{testId:`agent-model-selector`,name:`agent-model`,label:r(f.SETTINGS$AGENT_MODEL),items:[...Ke.map(e=>({key:e.id,label:e.label})),{key:P,label:r(f.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Ye,onSelectionChange:e=>{if(!e)return;let t=String(e);t===P?(W(!0),U(``)):(W(!1),U(t))}}),Ye===P&&(0,T.jsx)(ie,{testId:`agent-model-input`,label:r(qe?f.SETTINGS$AGENT_CUSTOM_MODEL:f.SETTINGS$AGENT_MODEL),type:`text`,className:`w-full`,value:H,showOptionalTag:!0,onChange:e=>{U(e)}}),(0,T.jsx)(C.Text,{className:`text-xs text-[#717888]`,children:r(f.SETTINGS$AGENT_MODEL_HINT)})]})]}),Y&&Z!==`custom`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`hr`,{className:`border-[#3D4046]`}),(0,T.jsx)(he,{form:G,providerKey:Z})]}),!e&&(0,T.jsx)(`div`,{children:(0,T.jsx)(ne,{testId:`agent-save-button`,type:`button`,variant:`primary`,isDisabled:$||!We||Ge,onClick:Qe,children:r($?f.SETTINGS$SAVING:f.SETTINGS$SAVE_CHANGES)})})]})}var ke=i(function(){return(0,T.jsx)(a,{to:`/settings/agents`,replace:!0})});export{k as i,ke as n,N as r,Oe as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./agent-settings-BF8hM6wb.js";export{e as default,t as handle};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{B as r,H as i,U as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{l as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as s}from"./useQuery-DAAacS7O.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{Q as l,ct as u,n as d,st as f}from"./active-backend-context-BnH4-L8h.js";import{K as p,a as m,t as h}from"./utils-BgLSZdyy.js";import{a as g,c as _,n as v}from"./agent-server-client-options-EHB23gyx.js";import{a as y,b,d as x,i as S,l as C,m as w,n as T,o as E,r as D,s as O,u as k,x as ee}from"./kebab-menu-item-content-SCJBwZnp.js";import{r as te}from"./context-menu-list-item-Cm7-7Y-7.js";import{b as A}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-Z0lly3FE.js";import{t as ne}from"./proxy-XP6U1Dhv.js";import{n as j}from"./organization-service.api-B5CvmnYQ.js";import{C as re,P as M,n as N,t as P}from"./use-tracking-j4uo9VEW.js";import{t as ie}from"./use-settings-C2KKQKVC.js";import{r as F}from"./modal-classes-B0b9eiL8.js";import{t as I}from"./brand-button-CUMfjb99.js";import{n as L}from"./navigation-context-CQZwH_tC.js";import{n as R}from"./use-create-conversation-i_PdFdIs.js";import{t as z}from"./u-edit-DAkcF52u.js";import{t as B}from"./terminal-BUpID2wS.js";import{t as V}from"./toggle-switch-B2uXaAUS.js";import{n as H,t as ae}from"./use-automation-health-U99vvHxx.js";import{t as U}from"./automation-C_eCrGyP.js";import{i as oe,l as se,o as ce,r as le,u as ue}from"./use-automations-Bq5hVuv0.js";import{t as de}from"./use-user-conversation-5UFqMoO4.js";import{n as W}from"./api-error-message-BXo0lCI5.js";import{t as fe}from"./x-mark-BopmFoBq.js";import{n as pe,t as me}from"./link-external-BNZzCM1I.js";import{t as he}from"./edit-automation-modal-D_JWSmxT.js";import{n as ge,t as _e}from"./use-automation-permissions-Buus0R6h.js";import{n as ve,t as ye}from"./trash-Ckh7yCaB.js";import{n as be,r as xe,t as Se}from"./error-state-Cf8LRuuY.js";import{i as Ce,r as we,t as Te}from"./automation-export-BJsfi7n2.js";import{a as G,i as Ee,n as K,r as q,t as De}from"./cog-CAEugqtV.js";var J=e(t());function Oe(e){let{backend:t,orgId:n}=d(),r=t.kind===`cloud`&&!!n&&!!e;return s({queryKey:[`cloud-org-member`,t.id,n,e,t.connectionRevision??0],queryFn:()=>j(n,e,t),enabled:r,staleTime:1e3*60*5,retry:!1,meta:{disableToast:!0}})}var Y=n(),ke=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,Y.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 Ae({active:e}){let{t}=c(`openhands`);return(0,Y.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:h(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?p.AUTOMATIONS$DETAIL$ACTIVE:p.AUTOMATIONS$DETAIL$INACTIVE)})}function je({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:a,onRunNow:o,isRunningNow:s=!1,canManage:l=!0,canToggle:u=l}){let{t:d}=c(`openhands`),f=[{label:d(p.AUTOMATIONS$EXPORT),icon:(0,Y.jsx)(ke,{className:`size-4`}),onClick:i},{label:d(p.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,Y.jsx)(ke,{className:`size-4`}),onClick:a},...l&&n?[{label:d(p.AUTOMATIONS$EDIT),icon:(0,Y.jsx)(z,{className:`size-4`}),onClick:n}]:[],...u?[{label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),icon:(0,Y.jsx)(T,{className:`size-4`}),onClick:t}]:[],...l?[{label:d(p.AUTOMATIONS$DELETE),icon:(0,Y.jsx)(ye,{className:`size-4`}),onClick:r}]:[]];return(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,Y.jsx)(Ae,{active:e.enabled})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&o&&(0,Y.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:s||!e.enabled,onClick:o,children:[(0,Y.jsx)(D,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),d(s?p.AUTOMATIONS$STARTING:p.AUTOMATIONS$RUN_NOW)]}),u&&(0,Y.jsx)(V,{enabled:e.enabled,label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),onToggle:t}),(0,Y.jsx)(ve,{items:f})]})]})})}var Me=240,Ne=`max-h-60`;function Pe({prompt:e}){let{t}=c(`openhands`),[n,r]=J.useState(!1),[i,a]=J.useState(!1),o=J.useRef(null),s=i&&!n;return J.useLayoutEffect(()=>{let e=o.current;if(!e)return;let t=()=>{a(e.scrollHeight>Me)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,Y.jsx)(q,{icon:(0,Y.jsx)(B,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PROMPT),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`p`,{ref:o,className:h(`whitespace-pre-wrap text-sm leading-6 text-content`,s&&h(Ne,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),s?(0,Y.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,Y.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?p.COMMON$VIEW_LESS:p.COMMON$VIEW_MORE)}):null]})})}var Fe=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.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`})}),Ie=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Y.jsx)(`path`,{d:`M12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4ZM6 8C6 4.68629 8.68629 2 12 2C15.3137 2 18 4.68629 18 8C18 11.3137 15.3137 14 12 14C8.68629 14 6 11.3137 6 8ZM8 18C6.34315 18 5 19.3431 5 21C5 21.5523 4.55228 22 4 22C3.44772 22 3 21.5523 3 21C3 18.2386 5.23858 16 8 16H16C18.7614 16 21 18.2386 21 21C21 21.5523 20.5523 22 20 22C19.4477 22 19 21.5523 19 21C19 19.3431 17.6569 18 16 18H8Z`,fill:`currentColor`})}),Le=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.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 Re({branch:e}){return(0,Y.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 ze=60;function Be({filter:e}){let{t}=c(`openhands`),[n,r]=(0,J.useState)(!1),i=e.length>ze;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:i&&!n?`${e.slice(0,ze)}…`:e}),i&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?p.SETTINGS$SKILLS_SHOW_LESS:p.SETTINGS$SKILLS_SHOW_MORE)})]})}function Ve({automation:e,runsAs:t}){let{t:n}=c(`openhands`),r=e.trigger.type===`event`,i=e.trigger.schedule??``;e.trigger.schedule_human&&(i=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let a=n(r?p.AUTOMATIONS$DETAIL$TRIGGER_EVENT:p.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(De,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Ee,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,Y.jsx)(Re,{branch:e.branch})]})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(y,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$TRIGGER),children:a}),!r&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Fe,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$SCHEDULE),children:i}),r&&e.trigger.source&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),r&&e.trigger.on&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(me,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_TYPE),children:w(e.trigger.on)}),r&&e.trigger.filter&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(pe,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,Y.jsx)(Be,{filter:e.trigger.filter})}),t&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Ie,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$RUNS_AS),children:(0,Y.jsx)(`span`,{className:`break-all`,children:t})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(ee,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$MODEL),children:e.model??n(p.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Le,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var He=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.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 Ue({name:e}){return(0,Y.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 We({plugins:e}){let{t}=c(`openhands`);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(He,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PLUGINS),children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,Y.jsx)(Ue,{name:e},e))})})}var Ge=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.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 Ke({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=c(`openhands`),i=r.language;return(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ge,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,Y.jsx)(K,{icon:(0,Y.jsx)(Fe,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$CREATED),children:C(e,i)}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(H,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$LAST_RUN),children:t?k(t,i,n):n(p.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var qe=100,Je=[`run_id`,`automation_id`,`automation_name`,`trigger`,`start_time`,`end_time`,`duration_seconds`,`status`,`conversation_id`,`conversation_url`,`error`,`cost`,`phase`];function Ye(e,t){return`${e.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||e.id}.activity-log.${t}`}function Xe(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Ze(e){let t=[Je.join(`,`)];for(let n of e){let e=Je.map(e=>{let t=n[e];return t==null?``:Xe(e===`trigger`?JSON.stringify(t):String(t))});t.push(e.join(`,`))}return`${t.join(`
|
|
2
|
-
`)}\n`}function Qe(e,t){if(!e)return null;let n=`/conversations/${e}`;return t?`${t.replace(/\/$/,``)}${n}`:n}function $e(e,t,n){let r=e.started_at||null,i=e.completed_at,a=null;return r&&i&&(a=(new Date(i).getTime()-new Date(r).getTime())/1e3),{run_id:e.id,automation_id:t.id,automation_name:t.name,trigger:t.trigger,start_time:r,end_time:i,duration_seconds:a,status:e.status,conversation_id:e.conversation_id,conversation_url:Qe(e.conversation_id,n),error:e.error_detail,cost:e.cost??null,phase:e.phase_code?.trim()||e.phase_label?.trim()||null}}async function et(e,t){let n=[],r=0,i=1/0;for(;r<i;){let a=await N.listAutomationRuns(e.id,{limit:qe,offset:r});for(let r of a.runs)n.push($e(r,e,t));if(i=a.total,r+=a.runs.length,a.runs.length===0)break}return n}async function tt(e){let{automation:t,format:n,conversationBaseUrl:r}=e,i=await et(t,r);if(n===`json`){m(new Blob([`${JSON.stringify({runs:i,total:i.length},null,2)}\n`],{type:`application/json`}),Ye(t,`json`));return}m(new Blob([Ze(i)],{type:`text/csv;charset=utf-8`}),Ye(t,`csv`))}var nt=20;function rt(e){return e.kind===`BashOutput`}var it=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<nt;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=>{rt(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=_().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),ne({backend:r,method:`GET`,hostOverride:g(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new A(v({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},at=[`bash-command-logs`];function ot(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 st(e){let t=o.isAxiosError(e)?e.response?.status:l(e)?e.status:void 0;if(t!==void 0)return t===404||t>=500?`unreachable`:null;if(o.isAxiosError(e)||e instanceof TypeError)return`unreachable`;if(e instanceof Error){let t=e.cause instanceof Error?e.cause.name:null;if(e.name===`AbortError`||e.name===`TimeoutError`||t===`AbortError`||t===`TimeoutError`)return`unreachable`}return null}function ct(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=d(),a=de(r?t??null:null),o=a.data,c=o?.conversation_url??null,l=o?.session_api_key??null,u=i.backend.kind===`cloud`,f=a.isFetched,p=null,m=!1;u&&f&&(o?p=ot(o.sandbox_status)??(o.conversation_url?null:`missing`):m=!0);let h=r&&!!n&&(u?!!c:!0)&&!p&&!m,g=s({queryKey:[...at,n,c,l,i.backend.id,i.orgId],queryFn:()=>it.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?st(g.error):null,v=p??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:m,sandboxIssue:v}}var lt=4e3;function ut(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function dt({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?ut(a,lt):`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(`
|
|
3
|
-
`)}function ft({run:e,automation:t,stderr:n}){let{t:r}=c(`openhands`),{navigate:i}=L(),a=R();return(0,Y.jsx)(I,{testId:`debug-automation-button`,type:`button`,variant:`primary`,onClick:()=>{if(a.isPending)return;let r=dt({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(p.AUTOMATIONS$DETAIL$DEBUG_WITH_OPENHANDS)})}var pt={missing:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function mt(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 X(e){return typeof e==`string`?e.trim()||null:typeof e==`number`||typeof e==`boolean`?String(e):null}function ht(e){if(!e)return null;let t=X(e.formatted_detail)??X(e.detail),n=[X(e.phase),X(e.kind),X(e.source),X(e.operation),X(e.code),X(e.status_code)].filter(Boolean);return t&&n.length>0?`${t} (${n.join(` · `)})`:t||(n.length>0?n.join(` · `):JSON.stringify(e))}function gt({run:e}){let{t}=c(`openhands`);if(!e)return null;let n=b(e),r=n.taskOutcome?.outcomeSummary??null,i=n.customTaskMetadataText,a=e.status===U.COMPLETED||n.taskOutcome?n.badgeStatus:null,o=e.error_detail?.trim()||null,s=ht(e.status_detail),l=o||s;return(0,Y.jsxs)(`dl`,{className:`mt-4 grid gap-3 rounded-lg border border-[var(--oh-border)] bg-black/20 p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-center`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$RUN_LABEL)}),(0,Y.jsx)(`dd`,{children:(0,Y.jsx)(`span`,{className:`inline-flex rounded-md bg-surface-raised px-2 py-0.5 font-mono text-[10px] font-medium text-muted`,children:e.status})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-start`,children:[(0,Y.jsx)(`dt`,{className:`pt-0.5 text-muted`,children:t(p.AUTOMATIONS$DETAIL$TASK_LABEL)}),(0,Y.jsxs)(`dd`,{className:`min-w-0 space-y-2`,children:[a?(0,Y.jsx)(S,{status:a,compact:!0}):null,r?(0,Y.jsx)(`p`,{className:`break-words text-content`,children:r}):i?(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$CUSTOM_TASK_METADATA)}):(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$NO_TASK_OUTCOME)}),i?(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$TASK_METADATA)}),(0,Y.jsx)(`pre`,{"data-testid":`automation-task-metadata`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--oh-border)] bg-black/30 p-2 font-mono text-[11px] leading-4 text-content`,children:i})]}):null]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-start`,children:[(0,Y.jsx)(`dt`,{className:`pt-0.5 text-muted`,children:t(p.AUTOMATIONS$DETAIL$SYSTEM_LABEL)}),(0,Y.jsx)(`dd`,{className:`min-w-0 space-y-1 break-words text-content`,children:l?(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(`p`,{children:[(0,Y.jsxs)(`span`,{className:`text-muted`,children:[t(p.COMMON$ERROR),`:`,` `]}),o]}):null,s?(0,Y.jsxs)(`p`,{children:[(0,Y.jsxs)(`span`,{className:`text-muted`,children:[t(p.AUTOMATIONS$DETAIL$STATUS_DETAIL),`:`,` `]}),s]}):null]}):(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$NO_SYSTEM_ISSUES)})})]})]})}function _t({conversationId:e,bashCommandId:t,isOpen:n,onClose:r,run:i,automation:a}){let{t:o}=c(`openhands`),[s,l]=(0,J.useState)(`stdout`),{data:u,isFetching:d,isResolvingConversation:f,sandboxIssue:m,conversationMissing:g,error:_}=ct({conversationId:e,bashCommandId:t,enabled:n});(0,J.useEffect)(()=>{n&&l(`stdout`)},[n,t]),(0,J.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,J.useMemo)(()=>u?{stdout:mt(u,`stdout`),stderr:mt(u,`stderr`)}:{stdout:``,stderr:``},[u]);if(!n)return null;let b=f||d&&!u,x=!t,S=s===`stdout`?v:y,C=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,w=`border-[var(--oh-primary)] text-white`,T=`border-transparent text-muted hover:text-content`;return(0,Y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":o(p.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,Y.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,Y.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":o(p.AUTOMATIONS$CANCEL),children:(0,Y.jsx)(fe,{className:`size-5`})}),(0,Y.jsx)(`h2`,{className:h(`pr-8`,F),children:o(p.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,Y.jsx)(gt,{run:i}),(0,Y.jsxs)(`div`,{role:`tablist`,"aria-label":o(p.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:s===`stdout`?0:-1,onClick:()=>l(`stdout`),className:`${C} ${s===`stdout`?w:T}`,children:o(p.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:s===`stderr`?0:-1,onClick:()=>l(`stderr`),className:`${C} ${s===`stderr`?w:T}`,children:o(p.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${s}`,"aria-labelledby":`run-logs-tab-${s}`,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:[x&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!x&&g&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!x&&!g&&m&&(0,Y.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${m}`,className:`text-muted italic`,children:o(pt[m])}),!x&&!g&&!m&&b&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!x&&!g&&!m&&!b&&_&&!u&&(0,Y.jsxs)(`p`,{className:`text-danger`,children:[o(p.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(_)]}),!b&&!m&&u&&(0,Y.jsx)(`pre`,{"data-testid":`run-logs-output-${s}`,className:`whitespace-pre-wrap break-words ${s===`stderr`?`text-danger`:`text-content`}`,children:S.length>0?S:(0,Y.jsx)(`span`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]}),i?.status===U.FAILED&&(0,Y.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,Y.jsx)(ft,{run:i,automation:a,stderr:y})})]})]})}function vt(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function yt(e){return`/conversations/${e}`}function bt(e){return typeof e!=`number`||!Number.isFinite(e)?null:`$${e.toFixed(4)}`}function xt({run:e,automation:t}){let{t:n,i18n:r}=c(`openhands`),i=!!e.conversation_id,a=!!e.bash_command_id,o=e.status===U.COMPLETED||e.status===U.FAILED||e.status===U.CANCELLED||e.status===U.SKIPPED,s=!i&&o,l=O(e.status),[u,d]=(0,J.useState)(!1),[f]=(0,J.useState)(()=>new Date().toISOString()),m=vt(x(e.started_at)?f:e.started_at,r.language),h=bt(e.cost),g=b(e),_=a?(0,Y.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(p.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:m}),title:n(p.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,Y.jsx)(B,{className:`size-4`})}):null,v=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-content`,children:m}),s&&(0,Y.jsx)(`span`,{className:`text-xs text-muted`,children:n(p.AUTOMATIONS$DETAIL$NO_CONVERSATION)})]}),g.summary?(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted`,children:g.summary}):null]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h&&(0,Y.jsx)(`span`,{"data-testid":`run-cost`,title:n(p.AUTOMATIONS$DETAIL$RUN_COST),className:`text-xs tabular-nums text-muted`,children:h}),_,l&&(0,Y.jsx)(E,{status:e.status,code:e.phase_code,label:e.phase_label,updatedAt:e.phase_updated_at,wide:!0}),(0,Y.jsx)(S,{status:g.badgeStatus})]})]});return(0,Y.jsxs)(Y.Fragment,{children:[i&&e.conversation_id?(0,Y.jsx)(`a`,{href:yt(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":n(p.AUTOMATIONS$DETAIL$VIEW_CONVERSATION_FOR_RUN,{timestamp:m}),children:v}):(0,Y.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:v}),a&&(0,Y.jsx)(_t,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:u,onClose:()=>d(!1),run:e,automation:t})]})}var Z=20,St=100;function Ct({automation:e,highlightedRunId:t=null}){let{t:n}=c(`openhands`),r=d(),{trackAutomationActivityLogExported:i}=P(),[a,o]=(0,J.useState)(Z),s=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1),{data:m,isLoading:g}=ue({id:e.id,limit:a,offset:0}),_=m?m.total>m.runs.length:!1,v=!g&&(m?.total??0)>0&&!l,y=async t=>{if(v){u(!0);try{await tt({automation:e,format:t,conversationBaseUrl:window.location.origin}),i({backendKind:r.backend.kind,format:t})}catch(e){f(W(e,n(p.AUTOMATIONS$DETAIL$EXPORT_ACTIVITY_LOG_ERROR)))}finally{u(!1)}}};return(0,J.useEffect)(()=>{if(!(!t||!m?.runs.length)){if(m.runs.findIndex(e=>e.id===t)<0){_&&a<St&&o(e=>e+Z);return}s.current?.scrollIntoView({behavior:`smooth`,block:`center`})}},[m?.runs,_,t,a]),(0,Y.jsxs)(`div`,{"data-testid":`automation-activity-log`,className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,Y.jsx)(`span`,{className:`size-4 text-muted`,children:(0,Y.jsx)(Ge,{className:`size-4`})}),(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:n(p.AUTOMATIONS$DETAIL$ACTIVITY_LOG)}),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-testid":`activity-log-export-json`,disabled:!v,onClick:()=>void y(`json`),className:`text-sm text-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:n(p.AUTOMATIONS$DETAIL$EXPORT_JSON)}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`activity-log-export-csv`,disabled:!v,onClick:()=>void y(`csv`),className:`text-sm text-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:n(p.AUTOMATIONS$DETAIL$EXPORT_CSV)})]})]}),g&&(0,Y.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,Y.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,Y.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!g&&m?.runs.length===0&&(0,Y.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:n(p.AUTOMATIONS$DETAIL$NO_RUNS)}),!g&&m&&m.runs.length>0&&(0,Y.jsxs)(`div`,{children:[m.runs.map((n,r)=>{let i=n.id===t;return(0,Y.jsx)(`div`,{ref:i?s:void 0,"data-testid":i?`automation-run-highlight-${n.id}`:void 0,className:h(r>0?`border-t border-[var(--oh-border)]`:``,i&&`bg-[var(--oh-focus)]/10`),children:(0,Y.jsx)(xt,{run:n,automation:e})},n.id)}),_&&(0,Y.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:n(p.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,Y.jsx)(`div`,{className:h(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,Y.jsx)(Q,{className:`h-5 w-40`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(Q,{className:`h-6 w-48`}),(0,Y.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,Y.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,Y.jsx)(Q,{className:`h-5 w-96`}),(0,Y.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,Y.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,Y.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,Y.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function wt(){let{t:e}=c(`openhands`);return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,Y.jsx)(xe,{className:`size-12 text-muted`}),(0,Y.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(p.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(p.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,Y.jsx)(`div`,{className:`mt-6`,children:(0,Y.jsx)(G,{})})]})}var Tt={id:``,name:``,prompt:null,trigger:{type:`cron`},enabled:!1,created_at:``,updated_at:``},Et=()=>{if(!M())throw new Response(null,{status:404,statusText:`Not Found`});return null},Dt=a(function(){let{t:e}=c(`openhands`),{automationId:t}=r(),[n]=i(),a=n.get(`run`),{navigate:o}=L(),[s,l]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),{data:_,isLoading:v,refetch:y}=ae(),b=_?.status===`ok`,x=d(),S=(0,J.useRef)(x.backend.id).current!==x.backend.id,{data:C,isLoading:w,isError:T,error:E,refetch:D}=se({id:t??``,enabled:b&&!S}),{trackPrebuiltAutomationEnabled:O,trackAutomationExported:k}=P(),ee=ce(),te=le(),A=oe(),{canManage:ne}=_e(),j=ge(C??Tt),M=Oe(C?.user_id),F=T&&ie(E)===404;if(v)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)($,{})})});if(!b)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(be,{onRetry:y})})});if(w)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)($,{})})});if(F)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(wt,{})})});if(T||!C)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(Se,{onRetry:()=>D()})})});let I=()=>{let e=!C.enabled;ee.mutate({id:C.id,enabled:e}),e&&O({automationId:C.id,automationName:C.name})},R=()=>{te.mutate(C.id,{onSuccess:()=>{o?.(re())}})},z=()=>{A.mutate(C.id,{onSuccess:()=>{u(e(p.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(W(t,e(p.AUTOMATIONS$RUN_NOW_ERROR)))}})},B=()=>{let e=`${JSON.stringify(we(C),null,2)}\n`;m(new Blob([e],{type:`application/json`}),Te(C)),k({backendKind:x.backend.kind})},V=ne||j,H=null;x.backend.kind===`cloud`&&C.user_id&&(H=M.data?.email??(M.isError?C.user_id:null));let U=C.enabled?V:j;return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(G,{}),(0,Y.jsx)(je,{automation:C,onToggle:I,onEdit:()=>g(!0),onDelete:()=>l(!0),onExport:B,onDownloadTarball:()=>N.downloadTarball(C.id,C.name),onRunNow:z,isRunningNow:A.isPending,canManage:V,canToggle:U}),C.prompt&&(0,Y.jsx)(Pe,{prompt:C.prompt}),(0,Y.jsx)(Ve,{automation:C,runsAs:H}),C.plugins&&C.plugins.length>0&&(0,Y.jsx)(We,{plugins:C.plugins}),(0,Y.jsx)(Ke,{createdAt:C.created_at,lastRunAt:C.last_triggered_at}),(0,Y.jsx)(Ct,{automation:C,highlightedRunId:a}),(0,Y.jsx)(Ce,{automationName:C.name,isOpen:s,onConfirm:R,onCancel:()=>l(!1)}),h&&(0,Y.jsx)(he,{automation:C,isOpen:h,onClose:()=>g(!1)})]})})})});export{Et as clientLoader,Dt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,bt as n,yt as r}from"./vendor-styling-Ck5D_A2Q.js";import{U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{i as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as o}from"./useQueries-pUohFMSP.js";import{t as s}from"./recommended-automations-launcher-DEHRKIAg.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{ct as l,lt as u,n as d,st as f}from"./active-backend-context-BnH4-L8h.js";import{K as p,a as m,t as h}from"./utils-BgLSZdyy.js";import{t as g}from"./check-Bo8s5Ylg.js";import{t as _}from"./chevron-down-Cr6Fn_wS.js";import{m as v,t as y}from"./kebab-menu-item-content-SCJBwZnp.js";import{i as b,n as ee,r as te,t as ne}from"./empty-state-FK_s1B60.js";import{P as x,_ as re,c as ie,g as ae,h as oe,l as se,m as ce}from"./home-automation-run-tooltip-B1N2uO9p.js";import{t as S}from"./list-filter-B8PQk3RA.js";import{t as C}from"./plus-C2e21TFC.js";import{t as le}from"./refresh-cw-BtdC3T8P.js";import{n as w,t as T}from"./context-menu-list-item-Cm7-7Y-7.js";import{A as ue,D as de,G as fe,P as E,S as pe,W as me,n as D,t as he,x as O}from"./use-tracking-j4uo9VEW.js";import{t as k}from"./modal-backdrop-BSzNhM4r.js";import{n as ge}from"./modal-classes-B0b9eiL8.js";import{t as A}from"./brand-button-CUMfjb99.js";import{n as _e}from"./navigation-context-CQZwH_tC.js";import{t as j,u as M}from"./dropdown-classes-BGvOvW2_.js";import{t as N}from"./modal-close-button-DfqfB2Nj.js";import{t as P}from"./use-click-outside-element-W6Os4Nlb.js";import{t as F}from"./enum-filter-dropdown-UNaom12H.js";import{t as ve}from"./use-automation-health-U99vvHxx.js";import{t as I}from"./automation-C_eCrGyP.js";import{a as ye,c as L,i as be,o as xe,r as Se,t as Ce}from"./use-automations-Bq5hVuv0.js";import{a as R}from"./extension-module-card-classes-DpeaYhYo.js";import{n as we}from"./api-error-message-BXo0lCI5.js";import{t as Te}from"./edit-automation-modal-D_JWSmxT.js";import{t as Ee}from"./use-automation-permissions-Buus0R6h.js";import{n as De,t as Oe}from"./error-state-Cf8LRuuY.js";import{n as ke,r as Ae,t as je}from"./manifest-subpage-layout-CVZgVKoY.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./automation-export-BJsfi7n2.js";var z=a(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),Ie=a(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Le=a(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),B=e(t(),1),V=e(n(),1),H=r();function U({icon:e,label:t,isSelected:n}){return(0,H.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,H.jsx)(`span`,{className:M,"aria-hidden":!0,children:(0,H.jsx)(e,{})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,H.jsx)(g,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}var W=[{value:`grid`,icon:Ie,labelKey:p.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:Le,labelKey:p.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Re({view:e,onChange:t,disabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(W.find(t=>t.value===e)??W[0]).icon;(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let f=i&&o?(0,H.jsx)(w,{ref:u,theme:`popover`,className:`min-w-[10rem]`,children:W.map(n=>(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),a(!1)},className:`group`,children:(0,H.jsx)(U,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:l,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(p.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||a(e=>!e)},className:h(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,H.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function ze({onAdd:e,onImport:t,isAddDisabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({position:`fixed`,zIndex:9999,top:e.bottom+2,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let d=e=>{e(),a(!1)},f=i&&o?(0,H.jsxs)(w,{ref:u,testId:`automations-add-automation-menu`,theme:`popover`,position:`none`,alignment:`none`,spacing:`none`,className:`min-w-[10rem]`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-add-automation-create`,isDisabled:n,className:`group`,onClick:()=>{n||d(e)},children:(0,H.jsx)(y,{icon:(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-import-automation`,className:`group`,onClick:()=>d(t),children:(0,H.jsx)(y,{icon:(0,H.jsx)(z,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$IMPORT)})})})]}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{ref:l,type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`whitespace-nowrap`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[r(p.AUTOMATIONS$ADD_AUTOMATION),(0,H.jsx)(_,{className:`size-4 shrink-0`,"aria-hidden":!0})]}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function G({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-xs font-medium uppercase tracking-wide text-muted`,children:e}),(0,H.jsx)(`dd`,{className:`whitespace-pre-wrap break-words text-sm text-content`,children:t})]})}function K(e){let t=e.dataTransfer?.files;return t&&t.length>0?t[0]:null}function Be({onFile:e}){let{t}=c(`openhands`),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),a=()=>n.current?.click();return(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 px-6 pb-6`,children:[(0,H.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[t(p.AUTOMATIONS$IMPORT_EXPLAIN),` `,(0,H.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`import-automation-format-docs`,className:`text-white no-underline transition-colors hover:text-white`,children:t(p.AUTOMATIONS$IMPORT_FORMAT_DOCS)})]}),(0,H.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsx)(`input`,{ref:n,type:`file`,accept:`application/json,.json`,className:`hidden`,"data-testid":`automations-import-file`,onChange:()=>{let t=n.current,r=t?.files?.[0];t&&(t.value=``),r&&e(r)}}),(0,H.jsxs)(`div`,{"data-testid":`import-automation-dropzone`,"data-active":r?`true`:`false`,onClick:a,onDragEnter:e=>{e.preventDefault(),i(!0)},onDragOver:e=>{e.preventDefault(),i(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},onDrop:t=>{t.preventDefault(),i(!1);let n=K(t);n&&e(n)},className:h(`flex cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center`,r?`border-[var(--oh-focus)] bg-[var(--oh-interactive-hover)]`:`border-[var(--oh-border)] bg-[var(--oh-surface)]`),children:[(0,H.jsx)(z,{className:`size-8 text-[var(--oh-muted)]`,"aria-hidden":!0}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(p.AUTOMATIONS$IMPORT_DROPZONE)}),(0,H.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_OR)}),(0,H.jsx)(A,{testId:`import-automation-choose-file`,type:`button`,variant:`secondary`,onClick:e=>{e?.stopPropagation(),a()},children:t(p.AUTOMATIONS$IMPORT_CHOOSE_FILE)})]})]})}function Ve({isOpen:e,spec:t,isImporting:n,onClose:r,onImport:i,onFile:a}){let{t:o}=c(`openhands`);if(!e)return null;let s=t?t.trigger.type===`event`?[t.trigger.source,v(t.trigger.on)].filter(Boolean).join(`: `):[t.trigger.schedule_human??t.trigger.schedule,t.timezone??t.trigger.timezone].filter(Boolean).join(` · `):``;return(0,H.jsx)(k,{onClose:n?void 0:r,closeOnEscape:!n,closeOnBackdropClick:!n,"aria-label":o(p.AUTOMATIONS$IMPORT),children:(0,H.jsxs)(`div`,{"data-testid":`import-automation-modal`,"data-view":t?`preview`:`picker`,className:`relative flex max-h-[85vh] w-[min(36rem,calc(100vw-2rem))] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,H.jsx)(N,{onClose:r,testId:`import-automation-modal-close`,disabled:n}),(0,H.jsxs)(`header`,{className:`px-6 pb-4 pt-6`,children:[(0,H.jsx)(`h2`,{className:h(`pr-6`,ge),children:o(p.AUTOMATIONS$IMPORT)}),t?(0,H.jsx)(`p`,{className:`mt-2 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION)}):null]}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`dl`,{className:`mx-6 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-4 py-4`,children:[(0,H.jsx)(G,{label:o(p.AUTOMATIONS$NAME),value:t.name}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$TRIGGER),value:s}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$PROMPT),value:t.prompt??``}),t.plugins&&t.plugins.length>0?(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$PLUGINS),value:t.plugins.join(`, `)}):null]}),(0,H.jsxs)(`footer`,{className:`px-6 py-5`,children:[(0,H.jsx)(`p`,{className:`mb-4 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,H.jsx)(A,{testId:`import-automation-cancel`,type:`button`,variant:`secondary`,onClick:r,isDisabled:n,children:o(p.AUTOMATIONS$CANCEL)}),(0,H.jsx)(A,{testId:`import-automation-confirm`,type:`button`,variant:`primary`,onClick:i,isDisabled:n,"aria-busy":n,children:o(n?p.AUTOMATIONS$IMPORTING:p.AUTOMATIONS$IMPORT)})]})]})]}):(0,H.jsx)(Be,{onFile:a})]})})}var q=20,He=15e3,Ue=e=>e.status===I.PENDING||e.status===I.RUNNING;function We(e,t={}){let{enabled:n=!0}=t,r=d();return o({queries:e.map(e=>({queryKey:[...L,e.id,{limit:q,offset:0},r.backend.id,r.orgId],queryFn:({signal:t})=>x.run(()=>D.getAutomationRuns(e.id,q,0),t),staleTime:60*1e3,retry:!1,refetchOnWindowFocus:!1,meta:{disableToast:!0},enabled:n&&!!e.id,refetchInterval:e=>{let t=e.state.data?.runs?.[0];return t&&Ue(t)?He:!1}})),combine:t=>{let n=new Map;return e.forEach((e,r)=>{let i=t[r];n.set(e.id,{summary:i.data?re(i.data):null,isLoading:i.isLoading,isError:i.isError})}),n}})}function J({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),t]})}function Y(e){return Object.fromEntries(e.map(e=>[e.value,e.label]))}function Ge({spec:e,status:t,trigger:n,sort:r,onStatusChange:i,onTriggerChange:a,onSortChange:o}){let{t:s}=c(`openhands`),[l,u]=(0,B.useState)(!1),d=P(()=>u(!1)),f=e.filters.find(e=>e.id===`status`),m=e.filters.find(e=>e.id===`trigger`),g=[f&&t!==f.options[0]?.value,m&&n!==m.options[0]?.value,r!==e.sort.default].filter(Boolean).length,v=s(p.AUTOMATIONS$FILTERS),y=f?.options[0]?.value,b=m?.options[0]?.value;return(0,H.jsxs)(`div`,{ref:d,className:`relative shrink-0 w-auto`,"data-testid":`automations-filters`,children:[(0,H.jsxs)(`button`,{type:`button`,"data-testid":`dropdown-trigger`,"aria-haspopup":`true`,"aria-expanded":l,"aria-label":v,onClick:()=>u(e=>!e),className:h(j,`h-9 py-0`,g>0&&`border-white/60 bg-white/10`),children:[(0,H.jsx)(S,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:v}),g>0?(0,H.jsx)(`span`,{className:`rounded-full bg-white px-1.5 text-[11px] font-medium text-black`,children:g}):null,(0,H.jsx)(_,{className:h(`h-4 w-4 shrink-0 text-tertiary-alt transition-transform`,l&&`rotate-180`),"aria-hidden":!0})]}),l?(0,H.jsxs)(`div`,{role:`group`,"data-testid":`automations-filters-menu`,"aria-label":v,className:`absolute right-0 top-full z-50 mt-1 flex min-w-[16rem] w-max flex-col gap-3 overflow-visible rounded-[6px] bg-tertiary p-3 context-menu-box-shadow`,children:[f?(0,H.jsx)(J,{label:f.label,children:(0,H.jsx)(F,{testId:`automations-filter-status`,value:t,onChange:i,options:f.options.map(e=>e.value),labelByValue:Y(f.options),ariaLabel:f.label,fullWidth:!0})}):null,m?(0,H.jsx)(J,{label:m.label,children:(0,H.jsx)(F,{testId:`automations-filter-trigger`,value:n,onChange:a,options:m.options.map(e=>e.value),labelByValue:Y(m.options),ariaLabel:m.label,fullWidth:!0})}):null,(0,H.jsx)(J,{label:e.sort.label,children:(0,H.jsx)(F,{testId:`automations-sort`,value:r,onChange:o,options:e.sort.options.map(e=>e.value),labelByValue:Y(e.sort.options),ariaLabel:e.sort.label,fullWidth:!0})}),g>0?(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-filters-reset`,onClick:()=>{y&&i(y),b&&a(b),o(e.sort.default)},className:`self-start text-sm text-muted hover:text-foreground`,children:s(p.AUTOMATIONS$RESET_ALL)}):null]}):null]})}function Ke({onClear:e}){let{t}=c(`openhands`);return(0,H.jsxs)(`div`,{"data-testid":`automations-filtered-empty`,className:`rounded-xl border border-dashed border-[var(--oh-border)] p-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:t(p.AUTOMATIONS$NO_FILTER_MATCHES)}),(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-clear-filters`,onClick:e,className:`mt-2 text-sm text-white underline-offset-2 hover:underline`,children:t(p.AUTOMATIONS$CLEAR_FILTERS)})]})}function qe({label:e,tiles:t}){return(0,H.jsx)(`section`,{"aria-label":e,className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:t.map(e=>(0,H.jsxs)(`div`,{"data-testid":`overview-tile-${e.key}`,className:h(R,`p-4`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs text-muted`,children:e.label}),(0,H.jsx)(e.Icon,{className:`size-4 shrink-0 text-[var(--oh-muted)]`,"aria-hidden":!0})]}),(0,H.jsx)(`div`,{className:`mt-2 text-xl font-semibold text-content`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted`,children:e.detail})]},e.key))})}var Je=50,X=()=>{if(!E())throw new Response(null,{status:404,statusText:`Not Found`});return null},Z=i(function(){let{t:e}=c(`openhands`),t=ue(),n=(0,B.useMemo)(()=>de(),[]),r=ke(),i=n&&r?{spec:n,nav:r}:null,[a,o]=(0,B.useState)(``),[g,_]=(0,B.useState)(`all`),[v,y]=(0,B.useState)(`all`),[x,re]=(0,B.useState)(n?.sort.default??`last-run`),[S,C]=(0,B.useState)(()=>ie()),[w,T]=(0,B.useState)(Je),[E,D]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[ge,j]=(0,B.useState)(!1),[M,N]=(0,B.useState)(null),[P,F]=(0,B.useState)(!1),I=d(),{navigate:L}=_e(),R=I.backend.kind===`local`,{canManage:z}=Ee(),{data:Ie,isLoading:Le,refetch:V}=ve(),U=Ie?.status===`ok`,{data:W,isLoading:G,isError:K,refetch:Be}=Ce({limit:w,offset:0,enabled:U}),q=We(W?.automations??[],{enabled:U&&i!==null}),{trackPrebuiltAutomationEnabled:He,trackAutomationExported:Ue}=he(),J=xe(),Y=Se(),X=be(),Z=ye(),Q=(0,B.useMemo)(()=>W?.automations?n?ce(W.automations,{search:a,status:g,trigger:v,sort:x},q):W.automations.filter(e=>ae(e,a)):[],[W?.automations,n,a,g,v,x,q]),$=(0,B.useMemo)(()=>Q.filter(e=>e.enabled),[Q]),Ye=(0,B.useMemo)(()=>Q.filter(e=>!e.enabled),[Q]),Xe=(e,t)=>{let n=!t;if(J.mutate({id:e,enabled:n}),n){let t=W?.automations.find(t=>t.id===e);He({automationId:e,automationName:t?.name??e})}},Ze=t=>{X.mutate(t,{onSuccess:()=>{l(e(p.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(we(t,e(p.AUTOMATIONS$RUN_NOW_ERROR)))}})},Qe=e=>{let t=W?.automations.find(t=>t.id===e);t&&D({id:e,name:t.name})},$e=e=>{let t=W?.automations.find(t=>t.id===e);t&&k(t)},et=e=>{let t=`${JSON.stringify(Pe(e),null,2)}\n`;m(new Blob([t],{type:`application/json`}),Fe(e)),Ue({backendKind:I.backend.kind})},tt=async t=>{try{let n;try{n=JSON.parse(await t.text())}catch{f(e(p.AUTOMATIONS$IMPORT_INVALID_JSON));return}N(Ne(n))}catch(t){f(t instanceof Error?t.message:e(p.ERROR$GENERIC))}},nt=()=>{M&&Z.mutate({...M,enabled:!1},{onSuccess:t=>{F(!1),N(null),u(e(p.AUTOMATIONS$IMPORT_SUCCESS,{name:t.name}),e(p.AUTOMATIONS$IMPORT_VIEW),pe(t.id))},onError:t=>{f(we(t,e(p.ERROR$GENERIC)))}})},rt=()=>{E&&(Y.mutate(E.id),D(null))},it=(0,B.useCallback)(e=>{C(e),se(e)},[]),at=()=>{o(``),_(`all`),y(`all`)},ot=(0,B.useMemo)(()=>{if(!n)return[];let e=W?.automations??[];return n.overview.tiles.map(t=>{let n=oe(t.metric,e,q),r=n.isZero&&t.zeroDetail?t.zeroDetail:t.detail;return{key:t.metric,label:t.label,value:n.display,detail:me(r,n.placeholderValues),Icon:fe[t.icon]}})},[n,W?.automations,q]),st=i?{spec:i.spec.insights,byId:q}:void 0,ct=e=>i?(0,H.jsx)(je,{heading:i.nav.heading,navTestIdBase:`automations-navbar`,items:i.nav.items,children:e}):(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:e})}),lt=W?W.total>W.automations.length:!1,ut=!G&&!K&&W?.automations.length===0;return ct(Le?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))})]}):U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2`,children:[R&&(0,H.jsx)(A,{type:`button`,variant:`secondary`,testId:`automations-git-sync`,className:`whitespace-nowrap`,onClick:()=>L?.(`/automations/git-sync`),startContent:(0,H.jsx)(le,{className:`size-4`,"aria-hidden":!0}),children:e(p.AUTOMATIONS$GIT_SYNC$NAV_BUTTON)}),z?(0,H.jsx)(ze,{onAdd:()=>j(!0),onImport:()=>F(!0)}):null]})]}),i&&(0,H.jsx)(qe,{label:i.spec.overview.label,tiles:ot}),(0,H.jsxs)(`div`,{className:h(`flex items-stretch gap-2`,i?`flex-wrap`:`mt-6`),children:[(0,H.jsx)(Ae,{value:a,onChange:o}),i&&(0,H.jsx)(Ge,{spec:i.spec,status:g,trigger:v,sort:x,onStatusChange:_,onTriggerChange:y,onSortChange:re}),(0,H.jsx)(Re,{view:S,onChange:it,disabled:ut})]}),(0,H.jsxs)(`div`,{className:h(`flex flex-col gap-6`,!i&&`mt-6`),children:[G&&(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))}),K&&!G&&(0,H.jsx)(Oe,{onRetry:Be}),ut&&(0,H.jsx)(ne,{}),!G&&!K&&W&&W.automations.length>0&&(i&&Q.length===0?(0,H.jsx)(Ke,{onClear:at}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(te,{title:e(p.AUTOMATIONS$ACTIVE),count:$.length,automations:$,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),(0,H.jsx)(te,{title:e(p.AUTOMATIONS$INACTIVE),count:Ye.length,automations:Ye,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),lt&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>T(e=>e+Je),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(p.AUTOMATIONS$LOAD_MORE)})]}))]}),!i&&(0,H.jsx)(`div`,{className:`mt-6`,children:(0,H.jsx)(s,{query:a})}),(0,H.jsx)(Me,{automationName:E?.name??``,isOpen:E!==null,onConfirm:rt,onCancel:()=>D(null)}),O&&(0,H.jsx)(Te,{automation:O,isOpen:O!==null,onClose:()=>k(null)}),(0,H.jsx)(ee,{isOpen:ge,onClose:()=>j(!1)}),(0,H.jsx)(Ve,{isOpen:P,spec:M,isImporting:Z.isPending,onClose:()=>{F(!1),N(null)},onImport:nt,onFile:tt})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(De,{onRetry:V})]}))});export{X as clientLoader,Z as default};
|