@openhands/agent-canvas 1.0.0-rc.2 → 1.0.0-rc.3
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 +2 -2
- package/README.windows.md +2 -2
- package/build/assets/acp-providers-C55k29rf.js +1 -0
- package/build/assets/{add-backend-modal-CIfhseZn.js → add-backend-modal-BdYxoUdL.js} +1 -1
- package/build/assets/agent-server-conversation-service.api-js3oYcdU.js +5 -0
- package/build/assets/{agent-settings-B6htMeS2.js → agent-settings-BNrffu3I.js} +1 -1
- package/build/assets/{alert-banner-D41ZKDZT.js → alert-banner-BzU93oDh.js} +1 -1
- package/build/assets/{analytics-consent-form-modal-TINgM_jV.js → analytics-consent-form-modal-Ce-_Skcd.js} +1 -1
- package/build/assets/{api-key-entry-screen-Di1vHgIU.js → api-key-entry-screen-CGyS-Cna.js} +1 -1
- package/build/assets/{app-settings-CjCa1MOB.js → app-settings-DmOs4oik.js} +1 -1
- package/build/assets/{automation-detail-DPoxzTdV.js → automation-detail-DLbCVJCw.js} +1 -1
- package/build/assets/{automations-list-DwUEe2Ea.js → automations-list-Ces5shz5.js} +1 -1
- package/build/assets/{backend-form-modal-B6q897ZX.js → backend-form-modal-BUy-PzZN.js} +1 -1
- package/build/assets/{backend-synced-settings-badge-BwTawSCE.js → backend-synced-settings-badge-1A63yxGs.js} +1 -1
- package/build/assets/browser-B8bp1IqT.js +5 -0
- package/build/assets/{browser-tab-DiRTKik8.js → browser-tab-CiBRWB4X.js} +1 -1
- package/build/assets/chat-send-button-qKFZuB9E.js +1 -0
- package/build/assets/{circle-plus-check-toggle-B3_W6-nt.js → circle-plus-check-toggle-CboDp7XB.js} +1 -1
- package/build/assets/{condenser-settings-DczjwkIp.js → condenser-settings-FCBjvqSo.js} +1 -1
- package/build/assets/conversation-CT8AvxEH.js +1 -0
- package/build/assets/conversation-panel-DqDDs4WZ.js +1 -0
- package/build/assets/conversation-service.api-y_eB_43m.js +1 -0
- package/build/assets/conversation-store-CiYGBud3.js +6 -0
- package/build/assets/conversation-vNuLKgz6.js +19 -0
- package/build/assets/conversation-websocket-context-Bb4XBXoc.js +3 -0
- package/build/assets/{device-verify-BVl4GEvt.js → device-verify-BOQz2LJQ.js} +1 -1
- package/build/assets/{edit-automation-modal-kc_FzbzK.js → edit-automation-modal-C-oC5tis.js} +1 -1
- package/build/assets/{entry.client-CWkbusD1.js → entry.client-Db3BpFL_.js} +2 -2
- package/build/assets/{enum-filter-dropdown-DlY0Q3fj.js → enum-filter-dropdown-DFwoVtOw.js} +1 -1
- package/build/assets/{extensions-hub-NbQnt-cn.js → extensions-hub-BxZbAtjP.js} +1 -1
- package/build/assets/extensions-navigation-BIb-vAa2.js +1 -0
- package/build/assets/{files-tab-mK7Mdyuf.js → files-tab-DpulQlIo.js} +1 -1
- package/build/assets/{git-control-bar-branch-button-C1qmab0K.js → git-control-bar-branch-button-D1uam-nI.js} +1 -1
- package/build/assets/home-sJAFzI6v.js +1 -0
- package/build/assets/install-server-modal-BjEzlLF5.js +1 -0
- package/build/assets/{launch-BADsYeGp.js → launch-DgtB1JTX.js} +1 -1
- package/build/assets/llm-settings-B8kPJ0Of.js +1 -0
- package/build/assets/llm-settings-CjUpPsvA.js +1 -0
- package/build/assets/{manage-backends-modal-sH7l5NgI.js → manage-backends-modal-CTA-2x4F.js} +1 -1
- package/build/assets/manifest-d3e8504d.js +1 -0
- package/build/assets/{markdown-renderer-CZq_UdmE.js → markdown-renderer-oOUs3tw5.js} +1 -1
- package/build/assets/{mcp-DdQ72_AO.js → mcp-kJYdM8aJ.js} +1 -1
- package/build/assets/messages-BFJXB6MW.js +36 -0
- package/build/assets/model-selector-z_QOzaRV.js +1 -0
- package/build/assets/{onboarding-DCL9stdH.js → onboarding-CZ_7nd-M.js} +1 -1
- package/build/assets/{path-utils-CNd_jqv_.js → path-utils-0KWEiRs9.js} +1 -1
- package/build/assets/{planner-tab-QBnZgIXd.js → planner-tab-CNmJiZ22.js} +1 -1
- package/build/assets/{recommended-automations-launcher-B01jchhe.js → recommended-automations-launcher-B1kfmFTQ.js} +8 -10
- package/build/assets/{root-BBV8Ew9E.js → root-CIZ7Rv1X.js} +2 -2
- package/build/assets/root-layout-B5ijp9At.js +2 -0
- package/build/assets/{sdk-section-page-BQKe3asw.js → sdk-section-page-DTyvCc52.js} +1 -1
- package/build/assets/{sdk-settings-schema-DoRnefvb.js → sdk-settings-schema-B0KrqqPX.js} +1 -1
- package/build/assets/{secrets-settings-D2EfzdpC.js → secrets-settings-BQNSDLKS.js} +1 -1
- package/build/assets/{settings-B7jVceyu.js → settings-BUlJrO_h.js} +1 -1
- package/build/assets/{settings-dropdown-input-BD7ziSoR.js → settings-dropdown-input-BUk4m23x.js} +1 -1
- package/build/assets/{settings-index-Xj0v9Oas.js → settings-index-DE91Eahc.js} +1 -1
- package/build/assets/{settings-modal-CDBy1S9S.js → settings-modal-CCaPYVqW.js} +1 -1
- package/build/assets/{settings-service.api-CTQ-LpAA.js → settings-service.api-4u2RKC8k.js} +1 -1
- package/build/assets/{settings-switch-CSHSqH99.js → settings-switch-BQiAS9ga.js} +1 -1
- package/build/assets/{settings-utils-BCbzc6-u.js → settings-utils-chxTa1vn.js} +1 -1
- package/build/assets/{shared-conversation-BHEbOdHj.js → shared-conversation-sBPLAawM.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-YYPXGikp.js → sidebar-mobile-menu-toggle-BDXWzhyB.js} +1 -1
- package/build/assets/{sidebar-nav-link-CiXbBMQx.js → sidebar-nav-link-Bhlzlhp8.js} +1 -1
- package/build/assets/{skill-card-pill-row-BXILn-GK.js → skill-card-pill-row-Bg5joQf6.js} +1 -1
- package/build/assets/{skills-plugins-Bs5HiF1O.js → skills-plugins-fihjo1KZ.js} +1 -1
- package/build/assets/{skills-settings-CQYxMmWf.js → skills-settings-NQnuMwZP.js} +1 -1
- package/build/assets/{styled-tooltip-DEr7oa0m.js → styled-tooltip-GXy1qxsO.js} +1 -1
- package/build/assets/{task-list-tab-R9N3Wd-U.js → task-list-tab-Hl9BuVfq.js} +1 -1
- package/build/assets/telemetry-j9SLrtY7.js +2 -0
- package/build/assets/{terminal-BTM3UFcQ.js → terminal-DRwe8--D.js} +1 -1
- package/build/assets/{use-active-conversation-BY5F6A1G.js → use-active-conversation-DJGoI9Mc.js} +1 -1
- package/build/assets/{use-agent-settings-schema-CsuMq16G.js → use-agent-settings-schema-DtusObuC.js} +1 -1
- package/build/assets/{use-agent-state-DX5NKEa_.js → use-agent-state-BXgWhFh6.js} +1 -1
- package/build/assets/{use-create-conversation-4iJytCT1.js → use-create-conversation-CzvaVA5A.js} +1 -1
- package/build/assets/use-event-store-DSpvASbC.js +1 -0
- package/build/assets/{use-get-secrets-BMnFFBUx.js → use-get-secrets-DiLgP147.js} +1 -1
- package/build/assets/use-handle-plan-click-CUZwmKIk.js +1 -0
- package/build/assets/{use-launch-skill-in-chat-BoqKmEHC.js → use-launch-skill-in-chat-ClRJlIx7.js} +1 -1
- package/build/assets/use-runtime-is-ready-CWkGQFsb.js +1 -0
- package/build/assets/{use-save-settings-hK6LYt0s.js → use-save-settings-CP23emUY.js} +1 -1
- package/build/assets/use-settings-0qFqC-r6.js +1 -0
- package/build/assets/{use-settings-nav-items-oZ-BlOWX.js → use-settings-nav-items-C6YxUn4h.js} +1 -1
- package/build/assets/{use-task-list-DydbuRFM.js → use-task-list-JPudBRv3.js} +1 -1
- package/build/assets/{use-tracking-DQU60djN.js → use-tracking-CjLZgh8X.js} +1 -1
- package/build/assets/{use-unified-vscode-url-D2Buvmxj.js → use-unified-vscode-url-DSn2tT08.js} +1 -1
- package/build/assets/{use-user-conversation-DwOGM1lc.js → use-user-conversation-CQ5IwnZk.js} +1 -1
- package/build/assets/{vendor~browser-3J6WDaAB.js → vendor~browser-Dwwc84Zf.js} +1 -1
- package/build/assets/{vendor~browser-tab-DYZ-OmbT.js → vendor~browser-tab-Bhohe29F.js} +1 -1
- package/build/assets/{vendor~files-tab-Diy4WrQz.js → vendor~files-tab-B447_Zns.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CWwn0K2j.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CQQAW8hY.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-dZ3D8RVL.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DFsI4CLy.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BighOCzm.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DcvlNgbn.js} +1 -1
- package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D13hiNGV.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-ojk_J4bB.js} +1 -1
- package/build/assets/{vendor~launch-D65Vw0VZ.js → vendor~launch-BdXJCmwc.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-BJPgfJoU.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-DToubnIU.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~jpfhx3ls-BkicN-14.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~jpfhx3ls-zdl_Rltz.js} +2 -2
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-Cwz6a1DC.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-C37jLHRk.js → vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BwbkftxT.js} +1 -1
- package/build/assets/{vendor~root-layout~home~mcp~automations-list-JQ-neDIa.js → vendor~root-layout~home~mcp~automations-list-CtdIEhjQ.js} +1 -1
- package/build/assets/{vendor~root-layout~home~mcp~automations-list-BTTZ58Mb.js → vendor~root-layout~home~mcp~automations-list-DGOI7kQz.js} +1 -1
- package/build/assets/{vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-UYEKKX0Y.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-iPAfRWNQ.js} +2 -2
- package/build/assets/{verification-settings-Rabe5TpK.js → verification-settings-Cm02KmeI.js} +1 -1
- package/build/assets/{vscode-tab-zLD5Z-PP.js → vscode-tab-AF70Yke0.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/ar/openhands.json +1 -1
- package/build/locales/ca/openhands.json +1 -1
- package/build/locales/de/openhands.json +1 -1
- package/build/locales/en/openhands.json +1 -1
- package/build/locales/es/openhands.json +1 -1
- package/build/locales/fr/openhands.json +1 -1
- package/build/locales/it/openhands.json +1 -1
- package/build/locales/ja/openhands.json +1 -1
- package/build/locales/ko-KR/openhands.json +1 -1
- package/build/locales/no/openhands.json +1 -1
- package/build/locales/pt/openhands.json +1 -1
- package/build/locales/tr/openhands.json +1 -1
- package/build/locales/uk/openhands.json +1 -1
- package/build/locales/zh-CN/openhands.json +1 -1
- package/build/locales/zh-TW/openhands.json +1 -1
- package/config/defaults.json +1 -1
- package/dist/api/agent-server-adapter.cjs +3 -3
- package/dist/api/agent-server-adapter.cjs.map +1 -1
- package/dist/api/agent-server-adapter.js +90 -85
- package/dist/api/agent-server-adapter.js.map +1 -1
- package/dist/api/app-preferences-store.cjs.map +1 -1
- package/dist/api/app-preferences-store.d.ts +6 -2
- package/dist/api/app-preferences-store.js.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.cjs +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.js +9 -9
- package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.js.map +1 -1
- package/dist/components/conversation-events/chat/event-message.cjs +1 -1
- package/dist/components/conversation-events/chat/event-message.cjs.map +1 -1
- package/dist/components/conversation-events/chat/event-message.js +80 -71
- package/dist/components/conversation-events/chat/event-message.js.map +1 -1
- package/dist/components/features/automations/recommended-automations-launcher.d.ts +7 -1
- package/dist/components/features/home/workspace-selection-form.d.ts +1 -0
- package/dist/components/features/onboarding/steps/setup-llm-step.d.ts +8 -0
- package/dist/components/features/sidebar/sidebar.cjs +1 -1
- package/dist/components/features/sidebar/sidebar.js +6 -6
- package/dist/components/features/skills/extensions-navigation.cjs +1 -1
- package/dist/components/features/skills/extensions-navigation.cjs.map +1 -1
- package/dist/components/features/skills/extensions-navigation.d.ts +1 -1
- package/dist/components/features/skills/extensions-navigation.js +27 -29
- package/dist/components/features/skills/extensions-navigation.js.map +1 -1
- package/dist/i18n/translation.cjs +1 -1
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +15 -15
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/ar/openhands.json +1 -1
- package/dist/locales/ca/openhands.json +1 -1
- package/dist/locales/de/openhands.json +1 -1
- package/dist/locales/en/openhands.json +1 -1
- package/dist/locales/es/openhands.json +1 -1
- package/dist/locales/fr/openhands.json +1 -1
- package/dist/locales/it/openhands.json +1 -1
- package/dist/locales/ja/openhands.json +1 -1
- package/dist/locales/ko-KR/openhands.json +1 -1
- package/dist/locales/no/openhands.json +1 -1
- package/dist/locales/pt/openhands.json +1 -1
- package/dist/locales/tr/openhands.json +1 -1
- package/dist/locales/uk/openhands.json +1 -1
- package/dist/locales/zh-CN/openhands.json +1 -1
- package/dist/locales/zh-TW/openhands.json +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.cjs +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.cjs.map +1 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.js +10 -1
- package/dist/node_modules/@openhands/typescript-client/dist/models/acp.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/llm-settings.cjs +1 -1
- package/dist/routes/llm-settings.cjs.map +1 -1
- package/dist/routes/llm-settings.js +21 -21
- package/dist/routes/llm-settings.js.map +1 -1
- package/dist/types/agent-server/core/events/index.d.ts +1 -0
- package/dist/types/agent-server/core/events/streaming-delta-event.d.ts +7 -0
- package/dist/types/agent-server/core/openhands-event.d.ts +2 -2
- package/dist/types/agent-server/type-guards.cjs +1 -1
- package/dist/types/agent-server/type-guards.cjs.map +1 -1
- package/dist/types/agent-server/type-guards.d.ts +2 -0
- package/dist/types/agent-server/type-guards.js +3 -3
- package/dist/types/agent-server/type-guards.js.map +1 -1
- package/dist/utils/handle-event-for-ui.cjs +1 -1
- package/dist/utils/handle-event-for-ui.cjs.map +1 -1
- package/dist/utils/handle-event-for-ui.js +69 -13
- package/dist/utils/handle-event-for-ui.js.map +1 -1
- package/dist/utils/mcp-config.cjs +1 -1
- package/dist/utils/mcp-config.cjs.map +1 -1
- package/dist/utils/mcp-config.js +27 -19
- package/dist/utils/mcp-config.js.map +1 -1
- package/dist/utils/mcp-marketplace-utils.cjs +1 -1
- package/dist/utils/mcp-marketplace-utils.cjs.map +1 -1
- package/dist/utils/mcp-marketplace-utils.js +38 -18
- package/dist/utils/mcp-marketplace-utils.js.map +1 -1
- package/dist/utils/normalize-display-model.cjs +1 -1
- package/dist/utils/normalize-display-model.cjs.map +1 -1
- package/dist/utils/normalize-display-model.js +8 -7
- package/dist/utils/normalize-display-model.js.map +1 -1
- package/dist/utils/openhands-llm.cjs +1 -1
- package/dist/utils/openhands-llm.cjs.map +1 -1
- package/dist/utils/openhands-llm.d.ts +13 -0
- package/dist/utils/openhands-llm.js +9 -3
- package/dist/utils/openhands-llm.js.map +1 -1
- package/package.json +2 -2
- package/scripts/check-sdk-version-sync.mjs +6 -6
- package/scripts/dev-safe.mjs +53 -118
- package/scripts/dev-with-automation.mjs +58 -4
- package/scripts/runtime-services-info.mjs +199 -0
- package/scripts/static-server.mjs +42 -4
- package/build/assets/acp-providers-DZEi8wDz.js +0 -1
- package/build/assets/agent-server-conversation-service.api-B82pNNTm.js +0 -5
- package/build/assets/browser-DTei6kki.js +0 -5
- package/build/assets/chat-send-button-06dIuWXm.js +0 -1
- package/build/assets/conversation-CBlJiDaV.js +0 -19
- package/build/assets/conversation-Dss8XCN_.js +0 -1
- package/build/assets/conversation-panel-B5sVpsz5.js +0 -1
- package/build/assets/conversation-service.api-B4s-xIOK.js +0 -1
- package/build/assets/conversation-store-kHcewy1E.js +0 -1
- package/build/assets/conversation-websocket-context-C2yKCqvj.js +0 -3
- package/build/assets/extensions-navigation-oOk5yl8X.js +0 -1
- package/build/assets/home-ChuA06Hv.js +0 -1
- package/build/assets/install-server-modal--lZ1HSHB.js +0 -1
- package/build/assets/llm-settings-D477P0Lg.js +0 -1
- package/build/assets/llm-settings-DtlQ7i4C.js +0 -1
- package/build/assets/manifest-17af0b17.js +0 -1
- package/build/assets/messages-luW9zf1w.js +0 -36
- package/build/assets/middleware-B5rcobhi.js +0 -6
- package/build/assets/model-selector-DzQRgNGZ.js +0 -1
- package/build/assets/root-layout-pQASEqtQ.js +0 -2
- package/build/assets/sidebar-store-B76R2gP8.js +0 -1
- package/build/assets/telemetry-DCrd7gnV.js +0 -2
- package/build/assets/use-event-store-Rw1YbvLm.js +0 -1
- package/build/assets/use-handle-plan-click-DYd5a6zN.js +0 -1
- package/build/assets/use-runtime-is-ready-DP-KKHO6.js +0 -1
- package/build/assets/use-settings-Clf0Y_P3.js +0 -1
- /package/build/assets/{automation-LZB0MjdV.js → automation-BzmydDjr.js} +0 -0
- /package/build/assets/{browser-store-BjhV_9wS.js → browser-store-C5uQbbIi.js} +0 -0
- /package/build/assets/{checkmark-BB7QCG5T.js → checkmark-SEZPnU2I.js} +0 -0
- /package/build/assets/{chevron-left-small-CuuwpRi9.js → chevron-left-small-x9_-ucHG.js} +0 -0
- /package/build/assets/{close-Cz0OAgTy.js → close-CbOsKMRg.js} +0 -0
- /package/build/assets/{code-tag-Cz9AIz-X.js → code-tag-C0vR_IQH.js} +0 -0
- /package/build/assets/{command-store-DAd3K0d_.js → command-store-BUWgE-vZ.js} +0 -0
- /package/build/assets/{confirmation-modal-C_lds1Tb.js → confirmation-modal-BPgWqWRI.js} +0 -0
- /package/build/assets/{context-menu-list-item-DhG1Ln5m.js → context-menu-list-item-CHWCx1Mc.js} +0 -0
- /package/build/assets/{conversation-state-store-BUU90dVq.js → conversation-state-store-DpgQaK_O.js} +0 -0
- /package/build/assets/{conversation-tab-empty-state-5bW9CQke.js → conversation-tab-empty-state-Ba5hbJhn.js} +0 -0
- /package/build/assets/{copy-CA1Dblua.js → copy-CAxUvM-U.js} +0 -0
- /package/build/assets/{dist-CBUfAk0Z.js → dist-CeJSjcAI.js} +0 -0
- /package/build/assets/{ellipsis-button-DRRmCrWi.js → ellipsis-button-CiLx8dqc.js} +0 -0
- /package/build/assets/{environment-switch-overlay-BrHKX6_Z.js → environment-switch-overlay-Cow6h62p.js} +0 -0
- /package/build/assets/{file-DM0ihEsO.js → file-BJCSojij.js} +0 -0
- /package/build/assets/{files-tab-store-QlUCuW8b.js → files-tab-store-CZAEwv3x.js} +0 -0
- /package/build/assets/{folder-UGYUKpqb.js → folder-wShAU0y7.js} +0 -0
- /package/build/assets/{git-status-mapper-N4-7eaeC.js → git-status-mapper-C3rfzUex.js} +0 -0
- /package/build/assets/{globe-2otpEmVh.js → globe-CQ_5xwpo.js} +0 -0
- /package/build/assets/{handle-capture-consent-OitMkDHc.js → handle-capture-consent-DDnXMC9Y.js} +0 -0
- /package/build/assets/{iconBase-B_5IRYeZ.js → iconBase-1A_WRQ4E.js} +0 -0
- /package/build/assets/{lesson-plan-5O2tVbD1.js → lesson-plan-B607buca.js} +0 -0
- /package/build/assets/{link-external-kU6aFXU6.js → link-external-DCsHkAj4.js} +0 -0
- /package/build/assets/{map-provider-BHow6ugd.js → map-provider-XSFHmdDs.js} +0 -0
- /package/build/assets/{modal-close-button-BCvw9IUN.js → modal-close-button-DY-rVmld.js} +0 -0
- /package/build/assets/{plan-components-BRiIX8Wn.js → plan-components-DsiDjcDi.js} +0 -0
- /package/build/assets/{sdk-settings-field-metadata-CtO73dY6.js → sdk-settings-field-metadata-CETNItbo.js} +0 -0
- /package/build/assets/{search-Cbh-hHBu.js → search-BqXT2Ied.js} +0 -0
- /package/build/assets/{secrets-service-DEIB-Cfk.js → secrets-service-rJqZtDmI.js} +0 -0
- /package/build/assets/{settings-KgLvVrSm.js → settings-BgL2HUsU.js} +0 -0
- /package/build/assets/{settings-gear-xGs_SPgZ.js → settings-gear-DFmoMp-6.js} +0 -0
- /package/build/assets/{settings-input-CPr7vX81.js → settings-input-DsoZj8Dm.js} +0 -0
- /package/build/assets/{settings-like-page-layout-classes-GknosJgv.js → settings-like-page-layout-classes-DENKlZpD.js} +0 -0
- /package/build/assets/{settings-list-classes-CYDn4jUg.js → settings-list-classes-D8VAVZmi.js} +0 -0
- /package/build/assets/{settings-section-header-context-aD2iq1gD.js → settings-section-header-context-D61smD-W.js} +0 -0
- /package/build/assets/{skills-CCaEu1KQ.js → skills-BDOWVle-.js} +0 -0
- /package/build/assets/{switch-skeleton-C87Tx3Tc.js → switch-skeleton-QpdcdxRP.js} +0 -0
- /package/build/assets/{terminal-DQJ6IJUd.js → terminal-BUww3Ssl.js} +0 -0
- /package/build/assets/{toggle-switch-C-7juZ1u.js → toggle-switch-DDr-DnEc.js} +0 -0
- /package/build/assets/{typography-U1gkzkXo.js → typography-Cx7uw7z3.js} +0 -0
- /package/build/assets/{u-check-circle-lbkXL2z4.js → u-check-circle-CftRwky1.js} +0 -0
- /package/build/assets/{u-check-circle-half-CirnoxXG.js → u-check-circle-half-sGVk0BtL.js} +0 -0
- /package/build/assets/{u-circuit-Danff2ks.js → u-circuit-Cg9tH5qb.js} +0 -0
- /package/build/assets/{u-edit-CH5nNya1.js → u-edit-foF02hwH.js} +0 -0
- /package/build/assets/{use-breakpoint-2sN462wJ.js → use-breakpoint-Dt2knceC.js} +0 -0
- /package/build/assets/{use-click-outside-element-_vianyPb.js → use-click-outside-element-Bu2A3s59.js} +0 -0
- /package/build/assets/{use-is-authed-DrocXcet.js → use-is-authed-fNsj-Adj.js} +0 -0
- /package/build/assets/{use-llm-profiles-BhZRf-NX.js → use-llm-profiles-CyNVoVqm.js} +0 -0
- /package/build/assets/{use-skills-v8pQ02ze.js → use-skills-BWHATXK-.js} +0 -0
- /package/build/assets/{v4-BMWDcIWQ.js → v4-BygpdDmc.js} +0 -0
- /package/build/assets/{vendor~browser-C3GKF4mj.js → vendor~browser-BYEwwJqV.js} +0 -0
- /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-DMcFTqbt.js → vendor~conversation-panel~conversation~alert-banner-BnHToS5O.js} +0 -0
- /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Cntsv2EN.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B4oeCCli.js} +0 -0
- /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTosGXG7.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D8cqyq4k.js} +0 -0
- /package/build/assets/{vendor~terminal-CnKZILnC.js → vendor~terminal-aeP3PnKf.js} +0 -0
- /package/build/assets/{vscode-url-helper-CwQPl6QN.js → vscode-url-helper-DOCkV_-G.js} +0 -0
- /package/build/assets/{waiting-for-runtime-message-B1Dzhtj5.js → waiting-for-runtime-message-Bg27u9JB.js} +0 -0
- /package/build/assets/{x-mark-CmcVOTk2.js → x-mark-Cn-YJVbN.js} +0 -0
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ agent-canvas --backend-only # agent server + automation backend + ingress only
|
|
|
74
74
|
|
|
75
75
|
**macOS / Linux:**
|
|
76
76
|
```sh
|
|
77
|
-
docker pull ghcr.io/openhands/agent-canvas:1.0.0-rc.
|
|
77
|
+
docker pull ghcr.io/openhands/agent-canvas:1.0.0-rc.3
|
|
78
78
|
|
|
79
79
|
export PROJECTS_PATH="$HOME/projects" # directory containing your project folders
|
|
80
80
|
mkdir -p "$PROJECTS_PATH" "$HOME/.openhands"
|
|
@@ -83,7 +83,7 @@ docker run -it --rm \
|
|
|
83
83
|
-p 8000:8000 \
|
|
84
84
|
-v "$HOME/.openhands:/home/openhands/.openhands" \
|
|
85
85
|
-v "${PROJECTS_PATH}:/projects" \
|
|
86
|
-
ghcr.io/openhands/agent-canvas:1.0.0-rc.
|
|
86
|
+
ghcr.io/openhands/agent-canvas:1.0.0-rc.3
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
**Windows (PowerShell / Windows Terminal):** See [README.windows.md](./README.windows.md) for the equivalent commands.
|
package/README.windows.md
CHANGED
|
@@ -12,7 +12,7 @@ For the main install options and overall context, see [README.md](./README.md).
|
|
|
12
12
|
- A host directory for `PROJECTS_PATH` containing the project folders you want the agent to access (create it before starting the container)
|
|
13
13
|
|
|
14
14
|
```powershell
|
|
15
|
-
docker pull ghcr.io/openhands/agent-canvas:1.0.0-rc.
|
|
15
|
+
docker pull ghcr.io/openhands/agent-canvas:1.0.0-rc.3
|
|
16
16
|
|
|
17
17
|
$env:PROJECTS_PATH = Join-Path $HOME "projects" # directory containing your project folders
|
|
18
18
|
New-Item -ItemType Directory -Force -Path $env:PROJECTS_PATH, (Join-Path $env:USERPROFILE ".openhands") | Out-Null
|
|
@@ -21,7 +21,7 @@ docker run -it --rm `
|
|
|
21
21
|
-p 8000:8000 `
|
|
22
22
|
-v "$($env:USERPROFILE)\.openhands:/home/openhands/.openhands" `
|
|
23
23
|
-v "$($env:PROJECTS_PATH):/projects" `
|
|
24
|
-
ghcr.io/openhands/agent-canvas:1.0.0-rc.
|
|
24
|
+
ghcr.io/openhands/agent-canvas:1.0.0-rc.3
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
The agent will be able to access any project under `PROJECTS_PATH`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./declaration-IA661TBv.js";import{n as t}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js";var n=`cli-generic`,r=new Set([`default`,`default (recommended)`]);function i(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||r.has(t.toLowerCase())||t===`acp-managed`?null:t}function a(e){for(let t of[e.runtimeName,e.runtimeId,e.configured,e.sdkLlm]){let e=i(t);if(e)return e}return e.providerDefault??null}var o={"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}},s=Object.entries(o).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}}),c=`custom`;function l(n){let r=n?t(n):null;if(!r)return[];let i=[];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 u(e){if(e)return s.find(t=>t.key===e)}function d(e){let t=u(e);return t?t.display_name:null}function f(e){return u(e)?.icon??`cli-generic`}function p(e,t){return t?u(e)?.available_models?.find(e=>e.id===t)?.label??t:null}function m(e,t={}){if(e===`openhands`)return{agent_kind:`openhands`};let n=e===c,r=n?void 0:u(e);if(!n&&!r&&!t.allowUnknownServer)return null;let i=t.model===void 0?r?.default_model??null:t.model;return{agent_kind:`acp`,acp_server:e,acp_command:t.command??[],acp_args:[],acp_model:i??null}}export{u as a,p as c,m as i,f as l,s as n,d as o,n as r,l as s,c as t,a as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{o as t}from"./declaration-IA661TBv.js";import{n}from"./backend-form-modal-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{o as t}from"./declaration-IA661TBv.js";import{n}from"./backend-form-modal-BUy-PzZN.js";var r=e({AddBackendModal:()=>a}),i=t();function a({onClose:e}){return(0,i.jsx)(n,{mode:`add`,onClose:e})}export{r as n,a as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-rJqZtDmI.js","assets/rolldown-runtime-BFRubm34.js","assets/settings-client-BUlG0Gzq.js","assets/agent-server-client-options-Dvgeb3x4.js","assets/proxy-wIasY2Po.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-CT1Z6Pdu.js";import{t}from"./common-Cfviy7yT.js";import{D as n,a as r,b as i,c as a,n as o,t as s,u as c,w as l}from"./agent-server-client-options-Dvgeb3x4.js";import{n as u,r as d}from"./settings-client-BUlG0Gzq.js";import{c as f,l as p,r as m,t as h}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js";import{t as g}from"./profiles-client-CesbAK-7.js";import{n as _}from"./agent-server-compatibility-BANjmMTo.js";import{n as ee,t as v}from"./proxy-wIasY2Po.js";import{t as y}from"./v4-BygpdDmc.js";import{t as b}from"./settings-BgL2HUsU.js";import{a as x,u as S}from"./acp-providers-C55k29rf.js";import{t as C}from"./settings-service.api-4u2RKC8k.js";var w=class{constructor(e){this.host=e.host.replace(/\/$/,``),this.apiKey=e.apiKey,this.client=new u({baseUrl:this.host,apiKey:this.apiKey,timeout:e.timeout||6e4})}async createConversation(e){return(await this.client.post(`/api/conversations`,e)).data}async searchConversations(e={}){return(await this.client.get(`/api/conversations/search`,{params:e})).data}async countConversations(e={}){return(await this.client.get(`/api/conversations/count`,{params:e})).data}async getConversations(e){return(await this.client.get(`/api/conversations`,{params:{ids:e}})).data}async getConversation(e){return(await this.client.get(`/api/conversations/${e}`)).data}async searchEvents(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/search`,{params:t})).data}async getEvent(e,t){return(await this.client.get(`/api/conversations/${e}/events/${t}`)).data}async getEvents(e,t){return Promise.all(t.map(async t=>{try{return await this.getEvent(e,t)}catch(e){if(e instanceof d&&e.status===404)return null;throw e}}))}async sendEvent(e,t,n={}){await this.client.post(`/api/conversations/${e}/events`,{...t,...n.run===void 0?{}:{run:n.run}})}async pauseConversation(e){return(await this.client.post(`/api/conversations/${e}/pause`,{})).data}async interruptConversation(e){return(await this.client.post(`/api/conversations/${e}/interrupt`,{})).data}async runConversation(e){return(await this.client.post(`/api/conversations/${e}/run`,{})).data}async askAgent(e,t){return(await this.client.post(`/api/conversations/${e}/ask_agent`,{question:t})).data}async getEventCount(e,t={}){return(await this.client.get(`/api/conversations/${e}/events/count`,{params:t})).data}async respondToConfirmation(e,t){return(await this.client.post(`/api/conversations/${e}/events/respond_to_confirmation`,t)).data}async getAgentFinalResponse(e){return(await this.client.get(`/api/conversations/${e}/agent_final_response`)).data}async setConfirmationPolicy(e,t){let n=`policy`in t?t:{policy:t};return(await this.client.post(`/api/conversations/${e}/confirmation_policy`,n)).data}async condenseConversation(e){return(await this.client.post(`/api/conversations/${e}/condense`,{})).data}async setSecurityAnalyzer(e,t){let n=te(t)?t:{security_analyzer:t};return(await this.client.post(`/api/conversations/${e}/security_analyzer`,n)).data}async updateSecrets(e,t){return(await this.client.post(`/api/conversations/${e}/secrets`,t)).data}async forkConversation(e,t={},n={}){return(await this.client.post(`/api/conversations/${e}/fork`,t,{params:n.includeSkills===void 0?void 0:{include_skills:n.includeSkills}})).data}async switchProfile(e,t){await this.client.post(`/api/conversations/${e}/switch_profile`,{profile_name:t})}async switchLLM(e,t){await this.client.post(`/api/conversations/${e}/switch_llm`,{llm:t})}async switchAcpModel(e,t){await this.client.post(`/api/conversations/${e}/switch_acp_model`,{model:t})}async deleteConversation(e){await this.client.delete(`/api/conversations/${e}`)}async updateConversation(e,t){return(await this.client.patch(`/api/conversations/${e}`,t)).data}close(){this.client.close()}};function te(e){return typeof e==`object`&&!!e&&`security_analyzer`in e}var T=new Map;function ne(e){return/^([/\\]|[a-zA-Z]:[/\\])/.test(e)}function re(e,t){return`${e.replace(/[/\\]+$/,``)}/${t.replace(/^[/\\]+/,``)}`}async function ie(e={}){let t=o(e),n=t.host,r=T.get(n);if(r)return r;let i=(async()=>{let{home:e}=await new p(t).getHome();if(!e||typeof e!=`string`)throw Error(`Agent server returned an empty home directory`);return e.replace(/[/\\]+$/,``)})();T.set(n,i);try{return await i}catch(e){throw T.delete(n),e}}async function ae(e,t={}){let n=e.replace(/[/\\]+$/,``);return n?ne(n)?n:re(await ie(t),n):ie(t)}var E=`openhands-agent-server-conversation-metadata`,D=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(E);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},O=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(E);return}window.localStorage.setItem(E,JSON.stringify(e))}},k=e=>D()[e]??null,A=(e,t)=>{let n=D();n[e]=t,O(n)},j=e=>{let t=D();e in t&&(delete t[e],O(t))};function M(e){if(!e?.id)return e;let t=k(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 N(){let e=a().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function oe(e=20,t){let n=N(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await v({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>M(e)),next_page_id:i?.next_page_id??null}}async function P(e){if(e.length===0)return[];let t=N(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await v({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(M)}async function se(e){return await v({backend:N(),method:`POST`,path:`/api/v1/app-conversations`,body:e})}async function ce(e){return v({backend:N(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function le(e){await v({backend:N(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function ue(e,t){return await v({backend:N(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function de(e){await v({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function fe(e){await v({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function pe(e,t){let n=N(),r=new URLSearchParams;return r.append(`file_path`,t),await v({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function me(e){let t=N(),n=new URLSearchParams;return n.set(`ids`,e),(await v({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}var F=`canvas_ui`,he=`canvas_ui_tool`,ge=[`terminal`,`file_editor`,`task_tracker`,F],I=`browser_tool_set`,L=`task_tool_set`;function _e(){return!0}function ve(){let e=(void 0)?.trim();if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_RUNTIME_SERVICES_INFO__;if(typeof e==`string`)return e.trim()||null}return null}function ye(){let e=ve();if(!e)return null;try{let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function be(){let e=ye();if(!e?.services)return;let t=[];t.push(`<RUNTIME_SERVICES>`),e.mode?t.push(`You are running inside an agent-canvas dev stack started in '${e.mode}' mode.`):t.push(`You are running inside an agent-canvas dev stack.`),t.push(`The following services are reachable from your sandbox. URLs are written`,`from your point of view (i.e., as you should curl/fetch them).`,``);let{agent_server:n,ingress:r,automation:i}=e.services,a=e.services.frontend??e.services.vite;n?.url_from_agent&&t.push(`* Agent Server (you): ${n.url_from_agent}`,` ${n.description??`The agent-server hosting your tool calls.`}`),r?.url_from_agent&&t.push(`* Ingress: ${r.url_from_agent}`,` ${r.description??`Unified entry point for browser-facing traffic.`}`),a?.url_from_agent&&t.push(`* Frontend: ${a.url_from_agent}`,` ${a.description??`Frontend dev server.`}`),i?.url_from_agent?(t.push(`* Automation backend: ${i.url_from_agent}`,` ${i.description??`OpenHands Automations service.`}`),i.docs_url&&t.push(` Docs: ${i.docs_url}`),i.openapi_url&&t.push(` OpenAPI: ${i.openapi_url}`),i.auth_env_var&&t.push(` Auth: header 'X-Session-API-Key: $${i.auth_env_var}'`)):t.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let o=n?.url_from_agent;return t.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),o&&t.push(`In particular, ${o} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),t.push(`</RUNTIME_SERVICES>`),t.join(`
|
|
3
|
+
`)}function xe(e){let{host:t}=o();return`${t}/api/conversations/${e}`}function R(e){return`Conversation ${e.slice(0,5)}`}function z(e){let n=k(e.id),r=e.agent?.kind===`ACPAgent`,i=r?e.tags?.acpserver??null:null;return{id:e.id,created_by_user_id:null,selected_repository:n?.selected_repository??null,selected_branch:n?.selected_branch??null,git_provider:n?.git_provider??null,selected_workspace:n?.selected_workspace??null,active_profile:n?.active_profile??null,title:e.title?.trim()?e.title:R(e.id),trigger:null,pr_number:[],agent_kind:r?`acp`:`openhands`,acp_server:i,llm_model:r?S({runtimeName:e.current_model_name,runtimeId:e.current_model_id,configured:e.agent?.acp_model,sdkLlm:e.agent?.llm?.model}):e.agent?.llm?.model??b.llm_model,metrics:e.metrics?{accumulated_cost:e.metrics.accumulated_cost??null,max_budget_per_task:e.metrics.max_budget_per_task??null,accumulated_token_usage:e.metrics.accumulated_token_usage?{prompt_tokens:e.metrics.accumulated_token_usage.prompt_tokens??0,completion_tokens:e.metrics.accumulated_token_usage.completion_tokens??0,cache_read_tokens:e.metrics.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:e.metrics.accumulated_token_usage.cache_write_tokens??0,context_window:e.metrics.accumulated_token_usage.context_window??0,per_turn_token:e.metrics.accumulated_token_usage.per_turn_token??0}:null}:null,created_at:e.created_at,updated_at:e.updated_at,execution_status:e.execution_status??t.IDLE,sandbox_status:e.sandbox_status??null,conversation_url:xe(e.id),session_api_key:o().apiKey??null,sandbox_id:null,workspace:{working_dir:e.workspace?.working_dir??l()},public:!1,sub_conversation_ids:[]}}function Se(e){return{items:e.items.map(z),next_page_id:e.next_page_id??null}}var Ce=`acpserver`,we=new Set([`schema_version`,`agent_settings`,`workspace`,`conversation_id`,`initial_message`,`plugins`]);function B(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:structuredClone(e)}function V(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function Te(e){return e.confirmation_mode===!0?e.security_analyzer===`llm`?{kind:`ConfirmRisky`,threshold:`HIGH`,confirm_unknown:!0}:{kind:`AlwaysConfirm`}:{kind:`NeverConfirm`}}function Ee(e){switch(e.security_analyzer){case`llm`:return{kind:`LLMSecurityAnalyzer`};case`pattern`:return{kind:`PatternSecurityAnalyzer`};case`policy_rail`:return{kind:`PolicyRailSecurityAnalyzer`};default:return}}function De(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.name==`string`}function H(e,t){return e===I?_e()&&_(e):e===L?t.enable_sub_agents===!0&&_(e):!0}function Oe(e){let t=new Map;for(let e of ge)t.set(e,{name:e,params:{}});for(let n of[I,L])H(n,e)&&t.set(n,{name:n,params:{}});let n=e.tools;if(Array.isArray(n)&&n.every(e=>De(e)))for(let r of n)H(r.name,e)&&t.set(r.name,{name:r.name,params:B(r.params)});return Array.from(t.values())}function ke(e,t){let n=[e?.trim(),t?.trim()].filter(Boolean);return n.length===0?null:{role:`user`,content:[{type:`text`,text:n.join(`
|
|
4
|
+
|
|
5
|
+
`)}],run:!0}}function U(e){let t=be();return{...B(e.agent_context),load_public_skills:n(),load_user_skills:!0,load_project_skills:!0,...t?{system_message_suffix:t}:{}}}function W(e){return B(e.agent_settings).agent_kind===`acp`}function Ae(e){let t=B(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function je(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=x(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Me(e){let t=B(e.agent_settings),n={agent_kind:`acp`,agent_context:U(t)};for(let e of h){if(e===`acp_model`||e===`acp_env`)continue;let r=e===`acp_command`?je(t):t[e];r!=null&&(n[e]=r)}let r=B(t.mcp_config);Object.keys(r).length>0&&`mcpServers`in r&&(n.mcp_config=r);let i=x(typeof t.acp_server==`string`?t.acp_server:void 0),a=S({configured:t.acp_model,providerDefault:i?.default_model});return a&&(n.acp_model=a),n}function Ne(e){let t=B(e.agent_settings),n=B(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:b.llm_model;let r=V(n.api_key);r?n.api_key=r:delete n.api_key;let i=V(n.base_url);i?n.base_url=i:delete n.base_url;let a=B(t.mcp_config);(Object.keys(a).length===0||!(`mcpServers`in a))&&delete t.mcp_config,delete t.acp_server;for(let e of h)delete t[e];return delete t.acp_env,{...t,llm:n,agent_context:U(t),tools:Oe(t)}}function Pe(e){return W(e)?Me(e):Ne(e)}function Fe(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=B(t.conversation_settings),s=ke(n,r);return we.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??l()},...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 Ie(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=W(t),r=Pe(t),i=n?Ae(t):void 0,a=Fe(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),o={agent_settings:r,workspace:a.workspace,confirmation_policy:Te(a),max_iterations:typeof a.max_iterations==`number`?a.max_iterations:500,stuck_detection:!0,autotitle:!0,worktree:!0};i&&(o.tags={[Ce]:i}),e.secretsEncrypted&&(o.secrets_encrypted=!0),e.conversationId&&(o.conversation_id=e.conversationId);let s=Ee(a);if(s&&(o.security_analyzer=s),a.initial_message&&(o.initial_message=a.initial_message),a.plugins&&(o.plugins=a.plugins),a.hook_config&&(o.hook_config=a.hook_config),o.tool_module_qualnames={[F]:he,...a.tool_module_qualnames??{}},a.agent_definitions&&(o.agent_definitions=a.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=c(),r=t?ee(t):{},i={};for(let t of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(t.name)}`,description:t.description};Object.keys(r).length>0&&(e.headers=r),i[t.name]=e}o.secrets=i,n&&(o.agent_settings.agent_context={...o.agent_settings.agent_context,secrets:i})}return o}async function Le(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-rJqZtDmI.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5])),[r,i]=await Promise.all([C.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return Ie({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Re(){return{hooks:[]}}var ze=`1970-01-01T00:00:00.000Z`,Be=`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 G(){return Error(Be)}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){return typeof e==`number`?e:null}function J(e){return typeof e==`number`?e:0}function Y(e){return typeof e==`string`?e:null}function X(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:ze}function Ve(e){return K(e)?{prompt_tokens:J(e.prompt_tokens),completion_tokens:J(e.completion_tokens),cache_read_tokens:J(e.cache_read_tokens),cache_write_tokens:J(e.cache_write_tokens),context_window:J(e.context_window),per_turn_token:J(e.per_turn_token)}:null}function Z(e){return K(e)?{accumulated_cost:q(e.accumulated_cost),max_budget_per_task:q(e.max_budget_per_task),accumulated_token_usage:Ve(e.accumulated_token_usage)}:null}function He(e){if(!K(e))return null;let t=K(e.llm)?{model:Y(e.llm.model)}:null;return{kind:Y(e.kind),acp_model:Y(e.acp_model),llm:t}}function Ue(e){return K(e)?{working_dir:Y(e.working_dir)}:null}function We(e){if(!K(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function Ge(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 Ke(e,t){let n=Ge(e),r=Ge(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function qe(e){if(!K(e)||typeof e.id!=`string`||!e.id.trim())throw G();return{id:e.id.trim(),title:Y(e.title),created_at:X(e,`created_at`,`createdAt`),updated_at:X(e,`updated_at`,`updatedAt`),execution_status:Y(e.execution_status),sandbox_status:Y(e.sandbox_status),metrics:Z(e.metrics),agent:He(e.agent),workspace:Ue(e.workspace),tags:We(e.tags),current_model_id:Y(e.current_model_id),current_model_name:Y(e.current_model_name)}}function Q(e){if(!Array.isArray(e))throw G();return e.map(qe)}function Je(e){if(Array.isArray(e))return{items:Q(e),next_page_id:null};if(!K(e))throw G();return{items:Q(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var Ye=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function Xe(e){let t=e??`idle`;return Ye.has(t)?t:`idle`}function $(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var Ze=class{static async sendMessage(e,t,n){let i=a().backend,s=n?.conversationUrl??null,c=n?.sessionApiKey??null;if(i.kind===`cloud`){if(!s||!c){let[t]=await P([e]);s=t?.conversation_url?.trim()??null,c=t?.session_api_key?.trim()??null}if(!s||!c)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await v({backend:i,method:`POST`,hostOverride:r(s),path:`/api/conversations/${e}/events`,body:{...t,run:!0},authMode:`session-api-key`,sessionApiKey:c}),t}return await new w(o({conversationUrl:s,sessionApiKey:c})).sendEvent(e,t,{run:!0}),t}static async createConversation(e,t,n,r,l,u,d,f){if(a().backend.kind===`cloud`)return se({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:t??null,selected_repository:r?.selected_repository??null,selected_branch:r?.selected_branch??null,git_provider:r?.git_provider??null,plugins:n??null,parent_conversation_id:u??null,agent_type:d,sandbox_id:f??null});let p=await C.getSettings(),m=y(),h=await Le({settings:p,query:e,conversationInstructions:t,plugins:n,conversationId:m,workingDir:await ae(l??i(m))}),g=await new w(o()).createConversation(h),_=c();if(!_)throw new s;return(r?.selected_repository||l)&&A(g.id,{selected_repository:r?.selected_repository??null,selected_branch:r?.selected_branch??null,git_provider:r?.git_provider??null,selected_workspace:l??null}),{id:g.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:g.id,agent_server_url:_.host,request:{initial_message:h.initial_message,plugins:n??null},created_at:g.created_at,updated_at:g.updated_at}}static async getStartTask(e){return a().backend.kind===`cloud`?me(e):null}static async getVSCodeUrl(e,t,n){let r=await this.resolveConversationWorkingDir(e);return{vscode_url:await new f(o({conversationUrl:t,sessionApiKey:n})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??l()}static async batchGetAppConversations(e){return e.length===0?[]:a().backend.kind===`cloud`?P(e):Q(await new w(o()).getConversations(e)).map(e=>z(e))}static async updateConversationPublicFlag(e,t){if(a().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return ue(e,t)}static async updateConversationRepository(e,t,n,r){t?A(e,{...k(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):j(e);let[i]=await this.batchGetAppConversations([e]);return $(i,e)}static async readConversationFile(e,t){if(a().backend.kind===`cloud`)return pe(e,Ke(t??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let n=await this.resolveConversationWorkingDir(e),r=Ke(t??`${n}/.agents_tmp/PLAN.md`,n);return new p(o()).downloadTextFile(r)}static async downloadConversation(e){return a().backend.kind===`cloud`?ce(e):new p(o()).downloadTrajectory(e)}static async getHooks(e){return Re()}static async getRuntimeConversation(e,t,n){let i=a().backend,s=i.kind===`cloud`&&t?await v({backend:i,method:`GET`,hostOverride:r(t),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:n}):await new w(o({conversationUrl:t,sessionApiKey:n})).getConversation(e),c=qe(s),l=K(s)?s.stats:null;return{id:c.id,title:c.title?.trim()?c.title:R(c.id),metrics:Z(c.metrics),created_at:c.created_at,updated_at:c.updated_at,status:Xe(c.execution_status),stats:K(l)?l:{usage_to_metrics:{}}}}static async searchConversations(e=20,t){return a().backend.kind===`cloud`?oe(e,t):Se(Je(await new w(o()).searchConversations({limit:e,page_id:t,sort_order:m.UPDATED_AT_DESC})))}static async deleteConversation(e){a().backend.kind===`cloud`?await le(e):await new w(o()).deleteConversation(e),j(e)}static async updateConversationTitle(e,t){await new w(o()).updateConversation(e,{title:t});let[n]=await this.batchGetAppConversations([e]);return $(n,e)}static async switchProfile(e,t){if(a().backend.kind===`cloud`)throw Error(`LLM profile switching is only supported for local agent-server backends.`);if(!e){await new g(o()).activateProfile(t);return}let n=o(),r=new w(n),i=await new g(n).getProfile(t,{exposeSecrets:`encrypted`}),s=typeof i.config.model==`string`?i.config.model:``;if(!s)throw Error(`Profile '${t}' has no model.`);await r.switchLLM(e,{...i.config,model:s,usage_id:`profile:${t}:${y()}`})}static async switchAcpModel(e,t){if(a().backend.kind===`cloud`)throw Error(`ACP model switching is only supported for local agent-server backends.`);await new w(o()).switchAcpModel(e,t)}};export{k as a,w as c,fe as i,P as n,A as o,de as r,ae as s,Ze as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{t as n}from"./react-CM_dJw1Z.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useTranslation-CbJtty1g.js";import{t as s}from"./retrieve-axios-error-message-DbnSBc_1.js";import{n as c,r as l}from"./custom-toast-handlers-fgD4IYsu.js";import{t as u}from"./utils-CVcuFUYj.js";import{t as d}from"./brand-button-BoiPxAGm.js";import{t as f}from"./settings-input-
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-BFRubm34.js";import{t as n}from"./react-CM_dJw1Z.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useTranslation-CbJtty1g.js";import{t as s}from"./retrieve-axios-error-message-DbnSBc_1.js";import{n as c,r as l}from"./custom-toast-handlers-fgD4IYsu.js";import{t as u}from"./utils-CVcuFUYj.js";import{t as d}from"./brand-button-BoiPxAGm.js";import{t as f}from"./settings-input-DsoZj8Dm.js";import{a as p,i as m,n as h,t as g}from"./acp-providers-C55k29rf.js";import{r as _}from"./use-settings-0qFqC-r6.js";import{t as v}from"./use-save-settings-CP23emUY.js";import{t as y}from"./use-agent-settings-schema-DtusObuC.js";import{r as b}from"./typography-Cx7uw7z3.js";import{i as ee,r as te}from"./sdk-settings-field-metadata-CETNItbo.js";import{t as x}from"./settings-dropdown-input-BUk4m23x.js";import{t as ne}from"./settings-switch-BQiAS9ga.js";var S=t(((e,t)=>{t.exports=function(e){return e.map(function(e){return e===``?`''`:e&&typeof e==`object`?e.op.replace(/(.)/g,`\\$1`):/["\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(` `)}})),C=t(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`"((\\\\"|[^"])*?)"`,o=`'((\\\\'|[^'])*?)'`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r.push(i),t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function 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?e:e.concat(t)},[])}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.concat(t);var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?e.concat(n[0]):e.concat(n.filter(Boolean).map(function(e){return m.test(e)?JSON.parse(e.split(d)[1]):e}))},[]):r}})),w=t((e=>{e.quote=S(),e.parse=C()})),T=e(n(),1),{quote:E}=e(w(),1);function D(e){let t=[],n=0,r=``,i=!1;for(;n<e.length;){let a=e[n];if(a===` `||a===` `||a===`
|
|
2
2
|
`||a===`\r`){i&&=(t.push(r),r=``,!1),n+=1;continue}if(a===`'`){for(i=!0,n+=1;n<e.length&&e[n]!==`'`;)r+=e[n],n+=1;n<e.length&&(n+=1);continue}if(a===`"`){for(i=!0,n+=1;n<e.length&&e[n]!==`"`;){if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`\\`){r+=t,n+=2;continue}}r+=e[n],n+=1}n<e.length&&(n+=1);continue}if(a===`\\`&&n+1<e.length){i=!0,r+=e[n+1],n+=2;continue}i=!0,r+=a,n+=1}return i&&t.push(r),t}var O=/[\s"'\\$`&|;<>(){}*?#!~[\]]/;function k(e){return e.map(e=>O.test(e)||e===``?E([e]):e).join(` `)}var A=i(),j={hideTitle:!0},M=`enable_sub_agents`,re=`npx -y <package-name>`,N=`__custom_model__`;function P(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function F(e,t){let n=D(e).join(` `);for(let e of t)if(n===e.default_command.join(` `))return e.key;return g}function ie(e){return e?.find(e=>e.key===M)}function ae(e,t){return typeof e==`boolean`?e:t?.default===!0}function I(e,t){return e?.available_models?.some(({id:e})=>e===t.trim())??!1}function L(){let{t:e}=o(`openhands`),{data:t,isLoading:n}=_(),{mutate:r,isPending:i}=v(),{data:S}=y(t?.agent_settings_schema),C=ie(T.useMemo(()=>S?.sections.flatMap(e=>e.fields),[S])),w=T.useMemo(()=>ae(t?.agent_settings?.[M],C),[C,t?.agent_settings]),[E,O]=(0,T.useState)(w),[j,L]=(0,T.useState)(`openhands`),[R,z]=(0,T.useState)(``),[B,V]=(0,T.useState)(``),[oe,H]=(0,T.useState)(!1),[se,U]=(0,T.useState)(!1),W=(0,T.useRef)(null),G=(0,T.useRef)(null),K=(0,T.useRef)(``);if((0,T.useEffect)(()=>{if(t&&W.current!==t){if(W.current=t,t.agent_settings?.agent_kind===`acp`){L(`acp`);let e=t.agent_settings?.acp_server,n=typeof e==`string`?e:void 0,r=p(n),i=P(t.agent_settings?.acp_command),a=[...i.length>0?i:r?.default_command??[],...P(t.agent_settings?.acp_args)],o=a.length>0?k(a):``;z(o),G.current=n??null,K.current=o;let s=t.agent_settings?.acp_model,c=typeof s==`string`?s.trim():``;V(c||r?.default_model||``),H(!!c&&(!r||!I(r,c)))}else L(`openhands`),z(``),V(``),G.current=null,K.current=``,H(!1);U(!1)}},[t]),(0,T.useEffect)(()=>{O(w)},[w]),n)return null;let q=j===`acp`,J=D(R),ce=q&&J.length===0,Y=F(R,h),X=p(Y),Z=X?.available_models??[],Q=Z.length>0,le=I(X,B),$=oe||!le?N:B,ue=!!X&&J.join(` `)===X.default_command.join(` `),de=k(h[0]?.default_command??[])||re,fe=se||!q&&E!==w,pe=()=>{if(q){let t=!!(X&&ue),n=G.current,i=R===K.current,o=!!n&&n!==`custom`&&!h.some(e=>e.key===n),u=q&&i&&o,d=m(u?n:X&&ue?X.key:g,{command:t?[]:J,model:B.trim()||void 0,allowUnknownServer:u});if(!d)return;r({agent_settings_diff:d},{onError:t=>{c(s(t)||e(a.ERROR$GENERIC))},onSuccess:()=>{l(e(a.SETTINGS$SAVED)),U(!1)}})}else r({agent_settings_diff:{agent_kind:`openhands`,enable_sub_agents:E}},{onError:t=>{c(s(t)||e(a.ERROR$GENERIC))},onSuccess:()=>{l(e(a.SETTINGS$SAVED)),U(!1)}})},me=C?ee(e,C.key,C.label):e(a.SCHEMA$ENABLE_SUB_AGENTS$LABEL),he=C?te(e,C.key,C.description):e(a.SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION);return(0,A.jsxs)(`div`,{"data-testid":`agent-settings-screen`,className:`flex flex-col gap-6 pb-8 max-w-2xl`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(b.H2,{className:`mb-2`,children:e(a.SETTINGS$NAV_AGENT)}),(0,A.jsx)(b.Paragraph,{className:`text-sm text-[#A3A3A3]`,children:e(a.SETTINGS$AGENT_PAGE_DESCRIPTION)})]}),(0,A.jsx)(x,{testId:`agent-type-selector`,name:`agent-type`,label:e(a.SETTINGS$NAV_AGENT),items:[{key:`openhands`,label:e(a.SETTINGS$AGENT_TYPE_OPENHANDS)},{key:`acp`,label:e(a.SETTINGS$AGENT_TYPE_ACP)}],selectedKey:j,onSelectionChange:e=>{if(!e)return;let t=e;if(L(t),t===`acp`&&!R){let e=h[0];e&&(z(k(e.default_command)),V(e.default_model??``),H(!1))}else t===`openhands`&&H(!1);U(!0)}}),!q&&(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(ne,{testId:`agent-settings-enable-sub-agents`,isToggled:E,onToggle:e=>{O(e)},children:me}),he?(0,A.jsx)(b.Paragraph,{className:u(`pl-12`,`text-tertiary-alt text-xs leading-5`),children:he}):null]}),q&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{testId:`agent-preset-selector`,name:`agent-preset`,label:e(a.SETTINGS$AGENT_PRESET),items:[...h.map(e=>({key:e.key,label:e.display_name})),{key:`custom`,label:e(a.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Y,onSelectionChange:e=>{if(!e)return;let t=String(e),n=p(t);n?(z(k(n.default_command)),V(n.default_model??``),H(!1)):t===`custom`&&(z(``),V(``),H(!0)),U(!0)}}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,A.jsx)(b.Text,{className:`text-sm`,children:e(a.SETTINGS$AGENT_COMMAND)}),(0,A.jsx)(`textarea`,{"data-testid":`agent-command-input`,className:`bg-tertiary border border-[#717888] rounded-sm p-2 text-sm font-mono text-white placeholder:text-[#717888] min-h-[60px] resize-y focus:outline-none focus:border-white`,value:R,placeholder:de,onChange:e=>{let t=e.target.value,n=F(R,h),r=F(t,h);r!==n&&(V(p(r)?.default_model??``),H(!1)),z(t),U(!0)}}),(0,A.jsx)(b.Text,{className:`text-xs text-[#717888]`,children:e(a.SETTINGS$AGENT_COMMAND_HINT)})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Q&&(0,A.jsx)(x,{testId:`agent-model-selector`,name:`agent-model`,label:e(a.SETTINGS$AGENT_MODEL),items:[...Z.map(e=>({key:e.id,label:e.label})),{key:N,label:e(a.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:$,onSelectionChange:e=>{if(!e)return;let t=String(e);t===N?(H(!0),V(``)):(H(!1),V(t)),U(!0)}}),$===N&&(0,A.jsx)(f,{testId:`agent-model-input`,label:e(Q?a.SETTINGS$AGENT_CUSTOM_MODEL:a.SETTINGS$AGENT_MODEL),type:`text`,className:`w-full`,value:B,showOptionalTag:!0,onChange:e=>{V(e),U(!0)}}),(0,A.jsx)(b.Text,{className:`text-xs text-[#717888]`,children:e(a.SETTINGS$AGENT_MODEL_HINT)})]})]}),(0,A.jsx)(`div`,{children:(0,A.jsx)(d,{testId:`agent-save-button`,type:`button`,variant:`primary`,isDisabled:i||!fe||ce,onClick:pe,children:e(i?a.SETTINGS$SAVING:a.SETTINGS$SAVE_CHANGES)})})]})}var R=r(L);export{R as default,j as handle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./utils-CVcuFUYj.js";import{n as o}from"./navigation-context-CszaA-CJ.js";import{l as s}from"./vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./utils-CVcuFUYj.js";import{n as o}from"./navigation-context-CszaA-CJ.js";import{l as s}from"./vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BwbkftxT.js";import{t as c}from"./close-CbOsKMRg.js";import{r as l}from"./typography-Cx7uw7z3.js";import{t as u}from"./vendor~conversation-panel~conversation~alert-banner-BnHToS5O.js";var d=e(t(),1),f=n();function p({maintenanceStartTime:e,faultyModels:t,errorMessage:n,updatedAt:p}){let{t:m}=i(`openhands`),[h,g]=u(`alert_banner_dismissed_at`,null),{currentPath:_}=o(),v=e?(e=>new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}))(e):null,y=!!e,b=t&&t.length>0,x=n&&n.trim().length>0,S=y||b||x,C=(0,d.useMemo)(()=>S?h!==p:!1,[h,p,S]),w=(0,d.useMemo)(()=>{if(!n)return null;let e=m(n);return e===n?n:e},[n,m]);return C?(0,f.jsxs)(`div`,{"data-testid":`alert-banner`,className:a(`bg-base border border-primary text-white p-4 rounded`,`flex flex-row items-center justify-between m-1`,_===`/`&&`mt-3 mr-3`),children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:`flex-shrink-0`,children:(0,f.jsx)(s,{className:`text-primary align-middle`})}),(0,f.jsx)(`div`,{className:`ml-3 flex flex-col gap-1`,children:(()=>{let e=[];return y&&v&&e.push((0,f.jsx)(l.Paragraph,{className:`text-sm font-medium`,children:m(r.MAINTENANCE$SCHEDULED_MESSAGE,{time:v})},`maintenance`)),b&&e.push((0,f.jsxs)(l.Paragraph,{className:`text-sm font-medium`,children:[m(r.ALERT$FAULTY_MODELS_MESSAGE),` `,t.join(`, `)]},`faulty-models`)),x&&w&&e.push((0,f.jsx)(l.Paragraph,{className:`text-sm font-medium`,children:w},`error-message`)),e})()})]}),(0,f.jsx)(`button`,{type:`button`,"data-testid":`dismiss-button`,onClick:()=>g(p),className:a(`bg-base rounded-full w-5 h-5 flex items-center justify-center cursor-pointer`),children:(0,f.jsx)(c,{})})]}):null}export{p as AlertBanner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,t}from"./declaration-IA661TBv.js";import{t as n}from"./useTranslation-CbJtty1g.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js";import{r as i}from"./telemetry-
|
|
1
|
+
import{o as e,t}from"./declaration-IA661TBv.js";import{t as n}from"./useTranslation-CbJtty1g.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js";import{r as i}from"./telemetry-j9SLrtY7.js";import{t as a}from"./modal-backdrop-B1si6TUd.js";import{n as o}from"./modal-body-2Po2nl1e.js";import{n as s,r as c}from"./base-modal-Ba5WcNb6.js";import{t as l}from"./brand-button-BoiPxAGm.js";import{t as u}from"./handle-capture-consent-DDnXMC9Y.js";import{t as d}from"./use-save-settings-CP23emUY.js";var f=e();function p({onClose:e}){let p=r(),{t:m}=n(`openhands`),{mutate:h}=d();return(0,f.jsx)(a,{children:(0,f.jsx)(`form`,{"data-testid":`user-capture-consent-form`,onSubmit:async t=>{t.preventDefault();let n=new FormData(t.currentTarget).get(`analytics`)===`on`;h({user_consents_to_analytics:n},{onSuccess:()=>{u(p,n),i(n?`granted`:`denied`),e()}})},className:`flex flex-col gap-2`,children:(0,f.jsxs)(o,{className:`border border-[var(--oh-border)]`,children:[(0,f.jsx)(c,{title:m(t.ANALYTICS$TITLE)}),(0,f.jsx)(s,{children:m(t.ANALYTICS$DESCRIPTION)}),(0,f.jsxs)(`label`,{className:`flex gap-2 items-center self-start text-sm`,children:[(0,f.jsx)(`input`,{name:`analytics`,type:`checkbox`,defaultChecked:!0}),m(t.ANALYTICS$SEND_ANONYMOUS_DATA)]}),(0,f.jsx)(l,{testId:`confirm-preferences`,type:`submit`,variant:`primary`,className:`w-full`,children:m(t.ANALYTICS$CONFIRM_PREFERENCES)})]})})})}export{p as AnalyticsConsentFormModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./utils-CVcuFUYj.js";import{n as o,p as s}from"./agent-server-client-options-Dvgeb3x4.js";import{r as c}from"./active-backend-context-CQTk4wD8.js";import{t as l}from"./settings-client-BUlG0Gzq.js";import{i as u}from"./agent-server-compatibility-BANjmMTo.js";import{r as d,t as f}from"./modal-body-2Po2nl1e.js";import{t as p}from"./brand-button-BoiPxAGm.js";import{r as m,t as h}from"./backend-form-modal-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./utils-CVcuFUYj.js";import{n as o,p as s}from"./agent-server-client-options-Dvgeb3x4.js";import{r as c}from"./active-backend-context-CQTk4wD8.js";import{t as l}from"./settings-client-BUlG0Gzq.js";import{i as u}from"./agent-server-compatibility-BANjmMTo.js";import{r as d,t as f}from"./modal-body-2Po2nl1e.js";import{t as p}from"./brand-button-BoiPxAGm.js";import{r as m,t as h}from"./backend-form-modal-BUy-PzZN.js";var g=e(t(),1),_=n();function v(){let{t:e}=i(`openhands`),{active:t,addBackend:n,updateBackend:v}=c(),y=window.location.origin,[b,x]=g.useState(!1),[S,C]=g.useState(`idle`),[w,T]=g.useState(null),E=g.useCallback(async i=>{x(!0),C(`idle`),T(null);try{await new l(o({host:i.host,sessionApiKey:i.apiKey,timeout:5e3})).getSettings(),C(`success`),s(t.backend)?n(i):v(t.backend.id,i),window.location.reload()}catch(t){if(C(`error`),u(t,401))T(e(r.AUTH$INVALID_KEY));else{let n=t instanceof Error?t.message:String(t);T(`${e(r.AUTH$CONNECTION_FAILED)}${n?`: ${n}`:``}`)}x(!1)}},[t.backend,n,v,e]);return(0,_.jsx)(`div`,{"data-testid":`api-key-entry-screen`,className:`flex min-h-screen items-center justify-center bg-base px-6`,children:(0,_.jsxs)(`div`,{className:a(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,d(`md`),f),children:[(0,_.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(r.BACKEND$ADD_TITLE)})}),(0,_.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:(0,_.jsx)(h,{mode:`add`,backend:{...t.backend,host:y,apiKey:``,name:``},onSubmitted:()=>{},testIdRoot:`api-key-entry`,hostReadOnly:!0,requireApiKey:!0,onSubmitOverride:E,renderActions:({canSubmit:t,testIdRoot:n})=>(0,_.jsxs)(_.Fragment,{children:[S!==`idle`&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,_.jsx)(m,{isConnected:S===`success`}),(0,_.jsx)(`span`,{"data-testid":`${n}-status`,className:S===`error`?`text-red-400`:`text-green-400`,children:S===`error`?w:e(r.ONBOARDING$BACKEND_STATUS_CONNECTED)})]}),(0,_.jsx)(p,{type:`submit`,variant:`secondary`,isDisabled:!t||b,testId:`${n}-submit`,className:`w-full text-center`,children:e(b?r.ONBOARDING$BACKEND_STATUS_CHECKING:r.BACKEND$CONNECT)})]})})})]})})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as r,t as i}from"./declaration-IA661TBv.js";import{t as a}from"./useTranslation-CbJtty1g.js";import{t as o}from"./i18n-CyvU1o95.js";import{t as s}from"./retrieve-axios-error-message-DbnSBc_1.js";import{n as c,r as l}from"./custom-toast-handlers-fgD4IYsu.js";import{n as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js";import{t as d}from"./brand-button-BoiPxAGm.js";import{i as f,n as p,r as m,t as h}from"./color-themes-B9n7pBQl.js";import{t as g}from"./settings-input-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as r,t as i}from"./declaration-IA661TBv.js";import{t as a}from"./useTranslation-CbJtty1g.js";import{t as o}from"./i18n-CyvU1o95.js";import{t as s}from"./retrieve-axios-error-message-DbnSBc_1.js";import{n as c,r as l}from"./custom-toast-handlers-fgD4IYsu.js";import{n as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js";import{t as d}from"./brand-button-BoiPxAGm.js";import{i as f,n as p,r as m,t as h}from"./color-themes-B9n7pBQl.js";import{t as g}from"./settings-input-DsoZj8Dm.js";import{t as _}from"./settings-BgL2HUsU.js";import{r as v}from"./use-settings-0qFqC-r6.js";import{t as y}from"./handle-capture-consent-DDnXMC9Y.js";import{t as b}from"./use-save-settings-CP23emUY.js";import{n as x,t as S}from"./switch-skeleton-QpdcdxRP.js";import{t as C}from"./settings-dropdown-input-BUk4m23x.js";import{t as w}from"./settings-switch-BQiAS9ga.js";var T=e(t(),1),E=r();function D({defaultKey:e,onChange:t,name:n}){let{t:r}=a(`openhands`);return(0,E.jsx)(C,{testId:n,name:n,onInputChange:t,label:r(i.SETTINGS$LANGUAGE),items:o.map(e=>({key:e.value,label:e.label})),defaultSelectedKey:e,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function O(){let{t:e}=a(`openhands`),t=T.useCallback(e=>{if(!e)return;let t=e;p(t),m(t)},[]);return(0,E.jsx)(C,{testId:`color-theme-input`,name:`color-theme-input`,label:e(i.SETTINGS$COLOR_THEME),items:h.map(e=>({key:e.key,label:e.label})),defaultSelectedKey:f(),onSelectionChange:t,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function k(){return(0,E.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,E.jsx)(x,{}),(0,E.jsx)(S,{}),(0,E.jsx)(S,{})]})}function A(){let e=u(),{t}=a(`openhands`),{mutate:n,isPending:r}=b(),{data:f,isLoading:p}=v(),[m,h]=T.useState(!1),[x,S]=T.useState(!1),[C,A]=T.useState(!1),[j,M]=T.useState(!1),[N,P]=T.useState(!1),F=r=>{let a=r.get(`language-input`)?.toString(),u=o.find(({label:e})=>e===a)?.value||_.language,d=r.get(`enable-analytics-switch`)?.toString()===`on`;n({language:u,user_consents_to_analytics:d,enable_sound_notifications:r.get(`enable-sound-notifications-switch`)?.toString()===`on`,git_user_name:r.get(`git-user-name-input`)?.toString()||_.git_user_name,git_user_email:r.get(`git-user-email-input`)?.toString()||_.git_user_email},{onSuccess:()=>{y(e,d),l(t(i.SETTINGS$SAVED))},onError:e=>{c(s(e)||t(i.ERROR$GENERIC))},onSettled:()=>{h(!1),S(!1),A(!1),M(!1),P(!1)}})},I=e=>{let t=o.find(({label:t})=>t===e)?.label,n=o.find(({value:e})=>e===f?.language)?.label;h(t!==n)},L=e=>{S(e!==(f?.user_consents_to_analytics??!0))},R=e=>{A(e!==!!f?.enable_sound_notifications)},z=e=>{let t=f?.git_user_name;M(e!==t)},B=e=>{let t=f?.git_user_email;P(e!==t)},V=!m&&!x&&!C&&!j&&!N,H=!f||p||r;return(0,E.jsxs)(`form`,{"data-testid":`app-settings-screen`,action:F,className:`flex flex-col gap-6`,children:[H&&(0,E.jsx)(k,{}),!H&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsx)(D,{name:`language-input`,defaultKey:f.language,onChange:I}),(0,E.jsx)(O,{}),(0,E.jsx)(w,{testId:`enable-analytics-switch`,name:`enable-analytics-switch`,defaultIsToggled:f.user_consents_to_analytics??!0,onToggle:L,children:t(i.ANALYTICS$SEND_ANONYMOUS_DATA)}),(0,E.jsx)(w,{testId:`enable-sound-notifications-switch`,name:`enable-sound-notifications-switch`,defaultIsToggled:!!f.enable_sound_notifications,onToggle:R,children:t(i.SETTINGS$SOUND_NOTIFICATIONS)}),(0,E.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,E.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:t(i.SETTINGS$GIT_SETTINGS)}),(0,E.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:t(i.SETTINGS$GIT_SETTINGS_DESCRIPTION)}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsx)(g,{testId:`git-user-name-input`,name:`git-user-name-input`,type:`text`,label:t(i.SETTINGS$GIT_USERNAME),defaultValue:f.git_user_name||``,onChange:z,placeholder:t(i.SETTINGS$GIT_USERNAME_PLACEHOLDER),className:`w-full min-w-0`}),(0,E.jsx)(g,{testId:`git-user-email-input`,name:`git-user-email-input`,type:`email`,label:t(i.SETTINGS$GIT_EMAIL),defaultValue:f.git_user_email||``,onChange:B,placeholder:t(i.SETTINGS$GIT_EMAIL_PLACEHOLDER),className:`w-full min-w-0`})]}),(0,E.jsx)(`div`,{className:`flex justify-start pt-4`,children:(0,E.jsxs)(d,{testId:`submit-button`,variant:`primary`,type:`submit`,isDisabled:r||V,children:[!r&&t(`SETTINGS$SAVE_CHANGES`),r&&t(`SETTINGS$SAVING`)]})})]})]})]})}var j=n(A);export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n,P as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useQuery-JDs8UaWj.js";import{t as s}from"./useTranslation-CbJtty1g.js";import{t as c}from"./back-nav-button-BDM9vr_o.js";import{n as l,r as u}from"./custom-toast-handlers-fgD4IYsu.js";import{t as d}from"./utils-CVcuFUYj.js";import{a as f,c as p,n as m}from"./agent-server-client-options-Dvgeb3x4.js";import{n as h}from"./active-backend-context-CQTk4wD8.js";import{l as g}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-Cwz6a1DC.js";import{r as _}from"./modal-classes-9XTtWCtF.js";import{n as v}from"./navigation-context-CszaA-CJ.js";import{n as y,r as b}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as x}from"./proxy-wIasY2Po.js";import{t as S}from"./use-tracking-DQU60djN.js";import{t as C}from"./u-edit-CH5nNya1.js";import{t as w}from"./terminal-DQJ6IJUd.js";import{t as T}from"./use-user-conversation-DwOGM1lc.js";import{t as E}from"./toggle-switch-C-7juZ1u.js";import{t as D}from"./x-mark-CmcVOTk2.js";import{t as O}from"./code-tag-Cz9AIz-X.js";import{t as k}from"./link-external-kU6aFXU6.js";import{t as A}from"./globe-2otpEmVh.js";import{C as j,S as M,a as N,b as ee,c as P,d as F,f as te,g as ne,i as re,l as I,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as L,v as ue,x as de,y as fe}from"./edit-automation-modal-kc_FzbzK.js";import{t as R}from"./automation-LZB0MjdV.js";var z=e(t()),B=i();function V(){let{t:e}=s(`openhands`);return(0,B.jsx)(c,{to:`/automations`,children:e(a.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var pe=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function me({active:e}){let{t}=s(`openhands`);return(0,B.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:d(`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?a.AUTOMATIONS$DETAIL$ACTIVE:a.AUTOMATIONS$DETAIL$INACTIVE)})}function he({automation:e,onToggle:t,onEdit:n,onDelete:r,onRunNow:i,isRunningNow:o=!1}){let{t:c}=s(`openhands`),l=te(`manage_automations`),u=[...n?[{label:c(a.AUTOMATIONS$EDIT),icon:(0,B.jsx)(C,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?c(a.AUTOMATIONS$TURN_OFF):c(a.AUTOMATIONS$TURN_ON),icon:(0,B.jsx)(ce,{className:`size-4`}),onClick:t},{label:c(a.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,B.jsx)(pe,{className:`size-4`}),onClick:()=>{j.downloadTarball(e.id,e.name)}},{label:c(a.AUTOMATIONS$DELETE),icon:(0,B.jsx)(ae,{className:`size-4`}),onClick:r}];return(0,B.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,B.jsx)(me,{active:e.enabled})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&i&&(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:o||!e.enabled,onClick:i,children:[(0,B.jsx)(F,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),o?`Starting…`:c(a.AUTOMATIONS$RUN_NOW)]}),l&&(0,B.jsx)(E,{enabled:e.enabled,label:e.enabled?c(a.AUTOMATIONS$TURN_OFF):c(a.AUTOMATIONS$TURN_ON),onToggle:t}),l&&(0,B.jsx)(oe,{items:u})]})]})})}function H({icon:e,title:t,children:n}){return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,B.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var ge=240,_e=`max-h-60`;function ve({prompt:e}){let{t}=s(`openhands`),[n,r]=z.useState(!1),[i,o]=z.useState(!1),c=z.useRef(null),l=i&&!n;return z.useLayoutEffect(()=>{let e=c.current;if(!e)return;let t=()=>{o(e.scrollHeight>ge)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,B.jsx)(H,{icon:(0,B.jsx)(w,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$PROMPT),children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`p`,{ref:c,className:d(`whitespace-pre-wrap text-sm leading-6 text-content`,l&&d(_e,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),l?(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,B.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?a.COMMON$VIEW_LESS:a.COMMON$VIEW_MORE)}):null]})})}var ye=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),be=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,B.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:9,cy:18,r:2})]}),U=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),W=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),xe=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function G({icon:e,label:t,children:n}){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,B.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function Se({branch:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var K=60;function Ce({filter:e}){let{t}=s(`openhands`),[n,r]=(0,z.useState)(!1),i=e.length>K;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`break-all`,children:i&&!n?`${e.slice(0,K)}…`:e}),i&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?a.SETTINGS$SKILLS_SHOW_LESS:a.SETTINGS$SKILLS_SHOW_MORE)})]})}function we({automation:e}){let{t}=s(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?a.AUTOMATIONS$DETAIL$TRIGGER_EVENT:a.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,B.jsx)(H,{icon:(0,B.jsx)(ye,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,B.jsx)(G,{icon:(0,B.jsx)(be,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,B.jsx)(Se,{branch:e.branch})]})}),(0,B.jsx)(G,{icon:(0,B.jsx)(U,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,B.jsx)(G,{icon:(0,B.jsx)(A,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,B.jsx)(G,{icon:(0,B.jsx)(k,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_TYPE),children:P(e.trigger.on)}),n&&e.trigger.filter&&(0,B.jsx)(G,{icon:(0,B.jsx)(O,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,B.jsx)(Ce,{filter:e.trigger.filter})}),(0,B.jsx)(G,{icon:(0,B.jsx)(I,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$MODEL),children:e.model??`Active profile`}),e.notification&&(0,B.jsx)(G,{icon:(0,B.jsx)(xe,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var Te=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ee({name:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function De({plugins:e}){let{t}=s(`openhands`);return(0,B.jsx)(H,{icon:(0,B.jsx)(Te,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$PLUGINS),children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,B.jsx)(Ee,{name:e},e))})})}var q=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function J(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function Oe(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),o=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(a.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(a.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):o<24?n(a.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:o}):s===1?n(a.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(a.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):J(e,t)}function ke({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=s(`openhands`),i=r.language;return(0,B.jsx)(H,{icon:(0,B.jsx)(q,{className:`size-4`}),title:n(a.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:n(a.AUTOMATIONS$DETAIL$CREATED),children:J(e,i)}),(0,B.jsx)(G,{icon:(0,B.jsx)(L,{className:`size-3.5`}),label:n(a.AUTOMATIONS$DETAIL$LAST_RUN),children:t?Oe(t,i,n):n(a.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Ae=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),je={[R.COMPLETED]:{label:a.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[R.FAILED]:{label:a.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[R.PENDING]:{label:a.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[R.RUNNING]:{label:a.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Me({status:e}){switch(e){case R.COMPLETED:return(0,B.jsx)(U,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case R.FAILED:return(0,B.jsx)(Ae,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,B.jsx)(L,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Ne({status:e}){let{t}=s(`openhands`),n=je[e];return(0,B.jsxs)(`span`,{className:d(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,B.jsx)(Me,{status:e}),t(n.label)]})}var Pe=20;function Fe(e){return e.kind===`BashOutput`}var Ie=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Pe;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=>{Fe(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=p().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))}),x({backend:r,method:`GET`,hostOverride:f(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new g(m({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Le=[`bash-command-logs`];function Re(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 Y(e){if(!b.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function ze(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=h(),a=T(r?t??null:null),s=a.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=i.backend.kind===`cloud`,d=a.isFetched,f=null,p=!1;u&&d&&(s?f=Re(s.sandbox_status)??(s.conversation_url?null:`missing`):p=!0);let m=r&&!!n&&(u?!!c:!0)&&!f&&!p,g=o({queryKey:[...Le,n,c,l,i.backend.id,i.orgId],queryFn:()=>Ie.listOutputs(c,l,n),enabled:m,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Y(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:p,sandboxIssue:v}}var Be={missing:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function X(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function Ve({conversationId:e,bashCommandId:t,isOpen:n,onClose:r}){let{t:i}=s(`openhands`),[o,c]=(0,z.useState)(`stdout`),{data:l,isFetching:u,isResolvingConversation:f,sandboxIssue:p,conversationMissing:m,error:h}=ze({conversationId:e,bashCommandId:t,enabled:n});(0,z.useEffect)(()=>{n&&c(`stdout`)},[n,t]),(0,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:g,stderr:v}=(0,z.useMemo)(()=>l?{stdout:X(l,`stdout`),stderr:X(l,`stderr`)}:{stdout:``,stderr:``},[l]);if(!n)return null;let y=f||u&&!l,b=!t,x=o===`stdout`?g:v,S=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,C=`border-[var(--oh-primary)] text-white`,w=`border-transparent text-muted hover:text-content`;return(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":i(a.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,B.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,B.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(a.AUTOMATIONS$CANCEL),children:(0,B.jsx)(D,{className:`size-5`})}),(0,B.jsx)(`h2`,{className:d(`pr-8`,_),children:i(a.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,B.jsxs)(`div`,{role:`tablist`,"aria-label":i(a.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:o===`stdout`?0:-1,onClick:()=>c(`stdout`),className:`${S} ${o===`stdout`?C:w}`,children:i(a.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:o===`stderr`?0:-1,onClick:()=>c(`stderr`),className:`${S} ${o===`stderr`?C:w}`,children:i(a.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${o}`,"aria-labelledby":`run-logs-tab-${o}`,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:[b&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!b&&m&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!b&&!m&&p&&(0,B.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${p}`,className:`text-muted italic`,children:i(Be[p])}),!b&&!m&&!p&&y&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!b&&!m&&!p&&!y&&h&&!l&&(0,B.jsxs)(`p`,{className:`text-danger`,children:[i(a.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(h)]}),!y&&!p&&l&&(0,B.jsx)(`pre`,{"data-testid":`run-logs-output-${o}`,className:`whitespace-pre-wrap break-words ${o===`stderr`?`text-danger`:`text-content`}`,children:x.length>0?x:(0,B.jsx)(`span`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]})]})]})}function He(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ue(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function We(e){return`/conversations/${e}`}function Ge({run:e}){let{t,i18n:n}=s(`openhands`),r=!!e.conversation_id,i=!!e.bash_command_id,o=e.status===R.COMPLETED||e.status===R.FAILED,c=!r&&o,[l,u]=(0,z.useState)(!1),[d]=(0,z.useState)(()=>new Date().toISOString()),f=He(Ue(e.started_at)?d:e.started_at,n.language),p=i?(0,B.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),u(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":t(a.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:f}),title:t(a.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,B.jsx)(w,{className:`size-4`})}):null,m=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm text-content`,children:f}),c&&(0,B.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,t(a.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,(0,B.jsx)(Ne,{status:e.status})]})]});return(0,B.jsxs)(B.Fragment,{children:[r&&e.conversation_id?(0,B.jsx)(`a`,{href:We(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${f}`,children:m}):(0,B.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:m}),i&&(0,B.jsx)(Ve,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:l,onClose:()=>u(!1)})]})}var Z=20;function Ke({automationId:e}){let{t}=s(`openhands`),[n,r]=(0,z.useState)(Z),{data:i,isLoading:o}=M({id:e,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:(0,B.jsx)(q,{className:`size-4`})}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(a.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),o&&(0,B.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,B.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,B.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!o&&i?.runs.length===0&&(0,B.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(a.AUTOMATIONS$DETAIL$NO_RUNS)}),!o&&i&&i.runs.length>0&&(0,B.jsxs)(`div`,{children:[i.runs.map((e,t)=>(0,B.jsx)(`div`,{className:t>0?`border-t border-[var(--oh-border)]`:``,children:(0,B.jsx)(Ge,{run:e})},e.id)),c&&(0,B.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:t(a.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,B.jsx)(`div`,{className:d(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,B.jsx)(Q,{className:`h-5 w-40`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Q,{className:`h-6 w-48`}),(0,B.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,B.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,B.jsx)(Q,{className:`h-5 w-96`}),(0,B.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function qe(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(N,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(a.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(a.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(V,{})})]})}var Je=n(function(){let{t:e}=s(`openhands`),{automationId:t}=r(),{navigate:n}=v(),[i,o]=(0,z.useState)(!1),[c,d]=(0,z.useState)(!1),{data:f,isLoading:p,refetch:m}=ne(),g=f?.status===`ok`,_=h(),b=(0,z.useRef)(_.backend.id).current!==_.backend.id,{data:x,isLoading:C,isError:w,error:T,refetch:E}=de({id:t??``,enabled:g&&!b}),{trackPrebuiltAutomationEnabled:D}=S(),O=ee(),k=ue(),A=fe(),j=w&&y(T)&&T.response?.status===404;if(p)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(!g)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(se,{onRetry:m})})});if(C)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(j)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(qe,{})})});if(w||!x)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(re,{onRetry:()=>E()})})});let M=()=>{let e=!x.enabled;O.mutate({id:x.id,enabled:e}),e&&D({automationId:x.id,automationName:x.name})},N=()=>{k.mutate(x.id,{onSuccess:()=>{n?.(`/automations`)}})},P=()=>{A.mutate(x.id,{onSuccess:()=>{u(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{l(y(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=_.backend.kind===`local`;return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(V,{}),(0,B.jsx)(he,{automation:x,onToggle:M,onEdit:F?()=>d(!0):void 0,onDelete:()=>o(!0),onRunNow:P,isRunningNow:A.isPending}),x.prompt&&(0,B.jsx)(ve,{prompt:x.prompt}),(0,B.jsx)(we,{automation:x}),x.plugins&&x.plugins.length>0&&(0,B.jsx)(De,{plugins:x.plugins}),(0,B.jsx)(ke,{createdAt:x.created_at,lastRunAt:x.last_triggered_at}),(0,B.jsx)(Ke,{automationId:x.id}),(0,B.jsx)(ie,{automationName:x.name,isOpen:i,onConfirm:N,onCancel:()=>o(!1)}),F&&(0,B.jsx)(le,{automation:x,isOpen:c,onClose:()=>d(!1)})]})})})});export{Je as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n,P as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useQuery-JDs8UaWj.js";import{t as s}from"./useTranslation-CbJtty1g.js";import{t as c}from"./back-nav-button-BDM9vr_o.js";import{n as l,r as u}from"./custom-toast-handlers-fgD4IYsu.js";import{t as d}from"./utils-CVcuFUYj.js";import{a as f,c as p,n as m}from"./agent-server-client-options-Dvgeb3x4.js";import{n as h}from"./active-backend-context-CQTk4wD8.js";import{u as g}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js";import{r as _}from"./modal-classes-9XTtWCtF.js";import{n as v}from"./navigation-context-CszaA-CJ.js";import{n as y,r as b}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as x}from"./proxy-wIasY2Po.js";import{t as S}from"./use-tracking-CjLZgh8X.js";import{t as C}from"./u-edit-foF02hwH.js";import{t as w}from"./terminal-BUww3Ssl.js";import{t as T}from"./use-user-conversation-CQ5IwnZk.js";import{t as E}from"./toggle-switch-DDr-DnEc.js";import{t as D}from"./x-mark-Cn-YJVbN.js";import{t as O}from"./code-tag-C0vR_IQH.js";import{t as k}from"./link-external-DCsHkAj4.js";import{t as A}from"./globe-CQ_5xwpo.js";import{C as j,S as M,a as N,b as ee,c as P,d as F,f as te,g as ne,i as re,l as I,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as L,v as ue,x as de,y as fe}from"./edit-automation-modal-C-oC5tis.js";import{t as R}from"./automation-BzmydDjr.js";var z=e(t()),B=i();function V(){let{t:e}=s(`openhands`);return(0,B.jsx)(c,{to:`/automations`,children:e(a.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var pe=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function me({active:e}){let{t}=s(`openhands`);return(0,B.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:d(`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?a.AUTOMATIONS$DETAIL$ACTIVE:a.AUTOMATIONS$DETAIL$INACTIVE)})}function he({automation:e,onToggle:t,onEdit:n,onDelete:r,onRunNow:i,isRunningNow:o=!1}){let{t:c}=s(`openhands`),l=te(`manage_automations`),u=[...n?[{label:c(a.AUTOMATIONS$EDIT),icon:(0,B.jsx)(C,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?c(a.AUTOMATIONS$TURN_OFF):c(a.AUTOMATIONS$TURN_ON),icon:(0,B.jsx)(ce,{className:`size-4`}),onClick:t},{label:c(a.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,B.jsx)(pe,{className:`size-4`}),onClick:()=>{j.downloadTarball(e.id,e.name)}},{label:c(a.AUTOMATIONS$DELETE),icon:(0,B.jsx)(ae,{className:`size-4`}),onClick:r}];return(0,B.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,B.jsx)(me,{active:e.enabled})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&i&&(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:o||!e.enabled,onClick:i,children:[(0,B.jsx)(F,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),o?`Starting…`:c(a.AUTOMATIONS$RUN_NOW)]}),l&&(0,B.jsx)(E,{enabled:e.enabled,label:e.enabled?c(a.AUTOMATIONS$TURN_OFF):c(a.AUTOMATIONS$TURN_ON),onToggle:t}),l&&(0,B.jsx)(oe,{items:u})]})]})})}function H({icon:e,title:t,children:n}){return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,B.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var ge=240,_e=`max-h-60`;function ve({prompt:e}){let{t}=s(`openhands`),[n,r]=z.useState(!1),[i,o]=z.useState(!1),c=z.useRef(null),l=i&&!n;return z.useLayoutEffect(()=>{let e=c.current;if(!e)return;let t=()=>{o(e.scrollHeight>ge)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,B.jsx)(H,{icon:(0,B.jsx)(w,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$PROMPT),children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`p`,{ref:c,className:d(`whitespace-pre-wrap text-sm leading-6 text-content`,l&&d(_e,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),l?(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,B.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?a.COMMON$VIEW_LESS:a.COMMON$VIEW_MORE)}):null]})})}var ye=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),be=e=>(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,B.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,B.jsx)(`circle`,{cx:9,cy:18,r:2})]}),U=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),W=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),xe=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function G({icon:e,label:t,children:n}){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,B.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function Se({branch:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var K=60;function Ce({filter:e}){let{t}=s(`openhands`),[n,r]=(0,z.useState)(!1),i=e.length>K;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`break-all`,children:i&&!n?`${e.slice(0,K)}…`:e}),i&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?a.SETTINGS$SKILLS_SHOW_LESS:a.SETTINGS$SKILLS_SHOW_MORE)})]})}function we({automation:e}){let{t}=s(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?a.AUTOMATIONS$DETAIL$TRIGGER_EVENT:a.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,B.jsx)(H,{icon:(0,B.jsx)(ye,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,B.jsx)(G,{icon:(0,B.jsx)(be,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,B.jsx)(Se,{branch:e.branch})]})}),(0,B.jsx)(G,{icon:(0,B.jsx)(U,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,B.jsx)(G,{icon:(0,B.jsx)(A,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,B.jsx)(G,{icon:(0,B.jsx)(k,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_TYPE),children:P(e.trigger.on)}),n&&e.trigger.filter&&(0,B.jsx)(G,{icon:(0,B.jsx)(O,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,B.jsx)(Ce,{filter:e.trigger.filter})}),(0,B.jsx)(G,{icon:(0,B.jsx)(I,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$MODEL),children:e.model??`Active profile`}),e.notification&&(0,B.jsx)(G,{icon:(0,B.jsx)(xe,{className:`size-3.5`}),label:t(a.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var Te=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ee({name:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function De({plugins:e}){let{t}=s(`openhands`);return(0,B.jsx)(H,{icon:(0,B.jsx)(Te,{className:`size-4`}),title:t(a.AUTOMATIONS$DETAIL$PLUGINS),children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,B.jsx)(Ee,{name:e},e))})})}var q=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function J(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function Oe(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),o=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(a.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(a.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):o<24?n(a.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:o}):s===1?n(a.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(a.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):J(e,t)}function ke({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=s(`openhands`),i=r.language;return(0,B.jsx)(H,{icon:(0,B.jsx)(q,{className:`size-4`}),title:n(a.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,B.jsx)(G,{icon:(0,B.jsx)(W,{className:`size-3.5`}),label:n(a.AUTOMATIONS$DETAIL$CREATED),children:J(e,i)}),(0,B.jsx)(G,{icon:(0,B.jsx)(L,{className:`size-3.5`}),label:n(a.AUTOMATIONS$DETAIL$LAST_RUN),children:t?Oe(t,i,n):n(a.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Ae=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,B.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),je={[R.COMPLETED]:{label:a.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[R.FAILED]:{label:a.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[R.PENDING]:{label:a.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[R.RUNNING]:{label:a.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Me({status:e}){switch(e){case R.COMPLETED:return(0,B.jsx)(U,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case R.FAILED:return(0,B.jsx)(Ae,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,B.jsx)(L,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Ne({status:e}){let{t}=s(`openhands`),n=je[e];return(0,B.jsxs)(`span`,{className:d(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,B.jsx)(Me,{status:e}),t(n.label)]})}var Pe=20;function Fe(e){return e.kind===`BashOutput`}var Ie=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Pe;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=>{Fe(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=p().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))}),x({backend:r,method:`GET`,hostOverride:f(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new g(m({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Le=[`bash-command-logs`];function Re(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 Y(e){if(!b.isAxiosError(e))return null;if(!e.response)return`unreachable`;let t=e.response.status;return t===404||t>=500?`unreachable`:null}function ze(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=h(),a=T(r?t??null:null),s=a.data,c=s?.conversation_url??null,l=s?.session_api_key??null,u=i.backend.kind===`cloud`,d=a.isFetched,f=null,p=!1;u&&d&&(s?f=Re(s.sandbox_status)??(s.conversation_url?null:`missing`):p=!0);let m=r&&!!n&&(u?!!c:!0)&&!f&&!p,g=o({queryKey:[...Le,n,c,l,i.backend.id,i.orgId],queryFn:()=>Ie.listOutputs(c,l,n),enabled:m,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Y(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:p,sandboxIssue:v}}var Be={missing:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:a.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function X(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function Ve({conversationId:e,bashCommandId:t,isOpen:n,onClose:r}){let{t:i}=s(`openhands`),[o,c]=(0,z.useState)(`stdout`),{data:l,isFetching:u,isResolvingConversation:f,sandboxIssue:p,conversationMissing:m,error:h}=ze({conversationId:e,bashCommandId:t,enabled:n});(0,z.useEffect)(()=>{n&&c(`stdout`)},[n,t]),(0,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:g,stderr:v}=(0,z.useMemo)(()=>l?{stdout:X(l,`stdout`),stderr:X(l,`stderr`)}:{stdout:``,stderr:``},[l]);if(!n)return null;let y=f||u&&!l,b=!t,x=o===`stdout`?g:v,S=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,C=`border-[var(--oh-primary)] text-white`,w=`border-transparent text-muted hover:text-content`;return(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":i(a.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,B.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,B.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(a.AUTOMATIONS$CANCEL),children:(0,B.jsx)(D,{className:`size-5`})}),(0,B.jsx)(`h2`,{className:d(`pr-8`,_),children:i(a.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,B.jsxs)(`div`,{role:`tablist`,"aria-label":i(a.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:o===`stdout`?0:-1,onClick:()=>c(`stdout`),className:`${S} ${o===`stdout`?C:w}`,children:i(a.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:o===`stderr`?0:-1,onClick:()=>c(`stderr`),className:`${S} ${o===`stderr`?C:w}`,children:i(a.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${o}`,"aria-labelledby":`run-logs-tab-${o}`,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:[b&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!b&&m&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!b&&!m&&p&&(0,B.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${p}`,className:`text-muted italic`,children:i(Be[p])}),!b&&!m&&!p&&y&&(0,B.jsx)(`p`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!b&&!m&&!p&&!y&&h&&!l&&(0,B.jsxs)(`p`,{className:`text-danger`,children:[i(a.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(h)]}),!y&&!p&&l&&(0,B.jsx)(`pre`,{"data-testid":`run-logs-output-${o}`,className:`whitespace-pre-wrap break-words ${o===`stderr`?`text-danger`:`text-content`}`,children:x.length>0?x:(0,B.jsx)(`span`,{className:`text-muted italic`,children:i(a.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]})]})]})}function He(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ue(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function We(e){return`/conversations/${e}`}function Ge({run:e}){let{t,i18n:n}=s(`openhands`),r=!!e.conversation_id,i=!!e.bash_command_id,o=e.status===R.COMPLETED||e.status===R.FAILED,c=!r&&o,[l,u]=(0,z.useState)(!1),[d]=(0,z.useState)(()=>new Date().toISOString()),f=He(Ue(e.started_at)?d:e.started_at,n.language),p=i?(0,B.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),u(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":t(a.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:f}),title:t(a.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,B.jsx)(w,{className:`size-4`})}):null,m=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm text-content`,children:f}),c&&(0,B.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,t(a.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,(0,B.jsx)(Ne,{status:e.status})]})]});return(0,B.jsxs)(B.Fragment,{children:[r&&e.conversation_id?(0,B.jsx)(`a`,{href:We(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${f}`,children:m}):(0,B.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:m}),i&&(0,B.jsx)(Ve,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:l,onClose:()=>u(!1)})]})}var Z=20;function Ke({automationId:e}){let{t}=s(`openhands`),[n,r]=(0,z.useState)(Z),{data:i,isLoading:o}=M({id:e,limit:n,offset:0}),c=i?i.total>i.runs.length:!1;return(0,B.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,B.jsx)(`span`,{className:`size-4 text-muted`,children:(0,B.jsx)(q,{className:`size-4`})}),(0,B.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(a.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),o&&(0,B.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,B.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,B.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!o&&i?.runs.length===0&&(0,B.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(a.AUTOMATIONS$DETAIL$NO_RUNS)}),!o&&i&&i.runs.length>0&&(0,B.jsxs)(`div`,{children:[i.runs.map((e,t)=>(0,B.jsx)(`div`,{className:t>0?`border-t border-[var(--oh-border)]`:``,children:(0,B.jsx)(Ge,{run:e})},e.id)),c&&(0,B.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+Z),className:`text-sm text-muted hover:text-foreground`,children:t(a.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function Q({className:e}){return(0,B.jsx)(`div`,{className:d(`animate-pulse rounded bg-surface-raised`,e)})}function $(){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,B.jsx)(Q,{className:`h-5 w-40`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Q,{className:`h-6 w-48`}),(0,B.jsx)(Q,{className:`h-6 w-16 rounded-full`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Q,{className:`h-6 w-11 rounded-full`}),(0,B.jsx)(Q,{className:`h-8 w-8`})]})]}),(0,B.jsx)(Q,{className:`h-5 w-96`}),(0,B.jsx)(Q,{className:`h-36 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-72 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-32 w-full rounded-2xl`}),(0,B.jsx)(Q,{className:`h-40 w-full rounded-2xl`})]})}function qe(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(N,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(a.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(a.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(V,{})})]})}var Je=n(function(){let{t:e}=s(`openhands`),{automationId:t}=r(),{navigate:n}=v(),[i,o]=(0,z.useState)(!1),[c,d]=(0,z.useState)(!1),{data:f,isLoading:p,refetch:m}=ne(),g=f?.status===`ok`,_=h(),b=(0,z.useRef)(_.backend.id).current!==_.backend.id,{data:x,isLoading:C,isError:w,error:T,refetch:E}=de({id:t??``,enabled:g&&!b}),{trackPrebuiltAutomationEnabled:D}=S(),O=ee(),k=ue(),A=fe(),j=w&&y(T)&&T.response?.status===404;if(p)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(!g)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(se,{onRetry:m})})});if(C)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)($,{})})});if(j)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(qe,{})})});if(w||!x)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(re,{onRetry:()=>E()})})});let M=()=>{let e=!x.enabled;O.mutate({id:x.id,enabled:e}),e&&D({automationId:x.id,automationName:x.name})},N=()=>{k.mutate(x.id,{onSuccess:()=>{n?.(`/automations`)}})},P=()=>{A.mutate(x.id,{onSuccess:()=>{u(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{l(y(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=_.backend.kind===`local`;return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(V,{}),(0,B.jsx)(he,{automation:x,onToggle:M,onEdit:F?()=>d(!0):void 0,onDelete:()=>o(!0),onRunNow:P,isRunningNow:A.isPending}),x.prompt&&(0,B.jsx)(ve,{prompt:x.prompt}),(0,B.jsx)(we,{automation:x}),x.plugins&&x.plugins.length>0&&(0,B.jsx)(De,{plugins:x.plugins}),(0,B.jsx)(ke,{createdAt:x.created_at,lastRunAt:x.last_triggered_at}),(0,B.jsx)(Ke,{automationId:x.id}),(0,B.jsx)(ie,{automationName:x.name,isOpen:i,onConfirm:N,onCancel:()=>o(!1)}),F&&(0,B.jsx)(le,{automation:x,isOpen:c,onClose:()=>d(!1)})]})})})});export{Je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{n as o,t as s}from"./recommended-automations-launcher-B01jchhe.js";import{t as c}from"./Trans-rF21Jwln.js";import{t as l}from"./useTranslation-CbJtty1g.js";import{t as u}from"./createLucideIcon-C9OEnwvX.js";import{t as d}from"./check-BDAbW7je.js";import{n as f,r as p}from"./custom-toast-handlers-fgD4IYsu.js";import{a as m,c as h,i as g,o as _,r as v,s as y}from"./circle-plus-check-toggle-B3_W6-nt.js";import{t as b}from"./utils-CVcuFUYj.js";import{n as ee}from"./active-backend-context-CQTk4wD8.js";import{t as x}from"./modal-backdrop-B1si6TUd.js";import{n as S}from"./modal-classes-9XTtWCtF.js";import{t as C}from"./brand-button-BoiPxAGm.js";import{n as w}from"./navigation-context-CszaA-CJ.js";import{t as T}from"./styled-tooltip-DEr7oa0m.js";import{u as E}from"./dropdown-classes-lT1LUsbO.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as D}from"./modal-close-button-BCvw9IUN.js";import{t as ne}from"./use-tracking-DQU60djN.js";import{n as O,t as k}from"./context-menu-list-item-DhG1Ln5m.js";import{t as A}from"./u-edit-CH5nNya1.js";import{t as j}from"./folder-UGYUKpqb.js";import{t as M}from"./search-Cbh-hHBu.js";import{n as N}from"./skill-card-pill-row-BXILn-GK.js";import{t as P}from"./globe-2otpEmVh.js";import{n as F,t as I}from"./use-launch-skill-in-chat-BoqKmEHC.js";import{_ as re,b as ie,c as L,d as R,f as z,g as ae,h as B,i as oe,l as V,m as H,n as se,o as ce,p as U,r as le,s as ue,t as de,u as W,v as fe,y as pe}from"./edit-automation-modal-kc_FzbzK.js";var me=u(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),he=u(`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`}]]),ge=u(`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`}]]),G=e(t(),1),K=i();function _e({value:e,onChange:t,className:n}){let{t:r}=l(`openhands`);return(0,K.jsxs)(`div`,{className:b(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,K.jsx)(M,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,K.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}function q(e,t){let n=[];if(e.repository&&n.push({id:`repository`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(j,{className:`size-3 shrink-0`}),e.repository]})}),e.trigger.type===`event`){let t=[e.trigger.on?L(e.trigger.on):``,e.trigger.source?`(${e.trigger.source})`:``].filter(Boolean).join(` `);n.push({id:`event-trigger`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(P,{className:`size-3 shrink-0`}),t]})})}else n.push({id:`schedule`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(W,{className:`size-3 shrink-0`}),t]})});return e.model&&n.push({id:`model`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(V,{className:`size-3 shrink-0`}),e.model]})}),n}function J({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,K.jsx)(R,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,K.jsx)(me,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,K.jsx)(A,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,K.jsx)(ue,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,K.jsx)(ce,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function ve({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:s}=w(),{t:c}=l(`openhands`),u=z(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,G.useMemo)(()=>q(e,d),[e,d]),p=()=>{s?.(`/automations/${e.id}`)},h=J({automation:e,t:c,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),g=()=>{p()};return(0,K.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:b(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,y,m),children:[(0,K.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-2 truncate text-sm font-semibold text-white`,children:[e.trigger.type===`event`?(0,K.jsx)(P,{className:`size-4 shrink-0 text-muted`}):(0,K.jsx)(W,{className:`size-4 shrink-0 text-muted`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.prompt?(0,K.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,K.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:B,children:[(0,K.jsx)(R,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),c(a.AUTOMATIONS$RUN_NOW)]}):null,(0,K.jsx)(U,{items:h})]})]}),f.length>0?(0,K.jsx)(N,{pills:f,testId:`automation-pills-${e.id}`}):null]})}var ye=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,be=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),xe=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,Y=`px-3 align-middle`,Se=[be,xe,`cursor-pointer`].join(` `),Ce=`openhands-automations-view`;function we(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function Te(e){window.localStorage.setItem(Ce,e)}function Ee({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:s}=w(),{t:c}=l(`openhands`),u=z(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,G.useMemo)(()=>q(e,d),[e,d]),p=()=>{s?.(`/automations/${e.id}`)},m=J({automation:e,t:c,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,K.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:b(Se,`cursor-pointer`),children:[(0,K.jsx)(`td`,{className:Y,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.trigger.type===`event`?(0,K.jsx)(P,{className:`size-4 shrink-0 text-muted`}):(0,K.jsx)(W,{className:`size-4 shrink-0 text-muted`}),(0,K.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(N,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,K.jsx)(`td`,{className:b(`w-0 whitespace-nowrap`,Y),children:(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,K.jsx)(T,{content:c(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,K.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":c(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:H,children:(0,K.jsx)(R,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,K.jsx)(U,{items:m})]})})]})}function X({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:s=null,onDelete:c,onEdit:l}){return n.length===0?null:(0,K.jsxs)(`section`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,K.jsx)(o,{count:t})]}),r===`grid`?(0,K.jsx)(`div`,{className:b(`mt-3`,g),children:(0,K.jsx)(`div`,{className:v,children:n.map(e=>(0,K.jsx)(ve,{automation:e,onToggle:i,onRunNow:a,isRunPending:s===e.id,onDelete:c,onEdit:l},e.id))})}):(0,K.jsx)(`div`,{className:b(ye,`mt-3`),children:(0,K.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,K.jsx)(`tbody`,{children:n.map(e=>(0,K.jsx)(Ee,{automation:e,onToggle:i,onRunNow:a,isRunPending:s===e.id,onDelete:c,onEdit:l},e.id))})})})]})}var De=e(r(),1),Z=[{value:`grid`,icon:he,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:ge,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Oe({icon:e,label:t,isSelected:n}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,K.jsx)(`span`,{className:E,"aria-hidden":!0,children:(0,K.jsx)(e,{})}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,K.jsx)(d,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function ke({view:e,onChange:t,disabled:n=!1}){let{t:r}=l(`openhands`),[i,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(Z.find(t=>t.value===e)??Z[0]).icon;(0,G.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&c({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,G.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&s?(0,K.jsx)(O,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:Z.map(n=>(0,K.jsx)(`li`,{children:(0,K.jsx)(k,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,K.jsx)(Oe,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:b(`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,K.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&s&&typeof document<`u`?De.createPortal((0,K.jsx)(`div`,{style:s,children:p}),document.body):null]})}function Q(){return(0,K.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${y} border border-transparent p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,K.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,K.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,K.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,K.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ae=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,K.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),je=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Me({children:e}){return(0,K.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function Ne({children:e}){return(0,K.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:b(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Pe({children:e}){return(0,K.jsx)(K.Fragment,{children:e})}var Fe={example:(0,K.jsx)(Me,{}),cmd:(0,K.jsx)(Ne,{}),punct:(0,K.jsx)(Pe,{})};function $({onLaunch:e}={}){let{t}=l(`openhands`),n=I();return(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,K.jsx)(c,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:Fe}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,K.jsx)(`a`,{href:je,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,K.jsx)(C,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,K.jsx)(F,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Ie({collapsible:e=!1}){let{t}=l(`openhands`),[n,r]=(0,G.useState)(!e);return e?(0,K.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,K.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,K.jsx)(Ae,{className:b(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,K.jsx)(`div`,{className:`px-4 pb-4`,children:(0,K.jsx)($,{})}):null]}):(0,K.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,K.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)($,{})})]})}function Le(){let{t:e}=l(`openhands`);return(0,K.jsxs)(`div`,{"data-testid":`automations-empty`,className:h,children:[(0,K.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(Ie,{})})]})}function Re({isOpen:e,onClose:t}){let{t:n}=l(`openhands`);return e?(0,K.jsx)(x,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,K.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,K.jsx)(D,{onClose:t,testId:`add-automation-modal-close`}),(0,K.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,K.jsx)(`h2`,{id:`add-automation-modal-title`,className:b(`pr-6`,S),children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,K.jsx)(`div`,{className:`px-6 pb-6`,children:(0,K.jsx)($,{onLaunch:t})})]})}):null}var ze=50,Be=n(function(){let{t:e}=l(`openhands`),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(()=>we()),[o,c]=(0,G.useState)(ze),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),v=ee().backend.kind===`local`,{data:y,isLoading:b,refetch:x}=ae(),S=y?.status===`ok`,{data:w,isLoading:T,isError:E,refetch:D}=re({limit:o,offset:0,enabled:S}),{trackPrebuiltAutomationEnabled:O}=ne(),k=ie(),A=fe(),j=pe(),M=(0,G.useMemo)(()=>{if(!w?.automations)return[];let e=t.toLowerCase();return e?w.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):w.automations},[w?.automations,t]),N=(0,G.useMemo)(()=>M.filter(e=>e.enabled),[M]),P=(0,G.useMemo)(()=>M.filter(e=>!e.enabled),[M]),F=(e,t)=>{let n=!t;if(k.mutate({id:e,enabled:n}),n){let t=w?.automations.find(t=>t.id===e);O({automationId:e,automationName:t?.name??e})}},I=t=>{j.mutate(t,{onSuccess:()=>{p(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},L=e=>{let t=w?.automations.find(t=>t.id===e);t&&d({id:e,name:t.name})},R=e=>{let t=w?.automations.find(t=>t.id===e);t&&h(t)},z=()=>{u&&(A.mutate(u.id),d(null))},B=(0,G.useCallback)(e=>{i(e),Te(e)},[]),V=w?w.total>w.automations.length:!1,H=!T&&!E&&w?.automations.length===0;return b?(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,K.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,K.jsx)(Q,{},`skeleton-${String(t)}`))})]})}):S?(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,K.jsx)(C,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>_(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,K.jsx)(_e,{value:t,onChange:n}),(0,K.jsx)(ke,{view:r,onChange:B,disabled:H})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[T&&(0,K.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,K.jsx)(Q,{},`skeleton-${String(t)}`))}),E&&!T&&(0,K.jsx)(oe,{onRetry:D}),H&&(0,K.jsx)(Le,{}),!T&&!E&&w&&w.automations.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(X,{title:e(a.AUTOMATIONS$ACTIVE),count:N.length,automations:N,view:r,onToggle:F,onRunNow:I,runPendingId:j.isPending?j.variables??null:null,onDelete:L,onEdit:v?R:void 0}),(0,K.jsx)(X,{title:e(a.AUTOMATIONS$INACTIVE),count:P.length,automations:P,view:r,onToggle:F,onRunNow:I,runPendingId:j.isPending?j.variables??null:null,onDelete:L,onEdit:v?R:void 0}),V&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+ze),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(s,{query:t})}),(0,K.jsx)(se,{automationName:u?.name??``,isOpen:u!==null,onConfirm:z,onCancel:()=>d(null)}),m&&(0,K.jsx)(de,{automation:m,isOpen:m!==null,onClose:()=>h(null)}),(0,K.jsx)(Re,{isOpen:g,onClose:()=>_(!1)})]})}):(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,K.jsx)(le,{onRetry:x})]})})});export{Be as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{n as o,t as s}from"./recommended-automations-launcher-B1kfmFTQ.js";import{t as c}from"./Trans-rF21Jwln.js";import{t as l}from"./useTranslation-CbJtty1g.js";import{t as u}from"./createLucideIcon-C9OEnwvX.js";import{t as d}from"./check-BDAbW7je.js";import{n as f,r as p}from"./custom-toast-handlers-fgD4IYsu.js";import{a as m,c as h,i as g,o as _,r as v,s as y}from"./circle-plus-check-toggle-CboDp7XB.js";import{t as b}from"./utils-CVcuFUYj.js";import{n as ee}from"./active-backend-context-CQTk4wD8.js";import{t as x}from"./modal-backdrop-B1si6TUd.js";import{n as S}from"./modal-classes-9XTtWCtF.js";import{t as C}from"./brand-button-BoiPxAGm.js";import{n as w}from"./navigation-context-CszaA-CJ.js";import{t as T}from"./styled-tooltip-GXy1qxsO.js";import{u as E}from"./dropdown-classes-lT1LUsbO.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as D}from"./modal-close-button-DY-rVmld.js";import{t as ne}from"./use-tracking-CjLZgh8X.js";import{n as O,t as k}from"./context-menu-list-item-CHWCx1Mc.js";import{t as A}from"./u-edit-foF02hwH.js";import{t as j}from"./folder-wShAU0y7.js";import{t as M}from"./search-BqXT2Ied.js";import{n as N}from"./skill-card-pill-row-Bg5joQf6.js";import{t as P}from"./globe-CQ_5xwpo.js";import{n as F,t as I}from"./use-launch-skill-in-chat-ClRJlIx7.js";import{_ as re,b as ie,c as L,d as R,f as z,g as ae,h as B,i as oe,l as V,m as H,n as se,o as ce,p as U,r as le,s as ue,t as de,u as W,v as fe,y as pe}from"./edit-automation-modal-C-oC5tis.js";var me=u(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),he=u(`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`}]]),ge=u(`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`}]]),G=e(t(),1),K=i();function _e({value:e,onChange:t,className:n}){let{t:r}=l(`openhands`);return(0,K.jsxs)(`div`,{className:b(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,K.jsx)(M,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,K.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}function q(e,t){let n=[];if(e.repository&&n.push({id:`repository`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(j,{className:`size-3 shrink-0`}),e.repository]})}),e.trigger.type===`event`){let t=[e.trigger.on?L(e.trigger.on):``,e.trigger.source?`(${e.trigger.source})`:``].filter(Boolean).join(` `);n.push({id:`event-trigger`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(P,{className:`size-3 shrink-0`}),t]})})}else n.push({id:`schedule`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(W,{className:`size-3 shrink-0`}),t]})});return e.model&&n.push({id:`model`,node:(0,K.jsxs)(`span`,{className:b(_,`gap-1`),children:[(0,K.jsx)(V,{className:`size-3 shrink-0`}),e.model]})}),n}function J({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,K.jsx)(R,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,K.jsx)(me,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,K.jsx)(A,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,K.jsx)(ue,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,K.jsx)(ce,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function ve({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:s}=w(),{t:c}=l(`openhands`),u=z(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,G.useMemo)(()=>q(e,d),[e,d]),p=()=>{s?.(`/automations/${e.id}`)},h=J({automation:e,t:c,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),g=()=>{p()};return(0,K.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:b(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,y,m),children:[(0,K.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-2 truncate text-sm font-semibold text-white`,children:[e.trigger.type===`event`?(0,K.jsx)(P,{className:`size-4 shrink-0 text-muted`}):(0,K.jsx)(W,{className:`size-4 shrink-0 text-muted`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.prompt?(0,K.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,K.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:B,children:[(0,K.jsx)(R,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),c(a.AUTOMATIONS$RUN_NOW)]}):null,(0,K.jsx)(U,{items:h})]})]}),f.length>0?(0,K.jsx)(N,{pills:f,testId:`automation-pills-${e.id}`}):null]})}var ye=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,be=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),xe=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,Y=`px-3 align-middle`,Se=[be,xe,`cursor-pointer`].join(` `),Ce=`openhands-automations-view`;function we(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function Te(e){window.localStorage.setItem(Ce,e)}function Ee({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:s}=w(),{t:c}=l(`openhands`),u=z(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,G.useMemo)(()=>q(e,d),[e,d]),p=()=>{s?.(`/automations/${e.id}`)},m=J({automation:e,t:c,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,K.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:b(Se,`cursor-pointer`),children:[(0,K.jsx)(`td`,{className:Y,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.trigger.type===`event`?(0,K.jsx)(P,{className:`size-4 shrink-0 text-muted`}):(0,K.jsx)(W,{className:`size-4 shrink-0 text-muted`}),(0,K.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(N,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,K.jsx)(`td`,{className:b(`w-0 whitespace-nowrap`,Y),children:(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,K.jsx)(T,{content:c(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,K.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":c(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:H,children:(0,K.jsx)(R,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,K.jsx)(U,{items:m})]})})]})}function X({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:s=null,onDelete:c,onEdit:l}){return n.length===0?null:(0,K.jsxs)(`section`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,K.jsx)(o,{count:t})]}),r===`grid`?(0,K.jsx)(`div`,{className:b(`mt-3`,g),children:(0,K.jsx)(`div`,{className:v,children:n.map(e=>(0,K.jsx)(ve,{automation:e,onToggle:i,onRunNow:a,isRunPending:s===e.id,onDelete:c,onEdit:l},e.id))})}):(0,K.jsx)(`div`,{className:b(ye,`mt-3`),children:(0,K.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,K.jsx)(`tbody`,{children:n.map(e=>(0,K.jsx)(Ee,{automation:e,onToggle:i,onRunNow:a,isRunPending:s===e.id,onDelete:c,onEdit:l},e.id))})})})]})}var De=e(r(),1),Z=[{value:`grid`,icon:he,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:ge,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Oe({icon:e,label:t,isSelected:n}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,K.jsx)(`span`,{className:E,"aria-hidden":!0,children:(0,K.jsx)(e,{})}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,K.jsx)(d,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function ke({view:e,onChange:t,disabled:n=!1}){let{t:r}=l(`openhands`),[i,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(Z.find(t=>t.value===e)??Z[0]).icon;(0,G.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&c({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,G.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&s?(0,K.jsx)(O,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:Z.map(n=>(0,K.jsx)(`li`,{children:(0,K.jsx)(k,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,K.jsx)(Oe,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:b(`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,K.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&s&&typeof document<`u`?De.createPortal((0,K.jsx)(`div`,{style:s,children:p}),document.body):null]})}function Q(){return(0,K.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${y} border border-transparent p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,K.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,K.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,K.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,K.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,K.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ae=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,K.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),je=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Me({children:e}){return(0,K.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function Ne({children:e}){return(0,K.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:b(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Pe({children:e}){return(0,K.jsx)(K.Fragment,{children:e})}var Fe={example:(0,K.jsx)(Me,{}),cmd:(0,K.jsx)(Ne,{}),punct:(0,K.jsx)(Pe,{})};function $({onLaunch:e}={}){let{t}=l(`openhands`),n=I();return(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,K.jsx)(c,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:Fe}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,K.jsx)(`a`,{href:je,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,K.jsx)(C,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,K.jsx)(F,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Ie({collapsible:e=!1}){let{t}=l(`openhands`),[n,r]=(0,G.useState)(!e);return e?(0,K.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,K.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,K.jsx)(Ae,{className:b(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,K.jsx)(`div`,{className:`px-4 pb-4`,children:(0,K.jsx)($,{})}):null]}):(0,K.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,K.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)($,{})})]})}function Le(){let{t:e}=l(`openhands`);return(0,K.jsxs)(`div`,{"data-testid":`automations-empty`,className:h,children:[(0,K.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(Ie,{})})]})}function Re({isOpen:e,onClose:t}){let{t:n}=l(`openhands`);return e?(0,K.jsx)(x,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,K.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,K.jsx)(D,{onClose:t,testId:`add-automation-modal-close`}),(0,K.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,K.jsx)(`h2`,{id:`add-automation-modal-title`,className:b(`pr-6`,S),children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,K.jsx)(`div`,{className:`px-6 pb-6`,children:(0,K.jsx)($,{onLaunch:t})})]})}):null}var ze=50,Be=n(function(){let{t:e}=l(`openhands`),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(()=>we()),[o,c]=(0,G.useState)(ze),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),v=ee().backend.kind===`local`,{data:y,isLoading:b,refetch:x}=ae(),S=y?.status===`ok`,{data:w,isLoading:T,isError:E,refetch:D}=re({limit:o,offset:0,enabled:S}),{trackPrebuiltAutomationEnabled:O}=ne(),k=ie(),A=fe(),j=pe(),M=(0,G.useMemo)(()=>{if(!w?.automations)return[];let e=t.toLowerCase();return e?w.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):w.automations},[w?.automations,t]),N=(0,G.useMemo)(()=>M.filter(e=>e.enabled),[M]),P=(0,G.useMemo)(()=>M.filter(e=>!e.enabled),[M]),F=(e,t)=>{let n=!t;if(k.mutate({id:e,enabled:n}),n){let t=w?.automations.find(t=>t.id===e);O({automationId:e,automationName:t?.name??e})}},I=t=>{j.mutate(t,{onSuccess:()=>{p(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},L=e=>{let t=w?.automations.find(t=>t.id===e);t&&d({id:e,name:t.name})},R=e=>{let t=w?.automations.find(t=>t.id===e);t&&h(t)},z=()=>{u&&(A.mutate(u.id),d(null))},B=(0,G.useCallback)(e=>{i(e),Te(e)},[]),V=w?w.total>w.automations.length:!1,H=!T&&!E&&w?.automations.length===0;return b?(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,K.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,K.jsx)(Q,{},`skeleton-${String(t)}`))})]})}):S?(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,K.jsx)(C,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>_(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,K.jsx)(_e,{value:t,onChange:n}),(0,K.jsx)(ke,{view:r,onChange:B,disabled:H})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[T&&(0,K.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,K.jsx)(Q,{},`skeleton-${String(t)}`))}),E&&!T&&(0,K.jsx)(oe,{onRetry:D}),H&&(0,K.jsx)(Le,{}),!T&&!E&&w&&w.automations.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(X,{title:e(a.AUTOMATIONS$ACTIVE),count:N.length,automations:N,view:r,onToggle:F,onRunNow:I,runPendingId:j.isPending?j.variables??null:null,onDelete:L,onEdit:v?R:void 0}),(0,K.jsx)(X,{title:e(a.AUTOMATIONS$INACTIVE),count:P.length,automations:P,view:r,onToggle:F,onRunNow:I,runPendingId:j.isPending?j.variables??null:null,onDelete:L,onEdit:v?R:void 0}),V&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+ze),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(s,{query:t})}),(0,K.jsx)(se,{automationName:u?.name??``,isOpen:u!==null,onConfirm:z,onCancel:()=>d(null)}),m&&(0,K.jsx)(de,{automation:m,isOpen:m!==null,onClose:()=>h(null)}),(0,K.jsx)(Re,{isOpen:g,onClose:()=>_(!1)})]})}):(0,K.jsx)(`div`,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,K.jsx)(le,{onRetry:x})]})})});export{Be as default};
|