@xopcai/xopc 0.0.474 → 0.0.476
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/server/chunks.bin +1103 -1067
- package/dist/gateway/server/chunks.json +1 -1
- package/dist/gateway/server/schema.sql +13 -0
- package/dist/gateway/server/upgrades/281_session_agent_reactions.sql +13 -0
- package/dist/gateway/static/root/assets/{activity-store-nD2NH0C7.js → activity-store-BK11iD5x.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D0JEEj2L.js → agent-avatar-dicebear-DZlgZHm9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BxHA8hEW.js → agent-avatar-display-BDHjRaTK.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-C7O0Aaq3.js → agent-defaults-settings-panel-Bicuh10_.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog--H7-gWL7.js → agent-plugin-dialog-hRZYhcLp.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CIcUUuaE.js → agents-C2DH8M4z.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DyeFg0yq.js → agents-admin-api-_mp_Ew1u.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DAWXH9Wf.js → api-D0r-2gWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{api-LSz0L9gc.js → api-oA0NOKLI.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CjXfqaEA.js → app-management-settings-panel-BrO0gY6b.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-0Zl5M7iV.js → appearance-settings-h82Or0g-.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DDVJnHlm.js → apps-page-B9Ho8S53.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CMqJbzQ-.js → archive-plugin-Co_oRPj1.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-DHGtNfOT.js → automation-api-CxLFngqe.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-DUBlVnPg.js → automation-result-state-CjiuyW-C.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-CuWKRWy0.js → automation-run-list-CLjSIujK.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-Y4vC_7qq.js → automation-task-card-BS-RT312.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DBQyHgFW.js → automations-page-BL6ASYrU.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DRCt4lq0.js → automations-workspace-BFk-AF43.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-CMKEp-IB.js → binary-plugins-5GVlyrXg.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CQwjLxA9.js → block-editor-Dtz8JtrO.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BA0i0h3v.js → browser-settings-page-CDUHHu0n.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-Clwtvm7F.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities--EoyYsa8.js → capabilities-DFRrPT_I.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-B5Ja0Knr.js → capabilities-page-D9EpUcuB.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-C5WmcgqD.js → capabilities-settings-panel-ComYXaP1.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-BQPomrMC.js → channels-Aa2Iun4r.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-DI0TksSO.js → chat-agents-api-B-47bqbd.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-CNm3uFNf.js → chat-chart-block-DA2S21y2.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D1DkoN9Y.js → chat-terminal-dock-BALrP7_l.js} +1 -1
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-CiwuuyV8.js → chunk-KS7C4IRE-BPb7KheU.js} +2 -2
- package/dist/gateway/static/root/assets/{command-palette-api-DZt3IZKz.js → command-palette-api-BbSsGD48.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-_doimXGR.js → composer-model-config-control-BFC8jNyK.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-BE40dFxM.js → composer-notifications-Drbl5lKS.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-DMWTIrnl.js → composer-payload-handoff-DKLokix8.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJiToD0s.js → computer-settings-page-CVWaJ3L8.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CYWTW8cv.js → connected-providers-grid-NZP4qb6S.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-QgwPzjZb.js → connection-usage-guide-BNoFtMol.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DkQsU_yu.js → connector-service-page-CzrdJ4JY.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-Bqac6cVg.js → connectors-api-KA6rkOJX.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DSCQw53B.js → connectors-page-BUqNvStL.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B0J_jDfr.js → date-picker-DgTDENzF.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Zr3u7nL1.js → date-time-picker-Gw4oSOk9.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CLD0xbpi.js → dependency-picker-BJDpQtKY.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CfQHdCjf.js → desktop-pet-BbIPYbvc.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-wlYidCpI.js → desktop-pet-settings-Cqzplufb.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DM2X7oYZ.js → dev-view-store-CXE5-Egp.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DIjBN08k.js → device-pairing-wizard-DXFZiWMi.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BJj6gT1z.js → directory-picker-path-field-DVFEzTAJ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-DC9q_s91.js → extension-authoritative-grants-DAfeCx4B.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DBLJqOJ2.js → extension-debug-page-gW4GEEcj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-DCdjl257.js → extension-iframe-host-DOPywUKI.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BEulqVpr.js → extension-marketplace-api-Bo_chffY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-DhEyQZWI.js → extension-message-router-TTAx3dPv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BpY2ZrxI.js → extension-page-Iq7vFC-g.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-YdavG8wv.js → extension-provider-BNnLkq95.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BKvG-hJa.js → extension-settings-page-C0oLjaz6.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-D71-xhLL.js → file-preview-surface-BSrIpn5C.js} +1 -1
- package/dist/gateway/static/root/assets/files-GdwDamkp.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-C-cx4ObA.js → gateway-config-swr-2VOPSLSq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Dh23j5Jx.js → gateway-realtime-CfceJ5WX.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Ca42Wsk6.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-F1q8XY7Y.js → gateway-restart-Dsg95Dwt.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-WQ42gfHY.js → gateway-settings-CMgry8RK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Dx1dmgnX.js → gateway-startup-retry-D0i7dt51.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-C_Sn41rn.js → global-defaults-api-u-ado9kz.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-A3VCyEO8.js → home-page-pT-lEQsu.js} +4 -4
- package/dist/gateway/static/root/assets/{image-generation-api-CvRiMNIJ.js → image-generation-api-DDHOD0Nx.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DJ2wJ2QG.js → imports-page-BxRXNvQx.js} +1 -1
- package/dist/gateway/static/root/assets/index-BtHMU5k4.css +1 -0
- package/dist/gateway/static/root/assets/index-DdEh8KeB.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-CyHz1Nys.js → install-connector-dialog-Rox2_5eU.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Byb_rqj4.js → keyboard-shortcuts-settings-D7xlV7xT.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-D58zzTUZ.js → local-app-workbench-page-ReBczGac.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-L6ODN66C.js → local-apps-page-Ct07GT0V.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-UN3vioSr.js → local-session-drafts-8PozABVy.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CnHhWsDP.js → locale-store-B4o4aDCg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-2rOEUxHs.js → logs-page-CtEv5J4C.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-CSkXaCjk.js → management-api-BBLUlEXt.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-B1Enr-fL.js → management-settings-BjvQ4WiZ.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CWhAtI1O.js → markdown-view-C7kqotD-.js} +1 -1
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-DfbMmlmC.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-DVrn3x6D.js → media-plugins-B5XMcW5S.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CZCXd6Pj.js → messages-hlOsXkQ7.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-D-9SUwg2.js → model-selector-BP-t33vd.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-qgre89p2.js → models-hub-cache-B0z5Ptmt.js} +1 -1
- package/dist/gateway/static/root/assets/{new-chat-navigation-DXYDldT_.js → new-chat-navigation-BA1IB3hy.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-4Pd0mAhL.js → note-detail-panel-DAhIT6xP.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DrVGs1eQ.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-_jYkMe8e.js → notes-api-B3Kc4909.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-zAJJ2OiQ.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-CaWkle-J.js → oauth-api-CW1XhW42.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-DTsztbWi.js → oauth-provider-connect-3QGibJMl.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CYMb3IZu.js → page-context-capture-button-Bd__UBi9.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-D441lgCD.js → page-context-draft-DpDsGHtl.js} +1 -1
- package/dist/gateway/static/root/assets/{page-header-store-7jhoVGK_.js → page-header-store-D_2QZ6Ps.js} +1 -1
- package/dist/gateway/static/root/assets/page-tabs-DoYMKhVO.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-CAATciod.js → personal-avatar-D5VUVQGE.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-DCcipmsB.js → personal-page-DHik8uj6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-CZhQ4fwt.js → personal-profile-settings-Cd2xUVbw.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CMaFnp1G.js → personal-settings-panel-CHRra9hc.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-BlFgKeRz.js → phone-dependencies-card-CREmmRxI.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-DF_E69Sv.js → phone-model-connection-BDzr9jXL.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-D3O3vql4.js → phone-model-picker-DSQF-RxW.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-d2OEqR-2.js → phone-settings-page-gP5kr3VO.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BrXIdz55.js → phone-workspace-store-B0mF8oMk.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-tpugwKl1.js → plugin-details-dialog-43jCnG5n.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-DXMfKUtD.js → preference-select-fields-VqtR_pOy.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-Bd9e2ent.js → preview-runtime-MJUo7XlD.js} +3 -3
- package/dist/gateway/static/root/assets/{product-automation-feedback-DmdIebRg.js → product-automation-feedback-D43XiQq6.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DnPJLzt7.js → product-open-page-CQMoDCO1.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-hChoKYQM.js → product-preview-content-CkQebfi-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-CwAjfaEd.js → product-preview-modal-DToUA1EF.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-BYZdStns.js → project-detail-page-BBF8eVJa.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-CeZ3CW6E.js → project-understanding-BScfv1pD.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BpARg2mt.js → projects-page-BCMWrLGf.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-DjHMmSNk.js → providers-api-BIA2IARN.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CxcMaBPr.js → recording-upload-Yy9r6kHe.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-x3kjVVzC.js → registry-api-CmLu4MA9.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Cuyfg5gz.js → remote-access-hub-BeG8Bgy0.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-ClTyW1KO.js → resource-unavailable-Dccp_uis.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-BgVMF75g.js → right-workspace-store-CFf15f36.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-BPMOD0qt.js → route-preload-Bl10PwKS.js} +2 -2
- package/dist/gateway/static/root/assets/{routine-panel-DqCzH4o9.js → routine-panel-BjqenuXU.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-ZKJq8Y1c.js → runtime-tools-api-CFvov9Uy.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CSVS-0w1.js → runtime-tools-settings-panel-C7sHr-Lm.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-Jbg55MsH.js → service-recommendation-list-Bz9QWUZc.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-JAcSuzXh.js → session-api-7-TPnKv0.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-CvC5uo-A.js → session-manager-fvJusKsK.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-itpuSflW.js → sessions-page-DS-OExY1.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DHfrm0Zj.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-C-Rq-g2w.js → settings-advanced-section-BsqgVQL3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DWWvnHvd.js → settings-mode-store-BtwrUOdQ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DppkfISC.js → settings-page-B_8kxJQW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BnBbewrE.js → settings-page-header-DKgbD0Bc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgRq0a-W.js → settings-page-layout-BE3vLWp_.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-_UOcgWMs.js → setup-interaction-page-DLpGv0yp.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-fXdj1EOR.js → setup-status-panel-BMaFUPnt.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BUzVn5kX.js → share-link-dialog-3RNzFIH3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CIdxsC9i.js → share-preview-page-C49EIXte.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DNlL_AwP.js → shares-api-B532SLIU.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-R2H0pdNK.js → shares-settings-C_ITdQqP.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-D3iuvyp7.js → skill-api-x-ENFv-9.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-K8n_AYMV.js → skill-list-api-CqmglPCz.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BqxHK3K0.js → skill-reload-api-YeoxO91w.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BHciTWaw.js → skills-page-B30SsJL6.js} +1 -1
- package/dist/gateway/static/root/assets/space-page-DmvjU1jc.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BPyQzKf8.js → system-settings-panel-KXLPpyOW.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-By5vozgo.js → task-detail-page-DHYm_bsg.js} +3 -3
- package/dist/gateway/static/root/assets/{task-header-title-lUJ0ls3u.js → task-header-title-Buwr7WTV.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-CWpAUoNq.js → task-result-evidence-DpV1mZJA.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-D24y7GIK.js → terminal-panel-store-Ch8lOYIq.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-VVHRSdNZ.js → theme-store-C7t81hG7.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-D3tu_G8X.js → tracing-settings-page-CcyPoojp.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DwTTVUxp.js → tunnel-api-D713CJ9R.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BOIGCSnz.js → understanding-activity-store-mSawFpIz.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-mKqdZVjW.js → understanding-refresh-store-4M0xrc88.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-B4MqbLKR.js → usage-page-DN1TcxWS.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BcgfZd3f.js → use-autosave-BkVX6SyB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Ca1eE6iV.js → use-composer-attachments-4FKbf6PB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BwB7VH_A.js → use-file-preview-expanded-CRBn6UTd.js} +1 -1
- package/dist/gateway/static/root/assets/use-generated-media-CEJ5BBxX.js +1 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-BDLuMaWC.js → use-personal-profile-DdjQjf9I.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-Dfbs6S75.js → use-personal-work-srLCZOam.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-BrM12ktL.js → use-realtime-voice-tyo85cre.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-AL4BVZhS.js → use-workspace-tree-VwHdfiR8.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CqTB0BIf.js → user-model-page-D-F5GO3T.js} +2 -2
- package/dist/gateway/static/root/assets/{voice-api-key-field-BbVCvQrE.js → voice-api-key-field-gWJ6bx-H.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-vtmTs-mq.js → voice-config-api-B1RtxiRq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-BhmaEWvI.js → voice-input-shortcut-events-C-8Ts1gq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-IVeW1g9y.js → voice-player-store-DyuAAbk0.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-JJfxv-lj.js → voice-settings-DOajN2ay.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bl2qHC88.js → work-discovery-overlay-CTLp1-tu.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-ChvUHm0f.js → work-discovery-page-B-UzFKIr.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BxeoaS6d.js → working-directory-picker-modal-DvVtUxHW.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-D_dxOn8W.js → workspace-api-CIfedJeG.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bh4FYwVq.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-D0GxWvAv.js → workspace-file-preview-dialog-Xi5feqPq.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CCJISdeq.js → workspace-open-location-menu-sbOva_RI.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-DKZ6gVL4.js → workspace-preview-store-DYd8E5bV.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Cxt6wEom.js → xopc-cloud-account-card-BYuMOGaK.js} +1 -1
- package/dist/gateway/static/root/index.html +96 -96
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/files.js +17 -3
- package/dist/packages/gateway-contract/src/home.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/commands/command-registry.d.ts +1 -1
- package/dist/src/agent/commands/command-registry.js +10 -1
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +3 -2
- package/dist/src/agent/embedded/runs.d.ts +3 -0
- package/dist/src/agent/embedded/runs.js +20 -2
- package/dist/src/agent/embedded/tool-search-extension.js +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/discovery.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
- package/dist/src/agent/mcp/continuation-guard.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.d.ts +221 -4
- package/dist/src/agent/mcp/conversation-setup.js +66 -27
- package/dist/src/agent/mcp/discovery.d.ts +5 -0
- package/dist/src/agent/mcp/discovery.js +47 -6
- package/dist/src/agent/prompt/conversational-configuration-guide.js +3 -2
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +3 -1
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.js +10 -9
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +1 -1
- package/dist/src/agent/tools/capability-catalog-tool.d.ts +10 -0
- package/dist/src/agent/tools/capability-catalog-tool.js +63 -0
- package/dist/src/agent/tools/exec-command.d.ts +1 -0
- package/dist/src/agent/tools/exec-command.js +11 -5
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +32 -1
- package/dist/src/agent/tools/language-diagnostics.js +4 -1
- package/dist/src/agent/tools/managed-job-tool.js +3 -2
- package/dist/src/agent/tools/mcp-setup-tool.js +2 -2
- package/dist/src/agent/tools/phone-use-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +2 -0
- package/dist/src/agent/tools/xopc-use-tool.js +5 -3
- package/dist/src/agent-config/schema.d.ts +3 -0
- package/dist/src/agent-config/schema.js +1 -0
- package/dist/src/automations/api/routes.js +17 -5
- package/dist/src/automations/capabilities/write.js +32 -4
- package/dist/src/automations/configuration-conversation.d.ts +7 -0
- package/dist/src/automations/configuration-conversation.js +13 -5
- package/dist/src/capabilities/capability-catalog.d.ts +47 -0
- package/dist/src/capabilities/capability-catalog.js +162 -0
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +1 -0
- package/dist/src/capabilities/store-connector.js +6 -3
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +5 -5
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/platform.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/config/schema.js +6 -3
- package/dist/src/extensions/index.js +2 -2
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/files/file-service.js +1 -0
- package/dist/src/files/file-versions.d.ts +15 -0
- package/dist/src/files/file-versions.js +87 -0
- package/dist/src/gateway/agent-reactions/reaction.d.ts +27 -0
- package/dist/src/gateway/agent-reactions/reaction.js +186 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/capabilities.js +27 -0
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/files.js +39 -0
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +4 -0
- package/dist/src/gateway/hono/routes/mobile-capability-actions.js +290 -0
- package/dist/src/gateway/hono/routes/music-generation.js +1 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +23 -43
- package/dist/src/gateway/hono/routes/sessions.js +41 -2
- package/dist/src/gateway/security/gateway-principal.d.ts +1 -0
- package/dist/src/gateway/security/gateway-principal.js +9 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/agent-runner.d.ts +2 -0
- package/dist/src/gateway/service/agent-runner.js +5 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +3 -0
- package/dist/src/gateway/service/run-gateway-agent.js +43 -1
- package/dist/src/gateway/service/task-conversation-query-service.d.ts +4 -0
- package/dist/src/gateway/service.js +20 -11
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/personal-agent/repository.d.ts +1 -0
- package/dist/src/personal-agent/repository.js +1 -0
- package/dist/src/personal-agent/schedules.d.ts +9 -1
- package/dist/src/personal-agent/schedules.js +32 -1
- package/dist/src/personal-agent/service.d.ts +2 -2
- package/dist/src/personal-agent/service.js +6 -3
- package/dist/src/projects/index.js +1 -1
- package/dist/src/providers/model-call.js +1 -0
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +2 -0
- package/dist/src/session/types.d.ts +4 -0
- package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +15 -0
- package/dist/src/storage/sqlite/agent-reaction-repository.js +73 -0
- package/dist/src/storage/sqlite/row-mappers.js +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/281_session_agent_reactions.sql +13 -0
- package/dist/src/tasks/home-query-service.js +1 -0
- package/dist/src/tui/backends/embedded-backend.js +5 -4
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-management.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/recorder.js +6 -2
- package/dist/src/usage/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/capabilities-DG-WesBp.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-DO060oe9.js +0 -72
- package/dist/gateway/static/root/assets/files-BNL4kkSB.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D_ZITqDi.js +0 -1
- package/dist/gateway/static/root/assets/index-Ca939klV.js +0 -11
- package/dist/gateway/static/root/assets/index-DrWdNdP4.css +0 -1
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-lOOFtIXe.js +0 -1
- package/dist/gateway/static/root/assets/note-image-lightbox-C1w4X0T6.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-strWZLkP.js +0 -8
- package/dist/gateway/static/root/assets/page-tabs-oeTY7z3_.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEDT8_0u.js +0 -1
- package/dist/gateway/static/root/assets/space-api-C302hvkG.js +0 -1
- package/dist/gateway/static/root/assets/space-page-sfc82o9O.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-D5wq8Kme.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./locale-store-
|
|
1
|
+
import{i as e,o as t}from"./locale-store-B4o4aDCg.js";async function n(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/development-conversation`),{method:`POST`})).conversationId}async function r(){return(await t(e(`/api/local-apps`))).apps}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function a(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function o(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/snapshots/${encodeURIComponent(r)}`))).snapshot}async function s(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/fix-guidance`),{method:`POST`,body:JSON.stringify(r)})).guidance}async function c(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function l(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function d(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function f(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function p(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{u as a,n as c,p as d,a as f,o as i,d as l,i as n,r as o,s as r,c as s,l as t,f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-CnHhWsDP.js";import{t as s}from"./messages-CZCXd6Pj.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./package-wATCyihJ.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{i as y}from"./vendor-swr-CdRzEUwF.js";import{t as b}from"./button-ChmVQg9O.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./copy-to-clipboard-HOJ79TWv.js";import{n as w}from"./interaction-BdhHBbYa.js";import{n as T}from"./electron-env-DHOGevH3.js";import{r as E}from"./settings-form-draft-Dy10ldo8.js";import{t as D}from"./settings-loading-skeleton-CAoOV17i.js";import{n as O,t as k}from"./settings-page-header-BnBbewrE.js";import"./settings-page-layout-DgRq0a-W.js";import{r as A,t as j}from"./settings-form-section-num14vSv.js";var M=n(),N=e(t(),1),P=r();function F(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function I(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function L(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,i]=(0,N.useReducer)(E,R),{info:a,loadError:o,actionError:s,copiedField:v,clearDialogOpen:y,clearConfirmChecked:T,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.useCallback)(async()=>{if(e?.getUninstallInfo){i({type:`patch`,patch:{loadError:null}});try{let t=await e.getUninstallInfo();i({type:`patch`,patch:{info:t}})}catch(e){i({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,N.useEffect)(()=>{z()},[z]);let B=async(e,n)=>{if(await C(e)){i({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>i({type:`patch`,patch:{copiedField:null}}),2e3);return}i({type:`patch`,patch:{actionError:t.copyFailed}})},V=async()=>{if(!(!e?.clearUserData||M)){i({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||i({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){i({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{i({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){i({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||i({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){i({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{i({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(o)return(0,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:o});if(!a)return(0,P.jsx)(D,{rows:2});let U=!a.packaged,W=M||a.pendingUpdate||U,G=!U&&a.uninstallMode!==`unsupported`,K=L(a,t),q=T&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,s?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,a.pendingUpdate?(0,P.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:a.appPath}),(0,P.jsxs)(`button`,{type:`button`,className:_(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(a.appPath,`app`),children:[(0,P.jsx)(m,{className:`size-3`,"aria-hidden":!0}),v===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:a.dataPath}),(0,P.jsxs)(`button`,{type:`button`,className:_(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(a.dataPath,`data`),children:[(0,P.jsx)(m,{className:`size-3`,"aria-hidden":!0}),v===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(a.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:_(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{i({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:_(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{i({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(p,{open:y,onOpenChange:e=>{!e&&!M&&i({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(u,{children:[(0,P.jsx)(c,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(d,{className:_(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:T,onChange:e=>i({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,type:`text`,autoComplete:`off`,spellCheck:!1,className:_(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>i({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(b,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{i({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(p,{open:k,onOpenChange:e=>{e||i({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(u,{children:[(0,P.jsx)(c,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(d,{className:_(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>i({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(b,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>i({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await o(i(`/api/migrations/status`))).payload}async function V(){await o(i(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=y(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(v,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(v,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,P.jsx)(b,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=a(W),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!T()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(k,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,P.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,P.jsxs)(O,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,P.jsx)(k,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,P.jsxs)(O,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U as AppManagementSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./package-wATCyihJ.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{i as y}from"./vendor-swr-CdRzEUwF.js";import{t as b}from"./button-ChmVQg9O.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./copy-to-clipboard-HOJ79TWv.js";import{n as w}from"./interaction-BdhHBbYa.js";import{n as T}from"./electron-env-DHOGevH3.js";import{r as E}from"./settings-form-draft-Dy10ldo8.js";import{t as D}from"./settings-loading-skeleton-CAoOV17i.js";import{n as O,t as k}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";import{r as A,t as j}from"./settings-form-section-num14vSv.js";var M=n(),N=e(t(),1),P=r();function F(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function I(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function L(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,i]=(0,N.useReducer)(E,R),{info:a,loadError:o,actionError:s,copiedField:v,clearDialogOpen:y,clearConfirmChecked:T,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.useCallback)(async()=>{if(e?.getUninstallInfo){i({type:`patch`,patch:{loadError:null}});try{let t=await e.getUninstallInfo();i({type:`patch`,patch:{info:t}})}catch(e){i({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,N.useEffect)(()=>{z()},[z]);let B=async(e,n)=>{if(await C(e)){i({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>i({type:`patch`,patch:{copiedField:null}}),2e3);return}i({type:`patch`,patch:{actionError:t.copyFailed}})},V=async()=>{if(!(!e?.clearUserData||M)){i({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||i({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){i({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{i({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){i({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||i({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){i({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{i({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(o)return(0,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:o});if(!a)return(0,P.jsx)(D,{rows:2});let U=!a.packaged,W=M||a.pendingUpdate||U,G=!U&&a.uninstallMode!==`unsupported`,K=L(a,t),q=T&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,s?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,a.pendingUpdate?(0,P.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:a.appPath}),(0,P.jsxs)(`button`,{type:`button`,className:_(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(a.appPath,`app`),children:[(0,P.jsx)(m,{className:`size-3`,"aria-hidden":!0}),v===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:a.dataPath}),(0,P.jsxs)(`button`,{type:`button`,className:_(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(a.dataPath,`data`),children:[(0,P.jsx)(m,{className:`size-3`,"aria-hidden":!0}),v===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(a.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:_(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{i({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:_(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{i({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(p,{open:y,onOpenChange:e=>{!e&&!M&&i({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(u,{children:[(0,P.jsx)(c,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(d,{className:_(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:T,onChange:e=>i({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,type:`text`,autoComplete:`off`,spellCheck:!1,className:_(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>i({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(b,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{i({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(p,{open:k,onOpenChange:e=>{e||i({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(u,{children:[(0,P.jsx)(c,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(d,{className:_(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>i({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(b,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>i({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(b,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await o(i(`/api/migrations/status`))).payload}async function V(){await o(i(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=y(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(v,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(v,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,P.jsx)(b,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=a(W),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!T()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(k,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,P.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,P.jsxs)(O,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,P.jsx)(k,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,P.jsxs)(O,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U as AppManagementSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-CnHhWsDP.js";import{t as s}from"./messages-CZCXd6Pj.js";import{n as c,r as l}from"./popover-select-CLsphyzA.js";import{t as u}from"./cn-0WouolD0.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{n as f,r as p}from"./gateway-config-swr-C-cx4ObA.js";import{n as m}from"./interaction-BdhHBbYa.js";import{t as h}from"./preference-select-fields-DXMfKUtD.js";import{i as g}from"./theme-store-VVHRSdNZ.js";import{t as _}from"./dev-view-store-DM2X7oYZ.js";import{n as v,t as y}from"./settings-page-header-BnBbewrE.js";import"./settings-page-layout-DgRq0a-W.js";import{t as b}from"./settings-advanced-gate-BEDT8_0u.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await o(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=u(`min-w-0`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=c);let l;t[6]===r?l=t[7]:(l=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=l);let d;return t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==l?(d=(0,E.jsxs)(`section`,{className:o,children:[s,c,l]}),t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#f7f8fa`,panel:`#ffffff`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#14171c`,panel:`#1b1f26`,accent:`#3a6bff`,fg:`#f4f6f8`,muted:`#323844`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#0a0a0a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e4dcd3`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#4a3e35`}},dawn:{light:{canvas:`linear-gradient(180deg, #accdec 0%, #e7ebf4 61.54%, #ffddb9 100%)`,panel:`rgb(255 255 255 / 0.6)`,accent:`#34363a`,fg:`rgb(0 0 0 / 0.85)`,muted:`rgb(111 137 163 / 0.2)`},dark:{canvas:`linear-gradient(180deg, #21394f 0%, #283545 61.54%, #564536 100%)`,panel:`rgb(31 45 59 / 0.68)`,accent:`#d9dde2`,fg:`rgb(255 255 255 / 0.92)`,muted:`rgb(255 255 255 / 0.14)`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={background:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=a(F),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(P),o=g(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let l;e[4]!==r||e[5]!==i||e[6]!==o?(l=j.map(e=>{let{value:t,labelKey:n}=e,a=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>o(t),className:u(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m.pressCard,a?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:u(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=o,e[7]=l):l=e[7];let d;e[8]===l?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:l}),e[8]=l,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=a(L),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:i,isLoading:o}=p(!0),f=i?.payload?.config,m;e[2]===f?m=e[3]:(m=w(f),e[2]=f,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==o||e[14]!==g||e[15]!==v?(M=o?(0,E.jsx)(d,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(c,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(l,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(l,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(l,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=o,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:u(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=a(V),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),o=_(z),c;e[2]===r.showRawToolDataTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=c);let l;e[4]===r.showRawToolDataDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===o?d=e[10]:(d=e=>o(e.target.checked),e[9]=o,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=a(U),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(y,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(D,{children:(0,E.jsx)(h,{variant:`page`,sections:[`language`]})}),e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsxs)(D,{children:[(0,E.jsx)(h,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=c):c=e[5];let l;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(R,{}),e[6]=l):l=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:l})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(v,{gap:`gap-6`,children:[i,o,c,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{n as c,r as l}from"./popover-select-CLsphyzA.js";import{t as u}from"./cn-0WouolD0.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{n as f,r as p}from"./gateway-config-swr-2VOPSLSq.js";import{n as m}from"./interaction-BdhHBbYa.js";import{t as h}from"./preference-select-fields-VqtR_pOy.js";import{i as g}from"./theme-store-C7t81hG7.js";import{t as _}from"./dev-view-store-CXE5-Egp.js";import{n as v,t as y}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";import{t as b}from"./settings-advanced-gate-DHfrm0Zj.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await o(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=u(`min-w-0`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=c);let l;t[6]===r?l=t[7]:(l=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=l);let d;return t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==l?(d=(0,E.jsxs)(`section`,{className:o,children:[s,c,l]}),t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#f7f8fa`,panel:`#ffffff`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#14171c`,panel:`#1b1f26`,accent:`#3a6bff`,fg:`#f4f6f8`,muted:`#323844`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#0a0a0a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e4dcd3`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#4a3e35`}},dawn:{light:{canvas:`linear-gradient(180deg, #accdec 0%, #e7ebf4 61.54%, #ffddb9 100%)`,panel:`rgb(255 255 255 / 0.6)`,accent:`#34363a`,fg:`rgb(0 0 0 / 0.85)`,muted:`rgb(111 137 163 / 0.2)`},dark:{canvas:`linear-gradient(180deg, #21394f 0%, #283545 61.54%, #564536 100%)`,panel:`rgb(31 45 59 / 0.68)`,accent:`#d9dde2`,fg:`rgb(255 255 255 / 0.92)`,muted:`rgb(255 255 255 / 0.14)`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={background:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=a(F),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(P),o=g(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let l;e[4]!==r||e[5]!==i||e[6]!==o?(l=j.map(e=>{let{value:t,labelKey:n}=e,a=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>o(t),className:u(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m.pressCard,a?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:u(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=o,e[7]=l):l=e[7];let d;e[8]===l?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:l}),e[8]=l,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=a(L),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:i,isLoading:o}=p(!0),f=i?.payload?.config,m;e[2]===f?m=e[3]:(m=w(f),e[2]=f,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==o||e[14]!==g||e[15]!==v?(M=o?(0,E.jsx)(d,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(c,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(l,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(l,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(l,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=o,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:u(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=a(V),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),o=_(z),c;e[2]===r.showRawToolDataTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=c);let l;e[4]===r.showRawToolDataDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===o?d=e[10]:(d=e=>o(e.target.checked),e[9]=o,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=a(U),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(y,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(D,{children:(0,E.jsx)(h,{variant:`page`,sections:[`language`]})}),e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsxs)(D,{children:[(0,E.jsx)(h,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=c):c=e[5];let l;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(R,{}),e[6]=l):l=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:l})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(v,{gap:`gap-6`,children:[i,o,c,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as c,n as l}from"./locale-store-CnHhWsDP.js";import{t as u}from"./messages-CZCXd6Pj.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-CY7CS_D3.js";import{t as _}from"./arrow-left-D880xG-P.js";import{t as v}from"./box-DvYoGszj.js";import{n as y,t as b}from"./extension-paths-DvuaZJuy.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./external-link-DjqjBmc3.js";import{t as C}from"./loader-circle-CifKLtgG.js";import{t as w}from"./markdown-view-CWhAtI1O.js";import{t as T}from"./package-wATCyihJ.js";import{t as E}from"./plus-Q2yW6OE7.js";import{t as D}from"./settings-uiTATseT.js";import{t as O}from"./shield-check-BU58siTV.js";import{t as k}from"./trash-2-DusmjVPV.js";import{t as A}from"./triangle-alert-2JXFNNKU.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-DzdOeGYz.js";import{a as P,i as F}from"./vendor-swr-CdRzEUwF.js";import{s as I}from"./gateway-realtime-Dh23j5Jx.js";import{t as L}from"./button-ChmVQg9O.js";import{n as R}from"./interaction-BdhHBbYa.js";import{t as z}from"./page-tabs-oeTY7z3_.js";import{t as B}from"./page-header-store-7jhoVGK_.js";import{i as V,o as H,r as U,s as W}from"./extension-provider-YdavG8wv.js";import{r as G}from"./settings-form-draft-Dy10ldo8.js";import{l as K,m as ee,o as te,r as q,t as ne}from"./dist-ZrL34Ps4.js";import{i as re,t as ie}from"./agent-plugin-dialog--H7-gWL7.js";import{n as J,t as Y}from"./capability-links-MZdYfPKx.js";import{t as X}from"./capability-icon-CmvCZOJX.js";import{a as Z,i as ae,n as oe,r as se,t as ce}from"./extension-marketplace-api-BEulqVpr.js";import{n as le,t as ue}from"./capability-header-actions-BfLcB3Kh.js";import{n as de,r as fe,t as pe}from"./plugin-presentation-CO5BFDGW.js";var me=n(),he=`grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-stretch gap-4`,ge=`relative h-full min-w-0 rounded-xl bg-surface-panel p-4 transition-colors hover:bg-surface-panel-hover motion-reduce:transition-none`,_e=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function ve(e){return e===`builtin`||e===`user`?e:`marketplace`}var $=r();function ye(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var be={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function xe({className:e,query:t}){let n=s(),r=i(),a=l(e=>e.language),o=u(a).extensionsPage,d=c(e=>!!e.conversationId),f=U(),{mutate:p}=P(),[m,h]=(0,Q.useReducer)(G,be),{debounced:g,detailPkg:_,quickInstallPkg:v,rowBusy:b,actionError:x,restartHint:S}=m,w=d?`marketplace-${g}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>h({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:E,isLoading:D,error:O}=F(w,()=>ce(g),{revalidateOnFocus:!1}),A=(0,Q.useCallback)(()=>{p(`gateway-extensions-list`),I()},[p]),j=(0,Q.useCallback)(async(e,t)=>{h({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await se({name:e,overwrite:t});A(),n.requiresGatewayRestart&&h({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw h({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceInstallFailed}}),e}finally{h({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceInstallFailed,o.marketplaceRestartHint,A]),R=(0,Q.useCallback)(async e=>{h({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await Z(e);A(),t.requiresGatewayRestart&&h({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw h({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceUninstallFailed}}),e}finally{h({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceRestartHint,o.marketplaceUninstallFailed,A]),z=E??[];return(0,$.jsxs)(`div`,{className:M(`flex flex-col gap-4`,e),children:[O?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O instanceof Error?O.message:o.marketplaceLoadFailed}):null,x?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,D&&!E?(0,$.jsx)(`ul`,{className:he,"aria-label":o.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(N,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(N,{className:`h-5 w-full`}),(0,$.jsx)(N,{className:`h-3 w-2/3`})]}),(0,$.jsx)(N,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(N,{className:`h-4 w-full`}),(0,$.jsx)(N,{className:`h-4 w-full`}),(0,$.jsx)(N,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:he,children:z.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:o.marketplaceEmpty}):z.map(e=>{let t=ye(f,e.id),i=b===e.id,s=f.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[a.startsWith(`zh`)?`zh-CN`:`en`],l=c?.displayName??e.name,u=c?.description??e.description;return(0,$.jsxs)(`li`,{className:ge,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${l}, ${o.marketplaceDetailTitle}`,onClick:()=>s?.pluginId?n(Y(s.pluginId,`installed`,!1,r.pathname+r.search)):h({type:`patch`,patch:{detailPkg:e.id}}),className:_e}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:T}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:l,children:l}),e.verified?(0,$.jsx)(y,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:s&&fe(s)?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:s&&fe(s)?a.startsWith(`zh`)?`需要授权`:`Authorization required`:o.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:o.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(L,{variant:`tonal`,type:`button`,onClick:()=>s?.pluginId&&pe(s)?n(J(l,a.startsWith(`zh`),s.pluginId)):s?.pluginId?n(Y(s.pluginId,`installed`,fe(s),r.pathname+r.search)):h({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:`rounded-lg text-xs`,children:s&&fe(s)?a.startsWith(`zh`)?`去授权`:`Connect account`:s&&pe(s)?a.startsWith(`zh`)?`开始使用`:`Start using`:a.startsWith(`zh`)?`管理插件`:`Manage plugin`}):(0,$.jsxs)(L,{variant:`tonal`,type:`button`,disabled:i,onClick:()=>{window.confirm(o.marketplaceUninstallConfirm)&&R(e.id).catch(()=>{})},className:`gap-1.5 rounded-lg text-xs`,children:[i?(0,$.jsx)(C,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(k,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),o.marketplaceUninstall]})}):(0,$.jsx)(L,{variant:`tonal`,type:`button`,onClick:()=>h({type:`patch`,patch:(e.packageType,{detailPkg:e.id,quickInstallPkg:null})}),className:`min-w-16 rounded-lg text-xs`,children:e.packageType===`plugin`?a.startsWith(`zh`)?`安装`:`Install`:o.marketplaceReview})})]}),u?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:u}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md bg-surface-inset px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),_?(0,$.jsx)(Se,{packageName:_,autoInstall:v===_,copy:o,extensions:f,onClose:()=>h({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:j,onUninstall:R}):null]})}function Se(e){let t=(0,me.c)(99),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:s,onInstall:u,onUninstall:f}=e,[v,y]=(0,Q.useState)(!1),b=l(Oe),[x,S]=(0,Q.useState)(!1),T=c(De)?`ext-mp-detail-${n}`:null,E;t[0]===n?E=t[1]:(E=async()=>oe(n),t[0]=n,t[1]=E);let D;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},t[2]=D):D=t[2];let{data:P,error:I,isLoading:L}=F(T,E,D),R;t[3]!==a||t[4]!==n?(R=ye(a,n),t[3]=a,t[4]=n,t[5]=R):R=t[5];let z=R,B=z===`user`,V=P?.manifest?.permissions,H,U,W,G,K,ee,te,q,ne,J,Y,X;if(t[6]!==r||t[7]!==i||t[8]!==P||t[9]!==I||t[10]!==a||t[11]!==z||t[12]!==L||t[13]!==b||t[14]!==s||t[15]!==n||t[16]!==V||t[17]!==x){ee=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V&&typeof V==`object`&&!Array.isArray(V)?Object.entries(V):[],o;t[30]!==i||t[31]!==P?(o=P?.readme?.trim()||(P?.description?.trim()?`### ${P.name}\n\n${P.description}`:`*${i.marketplaceNoReadme}*`),t[30]=i,t[31]=P,t[32]=o):o=t[32];let c=o;if(P?.format===`agent-plugin`){let e;if(t[33]!==P||t[34]!==a||t[35]!==n){let r;t[37]!==P||t[38]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===P.manifest?.name,t[37]=P,t[38]=n,t[39]=r):r=t[39],e=a.find(r),t[33]=P,t[34]=a,t[35]=n,t[36]=e}else e=t[36];let i=`store:${n}`,o;t[40]!==r||t[41]!==P||t[42]!==s||t[43]!==e||t[44]!==i?(o=(0,$.jsx)(ie,{extension:e,initialSource:i,marketplace:P,autoInstall:r,onClose:s}),t[40]=r,t[41]=P,t[42]=s,t[43]=e,t[44]=i,t[45]=o):o=t[45],ee=o;break bb0}W=g,G=!0,t[46]===s?K=t[47]:(K=e=>!e&&s(),t[46]=s,t[47]=K),U=p,t[48]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[48]=X):X=t[48],H=m,ne=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,J=Ee;let l;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(_,{className:`size-5`}),t[49]=l):l=t[49];let u;t[50]!==i.detailBack||t[51]!==s?(u=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:l}),t[50]=i.detailBack,t[51]=s,t[52]=u):u=t[52];let f;t[53]===i.marketplaceDetailTitle?f=t[54]:(f=(0,$.jsx)(h,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[53]=i.marketplaceDetailTitle,t[54]=f);let v;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(j,{className:`size-5`}),t[55]=v):v=t[55];let y;t[56]!==i.detailClose||t[57]!==s?(y=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:v}),t[56]=i.detailClose,t[57]=s,t[58]=y):y=t[58],t[59]!==u||t[60]!==f||t[61]!==y?(Y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,f,y]}),t[59]=u,t[60]=f,t[61]=y,t[62]=Y):Y=t[62],te=`min-h-0 flex-1 overflow-y-auto p-5`,q=L&&!P?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(N,{className:`h-6 w-48`}),(0,$.jsx)(N,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(N,{className:`h-12`}),(0,$.jsx)(N,{className:`h-12`})]}),(0,$.jsx)(N,{className:`h-28 w-full`}),(0,$.jsx)(N,{className:`h-36 w-full`})]}):I?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:I instanceof Error?I.message:i.marketplaceLoadFailed})]}):P?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:P.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:P.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:P.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:P.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:P.downloads})]})]}),(0,$.jsx)(re,{data:P,zh:b===`zh`}),z===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[P.installability.available?(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(A,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:P.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:P.installability.available?i.marketplaceCodeRisk:P.installability.reason??i.marketplaceUnavailableBody})]})]}),P.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:P.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(Te)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(P.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,P.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),P.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(w,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=P,t[9]=I,t[10]=a,t[11]=z,t[12]=L,t[13]=b,t[14]=s,t[15]=n,t[16]=V,t[17]=x,t[18]=H,t[19]=U,t[20]=W,t[21]=G,t[22]=K,t[23]=ee,t[24]=te,t[25]=q,t[26]=ne,t[27]=J,t[28]=Y,t[29]=X}else H=t[18],U=t[19],W=t[20],G=t[21],K=t[22],ee=t[23],te=t[24],q=t[25],ne=t[26],J=t[27],Y=t[28],X=t[29];if(ee!==Symbol.for(`react.early_return_sentinel`))return ee;let Z;t[63]!==te||t[64]!==q?(Z=(0,$.jsx)(`div`,{className:te,children:q}),t[63]=te,t[64]=q,t[65]=Z):Z=t[65];let ae;t[66]!==v||t[67]!==i.marketplaceBuiltinGoBuiltin||t[68]!==i.marketplaceBuiltinManageHint||t[69]!==i.marketplaceInstall||t[70]!==i.marketplaceReinstall||t[71]!==i.marketplaceReinstallConfirm||t[72]!==i.marketplaceUninstall||t[73]!==i.marketplaceUninstallConfirm||t[74]!==P||t[75]!==z||t[76]!==s||t[77]!==u||t[78]!==f||t[79]!==n||t[80]!==x||t[81]!==B?(ae=P?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:z===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(o,{to:`/capabilities/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:v||!P.installability.available||!x,onClick:()=>{B&&!window.confirm(i.marketplaceReinstallConfirm)||(y(!0),u(n,B).catch(we).finally(()=>y(!1)))},className:M(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[v?(0,$.jsx)(C,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,B?i.marketplaceReinstall:i.marketplaceInstall]}),B?(0,$.jsxs)(`button`,{type:`button`,disabled:v,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(y(!0),f(n).then(()=>s()).catch(Ce).finally(()=>y(!1)))},className:M(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[66]=v,t[67]=i.marketplaceBuiltinGoBuiltin,t[68]=i.marketplaceBuiltinManageHint,t[69]=i.marketplaceInstall,t[70]=i.marketplaceReinstall,t[71]=i.marketplaceReinstallConfirm,t[72]=i.marketplaceUninstall,t[73]=i.marketplaceUninstallConfirm,t[74]=P,t[75]=z,t[76]=s,t[77]=u,t[78]=f,t[79]=n,t[80]=x,t[81]=B,t[82]=ae):ae=t[82];let se;t[83]!==H||t[84]!==Z||t[85]!==ae||t[86]!==ne||t[87]!==J||t[88]!==Y?(se=(0,$.jsxs)(H,{className:ne,onOpenAutoFocus:J,children:[Y,Z,ae]}),t[83]=H,t[84]=Z,t[85]=ae,t[86]=ne,t[87]=J,t[88]=Y,t[89]=se):se=t[89];let ce;t[90]!==U||t[91]!==se||t[92]!==X?(ce=(0,$.jsxs)(U,{children:[X,se]}),t[90]=U,t[91]=se,t[92]=X,t[93]=ce):ce=t[93];let le;return t[94]!==W||t[95]!==G||t[96]!==K||t[97]!==ce?(le=(0,$.jsx)(W,{defaultOpen:G,onOpenChange:K,children:ce}),t[94]=W,t[95]=G,t[96]=K,t[97]=ce,t[98]=le):le=t[98],le}function Ce(){}function we(){}function Te(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Ee(e){return e.preventDefault()}function De(e){return!!e.conversationId}function Oe(e){return e.language}function ke({embedded:e=!1,onHeaderActionChange:t}){let n=s(),r=i(),c=l(e=>e.language),d=u(c),f=B(e=>e.setPageHeader),p=B(e=>e.clearPageHeader),m=U(),h=V(),[g,_]=a(),y=ve(g.get(`tab`)??(m.some(e=>e.source!==`bundled`)?`user`:null)),b=(0,Q.useRef)(!1),S=g.get(`q`)??``,[C,w]=(0,Q.useState)(y),[T,D]=(0,Q.useState)(S),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),N=g.toString(),P=(0,Q.useRef)(N);if(P.current!==N){P.current=N;let e=ve(g.get(`tab`)),t=g.get(`q`)??``;w(t=>t===e?t:e),D(e=>e===t?e:t)}(0,Q.useEffect)(()=>{_(e=>{let t=new URLSearchParams(e),n=T.trim();return n?t.set(`q`,n):t.delete(`q`),C===`marketplace`?t.delete(`tab`):t.set(`tab`,C),t.toString()===e.toString()?e:t},{replace:!0})},[C,T,_]);let F=(0,Q.useMemo)(()=>m.filter(e=>e.source===`bundled`),[m]),I=(0,Q.useMemo)(()=>m.filter(e=>e.source!==`bundled`),[m]);(0,Q.useEffect)(()=>{h||b.current||(b.current=!0,!g.has(`tab`)&&I.length&&w(`user`))},[h,g,I.length]);let H=C===`builtin`?F:I,W=(0,Q.useMemo)(()=>{let e=T.trim().toLowerCase(),t=H;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,c):e.hasUi?-1:1)},[H,T,c]);(0,Q.useEffect)(()=>{k(e=>{if(!e)return e;let t=m.find(t=>t.id===e.id);return t?Ae(e)===Ae(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[m]);let G=(0,Q.useMemo)(()=>({searchLabel:C===`marketplace`?d.extensionsPage.marketplaceSearchPlaceholder:d.extensionsPage.searchPlaceholder,search:(0,$.jsx)(le,{value:T,onChange:D,placeholder:C===`marketplace`?d.extensionsPage.marketplaceSearchPlaceholder:d.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(K,{children:[(0,$.jsx)(ee,{asChild:!0,children:(0,$.jsx)(L,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d.capabilitiesHub.moreActions,title:d.capabilitiesHub.moreActions,children:(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(te,{children:(0,$.jsxs)(ne,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(q,{className:M(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,R.transition),onSelect:()=>j(!0),children:[(0,$.jsx)(E,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),c.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(q,{asChild:!0,children:(0,$.jsxs)(o,{to:`/local-apps`,className:M(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,R.transition),children:[(0,$.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),d.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(L,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(o,{to:`/local-apps/new`,"aria-label":d.extensionsPage.createLocalApp,children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:d.extensionsPage.createLocalApp})]})})}),[c,d.capabilitiesHub.moreActions,d.extensionsPage,C,T]);(0,Q.useLayoutEffect)(()=>e?(t?.(G),()=>t?.(null)):(f({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:d.extensionsPage.title})}),end:(0,$.jsx)(ue,{contribution:G})}),()=>p()),[p,e,G,d.extensionsPage.title,t,f]);let re=[{id:`user`,label:d.extensionsPage.tabUser,count:h?void 0:I.length},{id:`marketplace`,label:d.extensionsPage.tabMarketplace},{id:`builtin`,label:d.extensionsPage.tabBuiltin,count:h?void 0:F.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:M(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(z,{items:re,activeTab:C,onChange:w,ariaLabel:d.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),C===`marketplace`?(0,$.jsx)(xe,{query:T}):h?(0,$.jsx)(Le,{}):C===`builtin`&&F.length===0?(0,$.jsx)(ze,{message:d.extensionsPage.emptyBuiltin}):C===`user`&&I.length===0?(0,$.jsx)(ze,{message:d.extensionsPage.emptyUser}):W.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:d.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:he,children:W.map(e=>(0,$.jsx)(Ne,{extension:e,copy:d.extensionsPage,onOpen:()=>e.pluginId?n(Y(e.pluginId,`installed`,!1,r.pathname+r.search)):k(e)},e.id))})]}),O?O.format===`agent-plugin`?(0,$.jsx)(ie,{extension:O,onClose:()=>k(null)},O.id):(0,$.jsx)(Fe,{extension:O,copy:d.extensionsPage,onClose:()=>k(null)},O.id):null,A?(0,$.jsx)(ie,{onClose:()=>j(!1)}):null]})}function Ae(e){return e.activationEligible??e.active}function je(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Me(e,t){let n=Ae(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ne(e){let t=(0,me.c)(56),{extension:n,copy:r,onOpen:a}=e,o=l(Pe),c,u;t[0]!==n||t[1]!==o?(u=o.startsWith(`zh`),c=de(n,u),t[0]=n,t[1]=o,t[2]=c,t[3]=u):(c=t[2],u=t[3]);let d=c,f;t[4]===n?f=t[5]:(f=fe(n),t[4]=n,t[5]=f);let p=f,m=n.localizations?.[u?`zh-CN`:`en`]?.description??n.description,h=s(),g=i(),_;t[6]===n?_=t[7]:(_=!!n.pluginId&&pe(n),t[6]=n,t[7]=_);let b=_,x=p?u?`去授权`:`Connect account`:b?u?`开始使用`:`Start using`:u?`管理插件`:`Manage plugin`,S;t[8]!==b||t[9]!==n.pluginId||t[10]!==g||t[11]!==d||t[12]!==h||t[13]!==p||t[14]!==a||t[15]!==u?(S=()=>{b?h(J(d,u,n.pluginId)):p&&n.pluginId?h(Y(n.pluginId,`installed`,!0,g.pathname+g.search)):a()},t[8]=b,t[9]=n.pluginId,t[10]=g,t[11]=d,t[12]=h,t[13]=p,t[14]=a,t[15]=u,t[16]=S):S=t[16];let C=S,w=`${d}, ${r.marketplaceDetailTitle}`,T;t[17]!==a||t[18]!==w?(T=(0,$.jsx)(`button`,{type:`button`,"aria-label":w,onClick:a,className:_e}),t[17]=a,t[18]=w,t[19]=T):T=t[19];let E=n.branding?.iconUrl,D;t[20]===E?D=t[21]:(D=(0,$.jsx)(X,{iconUrl:E,fallback:v}),t[20]=E,t[21]=D);let O;t[22]===d?O=t[23]:(O=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:d,children:d}),t[22]=d,t[23]=O);let k;t[24]===n.provenance?.publisherVerification?k=t[25]:(k=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(y,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[24]=n.provenance?.publisherVerification,t[25]=k);let A;t[26]!==O||t[27]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]===n.version?j=t[30]:(j=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[29]=n.version,t[30]=j);let M=p?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,N=p?u?`需要授权`:`Authorization required`:Ae(n)?r.statusEnabled:r.runStateOff,P;t[31]!==M||t[32]!==N?(P=(0,$.jsx)(`span`,{className:M,children:N}),t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==j||t[35]!==P?(F=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[j,P]}),t[34]=j,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==A||t[38]!==F?(I=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,F]}),t[37]=A,t[38]=F,t[39]=I):I=t[39];let R;t[40]!==x||t[41]!==C?(R=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(L,{variant:`tonal`,onClick:C,className:`rounded-lg text-xs`,children:x})}),t[40]=x,t[41]=C,t[42]=R):R=t[42];let z;t[43]!==I||t[44]!==R||t[45]!==D?(z=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[D,I,R]}),t[43]=I,t[44]=R,t[45]=D,t[46]=z):z=t[46];let B;t[47]!==r.cardNoDescription||t[48]!==m?(B=m?.trim()||r.cardNoDescription,t[47]=r.cardNoDescription,t[48]=m,t[49]=B):B=t[49];let V;t[50]===B?V=t[51]:(V=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:B}),t[50]=B,t[51]=V);let H;return t[52]!==z||t[53]!==V||t[54]!==T?(H=(0,$.jsxs)(`article`,{className:ge,children:[T,z,V]}),t[52]=z,t[53]=V,t[54]=T,t[55]=H):H=t[55],H}function Pe(e){return e.language}function Fe({extension:e,copy:t,onClose:n}){let{mutate:r}=P(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),v=e.activationEligible===!0,y=(0,Q.useCallback)(async()=>{c(null),u(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await ae({extensionId:e.id,enabled:!v});await r(`gateway-extensions-list`),I(),u(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[v,t.extensionToggleFailed,e.id,r]),x=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),u(!1),a(`uninstall`);try{await Z(e.id),await r(`gateway-extensions-list`),I(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),w=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=w.find(e=>e.showInNav)??w[0],A=T[0],N=O?b(e.id,O):null,F=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||H(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(p,{children:[(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(_,{className:`size-5`})}),(0,$.jsx)(h,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(f,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(j,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,je(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Me(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(L,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void y(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(C,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):v?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(L,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void x(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(C,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(w.length>0||T.length>0||E.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Ie,{template:t.badgePages,count:w.length,hidden:w.length===0}),(0,$.jsx)(Ie,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,$.jsx)(Ie,{template:t.badgeWidgets,count:E.length,hidden:E.length===0})]})]}):null,W(e)&&(N||F)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,$.jsxs)(o,{to:N,onClick:n,className:M(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(S,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,$.jsxs)(o,{to:F,onClick:n,className:M(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(D,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Ie(e){let t=(0,me.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function Le(){let e=(0,me.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:he,"aria-busy":`true`,children:Array.from({length:6},Re)}),e[0]=t):t=e[0],t}function Re(e,t){return(0,$.jsx)(N,{className:`h-32 rounded-xl`},t)}function ze(e){let t=(0,me.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center px-4 py-12 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ke as ExtensionsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,l as a,t as o,u as s}from"./chunk-KS7C4IRE-BPb7KheU.js";import{l as c,n as l}from"./locale-store-B4o4aDCg.js";import{t as u}from"./messages-hlOsXkQ7.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-CY7CS_D3.js";import{t as _}from"./arrow-left-D880xG-P.js";import{t as v}from"./box-DvYoGszj.js";import{n as y,t as b}from"./extension-paths-DvuaZJuy.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./external-link-DjqjBmc3.js";import{t as C}from"./loader-circle-CifKLtgG.js";import{t as w}from"./markdown-view-C7kqotD-.js";import{t as T}from"./package-wATCyihJ.js";import{t as E}from"./plus-Q2yW6OE7.js";import{t as D}from"./settings-uiTATseT.js";import{t as O}from"./shield-check-BU58siTV.js";import{t as k}from"./trash-2-DusmjVPV.js";import{t as A}from"./triangle-alert-2JXFNNKU.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-DzdOeGYz.js";import{a as P,i as F}from"./vendor-swr-CdRzEUwF.js";import{s as I}from"./gateway-realtime-CfceJ5WX.js";import{t as L}from"./button-ChmVQg9O.js";import{n as R}from"./interaction-BdhHBbYa.js";import{t as z}from"./page-tabs-DoYMKhVO.js";import{t as B}from"./page-header-store-D_2QZ6Ps.js";import{i as V,o as H,r as U,s as W}from"./extension-provider-BNnLkq95.js";import{r as G}from"./settings-form-draft-Dy10ldo8.js";import{l as K,m as ee,o as te,r as q,t as ne}from"./dist-ZrL34Ps4.js";import{i as re,t as ie}from"./agent-plugin-dialog-hRZYhcLp.js";import{n as J,t as Y}from"./capability-links-MZdYfPKx.js";import{t as X}from"./capability-icon-CmvCZOJX.js";import{a as Z,i as ae,n as oe,r as se,t as ce}from"./extension-marketplace-api-Bo_chffY.js";import{n as le,t as ue}from"./capability-header-actions-BfLcB3Kh.js";import{n as de,r as fe,t as pe}from"./plugin-presentation-CO5BFDGW.js";var me=n(),he=`grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-stretch gap-4`,ge=`relative h-full min-w-0 rounded-xl bg-surface-panel p-4 transition-colors hover:bg-surface-panel-hover motion-reduce:transition-none`,_e=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function ve(e){return e===`builtin`||e===`user`?e:`marketplace`}var $=r();function ye(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var be={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function xe({className:e,query:t}){let n=s(),r=a(),i=l(e=>e.language),o=u(i).extensionsPage,d=c(e=>!!e.conversationId),f=U(),{mutate:p}=P(),[m,h]=(0,Q.useReducer)(G,be),{debounced:g,detailPkg:_,quickInstallPkg:v,rowBusy:b,actionError:x,restartHint:S}=m,w=d?`marketplace-${g}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>h({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:E,isLoading:D,error:O}=F(w,()=>ce(g),{revalidateOnFocus:!1}),A=(0,Q.useCallback)(()=>{p(`gateway-extensions-list`),I()},[p]),j=(0,Q.useCallback)(async(e,t)=>{h({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await se({name:e,overwrite:t});A(),n.requiresGatewayRestart&&h({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw h({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceInstallFailed}}),e}finally{h({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceInstallFailed,o.marketplaceRestartHint,A]),R=(0,Q.useCallback)(async e=>{h({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await Z(e);A(),t.requiresGatewayRestart&&h({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw h({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceUninstallFailed}}),e}finally{h({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceRestartHint,o.marketplaceUninstallFailed,A]),z=E??[];return(0,$.jsxs)(`div`,{className:M(`flex flex-col gap-4`,e),children:[O?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O instanceof Error?O.message:o.marketplaceLoadFailed}):null,x?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,D&&!E?(0,$.jsx)(`ul`,{className:he,"aria-label":o.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(N,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(N,{className:`h-5 w-full`}),(0,$.jsx)(N,{className:`h-3 w-2/3`})]}),(0,$.jsx)(N,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(N,{className:`h-4 w-full`}),(0,$.jsx)(N,{className:`h-4 w-full`}),(0,$.jsx)(N,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:he,children:z.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:o.marketplaceEmpty}):z.map(e=>{let t=ye(f,e.id),a=b===e.id,s=f.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[i.startsWith(`zh`)?`zh-CN`:`en`],l=c?.displayName??e.name,u=c?.description??e.description;return(0,$.jsxs)(`li`,{className:ge,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${l}, ${o.marketplaceDetailTitle}`,onClick:()=>s?.pluginId?n(Y(s.pluginId,`installed`,!1,r.pathname+r.search)):h({type:`patch`,patch:{detailPkg:e.id}}),className:_e}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:T}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:l,children:l}),e.verified?(0,$.jsx)(y,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:s&&fe(s)?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:s&&fe(s)?i.startsWith(`zh`)?`需要授权`:`Authorization required`:o.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:o.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(L,{variant:`tonal`,type:`button`,onClick:()=>s?.pluginId&&pe(s)?n(J(l,i.startsWith(`zh`),s.pluginId)):s?.pluginId?n(Y(s.pluginId,`installed`,fe(s),r.pathname+r.search)):h({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:`rounded-lg text-xs`,children:s&&fe(s)?i.startsWith(`zh`)?`去授权`:`Connect account`:s&&pe(s)?i.startsWith(`zh`)?`开始使用`:`Start using`:i.startsWith(`zh`)?`管理插件`:`Manage plugin`}):(0,$.jsxs)(L,{variant:`tonal`,type:`button`,disabled:a,onClick:()=>{window.confirm(o.marketplaceUninstallConfirm)&&R(e.id).catch(()=>{})},className:`gap-1.5 rounded-lg text-xs`,children:[a?(0,$.jsx)(C,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(k,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),o.marketplaceUninstall]})}):(0,$.jsx)(L,{variant:`tonal`,type:`button`,onClick:()=>h({type:`patch`,patch:(e.packageType,{detailPkg:e.id,quickInstallPkg:null})}),className:`min-w-16 rounded-lg text-xs`,children:e.packageType===`plugin`?i.startsWith(`zh`)?`安装`:`Install`:o.marketplaceReview})})]}),u?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:u}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md bg-surface-inset px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),_?(0,$.jsx)(Se,{packageName:_,autoInstall:v===_,copy:o,extensions:f,onClose:()=>h({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:j,onUninstall:R}):null]})}function Se(e){let t=(0,me.c)(99),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:s,onInstall:u,onUninstall:f}=e,[v,y]=(0,Q.useState)(!1),b=l(Oe),[x,S]=(0,Q.useState)(!1),T=c(De)?`ext-mp-detail-${n}`:null,E;t[0]===n?E=t[1]:(E=async()=>oe(n),t[0]=n,t[1]=E);let D;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},t[2]=D):D=t[2];let{data:P,error:I,isLoading:L}=F(T,E,D),R;t[3]!==a||t[4]!==n?(R=ye(a,n),t[3]=a,t[4]=n,t[5]=R):R=t[5];let z=R,B=z===`user`,V=P?.manifest?.permissions,H,U,W,G,K,ee,te,q,ne,J,Y,X;if(t[6]!==r||t[7]!==i||t[8]!==P||t[9]!==I||t[10]!==a||t[11]!==z||t[12]!==L||t[13]!==b||t[14]!==s||t[15]!==n||t[16]!==V||t[17]!==x){ee=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V&&typeof V==`object`&&!Array.isArray(V)?Object.entries(V):[],o;t[30]!==i||t[31]!==P?(o=P?.readme?.trim()||(P?.description?.trim()?`### ${P.name}\n\n${P.description}`:`*${i.marketplaceNoReadme}*`),t[30]=i,t[31]=P,t[32]=o):o=t[32];let c=o;if(P?.format===`agent-plugin`){let e;if(t[33]!==P||t[34]!==a||t[35]!==n){let r;t[37]!==P||t[38]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===P.manifest?.name,t[37]=P,t[38]=n,t[39]=r):r=t[39],e=a.find(r),t[33]=P,t[34]=a,t[35]=n,t[36]=e}else e=t[36];let i=`store:${n}`,o;t[40]!==r||t[41]!==P||t[42]!==s||t[43]!==e||t[44]!==i?(o=(0,$.jsx)(ie,{extension:e,initialSource:i,marketplace:P,autoInstall:r,onClose:s}),t[40]=r,t[41]=P,t[42]=s,t[43]=e,t[44]=i,t[45]=o):o=t[45],ee=o;break bb0}W=g,G=!0,t[46]===s?K=t[47]:(K=e=>!e&&s(),t[46]=s,t[47]=K),U=p,t[48]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[48]=X):X=t[48],H=m,ne=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,J=Ee;let l;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(_,{className:`size-5`}),t[49]=l):l=t[49];let u;t[50]!==i.detailBack||t[51]!==s?(u=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:l}),t[50]=i.detailBack,t[51]=s,t[52]=u):u=t[52];let f;t[53]===i.marketplaceDetailTitle?f=t[54]:(f=(0,$.jsx)(h,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[53]=i.marketplaceDetailTitle,t[54]=f);let v;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(j,{className:`size-5`}),t[55]=v):v=t[55];let y;t[56]!==i.detailClose||t[57]!==s?(y=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:v}),t[56]=i.detailClose,t[57]=s,t[58]=y):y=t[58],t[59]!==u||t[60]!==f||t[61]!==y?(Y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,f,y]}),t[59]=u,t[60]=f,t[61]=y,t[62]=Y):Y=t[62],te=`min-h-0 flex-1 overflow-y-auto p-5`,q=L&&!P?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(N,{className:`h-6 w-48`}),(0,$.jsx)(N,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(N,{className:`h-12`}),(0,$.jsx)(N,{className:`h-12`})]}),(0,$.jsx)(N,{className:`h-28 w-full`}),(0,$.jsx)(N,{className:`h-36 w-full`})]}):I?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:I instanceof Error?I.message:i.marketplaceLoadFailed})]}):P?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:P.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:P.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:P.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:P.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:P.downloads})]})]}),(0,$.jsx)(re,{data:P,zh:b===`zh`}),z===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[P.installability.available?(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(A,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:P.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:P.installability.available?i.marketplaceCodeRisk:P.installability.reason??i.marketplaceUnavailableBody})]})]}),P.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:P.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(Te)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(P.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,P.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),P.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(w,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=P,t[9]=I,t[10]=a,t[11]=z,t[12]=L,t[13]=b,t[14]=s,t[15]=n,t[16]=V,t[17]=x,t[18]=H,t[19]=U,t[20]=W,t[21]=G,t[22]=K,t[23]=ee,t[24]=te,t[25]=q,t[26]=ne,t[27]=J,t[28]=Y,t[29]=X}else H=t[18],U=t[19],W=t[20],G=t[21],K=t[22],ee=t[23],te=t[24],q=t[25],ne=t[26],J=t[27],Y=t[28],X=t[29];if(ee!==Symbol.for(`react.early_return_sentinel`))return ee;let Z;t[63]!==te||t[64]!==q?(Z=(0,$.jsx)(`div`,{className:te,children:q}),t[63]=te,t[64]=q,t[65]=Z):Z=t[65];let ae;t[66]!==v||t[67]!==i.marketplaceBuiltinGoBuiltin||t[68]!==i.marketplaceBuiltinManageHint||t[69]!==i.marketplaceInstall||t[70]!==i.marketplaceReinstall||t[71]!==i.marketplaceReinstallConfirm||t[72]!==i.marketplaceUninstall||t[73]!==i.marketplaceUninstallConfirm||t[74]!==P||t[75]!==z||t[76]!==s||t[77]!==u||t[78]!==f||t[79]!==n||t[80]!==x||t[81]!==B?(ae=P?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:z===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(o,{to:`/capabilities/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:v||!P.installability.available||!x,onClick:()=>{B&&!window.confirm(i.marketplaceReinstallConfirm)||(y(!0),u(n,B).catch(we).finally(()=>y(!1)))},className:M(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[v?(0,$.jsx)(C,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,B?i.marketplaceReinstall:i.marketplaceInstall]}),B?(0,$.jsxs)(`button`,{type:`button`,disabled:v,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(y(!0),f(n).then(()=>s()).catch(Ce).finally(()=>y(!1)))},className:M(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[66]=v,t[67]=i.marketplaceBuiltinGoBuiltin,t[68]=i.marketplaceBuiltinManageHint,t[69]=i.marketplaceInstall,t[70]=i.marketplaceReinstall,t[71]=i.marketplaceReinstallConfirm,t[72]=i.marketplaceUninstall,t[73]=i.marketplaceUninstallConfirm,t[74]=P,t[75]=z,t[76]=s,t[77]=u,t[78]=f,t[79]=n,t[80]=x,t[81]=B,t[82]=ae):ae=t[82];let se;t[83]!==H||t[84]!==Z||t[85]!==ae||t[86]!==ne||t[87]!==J||t[88]!==Y?(se=(0,$.jsxs)(H,{className:ne,onOpenAutoFocus:J,children:[Y,Z,ae]}),t[83]=H,t[84]=Z,t[85]=ae,t[86]=ne,t[87]=J,t[88]=Y,t[89]=se):se=t[89];let ce;t[90]!==U||t[91]!==se||t[92]!==X?(ce=(0,$.jsxs)(U,{children:[X,se]}),t[90]=U,t[91]=se,t[92]=X,t[93]=ce):ce=t[93];let le;return t[94]!==W||t[95]!==G||t[96]!==K||t[97]!==ce?(le=(0,$.jsx)(W,{defaultOpen:G,onOpenChange:K,children:ce}),t[94]=W,t[95]=G,t[96]=K,t[97]=ce,t[98]=le):le=t[98],le}function Ce(){}function we(){}function Te(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Ee(e){return e.preventDefault()}function De(e){return!!e.conversationId}function Oe(e){return e.language}function ke({embedded:e=!1,onHeaderActionChange:t}){let n=s(),r=a(),c=l(e=>e.language),d=u(c),f=B(e=>e.setPageHeader),p=B(e=>e.clearPageHeader),m=U(),h=V(),[g,_]=i(),y=ve(g.get(`tab`)??(m.some(e=>e.source!==`bundled`)?`user`:null)),b=(0,Q.useRef)(!1),S=g.get(`q`)??``,[C,w]=(0,Q.useState)(y),[T,D]=(0,Q.useState)(S),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),N=g.toString(),P=(0,Q.useRef)(N);if(P.current!==N){P.current=N;let e=ve(g.get(`tab`)),t=g.get(`q`)??``;w(t=>t===e?t:e),D(e=>e===t?e:t)}(0,Q.useEffect)(()=>{_(e=>{let t=new URLSearchParams(e),n=T.trim();return n?t.set(`q`,n):t.delete(`q`),C===`marketplace`?t.delete(`tab`):t.set(`tab`,C),t.toString()===e.toString()?e:t},{replace:!0})},[C,T,_]);let F=(0,Q.useMemo)(()=>m.filter(e=>e.source===`bundled`),[m]),I=(0,Q.useMemo)(()=>m.filter(e=>e.source!==`bundled`),[m]);(0,Q.useEffect)(()=>{h||b.current||(b.current=!0,!g.has(`tab`)&&I.length&&w(`user`))},[h,g,I.length]);let H=C===`builtin`?F:I,W=(0,Q.useMemo)(()=>{let e=T.trim().toLowerCase(),t=H;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,c):e.hasUi?-1:1)},[H,T,c]);(0,Q.useEffect)(()=>{k(e=>{if(!e)return e;let t=m.find(t=>t.id===e.id);return t?Ae(e)===Ae(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[m]);let G=(0,Q.useMemo)(()=>({searchLabel:C===`marketplace`?d.extensionsPage.marketplaceSearchPlaceholder:d.extensionsPage.searchPlaceholder,search:(0,$.jsx)(le,{value:T,onChange:D,placeholder:C===`marketplace`?d.extensionsPage.marketplaceSearchPlaceholder:d.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(K,{children:[(0,$.jsx)(ee,{asChild:!0,children:(0,$.jsx)(L,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d.capabilitiesHub.moreActions,title:d.capabilitiesHub.moreActions,children:(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(te,{children:(0,$.jsxs)(ne,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(q,{className:M(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,R.transition),onSelect:()=>j(!0),children:[(0,$.jsx)(E,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),c.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(q,{asChild:!0,children:(0,$.jsxs)(o,{to:`/local-apps`,className:M(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,R.transition),children:[(0,$.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),d.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(L,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(o,{to:`/local-apps/new`,"aria-label":d.extensionsPage.createLocalApp,children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:d.extensionsPage.createLocalApp})]})})}),[c,d.capabilitiesHub.moreActions,d.extensionsPage,C,T]);(0,Q.useLayoutEffect)(()=>e?(t?.(G),()=>t?.(null)):(f({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:d.extensionsPage.title})}),end:(0,$.jsx)(ue,{contribution:G})}),()=>p()),[p,e,G,d.extensionsPage.title,t,f]);let re=[{id:`user`,label:d.extensionsPage.tabUser,count:h?void 0:I.length},{id:`marketplace`,label:d.extensionsPage.tabMarketplace},{id:`builtin`,label:d.extensionsPage.tabBuiltin,count:h?void 0:F.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:M(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(z,{items:re,activeTab:C,onChange:w,ariaLabel:d.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),C===`marketplace`?(0,$.jsx)(xe,{query:T}):h?(0,$.jsx)(Le,{}):C===`builtin`&&F.length===0?(0,$.jsx)(ze,{message:d.extensionsPage.emptyBuiltin}):C===`user`&&I.length===0?(0,$.jsx)(ze,{message:d.extensionsPage.emptyUser}):W.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:d.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:he,children:W.map(e=>(0,$.jsx)(Ne,{extension:e,copy:d.extensionsPage,onOpen:()=>e.pluginId?n(Y(e.pluginId,`installed`,!1,r.pathname+r.search)):k(e)},e.id))})]}),O?O.format===`agent-plugin`?(0,$.jsx)(ie,{extension:O,onClose:()=>k(null)},O.id):(0,$.jsx)(Fe,{extension:O,copy:d.extensionsPage,onClose:()=>k(null)},O.id):null,A?(0,$.jsx)(ie,{onClose:()=>j(!1)}):null]})}function Ae(e){return e.activationEligible??e.active}function je(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Me(e,t){let n=Ae(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ne(e){let t=(0,me.c)(56),{extension:n,copy:r,onOpen:i}=e,o=l(Pe),c,u;t[0]!==n||t[1]!==o?(u=o.startsWith(`zh`),c=de(n,u),t[0]=n,t[1]=o,t[2]=c,t[3]=u):(c=t[2],u=t[3]);let d=c,f;t[4]===n?f=t[5]:(f=fe(n),t[4]=n,t[5]=f);let p=f,m=n.localizations?.[u?`zh-CN`:`en`]?.description??n.description,h=s(),g=a(),_;t[6]===n?_=t[7]:(_=!!n.pluginId&&pe(n),t[6]=n,t[7]=_);let b=_,x=p?u?`去授权`:`Connect account`:b?u?`开始使用`:`Start using`:u?`管理插件`:`Manage plugin`,S;t[8]!==b||t[9]!==n.pluginId||t[10]!==g||t[11]!==d||t[12]!==h||t[13]!==p||t[14]!==i||t[15]!==u?(S=()=>{b?h(J(d,u,n.pluginId)):p&&n.pluginId?h(Y(n.pluginId,`installed`,!0,g.pathname+g.search)):i()},t[8]=b,t[9]=n.pluginId,t[10]=g,t[11]=d,t[12]=h,t[13]=p,t[14]=i,t[15]=u,t[16]=S):S=t[16];let C=S,w=`${d}, ${r.marketplaceDetailTitle}`,T;t[17]!==i||t[18]!==w?(T=(0,$.jsx)(`button`,{type:`button`,"aria-label":w,onClick:i,className:_e}),t[17]=i,t[18]=w,t[19]=T):T=t[19];let E=n.branding?.iconUrl,D;t[20]===E?D=t[21]:(D=(0,$.jsx)(X,{iconUrl:E,fallback:v}),t[20]=E,t[21]=D);let O;t[22]===d?O=t[23]:(O=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:d,children:d}),t[22]=d,t[23]=O);let k;t[24]===n.provenance?.publisherVerification?k=t[25]:(k=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(y,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[24]=n.provenance?.publisherVerification,t[25]=k);let A;t[26]!==O||t[27]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]===n.version?j=t[30]:(j=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[29]=n.version,t[30]=j);let M=p?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,N=p?u?`需要授权`:`Authorization required`:Ae(n)?r.statusEnabled:r.runStateOff,P;t[31]!==M||t[32]!==N?(P=(0,$.jsx)(`span`,{className:M,children:N}),t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==j||t[35]!==P?(F=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[j,P]}),t[34]=j,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==A||t[38]!==F?(I=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,F]}),t[37]=A,t[38]=F,t[39]=I):I=t[39];let R;t[40]!==x||t[41]!==C?(R=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(L,{variant:`tonal`,onClick:C,className:`rounded-lg text-xs`,children:x})}),t[40]=x,t[41]=C,t[42]=R):R=t[42];let z;t[43]!==I||t[44]!==R||t[45]!==D?(z=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[D,I,R]}),t[43]=I,t[44]=R,t[45]=D,t[46]=z):z=t[46];let B;t[47]!==r.cardNoDescription||t[48]!==m?(B=m?.trim()||r.cardNoDescription,t[47]=r.cardNoDescription,t[48]=m,t[49]=B):B=t[49];let V;t[50]===B?V=t[51]:(V=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:B}),t[50]=B,t[51]=V);let H;return t[52]!==z||t[53]!==V||t[54]!==T?(H=(0,$.jsxs)(`article`,{className:ge,children:[T,z,V]}),t[52]=z,t[53]=V,t[54]=T,t[55]=H):H=t[55],H}function Pe(e){return e.language}function Fe({extension:e,copy:t,onClose:n}){let{mutate:r}=P(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),v=e.activationEligible===!0,y=(0,Q.useCallback)(async()=>{c(null),u(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await ae({extensionId:e.id,enabled:!v});await r(`gateway-extensions-list`),I(),u(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[v,t.extensionToggleFailed,e.id,r]),x=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),u(!1),a(`uninstall`);try{await Z(e.id),await r(`gateway-extensions-list`),I(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),w=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=w.find(e=>e.showInNav)??w[0],A=T[0],N=O?b(e.id,O):null,F=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||H(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(p,{children:[(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(_,{className:`size-5`})}),(0,$.jsx)(h,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(f,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(j,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,je(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Me(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(L,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void y(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(C,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):v?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(L,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void x(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(C,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(w.length>0||T.length>0||E.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Ie,{template:t.badgePages,count:w.length,hidden:w.length===0}),(0,$.jsx)(Ie,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,$.jsx)(Ie,{template:t.badgeWidgets,count:E.length,hidden:E.length===0})]})]}):null,W(e)&&(N||F)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,$.jsxs)(o,{to:N,onClick:n,className:M(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(S,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,$.jsxs)(o,{to:F,onClick:n,className:M(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(D,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Ie(e){let t=(0,me.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function Le(){let e=(0,me.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:he,"aria-busy":`true`,children:Array.from({length:6},Re)}),e[0]=t):t=e[0],t}function Re(e,t){return(0,$.jsx)(N,{className:`h-32 rounded-xl`},t)}function ze(e){let t=(0,me.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center px-4 py-12 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ke as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-CMqJbzQ-.js → archive-plugin-Co_oRPj1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-hlOsXkQ7.js";import{t as a}from"./jszip.min-Dj17eJqX.js";import{t as o}from"./preview-open-alternatives-CY_hjK4b.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|
package/dist/gateway/static/root/assets/{automation-api-DHGtNfOT.js → automation-api-CxLFngqe.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./locale-store-
|
|
1
|
+
import{i as e,o as t}from"./locale-store-B4o4aDCg.js";var n={get:n=>t(e(`/api/automations/${encodeURIComponent(n)}`)),configuration:n=>t(e(`/api/automations/configuration-conversations/${encodeURIComponent(n)}`)),openConfiguration:n=>t(e(`/api/automations/configuration-conversations`),{method:`POST`,body:JSON.stringify(n)}),tasks:()=>t(e(`/api/tasks?limit=200`)),list:n=>{let r=new URLSearchParams;n?.projectId&&r.set(`projectId`,n.projectId);let i=r.toString();return t(e(`/api/automations${i?`?${i}`:``}`))},metrics:()=>t(e(`/api/automations/metrics`)),draft:(n,r=crypto.randomUUID())=>t(e(`/api/automations/draft`),{method:`POST`,headers:{"Idempotency-Key":r},body:JSON.stringify(n)}),simulate:n=>t(e(`/api/automations/simulate`),{method:`POST`,body:JSON.stringify(n)}),create:n=>t(e(`/api/automations`),{method:`POST`,body:JSON.stringify(n)}),update:(n,r)=>t(e(`/api/automations/${encodeURIComponent(n)}`),{method:`PATCH`,body:JSON.stringify(r)}),remove:n=>t(e(`/api/automations/${encodeURIComponent(n)}`),{method:`DELETE`}),runNow:n=>t(e(`/api/automations/${encodeURIComponent(n)}/run`),{method:`POST`}),pause:n=>t(e(`/api/automations/${encodeURIComponent(n)}/pause`),{method:`POST`}),resume:n=>t(e(`/api/automations/${encodeURIComponent(n)}/resume`),{method:`POST`}),runs:(n=50,r,i)=>{let a=new URLSearchParams({limit:String(n)});return r&&a.set(`automationId`,r),i?.projectId&&a.set(`projectId`,i.projectId),i?.cursor&&a.set(`cursor`,i.cursor),t(e(`/api/automation-runs?${a.toString()}`))},productEventRuns:n=>{let r=new URLSearchParams({eventType:n.eventType,limit:String(n.limit??5)});return n.source&&r.set(`source`,n.source),n.payloadKey&&r.set(`payloadKey`,n.payloadKey),n.payloadValue!==void 0&&r.set(`payloadValue`,n.payloadValue),t(e(`/api/automation-runs/product-events?${r.toString()}`))},events:(n={})=>{let r=new URLSearchParams({limit:String(n.limit??50)});return n.type&&r.set(`type`,n.type),n.source&&r.set(`source`,n.source),t(e(`/api/automation-events?${r.toString()}`))},deliveries:(n={})=>{let r=new URLSearchParams({limit:String(n.limit??50)});return n.runId&&r.set(`runId`,n.runId),n.status&&r.set(`status`,n.status),t(e(`/api/automation-deliveries?${r.toString()}`))},getRun:n=>t(e(`/api/automation-runs/${encodeURIComponent(n)}`)),runEvents:n=>t(e(`/api/automation-runs/${encodeURIComponent(n)}/events`)),rerun:n=>t(e(`/api/automation-runs/${encodeURIComponent(n)}/rerun`),{method:`POST`}),repairDraft:(n,r,i=crypto.randomUUID())=>t(e(`/api/automation-runs/${encodeURIComponent(n)}/repair-draft`),{method:`POST`,headers:{"Idempotency-Key":i},body:JSON.stringify(r)}),cancelRun:n=>t(e(`/api/automation-runs/${encodeURIComponent(n)}/cancel`),{method:`POST`}),markRunRead:n=>t(e(`/api/automation-runs/${encodeURIComponent(n)}/read`),{method:`POST`}),markAllRunsRead:n=>t(e(`/api/automation-runs/read-all${n?`?projectId=${encodeURIComponent(n)}`:``}`),{method:`POST`})};export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n}from"./vendor-swr-CdRzEUwF.js";import{t as r}from"./automation-api-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n}from"./vendor-swr-CdRzEUwF.js";import{t as r}from"./automation-api-CxLFngqe.js";var i=e(),a=t();function o(e,t){let n=t===`zh`;return e.some(e=>e.status===`dead_letter`)?n?`结果已保存,部分通知未能送达。可通过对话排查后重新发送,无需重跑任务。`:`Your result is saved, but a notification could not be sent. Ask in chat to retry delivery without rerunning the task.`:e.some(e=>e.status===`retrying`)?n?`结果已保存,通知正在重试。`:`Your result is saved. Notification delivery is retrying.`:e.some(e=>e.status===`pending`||e.status===`delivering`)?n?`结果已保存,正在发送通知。`:`Your result is saved. Sending notifications.`:null}function s(e){let t=(0,i.c)(11),{runId:s,language:c}=e,l,u;t[0]===s?(l=t[1],u=t[2]):(l=[`automation-result-deliveries`,s],u=()=>r.deliveries({runId:s}),t[0]=s,t[1]=l,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:5e3},t[3]=d):d=t[3];let{data:f,error:p}=n(l,u,d),m;t[4]!==f||t[5]!==c?(m=f?o(f.items,c):null,t[4]=f,t[5]=c,t[6]=m):m=t[6];let h=m,g;return t[7]!==p||t[8]!==h||t[9]!==c?(g=h?(0,a.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-5 text-fg-muted`,children:h}):p?(0,a.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:c===`zh`?`结果已保存,暂时无法确认通知状态。`:`Your result is saved. Notification status is temporarily unavailable.`}):null,t[7]=p,t[8]=h,t[9]=c,t[10]=g):g=t[10],g}function c(e,t){let n=t===`zh`;return e.error?.includes(`The selected model is unavailable:`)?n?`所选模型不可用,请更换模型或恢复默认模型后重试。`:`The selected model is unavailable. Choose another model or use the default.`:e.error?.startsWith(`Execution assistant is unavailable:`)?n?`执行助手暂不可用,请选择其他助手后重试。`:`The execution assistant is unavailable. Choose another assistant.`:e.status===`timeout`?n?`任务超时未完成,可以通过对话调整后重试。`:`The task timed out. Adjust it in chat and try again.`:e.error??(n?`这次运行未完成,可以通过对话排查原因。`:`This run did not finish. Ask in chat to investigate.`)}function l(e,t){return t.reduce((t,n)=>n.automationId===e&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0)}function u(e,t){let n=l(e.id,t),r=!!(e.state.lastRunAtMs&&(!n||e.state.lastRunAtMs>n.createdAtMs)),i=r?e.state.lastRunStatus:n?.status??e.state.lastRunStatus;return i!==`failed`&&i!==`timeout`?null:`${i}:${(r?e.state.lastRunAtMs:n?.createdAtMs??e.state.lastRunAtMs)??`unknown`}`}function d(e,t){return u(e,t)!==null}export{s as i,d as n,c as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{t as a}from"./messages-hlOsXkQ7.js";import{t as o}from"./createLucideIcon-DPHK1VkS.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{i as l,t as u}from"./vendor-swr-CdRzEUwF.js";import{t as d}from"./automation-api-CxLFngqe.js";var f=o(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),p=o(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),m=n(),h=e(t(),1),g=r(),_=e=>[`queued`,`running`,`cancelling`].includes(e.status);function v(e){let t=(0,m.c)(62),{automationId:n,projectId:r,language:o,selectedRunId:f,selectedRun:p,enabled:v,runHref:C,onSelectRun:w}=e,T=v===void 0||v,[E,D]=(0,h.useState)(!1),O=o===`zh`,k;t[0]!==T||t[1]!==p||t[2]!==f?(k=T&&f&&!p?[`automation-navigation-selected-run`,f]:null,t[0]=T,t[1]=p,t[2]=f,t[3]=k):k=t[3];let A;t[4]===f?A=t[5]:(A=()=>d.getRun(f),t[4]=f,t[5]=A);let j;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1,shouldRetryOnError:!1},t[6]=j):j=t[6];let{data:M}=l(k,A,j),N=p??M?.run,P;t[7]!==n||t[8]!==T||t[9]!==r?(P=(e,t)=>!T||e&&!t?.nextCursor?null:[`automation-navigation-runs`,n,r??``,e?t.nextCursor:``],t[7]=n,t[8]=T,t[9]=r,t[10]=P):P=t[10];let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F={refreshInterval:x,refreshWhenHidden:!1,refreshWhenOffline:!1,revalidateAll:!0,persistSize:!0},t[11]=F):F=t[11];let{data:I,error:L,size:R,setSize:z,isValidating:B,mutate:V}=u(P,S,F),H,U,W,G,K,q,J;if(t[12]!==E||t[13]!==n||t[14]!==N||t[15]!==I||t[16]!==L||t[17]!==B||t[18]!==o||t[19]!==w||t[20]!==C||t[21]!==f||t[22]!==R||t[23]!==O){G=Symbol.for(`react.early_return_sentinel`);bb0:{U=[...new Map((I??[]).flatMap(b).map(y)).values()];let e=E?U:U.slice(0,3),r=N?.automationId===n&&!e.some(e=>e.id===N.id)?[N,...e]:e;if(H=B&&(!I||I.length<R),I&&r.length===0&&!L){G=null;break bb0}K=`space-y-1 pb-3 pl-8 pr-2`,q=O?`执行记录`:`Execution history`,t[31]!==I||t[32]!==L?(J=!I&&!L?(0,g.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2 px-3 py-2`,children:[(0,g.jsx)(c,{className:`h-8`}),(0,g.jsx)(c,{className:`h-8`})]}):null,t[31]=I,t[32]=L,t[33]=J):J=t[33],W=r.map(t=>{let n=s(`w-full rounded-lg px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,f===t.id&&`bg-surface-active text-fg`),r=f===t.id?`true`:void 0,c=(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,g.jsx)(`span`,{children:new Date(t.createdAtMs).toLocaleString(O?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}),!_(t)&&t.readAtMs==null?(0,g.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,children:(0,g.jsx)(`span`,{className:`sr-only`,children:O?`未读`:`Unread`})}):null]}),N?.id===t.id&&!e.some(e=>e.id===t.id)?(0,g.jsx)(`span`,{className:`block text-accent-fg`,children:O?`当前查看`:`Currently viewing`}):null,(0,g.jsx)(`span`,{className:s(`block`,[`failed`,`timeout`].includes(t.status)&&`text-danger`),children:a(o).automations.status[t.status]})]});return C?(0,g.jsx)(i,{to:C(t),className:s(`block`,n),"aria-current":r,onClick:()=>w(t),children:c},t.id):(0,g.jsx)(`button`,{type:`button`,className:n,"aria-current":r,onClick:()=>w(t),children:c},t.id)})}t[12]=E,t[13]=n,t[14]=N,t[15]=I,t[16]=L,t[17]=B,t[18]=o,t[19]=w,t[20]=C,t[21]=f,t[22]=R,t[23]=O,t[24]=H,t[25]=U,t[26]=W,t[27]=G,t[28]=K,t[29]=q,t[30]=J}else H=t[24],U=t[25],W=t[26],G=t[27],K=t[28],q=t[29],J=t[30];if(G!==Symbol.for(`react.early_return_sentinel`))return G;let Y;t[34]!==L||t[35]!==V||t[36]!==O?(Y=L?(0,g.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-xs text-danger`,children:[(0,g.jsx)(`p`,{children:O?`执行记录加载失败`:`Could not load history`}),(0,g.jsx)(`button`,{type:`button`,className:`w-full rounded-lg px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void V(),children:O?`重试`:`Retry`})]}):null,t[34]=L,t[35]=V,t[36]=O,t[37]=Y):Y=t[37];let X;t[38]!==E||t[39]!==I?.[0]?.hasMore||t[40]!==U||t[41]!==O?(X=!E&&(U.length>3||I?.[0]?.hasMore)?(0,g.jsx)(`button`,{type:`button`,className:`w-full rounded-lg px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>D(!0),children:O?`查看全部执行`:`View all executions`}):null,t[38]=E,t[39]=I?.[0]?.hasMore,t[40]=U,t[41]=O,t[42]=X):X=t[42];let Z;t[43]!==E||t[44]!==I||t[45]!==H||t[46]!==z||t[47]!==R||t[48]!==O?(Z=E&&I?.at(-1)?.hasMore?(0,g.jsx)(`button`,{type:`button`,className:`w-full rounded-lg px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,disabled:H,onClick:()=>void z(R+1),children:H?O?`加载中…`:`Loading…`:O?`加载更多`:`Load more`}):null,t[43]=E,t[44]=I,t[45]=H,t[46]=z,t[47]=R,t[48]=O,t[49]=Z):Z=t[49];let Q;t[50]!==E||t[51]!==O?(Q=E?(0,g.jsx)(`button`,{type:`button`,className:`w-full rounded-lg px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>D(!1),children:O?`收起历史`:`Show recent`}):null,t[50]=E,t[51]=O,t[52]=Q):Q=t[52];let $;return t[53]!==W||t[54]!==Y||t[55]!==X||t[56]!==Z||t[57]!==Q||t[58]!==K||t[59]!==q||t[60]!==J?($=(0,g.jsxs)(`div`,{className:K,"aria-label":q,children:[J,W,Y,X,Z,Q]}),t[53]=W,t[54]=Y,t[55]=X,t[56]=Z,t[57]=Q,t[58]=K,t[59]=q,t[60]=J,t[61]=$):$=t[61],$}function y(e){return[e.id,e]}function b(e){return e.runs}function x(e){return(e?.length??0)>1?0:e?.[0]?.runs.some(_)?3e3:15e3}function S(e){let[,t,n,r]=e;return d.runs(20,t,{projectId:n||void 0,cursor:r||void 0})}export{f as i,_ as n,p as r,v as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as s}from"./messages-CZCXd6Pj.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CY7CS_D3.js";import{d as h,f as g,i as _,r as v,t as y,u as b}from"./automation-display-DaVDNZz8.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{t as x}from"./chevron-right-BweFrslA.js";import{n as S,r as C,t as te}from"./popover-select-CLsphyzA.js";import{O as w}from"./markdown-view-CWhAtI1O.js";import{t as T}from"./message-circle-Badhj-4D.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./x-B_N4OPjy.js";import{t as O}from"./cn-0WouolD0.js";import{t as k}from"./skeleton-DzdOeGYz.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{t as M}from"./chat-agents-api-DI0TksSO.js";import{t as N}from"./button-ChmVQg9O.js";import{t as P}from"./agent-avatar-display-BxHA8hEW.js";import{t as F}from"./automation-api-DHGtNfOT.js";import{n as I}from"./agent-display-names-Bje7vfSn.js";import{n as ne}from"./model-selector-D-9SUwg2.js";import{t as re}from"./date-picker-B0J_jDfr.js";import{t as ie}from"./time-picker-C1PXAXZF.js";var L=e(t(),1),R=n(),z=r(),B=`touch-manipulation inline-flex min-h-11 w-fit max-w-full min-w-0 items-center gap-2 rounded-[1.125rem] bg-surface-inset px-3 py-2 text-left text-sm text-fg transition-colors duration-150 motion-reduce:transition-none hover:bg-surface-hover active:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V=`m-0 flex w-full min-w-0 max-w-full list-none flex-col items-start gap-2 p-0`,H=`mt-2 min-w-0 max-w-full rounded-xl bg-surface-inset p-3 text-sm`;function U(e){let t=(0,R.c)(17),{icon:n,title:r,meta:i,trailing:a,fullTitle:o,className:s}=e,c=o!==void 0&&o,l;t[0]===n?l=t[1]:(l=(0,z.jsx)(`span`,{className:`flex size-[18px] shrink-0 items-center justify-center text-accent-fg [&>svg]:size-[18px]`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=l);let u=!c&&`line-clamp-2`,d;t[2]!==s||t[3]!==u?(d=O(`min-w-0 max-w-full break-words text-sm [overflow-wrap:anywhere]`,u,s),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f;t[5]!==d||t[6]!==r?(f=(0,z.jsx)(`span`,{className:d,children:r}),t[5]=d,t[6]=r,t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=i?(0,z.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`shrink-0`,"aria-hidden":!0,children:`·`}),(0,z.jsx)(`span`,{className:`min-w-0 line-clamp-2 break-words [overflow-wrap:anywhere]`,children:i})]}):null,t[8]=i,t[9]=p);let m;t[10]!==f||t[11]!==p?(m=(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[f,p]}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;return t[13]!==l||t[14]!==m||t[15]!==a?(h=(0,z.jsxs)(z.Fragment,{children:[l,m,a]}),t[13]=l,t[14]=m,t[15]=a,t[16]=h):h=t[16],h}function W({label:e,children:t}){let n=(0,L.useId)(),r,i=L.Children.map(t,(e,t)=>{if(!(0,L.isValidElement)(e)||e.type!==`input`&&e.type!==`textarea`&&e.type!==`select`&&e.type!==S)return e;let i=e,a=i.props.id??`${n}-${t}`;return r??=a,(0,L.cloneElement)(i,{id:a,...!i.props[`aria-label`]&&!i.props[`aria-labelledby`]?{"aria-labelledby":`${n}-label`}:{}})});return(0,z.jsxs)(`div`,{className:`grid gap-1.5`,role:`group`,"aria-labelledby":`${n}-label`,children:[r?(0,z.jsx)(`label`,{id:`${n}-label`,htmlFor:r,className:`text-xs font-medium text-fg-muted`,children:e}):(0,z.jsx)(`span`,{id:`${n}-label`,className:`text-xs font-medium text-fg-muted`,children:e}),i]})}async function G(e){let{conversationId:t}=await F.openConfiguration({automationId:e.automationId?.trim()||void 0,projectId:e.projectId?.trim()||void 0,...e.runId?{runId:e.runId}:{}}),n=new URLSearchParams(e.automationId?{automation:e.automationId.trim()}:{new:`1`,setupChat:t});return e.projectId?.trim()&&n.set(`projectId`,e.projectId.trim()),e.prompt?.trim()&&n.set(`chatDraft`,e.prompt.trim()),`/automations?${n.toString()}`}var K={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,model:``,instruction:``,taskId:``,safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,resultWebhookEndpoint:``,resultWebhookSecretId:``,disableAfterFailures:`3`},ae=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function q(e){let[t,n]=e.time.split(`:`),r=Number.parseInt(t||`9`,10),i=Number.parseInt(n||`0`,10),a;if(e.triggerMode===`manual`)a={kind:`manual`};else if(e.triggerMode===`once`)a={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)a={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)a={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)a={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`sessionUpdated`)a={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;a={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else a=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:y(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * *`}};let o=e.actionMode===`task_command`?`auto_apply`:e.safetyMode,s;return s=e.actionMode===`task_command`?{kind:`task_command`,taskId:e.taskId.trim(),command:{type:`start`,executor:{kind:`agent`,agentId:e.agentId.trim()}}}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:a,action:s,safety:{mode:o},conversationMode:e.conversationMode,delivery:{notificationPolicy:e.notificationPolicy,destinations:[{key:`gateway_event`,kind:`gateway_event`},...e.resultWebhookEndpoint.trim()&&e.resultWebhookSecretId.trim()?[{key:`result_webhook`,kind:`webhook`,endpoint:e.resultWebhookEndpoint.trim(),secretId:e.resultWebhookSecretId.trim()}]:[]]},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function J(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:K.time,weekday:K.weekday,cronExpr:e}}function Y(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function X(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Z(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function oe(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function se(e){let t={triggerMode:`manual`};if(e.trigger.kind===`webhook`)t={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)t=Z(e.trigger);else if(e.trigger.kind===`schedule`){let n=e.trigger.schedule;n.kind===`cron`&&(t={...J(n.expr),timezone:n.tz??``}),n.kind===`interval`&&(t={triggerMode:`interval`,...Y(n.everyMs)}),n.kind===`once`&&(t={triggerMode:`once`,onceAt:X(n.at)})}let n=e.action,r=e.reliability?.executionTimeoutSeconds??(`timeoutSeconds`in n?n.timeoutSeconds:void 0)??1800;return{...K,...t,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:n.kind===`task_command`?`task_command`:`agent`,agentId:n.kind===`agent`?n.agentId??``:n.kind===`task_command`&&n.command.type===`start`&&n.command.executor.kind===`agent`?n.command.executor.agentId:``,model:n.kind===`agent`?n.model??``:``,instruction:n.kind===`agent`?n.instruction:``,taskId:n.kind===`task_command`?n.taskId:``,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(r),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.delivery.notificationPolicy,resultWebhookEndpoint:e.delivery.destinations.find(e=>e.kind===`webhook`)?.endpoint??``,resultWebhookSecretId:e.delivery.destinations.find(e=>e.kind===`webhook`)?.secretId??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function ce(e,t){let n=q(t),r=e.trigger.kind===`schedule`&&n.trigger.kind===`schedule`&&e.trigger.schedule.kind===n.trigger.schedule.kind?{...n.trigger,schedule:{...e.trigger.schedule,...n.trigger.schedule}}:n.trigger,i=n.action;e.action.kind===`agent`&&n.action.kind===`agent`?i={...e.action,...n.action,agentId:n.action.agentId,model:n.action.model}:e.action.kind===`task_command`&&n.action.kind===`task_command`&&(i=n.action);let a=e.delivery.destinations.filter(e=>e.kind===`gateway_event`),o=e.delivery.destinations.filter(e=>e.kind===`webhook`);return{...n,description:t.description.trim(),projectId:t.projectId.trim(),delivery:{notificationPolicy:t.notificationPolicy,destinations:[...a.length>0?a:[{key:`gateway_event`,kind:`gateway_event`}],...e.delivery.destinations.filter(e=>e.kind===`file`||e.kind===`card`),...o.slice(1),...t.resultWebhookEndpoint.trim()&&t.resultWebhookSecretId.trim()?[{key:o[0]?.key??`result_webhook`,kind:`webhook`,endpoint:t.resultWebhookEndpoint.trim(),secretId:t.resultWebhookSecretId.trim()}]:[]]},trigger:r,action:i,reliability:{...e.reliability,...n.reliability}}}var le=h();function Q(e,t=new Date){let n=q(e);if(n.trigger.kind!==`schedule`||n.trigger.schedule.kind!==`cron`||!n.trigger.schedule.tz)return[];let r=le.CronExpressionParser.parse(n.trigger.schedule.expr,{currentDate:t,tz:n.trigger.schedule.tz});return[new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString()]}function ue(e){let t=(0,R.c)(35),{form:n,onChange:r,language:i}=e;if(![`daily`,`weekly`,`cron`,`once`].includes(n.triggerMode))return null;let a=i===`zh`;if(n.triggerMode===`once`){let e=a?`按当前浏览器时区输入,保存为绝对时间:`:`Entered in this browser timezone and stored as an absolute time: `,n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=Intl.DateTimeFormat().resolvedOptions(),t[0]=n):n=t[0];let r;return t[1]!==e||t[2]!==n.timeZone?(r=(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e,n.timeZone]}),t[1]=e,t[2]=n.timeZone,t[3]=r):r=t[3],r}let o,s,c,l,u,d;if(t[4]!==n||t[5]!==r||t[6]!==a){let e=[],i=!1;try{e=Q(n)}catch{i=!0}u=`rounded-lg bg-surface-base p-3`;let f=a?`时区与接下来的运行时间`:`Timezone and upcoming runs`,p=n.timezone?` · ${n.timezone}`:``;t[13]!==f||t[14]!==p?(d=(0,z.jsxs)(`summary`,{className:`cursor-pointer text-xs text-fg-muted focus-visible:outline-accent`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=d):d=t[15],o=`mt-3 space-y-2`;let m=a?`时区`:`Timezone`,h=n.timezone??``,g;t[16]===r?g=t[17]:(g=e=>r({timezone:e.target.value}),t[16]=r,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=(0,z.jsx)(`input`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:h,placeholder:`Asia/Shanghai`,onChange:g,"aria-invalid":i}),t[18]=h,t[19]=g,t[20]=_):_=t[20],t[21]!==_||t[22]!==m?(s=(0,z.jsx)(W,{label:m,children:_}),t[21]=_,t[22]=m,t[23]=s):s=t[23];let v=n.timezone?a?`按 ${n.timezone} 运行;下方显示执行时区时间与当前浏览器的当地时间。`:`Runs in ${n.timezone}; schedule-zone and browser-local times follow.`:a?`此规则未指定时区,沿用服务所在电脑的时区。指定时区后可预览;更改前请确认原定时间。`:`This legacy rule uses the service computer timezone. Specify a timezone to preview; confirm the intended schedule before changing it.`;t[24]===v?c=t[25]:(c=(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v}),t[24]=v,t[25]=c),l=i?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`请检查时区和定时规则。`:`Check the timezone and schedule expression.`}):(0,z.jsx)(`ol`,{className:`space-y-1 text-xs text-fg-muted`,children:e.map(e=>(0,z.jsxs)(`li`,{children:[new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZone:n.timezone,timeZoneName:`short`}),` · `,a?`你这里:`:`Your local time: `,new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZoneName:`short`})]},e))}),t[4]=n,t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d}else o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12];let f;t[26]!==o||t[27]!==s||t[28]!==c||t[29]!==l?(f=(0,z.jsxs)(`div`,{className:o,children:[s,c,l]}),t[26]=o,t[27]=s,t[28]=c,t[29]=l,t[30]=f):f=t[30];let p;return t[31]!==u||t[32]!==d||t[33]!==f?(p=(0,z.jsxs)(`details`,{className:u,children:[d,f]}),t[31]=u,t[32]=d,t[33]=f,t[34]=p):p=t[34],p}function de(e){let t=(0,R.c)(27),{language:n,agents:r,defaultId:i,loading:a,value:o,onChange:c}=e,l,u,d,f,p,m,h,g;if(t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o){let{agentsSettings:e,automations:c}=s(n),_=c.form,v;t[13]===i?v=t[14]:(v=e=>e.id===i,t[13]=i,t[14]=v);let y=r.find(v),b=y?_.defaultAgentWithName.replace(`{{name}}`,I(y,e)):_.defaultAgent;u=W,g=_.agent,l=te,d=_.agent,f=o,p=b,m=a,h=r.map(t=>({value:t.id,label:I(t,e),icon:(0,z.jsx)(P,{agentId:t.id,avatar:t.avatar,size:20})})),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12];let _;t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p||t[20]!==m||t[21]!==h?(_=(0,z.jsx)(l,{ariaLabel:d,value:f,placeholder:p,loading:m,options:h,onChange:c}),t[15]=l,t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m,t[21]=h,t[22]=_):_=t[22];let v;return t[23]!==u||t[24]!==g||t[25]!==_?(v=(0,z.jsx)(u,{label:g,children:_}),t[23]=u,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}async function fe(){await j(e=>typeof e==`string`?e.startsWith(`automation`):Array.isArray(e)&&typeof e[0]==`string`&&e[0].startsWith(`automation`))}var $=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-accent`;function pe({automation:e,projectId:t,language:n,onClose:r,onCreated:i}){let{data:a,error:o,isLoading:h}=A(`automation-chat-agents`,M),g=(0,L.useRef)(null),[_]=(0,L.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),[v,b]=(0,L.useState)(e),[x,te]=(0,L.useState)(()=>e?se(e):{...K,projectId:t??``,safetyMode:`auto_apply`}),[w,T]=(0,L.useState)(x),[E,O]=(0,L.useState)(!1),[k,j]=(0,L.useState)(``),[P,I]=(0,L.useState)(!1),[R,B]=(0,L.useState)(!1),V=n===`zh`,H=e=>T(t=>({...t,...e})),U=()=>{E||JSON.stringify(w)!==JSON.stringify(x)&&!window.confirm(V?`放弃尚未保存的修改?`:`Discard unsaved changes?`)||r()},G=async()=>{O(!0),j(``),I(!1);try{let e=!v||[`triggerMode`,`onceAt`,`time`,`weekday`,`timezone`,`cronExpr`,`intervalValue`,`intervalUnit`].some(e=>w[e]!==x[e]);if((e||v?.enabled)&&w.triggerMode===`once`&&(!w.onceAt||!Number.isFinite(new Date(w.onceAt).getTime())||new Date(w.onceAt).getTime()<=Date.now()))throw Error(V?`请选择未来的运行时间。`:`Choose a future run time.`);if(v&&v.action.kind!==`agent`)throw Error(V?`请在任务页编辑此类型任务。`:`Edit this task type on the task page.`);if([`daily`,`weekly`].includes(w.triggerMode)&&!/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(w.time))throw Error(V?`请选择有效的运行时间。`:`Choose a valid run time.`);if(w.triggerMode===`interval`&&y(w.intervalValue,w.intervalUnit)<6e4)throw Error(V?`运行间隔至少为一分钟。`:`Use an interval of at least one minute.`);Q(w);let t=w.name.trim()||w.instruction.trim().split(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-BPb7KheU.js";import{t as s}from"./messages-hlOsXkQ7.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CY7CS_D3.js";import{d as h,f as g,i as _,r as v,t as y,u as b}from"./automation-display-DaVDNZz8.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{t as x}from"./chevron-right-BweFrslA.js";import{n as S,r as C,t as te}from"./popover-select-CLsphyzA.js";import{O as w}from"./markdown-view-C7kqotD-.js";import{t as T}from"./message-circle-Badhj-4D.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./x-B_N4OPjy.js";import{t as O}from"./cn-0WouolD0.js";import{t as k}from"./skeleton-DzdOeGYz.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{t as M}from"./chat-agents-api-B-47bqbd.js";import{t as N}from"./button-ChmVQg9O.js";import{t as P}from"./agent-avatar-display-BDHjRaTK.js";import{t as F}from"./automation-api-CxLFngqe.js";import{n as I}from"./agent-display-names-Bje7vfSn.js";import{n as ne}from"./model-selector-BP-t33vd.js";import{t as re}from"./date-picker-DgTDENzF.js";import{t as ie}from"./time-picker-C1PXAXZF.js";var L=e(t(),1),R=n(),z=r(),B=`touch-manipulation inline-flex min-h-11 w-fit max-w-full min-w-0 items-center gap-2 rounded-[1.125rem] bg-surface-inset px-3 py-2 text-left text-sm text-fg transition-colors duration-150 motion-reduce:transition-none hover:bg-surface-hover active:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V=`m-0 flex w-full min-w-0 max-w-full list-none flex-col items-start gap-2 p-0`,H=`mt-2 min-w-0 max-w-full rounded-xl bg-surface-inset p-3 text-sm`;function U(e){let t=(0,R.c)(17),{icon:n,title:r,meta:i,trailing:a,fullTitle:o,className:s}=e,c=o!==void 0&&o,l;t[0]===n?l=t[1]:(l=(0,z.jsx)(`span`,{className:`flex size-[18px] shrink-0 items-center justify-center text-accent-fg [&>svg]:size-[18px]`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=l);let u=!c&&`line-clamp-2`,d;t[2]!==s||t[3]!==u?(d=O(`min-w-0 max-w-full break-words text-sm [overflow-wrap:anywhere]`,u,s),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f;t[5]!==d||t[6]!==r?(f=(0,z.jsx)(`span`,{className:d,children:r}),t[5]=d,t[6]=r,t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=i?(0,z.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`shrink-0`,"aria-hidden":!0,children:`·`}),(0,z.jsx)(`span`,{className:`min-w-0 line-clamp-2 break-words [overflow-wrap:anywhere]`,children:i})]}):null,t[8]=i,t[9]=p);let m;t[10]!==f||t[11]!==p?(m=(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[f,p]}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;return t[13]!==l||t[14]!==m||t[15]!==a?(h=(0,z.jsxs)(z.Fragment,{children:[l,m,a]}),t[13]=l,t[14]=m,t[15]=a,t[16]=h):h=t[16],h}function W({label:e,children:t}){let n=(0,L.useId)(),r,i=L.Children.map(t,(e,t)=>{if(!(0,L.isValidElement)(e)||e.type!==`input`&&e.type!==`textarea`&&e.type!==`select`&&e.type!==S)return e;let i=e,a=i.props.id??`${n}-${t}`;return r??=a,(0,L.cloneElement)(i,{id:a,...!i.props[`aria-label`]&&!i.props[`aria-labelledby`]?{"aria-labelledby":`${n}-label`}:{}})});return(0,z.jsxs)(`div`,{className:`grid gap-1.5`,role:`group`,"aria-labelledby":`${n}-label`,children:[r?(0,z.jsx)(`label`,{id:`${n}-label`,htmlFor:r,className:`text-xs font-medium text-fg-muted`,children:e}):(0,z.jsx)(`span`,{id:`${n}-label`,className:`text-xs font-medium text-fg-muted`,children:e}),i]})}async function G(e){let{conversationId:t}=await F.openConfiguration({automationId:e.automationId?.trim()||void 0,projectId:e.projectId?.trim()||void 0,...e.runId?{runId:e.runId}:{}}),n=new URLSearchParams(e.automationId?{automation:e.automationId.trim()}:{new:`1`,setupChat:t});return e.projectId?.trim()&&n.set(`projectId`,e.projectId.trim()),e.prompt?.trim()&&n.set(`chatDraft`,e.prompt.trim()),`/automations?${n.toString()}`}var K={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,model:``,instruction:``,taskId:``,safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,resultWebhookEndpoint:``,resultWebhookSecretId:``,disableAfterFailures:`3`},ae=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function q(e){let[t,n]=e.time.split(`:`),r=Number.parseInt(t||`9`,10),i=Number.parseInt(n||`0`,10),a;if(e.triggerMode===`manual`)a={kind:`manual`};else if(e.triggerMode===`once`)a={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)a={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)a={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)a={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`sessionUpdated`)a={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;a={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else a=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:y(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * *`}};let o=e.actionMode===`task_command`?`auto_apply`:e.safetyMode,s;return s=e.actionMode===`task_command`?{kind:`task_command`,taskId:e.taskId.trim(),command:{type:`start`,executor:{kind:`agent`,agentId:e.agentId.trim()}}}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:a,action:s,safety:{mode:o},conversationMode:e.conversationMode,delivery:{notificationPolicy:e.notificationPolicy,destinations:[{key:`gateway_event`,kind:`gateway_event`},...e.resultWebhookEndpoint.trim()&&e.resultWebhookSecretId.trim()?[{key:`result_webhook`,kind:`webhook`,endpoint:e.resultWebhookEndpoint.trim(),secretId:e.resultWebhookSecretId.trim()}]:[]]},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function J(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:K.time,weekday:K.weekday,cronExpr:e}}function Y(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function X(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Z(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function oe(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function se(e){let t={triggerMode:`manual`};if(e.trigger.kind===`webhook`)t={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)t=Z(e.trigger);else if(e.trigger.kind===`schedule`){let n=e.trigger.schedule;n.kind===`cron`&&(t={...J(n.expr),timezone:n.tz??``}),n.kind===`interval`&&(t={triggerMode:`interval`,...Y(n.everyMs)}),n.kind===`once`&&(t={triggerMode:`once`,onceAt:X(n.at)})}let n=e.action,r=e.reliability?.executionTimeoutSeconds??(`timeoutSeconds`in n?n.timeoutSeconds:void 0)??1800;return{...K,...t,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:n.kind===`task_command`?`task_command`:`agent`,agentId:n.kind===`agent`?n.agentId??``:n.kind===`task_command`&&n.command.type===`start`&&n.command.executor.kind===`agent`?n.command.executor.agentId:``,model:n.kind===`agent`?n.model??``:``,instruction:n.kind===`agent`?n.instruction:``,taskId:n.kind===`task_command`?n.taskId:``,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(r),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.delivery.notificationPolicy,resultWebhookEndpoint:e.delivery.destinations.find(e=>e.kind===`webhook`)?.endpoint??``,resultWebhookSecretId:e.delivery.destinations.find(e=>e.kind===`webhook`)?.secretId??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function ce(e,t){let n=q(t),r=e.trigger.kind===`schedule`&&n.trigger.kind===`schedule`&&e.trigger.schedule.kind===n.trigger.schedule.kind?{...n.trigger,schedule:{...e.trigger.schedule,...n.trigger.schedule}}:n.trigger,i=n.action;e.action.kind===`agent`&&n.action.kind===`agent`?i={...e.action,...n.action,agentId:n.action.agentId,model:n.action.model}:e.action.kind===`task_command`&&n.action.kind===`task_command`&&(i=n.action);let a=e.delivery.destinations.filter(e=>e.kind===`gateway_event`),o=e.delivery.destinations.filter(e=>e.kind===`webhook`);return{...n,description:t.description.trim(),projectId:t.projectId.trim(),delivery:{notificationPolicy:t.notificationPolicy,destinations:[...a.length>0?a:[{key:`gateway_event`,kind:`gateway_event`}],...e.delivery.destinations.filter(e=>e.kind===`file`||e.kind===`card`),...o.slice(1),...t.resultWebhookEndpoint.trim()&&t.resultWebhookSecretId.trim()?[{key:o[0]?.key??`result_webhook`,kind:`webhook`,endpoint:t.resultWebhookEndpoint.trim(),secretId:t.resultWebhookSecretId.trim()}]:[]]},trigger:r,action:i,reliability:{...e.reliability,...n.reliability}}}var le=h();function Q(e,t=new Date){let n=q(e);if(n.trigger.kind!==`schedule`||n.trigger.schedule.kind!==`cron`||!n.trigger.schedule.tz)return[];let r=le.CronExpressionParser.parse(n.trigger.schedule.expr,{currentDate:t,tz:n.trigger.schedule.tz});return[new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString()]}function ue(e){let t=(0,R.c)(35),{form:n,onChange:r,language:i}=e;if(![`daily`,`weekly`,`cron`,`once`].includes(n.triggerMode))return null;let a=i===`zh`;if(n.triggerMode===`once`){let e=a?`按当前浏览器时区输入,保存为绝对时间:`:`Entered in this browser timezone and stored as an absolute time: `,n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=Intl.DateTimeFormat().resolvedOptions(),t[0]=n):n=t[0];let r;return t[1]!==e||t[2]!==n.timeZone?(r=(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e,n.timeZone]}),t[1]=e,t[2]=n.timeZone,t[3]=r):r=t[3],r}let o,s,c,l,u,d;if(t[4]!==n||t[5]!==r||t[6]!==a){let e=[],i=!1;try{e=Q(n)}catch{i=!0}u=`rounded-lg bg-surface-base p-3`;let f=a?`时区与接下来的运行时间`:`Timezone and upcoming runs`,p=n.timezone?` · ${n.timezone}`:``;t[13]!==f||t[14]!==p?(d=(0,z.jsxs)(`summary`,{className:`cursor-pointer text-xs text-fg-muted focus-visible:outline-accent`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=d):d=t[15],o=`mt-3 space-y-2`;let m=a?`时区`:`Timezone`,h=n.timezone??``,g;t[16]===r?g=t[17]:(g=e=>r({timezone:e.target.value}),t[16]=r,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=(0,z.jsx)(`input`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:h,placeholder:`Asia/Shanghai`,onChange:g,"aria-invalid":i}),t[18]=h,t[19]=g,t[20]=_):_=t[20],t[21]!==_||t[22]!==m?(s=(0,z.jsx)(W,{label:m,children:_}),t[21]=_,t[22]=m,t[23]=s):s=t[23];let v=n.timezone?a?`按 ${n.timezone} 运行;下方显示执行时区时间与当前浏览器的当地时间。`:`Runs in ${n.timezone}; schedule-zone and browser-local times follow.`:a?`此规则未指定时区,沿用服务所在电脑的时区。指定时区后可预览;更改前请确认原定时间。`:`This legacy rule uses the service computer timezone. Specify a timezone to preview; confirm the intended schedule before changing it.`;t[24]===v?c=t[25]:(c=(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v}),t[24]=v,t[25]=c),l=i?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`请检查时区和定时规则。`:`Check the timezone and schedule expression.`}):(0,z.jsx)(`ol`,{className:`space-y-1 text-xs text-fg-muted`,children:e.map(e=>(0,z.jsxs)(`li`,{children:[new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZone:n.timezone,timeZoneName:`short`}),` · `,a?`你这里:`:`Your local time: `,new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZoneName:`short`})]},e))}),t[4]=n,t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d}else o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12];let f;t[26]!==o||t[27]!==s||t[28]!==c||t[29]!==l?(f=(0,z.jsxs)(`div`,{className:o,children:[s,c,l]}),t[26]=o,t[27]=s,t[28]=c,t[29]=l,t[30]=f):f=t[30];let p;return t[31]!==u||t[32]!==d||t[33]!==f?(p=(0,z.jsxs)(`details`,{className:u,children:[d,f]}),t[31]=u,t[32]=d,t[33]=f,t[34]=p):p=t[34],p}function de(e){let t=(0,R.c)(27),{language:n,agents:r,defaultId:i,loading:a,value:o,onChange:c}=e,l,u,d,f,p,m,h,g;if(t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o){let{agentsSettings:e,automations:c}=s(n),_=c.form,v;t[13]===i?v=t[14]:(v=e=>e.id===i,t[13]=i,t[14]=v);let y=r.find(v),b=y?_.defaultAgentWithName.replace(`{{name}}`,I(y,e)):_.defaultAgent;u=W,g=_.agent,l=te,d=_.agent,f=o,p=b,m=a,h=r.map(t=>({value:t.id,label:I(t,e),icon:(0,z.jsx)(P,{agentId:t.id,avatar:t.avatar,size:20})})),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12];let _;t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p||t[20]!==m||t[21]!==h?(_=(0,z.jsx)(l,{ariaLabel:d,value:f,placeholder:p,loading:m,options:h,onChange:c}),t[15]=l,t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m,t[21]=h,t[22]=_):_=t[22];let v;return t[23]!==u||t[24]!==g||t[25]!==_?(v=(0,z.jsx)(u,{label:g,children:_}),t[23]=u,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}async function fe(){await j(e=>typeof e==`string`?e.startsWith(`automation`):Array.isArray(e)&&typeof e[0]==`string`&&e[0].startsWith(`automation`))}var $=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-accent`;function pe({automation:e,projectId:t,language:n,onClose:r,onCreated:i}){let{data:a,error:o,isLoading:h}=A(`automation-chat-agents`,M),g=(0,L.useRef)(null),[_]=(0,L.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),[v,b]=(0,L.useState)(e),[x,te]=(0,L.useState)(()=>e?se(e):{...K,projectId:t??``,safetyMode:`auto_apply`}),[w,T]=(0,L.useState)(x),[E,O]=(0,L.useState)(!1),[k,j]=(0,L.useState)(``),[P,I]=(0,L.useState)(!1),[R,B]=(0,L.useState)(!1),V=n===`zh`,H=e=>T(t=>({...t,...e})),U=()=>{E||JSON.stringify(w)!==JSON.stringify(x)&&!window.confirm(V?`放弃尚未保存的修改?`:`Discard unsaved changes?`)||r()},G=async()=>{O(!0),j(``),I(!1);try{let e=!v||[`triggerMode`,`onceAt`,`time`,`weekday`,`timezone`,`cronExpr`,`intervalValue`,`intervalUnit`].some(e=>w[e]!==x[e]);if((e||v?.enabled)&&w.triggerMode===`once`&&(!w.onceAt||!Number.isFinite(new Date(w.onceAt).getTime())||new Date(w.onceAt).getTime()<=Date.now()))throw Error(V?`请选择未来的运行时间。`:`Choose a future run time.`);if(v&&v.action.kind!==`agent`)throw Error(V?`请在任务页编辑此类型任务。`:`Edit this task type on the task page.`);if([`daily`,`weekly`].includes(w.triggerMode)&&!/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(w.time))throw Error(V?`请选择有效的运行时间。`:`Choose a valid run time.`);if(w.triggerMode===`interval`&&y(w.intervalValue,w.intervalUnit)<6e4)throw Error(V?`运行间隔至少为一分钟。`:`Use an interval of at least one minute.`);Q(w);let t=w.name.trim()||w.instruction.trim().split(`
|
|
2
2
|
`)[0].slice(0,80),n=q({...w,name:t});if(v&&v.action.kind===`agent`)await F.update(v.id,{expectedRevision:v.updatedAtMs,name:t,action:{...v.action,instruction:w.instruction.trim(),agentId:w.agentId.trim()||void 0,model:w.model.trim()||void 0},...e?{trigger:n.trigger}:{},conversationMode:w.conversationMode,delivery:{...v.delivery,notificationPolicy:w.notificationPolicy}});else{let e=await F.create({...n,enabled:!0});i?.(e.automation)}await fe(),r()}catch(e){I(e?.status===409),j(e?.status===409?V?`任务已在其他地方更新,请核对最新设置后再保存。`:`This task changed elsewhere. Review the latest settings before saving.`:e instanceof Error?e.message:String(e))}finally{O(!1)}},ae=async()=>{if(!(!v||!window.confirm(V?`载入最新设置将替换当前未保存的修改,是否继续?`:`Loading the latest settings replaces your unsaved edits. Continue?`))){O(!0);try{let{automation:e}=await F.get(v.id),t=se(e);b(e),te(t),T(t),j(``),I(!1)}catch{j(V?`暂时无法载入最新设置,请重试。`:`Could not load the latest settings. Try again.`)}finally{O(!1)}}},J=w.timezone||(V?`默认时区`:`Default timezone`);try{J=V&&w.timezone===`Asia/Shanghai`?`中国时间`:new Intl.DateTimeFormat(V?`zh-CN`:`en-US`,{timeZone:J,timeZoneName:`shortGeneric`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value||J}catch{}let Y=``;try{let e=Q(w)[0];e&&w.timezone!==Intl.DateTimeFormat().resolvedOptions().timeZone&&(Y=`${V?`你这里的下次时间:`:`Next run in your timezone: `}${new Date(e).toLocaleString(V?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`})}`)}catch{}let X=`flex min-h-12 items-center justify-between gap-4 border-b border-edge last:border-b-0`,Z=`min-h-10 w-32 shrink-0 justify-end border-0 bg-transparent py-2 pl-3 pr-0 text-right text-sm text-fg-muted shadow-none`;return(0,z.jsx)(m,{open:!0,onOpenChange:e=>{e||U()},children:(0,z.jsxs)(d,{children:[(0,z.jsx)(c,{className:`fixed inset-0 z-65 bg-scrim`}),(0,z.jsxs)(f,{onCloseAutoFocus:e=>{e.preventDefault(),_?.isConnected&&_.focus()},onOpenAutoFocus:e=>{e.preventDefault(),g.current?.focus()},style:{height:`min(${R?760:v?600:440}px, calc(100dvh - 2rem))`},className:`fixed left-1/2 top-1/2 z-66 flex w-[min(42.5rem,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between px-5 pb-3 pt-5`,children:[(0,z.jsx)(p,{className:`text-base font-semibold text-fg`,children:v?V?`编辑定时任务`:`Edit scheduled task`:V?`设定定时任务`:`Schedule a task`}),(0,z.jsx)(u,{asChild:!0,children:(0,z.jsx)(N,{variant:`ghost`,disabled:E,"aria-label":V?`关闭`:`Close`,children:(0,z.jsx)(D,{className:`size-4`})})})]}),(0,z.jsx)(l,{className:`sr-only`,children:V?`描述要做的事,选择重复频率和时间。`:`Describe the task and choose its frequency and time.`}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pb-3`,children:[v?(0,z.jsx)(`input`,{"aria-label":V?`任务名称`:`Task name`,className:`w-full rounded-xl border border-edge bg-transparent px-4 py-3 text-sm text-fg focus-visible:outline-accent`,value:w.name,onChange:e=>H({name:e.target.value})}):null,(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:V?`要做什么`:`What should happen`}),(0,z.jsx)(`textarea`,{ref:g,"aria-label":V?`任务说明`:`Task description`,placeholder:V?`希望定期帮你做什么?`:`What would you like done regularly?`,className:`block h-32 w-full resize-none rounded-xl border border-edge bg-transparent px-4 py-3 text-sm leading-6 text-fg placeholder:text-fg-subtle focus-visible:outline-accent`,value:w.instruction,onChange:e=>H({instruction:e.target.value})})]}),(0,z.jsxs)(`section`,{"aria-label":V?`运行时间`:`Schedule`,className:`rounded-xl border border-edge px-4`,children:[(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:V?`重复`:`Repeat`}),(0,z.jsxs)(S,{"aria-label":V?`重复`:`Repeat`,className:Z,value:w.triggerMode,onChange:e=>H({triggerMode:e.target.value}),children:[(0,z.jsx)(C,{value:`once`,children:V?`仅一次`:`Once`}),(0,z.jsx)(C,{value:`daily`,children:V?`每天`:`Daily`}),(0,z.jsx)(C,{value:`weekly`,children:V?`每周`:`Weekly`}),(0,z.jsx)(C,{value:`interval`,children:V?`固定间隔`:`At intervals`}),(0,z.jsx)(C,{value:`cron`,children:V?`自定义`:`Custom`}),[`once`,`daily`,`weekly`,`interval`,`cron`].includes(w.triggerMode)?null:(0,z.jsx)(C,{value:w.triggerMode,children:V?`保持当前触发方式`:`Keep current trigger`})]})]}),[`daily`,`weekly`].includes(w.triggerMode)?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:V?`时间`:`Time`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`truncate text-xs`,children:J}),(0,z.jsx)(ie,{value:w.time,onChange:e=>H({time:e}),ariaLabel:V?`时间`:`Time`,className:`w-auto`,triggerClassName:`w-auto border-0 bg-transparent px-0 shadow-none`})]})]}):null,w.triggerMode===`weekly`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:V?`星期`:`Day`}),(0,z.jsx)(S,{"aria-label":V?`星期`:`Day`,className:Z,value:w.weekday,onChange:e=>H({weekday:e.target.value}),children:Object.entries(V?{1:`星期一`,2:`星期二`,3:`星期三`,4:`星期四`,5:`星期五`,6:`星期六`,0:`星期日`}:{1:`Monday`,2:`Tuesday`,3:`Wednesday`,4:`Thursday`,5:`Friday`,6:`Saturday`,0:`Sunday`}).map(([e,t])=>(0,z.jsx)(C,{value:e,children:t},e))})]}):null,w.triggerMode===`once`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:V?`日期`:`Date`}),(0,z.jsx)(re,{ariaLabel:V?`运行日期`:`Run date`,className:`w-auto bg-transparent text-fg-muted`,value:w.onceAt.split(`T`)[0],onChange:e=>H({onceAt:`${e}T${w.onceAt.split(`T`)[1]||w.time}`})})]}),(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:V?`时间`:`Time`}),(0,z.jsx)(ie,{ariaLabel:V?`运行时间`:`Run time`,value:w.onceAt.split(`T`)[1]||w.time,onChange:e=>H({onceAt:`${w.onceAt.split(`T`)[0]}T${e}`}),triggerClassName:`border-0 bg-transparent text-fg-muted shadow-none`})]})]}):null,w.triggerMode===`cron`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`label`,{htmlFor:`automation-cron`,className:`text-sm text-fg`,children:V?`时间规则`:`Schedule`}),(0,z.jsx)(`input`,{id:`automation-cron`,className:`min-w-0 bg-transparent py-3 text-right text-sm text-fg-muted`,value:w.cronExpr,onChange:e=>H({cronExpr:e.target.value})})]}):null,w.triggerMode===`interval`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`label`,{htmlFor:`automation-interval`,className:`text-sm text-fg`,children:V?`每隔`:`Every`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`input`,{id:`automation-interval`,type:`number`,min:`1`,"aria-label":V?`间隔数值`:`Interval value`,className:`w-16 bg-transparent text-right text-sm text-fg-muted`,value:w.intervalValue,onChange:e=>H({intervalValue:e.target.value})}),(0,z.jsxs)(S,{"aria-label":V?`间隔单位`:`Interval unit`,className:Z,value:w.intervalUnit,onChange:e=>H({intervalUnit:e.target.value}),children:[(0,z.jsx)(C,{value:`minute`,children:V?`分钟`:`Minutes`}),(0,z.jsx)(C,{value:`hour`,children:V?`小时`:`Hours`}),(0,z.jsx)(C,{value:`day`,children:V?`天`:`Days`}),(0,z.jsx)(C,{value:`week`,children:V?`周`:`Weeks`})]})]})]}):null]}),Y?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:Y}):null,w.triggerMode===`once`?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V?`按你所在时区输入,换时区后仍在同一时刻运行。`:`Enter your local time. Changing timezone keeps the same instant.`}):null,(0,z.jsx)(de,{language:n,agents:a?.items??[],defaultId:a?.defaultId??``,loading:h,value:w.agentId,onChange:e=>H({agentId:e})}),o?(0,z.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:V?`暂时无法加载执行者,请稍后重试。`:`Could not load assignees. Try again later.`}):v?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V?`更换执行者后,从下一次运行开始生效。`:`Assignee changes apply on the next run.`}):null,(0,z.jsxs)(`details`,{className:`group`,onToggle:e=>B(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 py-2 text-sm text-fg-muted focus-visible:outline-accent`,children:[V?`高级`:`Advanced`,(0,z.jsx)(ee,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,z.jsxs)(`div`,{className:`mt-2 grid gap-4 pb-2`,children:[v?null:(0,z.jsx)(W,{label:V?`任务名称(可选)`:`Task name (optional)`,children:(0,z.jsx)(`input`,{className:$,value:w.name,onChange:e=>H({name:e.target.value}),placeholder:V?`根据说明自动命名`:`Named from your description`})}),(0,z.jsx)(W,{label:V?`时区`:`Timezone`,children:(0,z.jsx)(`input`,{className:$,value:w.timezone??``,placeholder:`Asia/Shanghai`,onChange:e=>H({timezone:e.target.value})})}),(0,z.jsx)(W,{label:V?`使用模型`:`Model`,children:(0,z.jsx)(ne,{value:w.model,onChange:e=>H({model:e}),allowEmpty:!0,placeholder:s(n).automations.form.defaultModel,searchPlaceholder:s(n).automations.form.searchModels,noMatches:s(n).automations.form.noModels,emptyLabel:V?`默认模型`:`Default model`,ariaLabel:V?`使用模型`:`Model`})}),(0,z.jsx)(W,{label:V?`运行上下文`:`Run context`,children:(0,z.jsxs)(S,{className:$,value:w.conversationMode,onChange:e=>H({conversationMode:e.target.value}),children:[(0,z.jsx)(C,{value:`new_session`,children:V?`每次独立运行`:`Independent runs`}),(0,z.jsx)(C,{value:`continuous`,children:V?`延续之前的运行`:`Continue previous runs`})]})}),(0,z.jsx)(W,{label:V?`通知我`:`Notify me`,children:(0,z.jsxs)(S,{className:$,value:w.notificationPolicy,onChange:e=>H({notificationPolicy:e.target.value}),children:[(0,z.jsx)(C,{value:`attention`,children:V?`需要关注时`:`When attention is needed`}),(0,z.jsx)(C,{value:`all`,children:V?`每次完成时`:`After every run`}),(0,z.jsx)(C,{value:`none`,children:V?`不通知`:`Never`})]})})]})]}),k?(0,z.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,z.jsx)(`p`,{children:k}),P?(0,z.jsx)(N,{variant:`secondary`,disabled:E,onClick:()=>void ae(),children:V?`载入最新设置`:`Load latest settings`}):null,(0,z.jsx)(`p`,{children:V?`内容已保留,请核对后重试。`:`Your edits are preserved. Review and retry.`})]}):null]}),(0,z.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 px-5 pb-5 pt-3`,children:[(0,z.jsx)(N,{variant:`ghost`,className:`rounded-full bg-surface-base px-4`,disabled:E,onClick:U,children:V?`取消`:`Cancel`}),(0,z.jsx)(N,{variant:`primary`,className:`rounded-full px-4 disabled:bg-surface-active disabled:text-fg-subtle disabled:opacity-100`,disabled:E||!w.instruction.trim(),onClick:()=>void G(),children:E?V?`保存中…`:`Saving…`:v?V?`保存`:`Save`:V?`创建`:`Create`})]})]})]})})}function me({automationId:e,runId:t,language:n,inConfiguration:r=!1,embedded:c=!1}){let l=i(),u=o(),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,y]=(0,L.useState)(``),{data:ee,error:S,isLoading:C,mutate:te}=A([`automation-card`,e],()=>F.get(e),{refreshInterval:5e3,shouldRetryOnError:!1}),D=n===`zh`,j=ee?.automation,M=s(n),P=c?void 0:`my-3 rounded-xl border border-edge`;if(C&&!j)return(0,z.jsx)(`div`,{className:O(P,!c&&`p-3`),children:(0,z.jsx)(k,{className:c?`h-11 w-48 max-w-full rounded-[1.125rem]`:`h-12 w-full rounded-lg`})});if(S||!j)return(0,z.jsxs)(`div`,{className:O(P,`p-3 text-sm text-fg-muted`),children:[(0,z.jsx)(`p`,{children:D?`任务已删除或暂时无法读取。`:`This task was deleted or is unavailable.`}),(0,z.jsx)(`button`,{type:`button`,className:`mt-2 underline`,onClick:()=>void te(),children:D?`重试`:`Retry`})]});if(t)return(0,z.jsx)(a,{className:O(c?B:P,!c&&`flex min-h-14 min-w-0 items-center gap-3 px-3 py-2 text-left hover:bg-surface-hover/65 active:bg-surface-active/70 transition-colors duration-150 motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`),"data-product-delivery":`automation`,to:w(`${l.pathname}${l.search}`,`/automations?automation=${encodeURIComponent(j.id)}&view=run&run=${encodeURIComponent(t)}`),children:c?(0,z.jsx)(U,{icon:(0,z.jsx)(g,{}),title:j.name,meta:D?`查看运行情况`:`View run`,trailing:(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(g,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:j.name}),(0,z.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:D?`查看运行情况`:`View run`})]}),(0,z.jsx)(x,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})});let I=async()=>{m(!0),y(``);try{u(await G({automationId:j.id}))}catch(e){y(e instanceof Error?e.message:String(e))}finally{m(!1)}};return c?(0,z.jsxs)(`details`,{className:`group min-w-0 max-w-full`,"data-product-delivery":`automation`,children:[(0,z.jsx)(`summary`,{className:O(B,`cursor-pointer list-none`),title:j.name,children:(0,z.jsx)(U,{icon:(0,z.jsx)(g,{}),title:j.name,meta:b(j)?D?`已完成`:`Completed`:j.enabled?_(j.trigger,M.automations,M.cron,n):M.automations.paused,trailing:(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle transition-transform group-open:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})})}),(0,z.jsxs)(`div`,{className:H,children:[(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[_(j.trigger,M.automations,M.cron,n),j.trigger.kind===`schedule`&&j.trigger.schedule.kind===`cron`&&j.trigger.schedule.tz?` · ${j.trigger.schedule.tz}`:``,` · `,b(j)?D?`已完成`:`Completed`:j.enabled?M.automations.enabled:M.automations.paused]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.enabled?`${D?`下次:`:`Next: `}${v(j,M.automations,n)}`:b(j)?D?`这项一次性任务已完成`:`This one-time task is complete`:D?`恢复后将按计划运行`:`Resume to run on schedule`}),(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[!j.management&&j.action.kind===`agent`?(0,z.jsxs)(N,{variant:`ghost`,onClick:()=>f(!0),children:[(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),D?`编辑`:`Edit`]}):null,!r&&!j.management&&j.action.kind!==`system`?(0,z.jsxs)(N,{variant:`ghost`,disabled:p,onClick:()=>void I(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),D?`继续对话`:`Continue in chat`]}):null,(0,z.jsx)(a,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-xs text-accent-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:`/automations?automation=${encodeURIComponent(j.id)}`,children:D?`打开`:`Open`})]}),[`failed`,`timeout`].includes(j.state.lastRunStatus??``)?(0,z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:D?`上次运行未完成。可以在对话中说明“帮我修复”,再试运行。`:`The last run did not finish. Ask in chat to fix it, then try again.`}):null,h?(0,z.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:h}):null]}),d?(0,z.jsx)(pe,{automation:j,language:n,onClose:()=>f(!1)}):null]}):(0,z.jsxs)(`div`,{className:O(P,`overflow-hidden`,!c&&`bg-surface-panel`),"data-product-delivery":`automation`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-3`,children:[(0,z.jsx)(g,{className:`size-6 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:j.name}),(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[_(j.trigger,M.automations,M.cron,n),j.trigger.kind===`schedule`&&j.trigger.schedule.kind===`cron`&&j.trigger.schedule.tz?` · ${j.trigger.schedule.tz}`:``,` · `,b(j)?D?`已完成`:`Completed`:j.enabled?M.automations.enabled:M.automations.paused]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:j.enabled?`${D?`下次:`:`Next: `}${v(j,M.automations,n)}`:b(j)?D?`这项一次性任务已完成`:`This one-time task is complete`:D?`恢复后将按计划运行`:`Resume to run on schedule`})]}),!j.management&&j.action.kind===`agent`?(0,z.jsxs)(N,{variant:`ghost`,onClick:()=>f(!0),children:[(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),D?`编辑`:`Edit`]}):null,!r&&!j.management&&j.action.kind!==`system`?(0,z.jsxs)(N,{variant:`ghost`,disabled:p,onClick:()=>void I(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),D?`继续对话`:`Continue in chat`]}):null,(0,z.jsx)(a,{className:`rounded-md border border-edge px-3 py-2 text-xs text-fg hover:bg-surface-hover`,to:`/automations?automation=${encodeURIComponent(j.id)}`,children:D?`打开`:`Open`})]}),[`failed`,`timeout`].includes(j.state.lastRunStatus??``)?(0,z.jsx)(`p`,{className:`px-4 pb-3 text-xs text-fg-muted`,children:D?`上次运行未完成。可以在对话中说明“帮我修复”,再试运行。`:`The last run did not finish. Ask in chat to fix it, then try again.`}):null,h?(0,z.jsx)(`p`,{role:`alert`,className:`px-4 pb-3 text-sm text-danger`,children:h}):null,d?(0,z.jsx)(pe,{automation:j,language:n,onClose:()=>f(!1)}):null]})}function he(e){let t=(0,R.c)(22),{conversationId:n,language:r,running:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=[`automation-configuration`,n],o=()=>F.configuration(n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e3,shouldRetryOnError:!1},t[3]=s):s=t[3];let{data:c,error:l,mutate:u}=A(a,o,s),d;t[4]!==u||t[5]!==i?(d=()=>{i||(u(),fe())},t[4]=u,t[5]=i,t[6]=d):d=t[6];let f;if(t[7]!==n||t[8]!==u||t[9]!==i?(f=[i,n,u],t[7]=n,t[8]=u,t[9]=i,t[10]=f):f=t[10],(0,L.useEffect)(d,f),l){let e;t[11]===u?e=t[12]:(e=()=>void u(),t[11]=u,t[12]=e);let n=r===`zh`?`任务配置暂时无法读取,点击重试`:`Task configuration unavailable. Retry`,i;return t[13]!==e||t[14]!==n?(i=(0,z.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-fg-muted underline`,onClick:e,children:n}),t[13]=e,t[14]=n,t[15]=i):i=t[15],i}if(!c){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(k,{className:`mb-4 h-20 rounded-xl`}),t[16]=e):e=t[16],e}if(c.deleted){let e=r===`zh`?`这个定时任务已删除,配置讨论仍可查看。`:`This scheduled task was deleted. Its configuration discussion is preserved.`,n;return t[17]===e?n=t[18]:(n=(0,z.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e}),t[17]=e,t[18]=n),n}let p;return t[19]!==c.automation||t[20]!==r?(p=c.automation?(0,z.jsx)(me,{automationId:c.automation.id,language:r,inConfiguration:!0}):null,t[19]=c.automation,t[20]=r,t[21]=p):p=t[21],p}function ge({automationId:e,language:t,runId:n,variant:r=`primary`}){let i=o(),[a,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),u=async()=>{s(!0),l(``);try{i(await G({automationId:e,runId:n,prompt:n?t===`zh`?`帮我看看这次为什么没有完成,并修复问题。`:`Help me understand why this did not finish and fix the problem.`:void 0}))}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(N,{variant:r,disabled:a,onClick:()=>void u(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),n?t===`zh`?`对话修复`:`Fix in chat`:t===`zh`?`继续对话`:`Continue in chat`]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`ml-2 text-xs text-danger`,children:c}):null]})}export{B as _,de as a,ae as c,se as d,K as f,U as g,W as h,me as i,ce as l,G as m,ge as n,ue as o,oe as p,pe as r,Q as s,he as t,q as u,H as v,V as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-BFk-AF43.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
|