@xopcai/xopc 0.0.480 → 0.0.482
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/dingtalk/src/index.js +8 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/server/chunks.bin +1548 -1552
- package/dist/gateway/server/chunks.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-9wMoZ4Ok.js → activity-store-BCPCuT-6.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-TrALdAg_.js → agent-avatar-dicebear-Di9jxcH9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BiHRFRo2.js → agent-avatar-display-KbzBlJ8W.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DLopBKfN.js → agent-defaults-settings-panel-CYZzdU6C.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-wisFd2cR.js → agent-plugin-dialog-Bhkawcil.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CzgZX_E9.js → agents-B2RXJeIo.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-Crvl6IB4.js → agents-admin-api-DpfkHNbc.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DQVcF1zq.js → api-BtngCZrB.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CJvZsRen.js → api-CnOSHyKU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CYwY9a8P.js → app-management-settings-panel-Dyc3I-ng.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-8clf9SDY.js → appearance-settings-CmdhL-0n.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-B2qv9gWd.js → apps-page-BFqC9Knk.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Bu1nF6Lg.js → archive-plugin-DFP0MajV.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-HQmKv0Sm.js → automation-api-Cc5X3Q1t.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CMjfyY6p.js → automation-result-state-B7fHzLLf.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-wlGMBYYv.js → automation-run-list-DPTby29p.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-2EsZ1jBs.js → automation-task-card-CjzArAJi.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BUtoiUiH.js → automations-page-BKbElVfF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CW_8-0Cb.js → automations-workspace-_18qOoLm.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-Dz62GXI_.js → binary-plugins-DnE-iqaV.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CA66tdm3.js → block-editor-CYobheuw.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-settings-page-hAttQ9qS.js → browser-settings-page-BLniK98R.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-BfTF_flC.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-BNmDs-Ca.js → capabilities-oihQXc5J.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B32XFJ59.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CWnHPY8j.js +8 -0
- package/dist/gateway/static/root/assets/capability-presentation-DlJQUUlM.js +1 -0
- package/dist/gateway/static/root/assets/{channels-CFmGXibE.js → channels-DEIqjf9M.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-LVSL686y.js → chat-agents-api-BzuJyysa.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-Drmp5p0m.js → chat-chart-block-DurSfGy2.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-CK4aWVbI.js +74 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-twWNRsuW.js → chat-terminal-dock-UBaRUsXJ.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-B27c_GTI.js → command-palette-api-3kNqE3U7.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-DdxZ-1U4.js → composer-model-config-control-CrI-u8F_.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-Dd64p5ZI.js → composer-notifications-L6u0F2_8.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Cbkv-F26.js → composer-payload-handoff-DdHGkHOq.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-B8UkO-mU.js → computer-settings-page-BwvCOkbI.js} +1 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-B8eiZl6Z.js +1 -0
- package/dist/gateway/static/root/assets/{connection-usage-guide-CNB9P9jg.js → connection-usage-guide-CydSRk3h.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DkifsBTl.js → connector-service-page-CLBi6R-Z.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DjIpuBCy.js → connectors-api-Bn2IbtcF.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-oGveGlkI.js → connectors-page-ywk7W0s6.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-_G6tIiGk.js → date-picker-DsD7NIm2.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-B3lS-ZGW.js → date-time-picker-BhnBpBpj.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BAKyq-sn.js → desktop-pet-eFR-zmP2.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DGpu4hH_.js → desktop-pet-settings-CfFTYstQ.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DqYjZFu1.js → dev-view-store-D_uPX9_R.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CIvmpDvo.js → device-pairing-wizard-BeLkoDUp.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BAsEQvG4.js → directory-picker-path-field-5wZa0JF3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-BmlRcbhA.js → extension-authoritative-grants-DaA0KXyO.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page--EU_kb8E.js → extension-debug-page-CXe8jimk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CcspWP4N.js → extension-iframe-host-BwMISzWU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BQIfGFSy.js → extension-marketplace-api-DuWuae8G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-f7v82b69.js → extension-message-router-DzBfVl6h.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-CJxtbXQj.js → extension-page-DW18FOb8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-htRLPCBf.js → extension-provider-CyYrgUw-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CKui11ZQ.js → extension-settings-page-ByGVQYDw.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-Cwy9Cgaq.js → file-preview-surface-Cw70pwph.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-abWJ0Q_y.js → gateway-config-swr-BYoBGl6i.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-PYDAppcy.js → gateway-realtime-Dzq6_piH.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B9CDQ8NO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-BtAJNIO-.js → gateway-restart-CtqJpyNu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BvD8fcB2.js → gateway-settings-xzO7KDsu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cza1BaL8.js → gateway-startup-retry-DCDOl6Oo.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BIa73mvy.js → global-defaults-api-DXFSI87T.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CztF0goW.js +8 -0
- package/dist/gateway/static/root/assets/home-task-actions-DTXb7Gc7.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BCU7Uxyy.js → image-generation-api-Ck0rMJy3.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Clh0polM.js → imports-page-egn9yYfF.js} +1 -1
- package/dist/gateway/static/root/assets/index-dqkMYWTd.js +11 -0
- package/dist/gateway/static/root/assets/index-q78xsKF3.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DSkXYsng.js → install-connector-dialog-CMh8jhn1.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Crf76ecq.js → keyboard-shortcuts-settings-BOiKmOwN.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-WudNXl41.js → local-app-workbench-page-ev6VTDX2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Br9ZO7Ad.js → local-apps-page-CQBSa3cR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BHrHLZJJ.js → local-session-drafts-pAAFf-Ad.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-5DzxIIeq.js → locale-store-BYdvIuPj.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BqUeqzPB.js → logs-page-Z-4VNgnq.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-DHCpR1ma.js → management-api-D739TCBl.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BccKy8tW.js → management-settings-CZDWUPmg.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-BOJVaGPC.js +261 -0
- package/dist/gateway/static/root/assets/markdown-view-Czi3_WHu.css +1 -0
- package/dist/gateway/static/root/assets/marked.esm-8VXEA2AD.js +64 -0
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DxZ-KH6B.js → mcp-conversation-setup-page-NcRvP7cK.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DissTT0S.js → media-plugins-B9bQ3e1j.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CGGOcV9B.js → messages-lc5BjBtX.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-DsCLjn_X.js → model-selector-DugdMlvi.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-B0Y9Frop.js → models-hub-cache-DvDksW4g.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CEi6GNEA.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DftbeSZR.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CdC4jVPP.js → notes-api-auhtw3zM.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CC5-BWmA.js → notes-page-DnI1iJ3g.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-CAPuqZdT.js → oauth-api-BXKG29Kg.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-7i3NoKo4.js → oauth-provider-connect-y6-vDWb-.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BcSfcOme.js → page-context-capture-button-BBVJZgU0.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BJ2cY1Us.js → page-context-draft-B30xEPDh.js} +1 -1
- package/dist/gateway/static/root/assets/{page-header-store-xgXJVGDC.js → page-header-store-BGCCXOOf.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-avatar-CidTaDAv.js → personal-avatar-w5Sekj02.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BlxApjBh.js → personal-page-BWzfp81f.js} +1 -1
- package/dist/gateway/static/root/assets/personal-profile-settings-BYmKk14v.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-BXKSkUoc.js → personal-settings-panel-DYnTT7aB.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-_7leySaj.js → phone-dependencies-card-DJciwZ-7.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-CVI6GGMF.js → phone-model-connection-C3jmc4ma.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-qP1Sh-eA.js → phone-model-picker-MWC_Zh2a.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-BAKOJllx.js → phone-settings-page-C1Yc6tP7.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-CDtfKAUX.js → phone-workspace-store-Cxk2PJZe.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-BpPMZLLz.js → plugin-details-dialog-CpKZE_nx.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BS-XMhb4.js → preference-select-fields-ByihE_wl.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-D8kxmrLV.js → preview-runtime-iJuVSugF.js} +3 -3
- package/dist/gateway/static/root/assets/product-automation-feedback-ref9gqOW.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BUqA67HG.js → product-open-page-B7kAAD7Q.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CowHxHNk.js → product-preview-content-CzNWh2h2.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-BJDwL7x3.js → product-preview-modal-B1RKw3Z-.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-CJQuslC9.js → project-detail-page-Zr1I56NG.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-eH4uN6k8.js → project-understanding-D0S9pFg7.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DFo_ESE9.js → projects-page-DlwRbxAj.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-Df4w723e.js → providers-api-D_v_CJ3l.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-DnRi2KQ5.js → recording-upload-BSyxK34y.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Dw8Ou9VV.js → registry-api-DGi-X6j7.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B7jGK_WY.js → remote-access-hub-D3EYRXQC.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-CZV8cItD.js → resource-unavailable-52Jvhy-I.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-DOyKalyG.js → right-workspace-store-DsGslCi-.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-D00yB6hp.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-sCpXMbMl.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-2sksjMtE.js → runtime-tools-api-D8Xtty0g.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DPX5htrV.js → runtime-tools-settings-panel-r28zxrgP.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-BnJcjQuF.js → service-recommendation-list-Kw6pwI8U.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CUkWJyfm.js → session-api-eApyRHbI.js} +1 -1
- package/dist/gateway/static/root/assets/session-channel-icon-CJAPoVO-.js +1 -0
- package/dist/gateway/static/root/assets/session-identity-DRFdxntH.js +1 -0
- package/dist/gateway/static/root/assets/session-identity-label-CZf50vSj.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-C-oe-9_N.js +28 -0
- package/dist/gateway/static/root/assets/sessions-page-BkNfjgXC.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B82UPSQS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-Bponzv_k.js → settings-advanced-section-Dc9aztiW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-BtgmaA-P.js → settings-mode-store-DcE2iR7e.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C1USPFgf.js → settings-page-CXRPZxuB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-B8nLRdnY.js → settings-page-header-CQueaD1Z.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DhOLVJYv.js → settings-page-layout-BlwyxcEq.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-CyEO6jAM.js → setup-interaction-page-BvL6C5ja.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CNpRqxnq.js → setup-status-panel-Dp5cY2P9.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-kZSUpbBN.js → share-link-dialog-CB3LkWw8.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-9-aTa7_a.js → share-preview-page-IG0fTWJO.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BxQqmxkq.js → shares-api-DgYOJV0T.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DoMMw8Ud.js → shares-settings-YeLkRDki.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-V3Y6pTog.js → skill-api-DRCHLW2T.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-BSHfM0qb.js → skill-list-api-CQUhEUOF.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Dq3F9pqP.js → skill-reload-api-BoEna1cx.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DGWy1Jns.js → skills-page-CBAL83FE.js} +1 -1
- package/dist/gateway/static/root/assets/{space-api-BkXqM2MT.js → space-api-d4Q4hkEY.js} +1 -1
- package/dist/gateway/static/root/assets/space-page-8BMb_g2p.js +2 -0
- package/dist/gateway/static/root/assets/{space-workbook-7S_FfalA.js → space-workbook-BDjeiRtr.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DSmwwU8o.js → system-settings-panel-dt8k0K4V.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DFeKIcxT.js +3 -0
- package/dist/gateway/static/root/assets/{task-header-title-DAwu5vni.js → task-header-title-ClyuCAFb.js} +1 -1
- package/dist/gateway/static/root/assets/task-run-issue-notice-XWlgvgEo.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-BIehlq7k.js → tasks-CwyNaa-j.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-IpKmyQVN.js → terminal-panel-store-CNkRP4kf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B75oCec7.js → theme-store-nXIuAiQZ.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CVj7aLAl.js → tracing-settings-page-CoWcr2c0.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-TWW8dGwO.js → tunnel-api-DgsELO9g.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-NgjWPD55.js → understanding-activity-store-BI_PbKCi.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CN-7T5G5.js → understanding-refresh-store-DPHzCi1Q.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-D6mzQviK.js → usage-page-BVNBJa59.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BYtW_pgF.js → use-autosave-BPDFVsgM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dn6X6xAP.js → use-composer-attachments-9nVD0sQ1.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BT0pss9g.js → use-file-preview-expanded-BhmEiOkv.js} +1 -1
- package/dist/gateway/static/root/assets/{use-generated-media-CuhMqXFp.js → use-generated-media-CLEV4wYC.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-profile-DxE21oPS.js → use-personal-profile-CFaihmiJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-j8AH0g9w.js → use-personal-work-CIZMwOlm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-CNG2yeaO.js → use-realtime-voice-CvtX2HcA.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-BohZkOOW.js → use-workspace-tree-BnvuxYD4.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Dlm-Mmo4.js → user-model-page-D4yNFvW1.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D_o-xx9v.js → voice-api-key-field-NINoxB5r.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BX2Q9Cgb.js → voice-config-api-7cvKLNoE.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-qbqLMfW_.js → voice-input-shortcut-events-DaCuiqoi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-z-upb7lD.js → voice-player-store-DipmM7w1.js} +1 -1
- package/dist/gateway/static/root/assets/voice-settings-BTvMqF_9.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-ClPiLw1F.js → work-discovery-overlay-BKdumzyK.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BohjMx1A.js → work-discovery-page-uX1VIzJY.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-CcD0smT0.js → working-directory-picker-modal-C9hWAPvW.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-_mQWmOZm.js +2 -0
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BzuNTkZu.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BjJEOajj.js → workspace-file-preview-dialog-D4Nc7XkR.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-Bc8qK8WA.js → workspace-open-location-menu-BZSS94es.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BWdmU4iy.js → xopc-cloud-account-card-xJr48TmR.js} +1 -1
- package/dist/gateway/static/root/index.html +125 -123
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +38 -2
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +6 -5
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +8 -2
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/discovery.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/mcp/connection-drafts.d.ts +1 -1
- package/dist/src/agent/mcp/connection-drafts.js +15 -2
- package/dist/src/agent/mcp/managed-discovery.js +2 -2
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service.js +5 -4
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +3 -2
- package/dist/src/agent/tools/personal-memory-tool.js +2 -2
- package/dist/src/agent/tools/personal-request-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-request-tool.js +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +44 -13
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
- package/dist/src/agent/tools/xopc-use-tool.js +3 -3
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/delivery/delivery-router.js +1 -1
- package/dist/src/automations/service/automation-service.js +1 -1
- package/dist/src/capabilities/capability-catalog.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.js +1 -1
- package/dist/src/channels/enterprise/setup.d.ts +4 -0
- package/dist/src/channels/enterprise/setup.js +3 -2
- package/dist/src/channels/plugins/types.adapters.d.ts +4 -0
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +10 -7
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
- package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +3 -1
- package/dist/src/gateway/hono/routes/mobile-capability-panels.js +144 -50
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/task-retry.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-retry.js +20 -0
- package/dist/src/gateway/hono/routes/tui.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.js +1 -1
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service.d.ts +9 -0
- package/dist/src/gateway/service.js +21 -13
- package/dist/src/local-apps/automation-proposals.js +1 -1
- package/dist/src/local-apps/capabilities/projections.d.ts +1 -1
- package/dist/src/local-apps/execution-authority.js +1 -1
- package/dist/src/local-apps/p1-services.js +2 -2
- package/dist/src/local-apps/preview-worker.js +1 -1
- package/dist/src/local-apps/service.js +3 -3
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/prompt-context.js +1 -1
- package/dist/src/personal-agent/prompts.js +2 -2
- package/dist/src/personal-agent/reply-composer.d.ts +2 -0
- package/dist/src/personal-agent/reply-composer.js +132 -82
- package/dist/src/personal-agent/reply-result.d.ts +11 -0
- package/dist/src/personal-agent/reply-result.js +60 -0
- package/dist/src/personal-agent/reply-style.d.ts +1 -1
- package/dist/src/personal-agent/reply-style.js +1 -1
- package/dist/src/personal-agent/request-access.js +1 -1
- package/dist/src/personal-agent/request-delivery.d.ts +1 -1
- package/dist/src/personal-agent/request-delivery.js +10 -9
- package/dist/src/personal-agent/request-service.d.ts +3 -1
- package/dist/src/personal-agent/request-service.js +75 -64
- package/dist/src/projects/capabilities/write.js +3 -3
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/runtime-tools/harmony-dependencies.js +5 -5
- package/dist/src/runtime-tools/hdc-files.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +2 -2
- package/dist/src/tasks/capabilities/read.js +1 -1
- package/dist/src/tasks/capabilities/relations.js +1 -1
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +3 -3
- package/dist/src/tasks/task-application-service.d.ts +8 -0
- package/dist/src/tasks/task-application-service.js +18 -7
- package/dist/src/tasks/task-context-assembler.js +2 -2
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tasks/task-execution-capabilities.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.js +2 -2
- package/dist/src/tasks/task-origin-repository.d.ts +2 -0
- package/dist/src/tasks/task-origin-repository.js +3 -2
- package/dist/src/tasks/task-read-model-projector.js +22 -8
- package/dist/src/tasks/task-research-result.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +1 -1
- package/dist/src/tasks/task-retry-policy.d.ts +5 -0
- package/dist/src/tasks/task-retry-policy.js +48 -0
- package/dist/src/tasks/task-retry-service.d.ts +18 -0
- package/dist/src/tasks/task-retry-service.js +186 -0
- package/dist/src/tasks/task-run-coordinator.js +3 -3
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tasks/task-run-repository.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +3 -3
- package/dist/src/tui/tui-capabilities.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/voice/realtime/memory-context.d.ts +1 -1
- package/dist/src/voice/realtime/memory-context.js +12 -10
- package/dist/src/voice/realtime/omniEngine.js +32 -12
- package/dist/src/voice/realtime/omniRoute.js +1 -1
- package/dist/src/voice/realtime/runtime.js +15 -11
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/capabilities-BcgSEYc5.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-CT6qMkqA.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-9lLzGQ-F.js +0 -8
- package/dist/gateway/static/root/assets/chat-page-qrdWReZ2.js +0 -72
- package/dist/gateway/static/root/assets/connected-providers-grid-ds0J-7Qc.js +0 -1
- package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DTcS5Hqk.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CwUc6499.js +0 -8
- package/dist/gateway/static/root/assets/index-BWJ0tePz.js +0 -11
- package/dist/gateway/static/root/assets/index-C-4H3NhI.css +0 -1
- package/dist/gateway/static/root/assets/markdown-view-BwbjZnQ6.js +0 -324
- package/dist/gateway/static/root/assets/markdown-view-DG8DDkEA.css +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DEz8I-eN.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-D-7a_BCN.js +0 -1
- package/dist/gateway/static/root/assets/personal-profile-settings-D1TpPIVg.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-CDjJlwol.js +0 -7
- package/dist/gateway/static/root/assets/route-preload-N7Ieq1wB.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-BvBR3khG.js +0 -2
- package/dist/gateway/static/root/assets/session-channel-icon-COynhpeK.js +0 -1
- package/dist/gateway/static/root/assets/session-identity-label-DCIZvqbN.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-BRzFtnn4.js +0 -22
- package/dist/gateway/static/root/assets/sessions-page-PjTnKj7l.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-JrndQtAT.js +0 -1
- package/dist/gateway/static/root/assets/space-page-BAp28k1I.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-15Qm8kNq.js +0 -3
- package/dist/gateway/static/root/assets/task-result-evidence-BqAt23uk.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-BEhihzNq.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-Bpq_rBZM.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BkCt8mdN.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-QUX-jyAL.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as a,l as o,n as s,o as c}from"./locale-store-5DzxIIeq.js";import{t as l}from"./messages-CGGOcV9B.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-DlirbHVs.js";import{n as g,r as _,t as v}from"./session-identity-label-DCIZvqbN.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-hRG1EzAY.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as w}from"./database-CjjeZfRG.js";import{t as T}from"./download-Dk-ZjtO6.js";import{t as E}from"./folder-open-CyzJ19I9.js";import{t as D}from"./layers-mJW7JJKm.js";import{t as O}from"./layout-grid-CEVZdVFU.js";import{t as k}from"./message-square-fVE7Ghj1.js";import{t as A}from"./minimize-2-DtOGrlpo.js";import{n as ee,t as j}from"./pin-off-BMRv-Kxr.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./search-DA7gz22f.js";import{t as P}from"./settings-uiTATseT.js";import{t as F}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as I}from"./cn-0WouolD0.js";import{t as L}from"./skeleton-DzdOeGYz.js";import{a as R,c as z,f as B,n as V,o as ne,p as re,r as ie,s as ae,t as oe}from"./session-api-CUkWJyfm.js";import{t as se}from"./session-channel-icon-COynhpeK.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-abWJ0Q_y.js";import{t as ue}from"./chat-agents-api-LVSL686y.js";import{n as de,t as U}from"./registry-api-Dw8Ou9VV.js";import{t as W}from"./button-C5tRaJxt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-DoYMKhVO.js";import{t as ge}from"./agent-avatar-display-BiHRFRo2.js";import{n as _e,r as ve}from"./segmented-styles-Cqb91xsn.js";import{n as ye,r as be,t as q}from"./settings-form-draft-Dy10ldo8.js";import{t as xe}from"./sliding-tab-list-CmcrqRzN.js";import{n as Se}from"./model-selector-DsCLjn_X.js";import{t as J}from"./settings-advanced-section-Bponzv_k.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-B8nLRdnY.js";import"./settings-page-layout-DhOLVJYv.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-BYtW_pgF.js";import{t as Oe}from"./settings-advanced-gate-JrndQtAT.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,E=n.usage,D;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==E?(D=E?.calls?E.costCompleteness===`unknown`?i.costUnknown:`${E.costCompleteness===`partial`?`≥ `:`≈ `}${Me(E.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=E,t[11]=D):D=t[11];let O=D,A=E?.calls?E.costCompleteness===`partial`?i.costPartial:E.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,M=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,N;t[12]===M?N=t[13]:(N=I(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,M),t[12]=M,t[13]=N);let P;t[14]===c?P=t[15]:(P=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=P);let te=r===`list`&&`sm:py-3`,L;t[16]===te?L=t[17]:(L=I(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=L);let R;t[18]===n?R=t[19]:(R=(0,Q.jsx)(se,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=R);let z;t[20]===h?z=t[21]:(z=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=z);let B;t[22]!==R||t[23]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[R,z]}),t[22]=R,t[23]=z,t[24]=B):B=t[24];let V;t[25]===S?V=t[26]:(V=S?(0,Q.jsx)(ee,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=V);let ne;t[27]===n.updatedAt?ne=t[28]:(ne=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=ne);let re;t[29]===ne?re=t[30]:(re=(0,Q.jsx)(`span`,{children:ne}),t[29]=ne,t[30]=re);let ie;t[31]!==V||t[32]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[V,re]}),t[31]=V,t[32]=re,t[33]=ie):ie=t[33];let ae;t[34]!==B||t[35]!==ie||t[36]!==L?(ae=(0,Q.jsxs)(`div`,{className:L,children:[B,ie]}),t[34]=B,t[35]=ie,t[36]=L,t[37]=ae):ae=t[37];let oe=r===`list`&&`sm:py-3`,ce;t[38]===oe?ce=t[39]:(ce=I(`min-w-0 flex-1 px-3 py-2`,oe),t[38]=oe,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=I(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=E?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let be;t[68]!==O||t[69]!==A?(be=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:A,children:[ye,O]}),t[68]=O,t[69]=A,t[70]=be):be=t[70];let q;t[71]!==G||t[72]!==ve||t[73]!==be?(q=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,be]}),t[71]=G,t[72]=ve,t[73]=be,t[74]=q):q=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==q||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,q,xe]}),t[77]=ce,t[78]=fe,t[79]=q,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(T,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=I(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(F,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==ae||t[119]!==Se||t[120]!==ze||t[121]!==N||t[122]!==P?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:N,onClick:c,onKeyDown:P,children:[ae,Se,ze]}),t[117]=c,t[118]=ae,t[119]=Se,t[120]=ze,t[121]=N,t[122]=P,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=I(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ye({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-48`}),(0,Q.jsx)(L,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(L,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),w=Math.min(Math.floor(Je*g.triggerThreshold),C),T=Math.min(100,w/Je*100),E=Math.min(100,C/Je*100),D=g.model?i.find(e=>e.id===g.model):void 0,O=D?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>D.contextWindow,k=g.keepRecentTokens+g.reserveTokens>w,ee=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},N={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:A,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:I(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:N[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:N[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(w)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${T}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${E}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),k?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(Se,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(ee)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:I(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ye({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(L,{className:`h-5 w-40`}),(0,Q.jsx)(L,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:w,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=w):w=t[2];let T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=I(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=T):T=t[3];let E;t[4]!==i||t[5]!==o||t[6]!==a?(E=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=E):E=t[7];let D;t[8]!==s.unnamedSession||t[9]!==i?.name?(D=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=D):D=t[10];let O;t[11]===D?O=t[12]:(O=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:D}),t[11]=D,t[12]=O);let k;t[13]!==E||t[14]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[E,O]}),t[13]=E,t[14]=O,t[15]=k):k=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=A):A=t[16];let ee;t[17]===s.close?ee=t[18]:(ee=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:A})}),t[17]=s.close,t[18]=ee);let j;t[19]!==k||t[20]!==ee?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[k,ee]}),t[19]=k,t[20]=ee,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let L;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(L=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=L):L=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==L||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,L,R]})}),t[47]=P,t[48]=F,t[49]=L,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[w,(0,Q.jsxs)(p,{className:T,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?D:P})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[w,T]=(0,Z.useReducer)(be,v,Ct),{searchInput:k,debouncedSearch:A,statusFilter:j,viewMode:M,channelFilter:P,sessions:F,loading:te,error:L,hasMore:se,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=w;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=k.trim();A!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[k,A]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...k===e?{}:{searchInput:e},...A===o?{}:{debouncedSearch:o},...j===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...P===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=A.trim();t?e.set(`q`,t):e.delete(`q`),j===`all`?e.delete(`status`):e.set(`status`,j),M===`grid`?e.delete(`view`):e.set(`view`,M),P?e.set(`channel`,P):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[A,v,b,j,M,P]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ae({limit:pt,offset:0,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,A,j,P,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ye=(0,Z.useCallback)(async()=>{if(!(!r||te||!se)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ae({limit:pt,offset:F.length,...A?{search:A}:{},...j===`all`?{}:{status:j},...P?{channel:P}:{}});T({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,te,se,F.length,A,j,P,t.loadError]),q=(0,Z.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),Se=(0,Z.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await R(e);T({type:`patch`,patch:{detailSession:t}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{Se(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await oe(e),q(e,`archived`);break;case`unarchive`:await B(e),q(e,`active`);break;case`pin`:await z(e),q(e,`pinned`);break;case`unpin`:await re(e),q(e,`active`);break;case`export`:{let t=await ie(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await V(e),T({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),ne().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:D},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:ee},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(xe,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:I(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,j===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(N,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:k,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":A||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(xe,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!P,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":P===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:I(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,P===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,L?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:L}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(xe,{className:ve,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:I(_e,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:I(_e,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),te&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(E,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:I(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":A||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),se?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:te,onClick:()=>void ye(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&T({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:I(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:I(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./settings-mode-store-BtgmaA-P.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/chat-page-qrdWReZ2.js","assets/diagnostics-Bo0Z42P_.js","assets/vendor-react-BOUWij0V.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-5DzxIIeq.js","assets/messages-CGGOcV9B.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-CDjJlwol.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-BwbjZnQ6.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-Ji4uewEG.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-HQmKv0Sm.js","assets/playback-coordinator-CWHIf0wr.js","assets/earth-C9Z4bTTG.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-CcD0smT0.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-hRG1EzAY.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/copy-Dv6d4Dvw.js","assets/database-CjjeZfRG.js","assets/ellipsis-0k4rZLoy.js","assets/file-code-corner-byQA1VfD.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/notes-api-CdC4jVPP.js","assets/chat-chart-block-Drmp5p0m.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-CuhMqXFp.js","assets/install-connector-dialog-DSkXYsng.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-DjIpuBCy.js","assets/gateway-config-swr-abWJ0Q_y.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-7i3NoKo4.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-B0Y9Frop.js","assets/registry-api-Dw8Ou9VV.js","assets/gateway-startup-retry-Cza1BaL8.js","assets/oauth-api-CAPuqZdT.js","assets/connection-usage-guide-CNB9P9jg.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-D8kxmrLV.js","assets/turn-outcome-BSbEJx8h.js","assets/attachment-utils-core-BPYdUI6y.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-Bpq_rBZM.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/share-link-dialog-kZSUpbBN.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-BIehlq7k.js","assets/specialists-xbB3xL9e.js","assets/api-CJvZsRen.js","assets/session-api-CUkWJyfm.js","assets/session-manager-BRzFtnn4.js","assets/local-session-drafts-BHrHLZJJ.js","assets/tool-activity-BtJkgjFf.js","assets/gateway-realtime-PYDAppcy.js","assets/gateway-realtime-store-DTcS5Hqk.js","assets/agents-admin-api-Crvl6IB4.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-DdxZ-1U4.js","assets/model-selector-DsCLjn_X.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-BkXqM2MT.js","assets/workspace-preview-store-QUX-jyAL.js","assets/capabilities-BcgSEYc5.js","assets/capabilities-BNmDs-Ca.js","assets/right-workspace-store-DOyKalyG.js","assets/phone-workspace-store-CDtfKAUX.js","assets/workspace-editor-agent-store-BkCt8mdN.js","assets/chat-agents-api-LVSL686y.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-Cbkv-F26.js","assets/voice-input-shortcut-events-qbqLMfW_.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-CNG2yeaO.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-Dd64p5ZI.js","assets/activity-store-9wMoZ4Ok.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-xgXJVGDC.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-htRLPCBf.js","assets/theme-store-B75oCec7.js","assets/extension-message-router-f7v82b69.js","assets/agent-avatar-display-BiHRFRo2.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-MHCmEEUZ.js","assets/shares-api-BxQqmxkq.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-Dn6X6xAP.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-BT0pss9g.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/file-preview-surface-Cwy9Cgaq.js","assets/command-palette-api-B27c_GTI.js","assets/skill-list-api-BSHfM0qb.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-2EsZ1jBs.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-_G6tIiGk.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-DqYjZFu1.js","assets/extension-iframe-host-CcspWP4N.js","assets/extension-authoritative-grants-BmlRcbhA.js","assets/runtime-health-zDkHcOZO.js","assets/api-DQVcF1zq.js","assets/terminal-panel-store-IpKmyQVN.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-BJ2cY1Us.js","assets/management-api-DHCpR1ma.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css","assets/space-workbook-7S_FfalA.js","assets/space-workbook-CvOADsEJ.css","assets/space-workbook-format-D1PqIvbd.js","assets/xlsx-Cl_0CZaL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{_ as o,d as s,f as c,m as l,p as u,t as d,u as f}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as p,l as m,n as h,o as g}from"./locale-store-5DzxIIeq.js";import{t as _}from"./archive-Dz0hferG.js";import{t as v}from"./arrow-down-to-line-C5D8Vt-L.js";import{t as y}from"./arrow-left-D880xG-P.js";import{n as b,r as x}from"./popover-select-hRG1EzAY.js";import{t as S}from"./ellipsis-0k4rZLoy.js";import{t as C}from"./file-image-CDUPkZvG.js";import{t as w}from"./file-text-D12HbeVy.js";import{t as T}from"./file-CStvVK2S.js";import{n as E,t as D}from"./table-cells-split-DpObdvTg.js";import{n as ee,t as O}from"./star-BuMAkjC9.js";import{a as te,c as k,l as A,r as j,s as M}from"./use-generated-media-CuhMqXFp.js";import{t as ne}from"./panel-right-CFGrHTsD.js";import{t as N}from"./pause-DuPxgSxk.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./plus-Q2yW6OE7.js";import{t as ae}from"./presentation-D-Ui_vVA.js";import{t as oe}from"./rotate-ccw-JM1TBLpp.js";import{t as se}from"./search-DA7gz22f.js";import{i as ce,m as le,n as ue,r as de,t as fe}from"./preview-runtime-D8kxmrLV.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as me}from"./upload-rrb46c3c.js";import{t as he}from"./x-B_N4OPjy.js";import{t as P}from"./cn-0WouolD0.js";import{t as ge}from"./skeleton-DzdOeGYz.js";import{a as _e}from"./api-CJvZsRen.js";import{a as ve}from"./session-api-CUkWJyfm.js";import{t as ye}from"./session-manager-BRzFtnn4.js";import{o as be}from"./local-session-drafts-BHrHLZJJ.js";import{l as xe,o as Se,s as F,t as Ce}from"./new-session-preferences-gb411vZP.js";import{c as we,d as Te,f as Ee,i as De,l as Oe,n as ke,p as Ae,r as je,t as Me,u as Ne}from"./space-api-BkXqM2MT.js";import{i as Pe,t as Fe}from"./vendor-swr-CdRzEUwF.js";import{t as I}from"./chat-agents-api-LVSL686y.js";import"./constants-D5Z-mUto.js";import{a as Ie,i as Le,o as Re,r as ze,s as Be}from"./dist-BSVQC3i_.js";import{i as Ve}from"./theme-store-B75oCec7.js";import{t as He}from"./page-tabs-DoYMKhVO.js";import{t as Ue}from"./page-header-store-xgXJVGDC.js";var We=e(n(),1),L=r(),R=e(t(),1),z=i();function Ge({itemId:e,version:t,hit:n,download:r}){let i=h(e=>e.language),o=Ve(e=>e.resolved),s=le(t.fileName,t.mimeType),c=s===`audio`||s===`video`,[l,u]=(0,R.useState)(null),d={id:`space:${t.id}`,context:`attachment`,source:{kind:`inline`},fileName:t.fileName,mimeType:t.mimeType,size:t.sizeBytes,type:s},f=de(d),[p,m]=(0,R.useState)({loading:!0,textContent:null,binaryBuffer:null,loadError:null}),{plugin:g,controls:_}=f,{setPage:v,pageCount:y}=_,b=typeof n?.locator.page==`number`?n.locator.page:void 0,x=typeof n?.locator.slide==`number`?n.locator.slide:void 0,S=typeof n?.locator.line==`number`?n.locator.line:void 0,C=typeof n?.locator.sheet==`string`?n.locator.sheet:void 0,w=typeof n?.locator.paragraph==`number`?n.locator.paragraph:void 0;if((0,R.useEffect)(()=>{b&&y!==null&&v(b)},[b,y,v]),(0,R.useEffect)(()=>{let n=new AbortController,r;if(!c){if(g.readMode===`metadata`){m({loading:!1,textContent:null,binaryBuffer:null,loadError:null});return}if(g.maxBytes&&t.sizeBytes>g.maxBytes){m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`文件过大,可下载查看`:`File too large to preview`});return}return we(e,t.id,n.signal).then(async e=>{let i=g.readMode===`text`?await e.text():null,o=g.readMode===`binary`?await e.arrayBuffer():null,c=s===`pptx`&&o?await a(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(o,t.fileName)),__vite__mapDeps([0,1,2,3])):void 0;n.signal.aborted||(c&&u(c.extractedText),r=g.readMode===`url`?URL.createObjectURL(new Blob([e],{type:t.mimeType})):void 0,m({loading:!1,textContent:i,binaryBuffer:o,rawUrl:r,loadError:null}))}).catch(()=>{n.signal.aborted||m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`资料暂不可读`:`Content unavailable`})}),()=>{n.abort(),r&&URL.revokeObjectURL(r)}}},[s,c,e,t.id,t.fileName,t.mimeType,t.sizeBytes,g,i]),c){let n=Oe(e,t.id);return(0,z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden bg-surface-panel p-3`,children:s===`audio`?(0,z.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`,className:`w-full`}):(0,z.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-full max-w-full rounded-lg`})})}return(0,z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[g.capabilities.some(e=>[`zoom`,`pageNavigation`,`rotate`,`search`].includes(e))?(0,z.jsx)(`div`,{className:`border-b border-edge-subtle px-2 py-1`,children:(0,z.jsx)(fe,{controller:f})}):null,(0,z.jsx)(ue,{...p,descriptor:d,language:i,resolvedTheme:o,targetLine:S,targetSlide:x,targetSheet:C,targetParagraph:w,extractedText:l,controller:f,actions:{onDownload:r,canDownload:!0}})]})}var B=`grid h-9 w-11 shrink-0 place-items-center overflow-hidden rounded-md bg-surface-inset text-fg-muted`;function Ke(e){let t=(0,L.c)(17),{kind:n,src:r}=e,i=(0,R.useRef)(null),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(!1),d,f;t[0]===n?(d=t[1],f=t[2]):(d=()=>{let e=i.current;if(n!==`video`||!e)return;let t=new IntersectionObserver(e=>{e.some(V)&&(o(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},f=[n],t[0]=n,t[1]=d,t[2]=f),(0,R.useEffect)(d,f);let p=n===`image`?C:E,m=!s&&`invisible`,h;t[3]===m?h=t[4]:(h=P(`absolute inset-0 size-full object-cover`,m),t[3]=m,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=P(B,`relative`),t[5]=_):_=t[5];let v;t[6]===p?v=t[7]:(v=(0,z.jsx)(p,{className:`size-4`}),t[6]=p,t[7]=v);let y;t[8]!==l||t[9]!==n||t[10]!==g||t[11]!==r||t[12]!==a?(y=!l&&(n===`image`?(0,z.jsx)(`img`,{src:r,width:44,height:36,loading:`lazy`,decoding:`async`,alt:``,className:g,onLoad:()=>c(!0),onError:()=>u(!0)}):a&&(0,z.jsx)(`video`,{src:`${r}#t=0.1`,muted:!0,playsInline:!0,preload:`metadata`,className:g,onLoadedData:()=>c(!0),onError:()=>u(!0)})),t[8]=l,t[9]=n,t[10]=g,t[11]=r,t[12]=a,t[13]=y):y=t[13];let b;return t[14]!==v||t[15]!==y?(b=(0,z.jsxs)(`span`,{ref:i,className:_,"aria-hidden":!0,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16],b}function V(e){return e.isIntersecting}function qe(e){let t=(0,L.c)(2),{icon:n}=e,r=n===void 0?T:n,i;return t[0]===r?i=t[1]:(i=(0,z.jsx)(`span`,{className:B,children:(0,z.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),t[0]=r,t[1]=i),i}function Je(e){let t=(0,L.c)(25),{src:n,title:r,zh:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.active?.entry.source.src===n?e.active.entry.element:null,t[0]=n,t[1]=a);let o=M(a),{playing:s,starting:c,failed:l,toggle:u}=j(o),[d,f]=(0,R.useState)(!1),p=d||l,m=s||c,h=p?oe:m?N:re,g=p?i?`重试播放`:`Retry playback`:m?i?`暂停`:`Pause`:i?`播放`:`Play`,_;t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==u?(_=function(){f(!1),o?u():te({kind:`audio`,src:n,title:r}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||f(!0)})},t[2]=o,t[3]=n,t[4]=r,t[5]=u,t[6]=_):_=t[6];let v=_,y=`${g} ${r}`,b=m&&`bg-accent-soft text-accent-fg`,x;t[7]===b?x=t[8]:(x=P(B,`hover:bg-surface-active`,b),t[7]=b,t[8]=x);let S;t[9]===h?S=t[10]:(S=(0,z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[9]=h,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,z.jsx)(`span`,{className:x,children:S}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==g||t[15]!==v||t[16]!==y||t[17]!==C?(w=(0,z.jsx)(`button`,{type:`button`,"aria-label":y,title:g,onClick:v,className:`absolute start-2 top-1/2 grid size-11 -translate-y-1/2 place-items-center rounded-md focus-visible:outline-2 focus-visible:outline-accent sm:start-3`,children:C}),t[14]=g,t[15]=v,t[16]=y,t[17]=C,t[18]=w):w=t[18];let T;t[19]!==d||t[20]!==i?(T=d?(0,z.jsx)(`span`,{role:`alert`,className:`sr-only`,children:i?`音频暂时无法播放,请重试。`:`Audio could not play. Try again.`}):null,t[19]=d,t[20]=i,t[21]=T):T=t[21];let E;return t[22]!==w||t[23]!==T?(E=(0,z.jsxs)(z.Fragment,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24],E}var Ye=e=>/\.(xlsx|csv|tsv)$/i.test(e);async function Xe(e,t){if(e.size>4*1024*1024)throw Error(`limits`);let n=await e.arrayBuffer(),r=new Worker(new URL(`/assets/space-workbook-import.worker-Bw2gfMG9.js`,``+import.meta.url),{type:`module`});try{return await new Promise((e,i)=>{let a=setTimeout(()=>i(Error(`limits`)),12e3);r.onmessage=t=>{clearTimeout(a),`workbook`in t.data?e(t.data.workbook):i(Error(t.data.error))},r.onerror=()=>{clearTimeout(a),i(Error(`unsupported`))},r.postMessage({bytes:n,fileName:t},[n])})}finally{r.terminate()}}var Ze=(0,R.lazy)(()=>a(()=>import(`./chat-page-qrdWReZ2.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([4,1,5,6,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216])));async function H(e,t,n){let r=`xopc.workbook-chat:${m.getState().baseUrl}:${e}`,i=null;try{i=localStorage.getItem(r)??sessionStorage.getItem(r)}catch{}if(i){if(await be(i))return i;try{return await ve(i),i}catch(e){if(e.status!==404)throw e}}if(t&&t!==i)return t;let a=Ce(),o=n?_e(n).catch(e=>{if(e.status!==404)throw e}):void 0,[s,c]=await Promise.all([I(),o]),{agentId:l,projectId:u}=xe({origin:`workbook`,project:c?{kind:`project`,projectId:c.id}:{kind:`none`}},{defaultAgentId:s.defaultId,selectedAgentId:s.items.find(e=>e.id===a.selectedAgentId)?.id,projectDefaultAgentId:s.items.find(e=>e.id===c?.defaultAgentId)?.id}),d=F(a,l),f=await new ye().createSession({agentId:l,projectId:u,executionMode:c?.workspaceRoot?.trim()?Se(a,c.id)??`local_checkout`:void 0,initialAgentConfig:d?{model:d.modelRef,thinkingLevel:d.thinkingLevel}:void 0});try{localStorage.setItem(r,f.key)}catch{}return f.key}function Qe({id:e,open:t,zh:n,originId:r,projectId:i,onClose:a,readSelection:o,prepareSendContext:s,onRunSettled:c}){let[l,u]=(0,R.useState)(),[d,f]=(0,R.useState)(),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(!1),[_,v]=(0,R.useState)(0),y=(0,R.useRef)(void 0),b=(0,R.useRef)(null);(0,R.useEffect)(()=>{let t=!0;return y.current??=H(e,r,i),y.current.then(e=>{t&&u(e)},()=>{t&&g(!0)}),()=>{t=!1}},[_,e,r,i]),(0,R.useEffect)(()=>{t&&b.current?.focus({preventScroll:!0})},[t]);async function x(){m(!0);try{let e=await o();e&&f(ce(e))}finally{m(!1)}}let S=(0,z.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,z.jsx)(ge,{className:`h-5 w-1/2`}),(0,z.jsx)(ge,{className:`h-16 w-full rounded-xl`})]});return(0,z.jsxs)(`aside`,{id:`workbook-chat`,"data-workbook-chat":!0,"aria-labelledby":`workbook-chat-heading`,className:P(`file-preview-surface absolute inset-y-0 end-0 z-30 min-h-0 w-[min(26rem,calc(100%-1rem))] shrink-0 flex-col overflow-hidden border-s border-edge shadow-popover @min-[48rem]/space:relative @min-[48rem]/space:w-[clamp(22rem,36%,31rem)] @min-[48rem]/space:shadow-none`,t?`flex`:`hidden`),onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),a())},children:[(0,z.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-3 py-2`,children:[(0,z.jsx)(`h2`,{id:`workbook-chat-heading`,ref:b,tabIndex:-1,className:`text-sm font-semibold text-fg outline-none`,children:n?`工作簿对话`:`Workbook chat`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsxs)(`button`,{type:`button`,disabled:!l||p,onClick:()=>void x(),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,z.jsx)(D,{className:`size-4`,"aria-hidden":!0}),n?`添加选区`:`Add selection`]}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:a,"aria-label":n?`收起工作簿对话`:`Close workbook chat`,children:(0,z.jsx)(he,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:l?(0,z.jsx)(R.Suspense,{fallback:S,children:(0,z.jsx)(Ze,{embedded:!0,conversationId:l,prepareSendContext:s,onRunSettled:c,embeddedAttachmentHandoffId:t?d:void 0,composerPlaceholder:n?`提问,或说明想怎么改这份工作簿…`:`Ask a question or describe a change…`})}):h?(0,z.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm text-fg-muted`,children:[(0,z.jsx)(`p`,{children:n?`暂时无法打开对话。`:`Could not open the chat.`}),(0,z.jsx)(`button`,{type:`button`,className:`mt-2 rounded-lg px-2 py-1 text-accent-fg hover:bg-accent-soft`,onClick:()=>{y.current=void 0,g(!1),v(e=>e+1)},children:n?`重试`:`Retry`})]}):S})]})}function $e(e){let t=(0,L.c)(4),{items:n}=e,r;t[0]===n?r=t[1]:(r=n.map(U),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,z.jsx)(`ul`,{className:`space-y-1`,children:r}),t[2]=r,t[3]=i),i}function U(e){return(0,z.jsxs)(`li`,{className:`grid grid-cols-[minmax(7rem,1fr)_2fr] gap-2 text-xs`,children:[(0,z.jsxs)(`span`,{className:`truncate font-medium`,title:`${e.sheetName}!${e.cell}`,children:[e.sheetName,`!`,e.cell]}),(0,z.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,z.jsx)(`span`,{className:`text-fg-muted`,children:e.beforeFormula??String(e.before??`—`)}),(0,z.jsx)(`span`,{"aria-hidden":!0,children:` → `}),e.afterFormula??String(e.after??`—`)]})]},`${e.sheetId}:${e.cell}`)}function et({id:e,versionId:t,proposalId:n,undo:r,zh:i,onClose:a,onComplete:o}){let[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=Pe(n?[`workbook-proposal`,e,n]:null,()=>De(e,n),{shouldRetryOnError:!1}),f=!!d.data?.appliedVersionId;async function p(){c(!0),u(``);try{d.data?await Ee(e,{action:`apply`,proposalId:d.data.proposalId}):r&&await Ee(e,{action:`undo`,versionId:t,sourceVersionId:r}),o()}catch(e){u(e?.status===409?i?`工作簿已有更新,请在最新版本重新检查。`:`The workbook has changed. Review the latest version and try again.`:i?`操作未完成,请重试。`:`Could not complete the action. Try again.`)}finally{c(!1)}}return(0,z.jsxs)(`section`,{"aria-label":i?`工作簿修改`:`Workbook changes`,className:`max-h-[38%] shrink-0 overflow-y-auto border-b border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`h3`,{className:`me-auto text-sm font-semibold`,children:r?i?`撤销这次修改`:`Undo this change`:f?i?`本次已保存的修改`:`Saved changes`:i?`审阅修改`:`Review changes`}),(0,z.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-8 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,children:i?`关闭`:`Close`}),r||d.data&&!f?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void p(),disabled:s,className:`min-h-8 rounded-lg bg-accent px-2.5 text-xs font-medium text-on-accent hover:bg-accent-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:r?i?`撤销修改`:`Undo change`:i?`应用并保存新版本`:`Apply and save a new version`}):null]}),r?(0,z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`恢复修改前的内容,并保留两个历史版本。`:`Restore the previous contents and keep both versions in history.`}):null,d.isLoading?(0,z.jsx)(ge,{className:`mt-2 h-8`}):null,d.data?(0,z.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,z.jsx)($e,{items:d.data.changes}),d.data.effects.length?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{className:`text-xs text-fg-muted`,children:i?`公式重算结果`:`Recalculated results`}),(0,z.jsx)($e,{items:d.data.effects})]}):null]}):null,l||d.error?(0,z.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:l||(i?`该建议已过期或不可用。`:`This proposal has expired or is unavailable.`)}):null]})}var tt=(0,R.lazy)(()=>a(()=>import(`./space-workbook-7S_FfalA.js`),__vite__mapDeps([217,1,6,2,7,11,12,10,75,13,33,64,32,151,8,9,36,67,68,176,159,218]))),nt={document:w,pdf:w,spreadsheet:k,presentation:ae,audio:A,archive:_},W=`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,rt=`block w-full rounded-lg px-3 py-2 text-start text-sm hover:bg-surface-hover`,it=`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover disabled:opacity-50`,at=`grid grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-2 sm:px-3 @xl/list:grid-cols-[minmax(0,1fr)_4.5rem_minmax(0,0.55fr)_6.5rem] @xl/list:gap-4`,G=38,K=30,q=72,ot=`xopc.space.previewWidth`;function st(){try{let e=Number(window.localStorage.getItem(ot));if(e>=K&&e<=q)return e}catch{}return G}function J(e){try{window.localStorage.setItem(ot,String(e))}catch{}}function ct(e){let t=e.get(`view`);return t===`favorites`||t===`trash`?t:`all`}function lt(e){let t=(0,L.c)(33),{zh:n,width:r,onResize:i}=e,a=(0,R.useRef)(null),[o,s]=(0,R.useState)(!1),c;t[0]===i?c=t[1]:(c=function(e){let t=Math.max(K,Math.min(q,e));return i(t),t},t[0]=i,t[1]=c);let l=c,u=n?`调整资料预览宽度`:`Resize file preview`,d;t[2]===r?d=t[3]:(d=Math.round(r),t[2]=r,t[3]=d);let f=n?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,p=o&&`bg-accent-soft/40`,m;t[4]===p?m=t[5]:(m=P(`group absolute inset-y-0 start-0 z-20 hidden w-3 -translate-x-1/2 cursor-col-resize touch-none select-none items-center justify-center rounded-sm focus-visible:outline-2 focus-visible:outline-accent @min-[58rem]/space:flex`,p),t[4]=p,t[5]=m);let h;t[6]===r?h=t[7]:(h=e=>{if(e.button!==0||a.current)return;let t=e.currentTarget,n=t.closest(`[data-space-preview-host]`)?.parentElement?.clientWidth;n&&(e.preventDefault(),t.setPointerCapture(e.pointerId),a.current={id:e.pointerId,startX:e.clientX,startWidth:r,availableWidth:n,currentWidth:r},s(!0))},t[6]=r,t[7]=h);let g;t[8]===l?g=t[9]:(g=e=>{let t=a.current;t?.id===e.pointerId&&(t.currentWidth=l(t.startWidth+(t.startX-e.clientX)*100/t.availableWidth))},t[8]=l,t[9]=g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a.current?.id===e.pointerId&&(J(a.current.currentWidth),a.current=null,s(!1))},t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=()=>J(l(G)),t[11]=l,t[12]=v);let y;t[13]!==l||t[14]!==r?(y=e=>{let t={ArrowLeft:r+2,ArrowRight:r-2,Home:K,End:q};Object.hasOwn(t,e.key)&&(e.preventDefault(),J(l(t[e.key])))},t[13]=l,t[14]=r,t[15]=y):y=t[15];let b=o&&`bg-accent`,x;t[16]===b?x=t[17]:(x=P(`h-10 w-0.5 rounded-full bg-edge group-hover:bg-accent group-focus-visible:bg-accent`,b),t[16]=b,t[17]=x);let S;t[18]===x?S=t[19]:(S=(0,z.jsx)(`span`,{"aria-hidden":!0,className:x}),t[18]=x,t[19]=S);let C;t[20]===o?C=t[21]:(C=o?(0,z.jsx)(`span`,{"aria-hidden":!0,className:`fixed inset-0 z-50 cursor-col-resize`}):null,t[20]=o,t[21]=C);let w;return t[22]!==v||t[23]!==y||t[24]!==S||t[25]!==C||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==m||t[30]!==h||t[31]!==g?(w=(0,z.jsxs)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-controls":`space-file-preview`,"aria-valuemin":K,"aria-valuemax":q,"aria-valuenow":d,tabIndex:0,title:f,className:m,onPointerDown:h,onPointerMove:g,onLostPointerCapture:_,onDoubleClick:v,onKeyDown:y,children:[S,C]}),t[22]=v,t[23]=y,t[24]=S,t[25]=C,t[26]=u,t[27]=d,t[28]=f,t[29]=m,t[30]=h,t[31]=g,t[32]=w):w=t[32],w}function ut(e){return e?.available?e.kind===`task`&&e.taskId?`/tasks/${encodeURIComponent(e.taskId)}`:e.kind===`automation`&&e.automationRunId?`/automations?view=execution&run=${encodeURIComponent(e.automationRunId)}`:`/chat/${encodeURIComponent(e.conversationId)}`:null}function dt(e){let t=(0,L.c)(20),{text:n,query:r}=e,i,a,o,s,c;if(t[0]!==r||t[1]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r?n.toLowerCase().indexOf(r.toLowerCase()):-1;if(e<0){let e;t[7]===n?e=t[8]:(e=(0,z.jsx)(z.Fragment,{children:n}),t[7]=n,t[8]=e),c=e;break bb0}i=e+r.length,s=e>40?`…${n.slice(e-40,e)}`:n.slice(0,e),a=`rounded-sm bg-accent-soft text-accent-fg`,o=n.slice(e,i)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[9]!==a||t[10]!==o?(l=(0,z.jsx)(`mark`,{className:a,children:o}),t[9]=a,t[10]=o,t[11]=l):l=t[11];let u;t[12]!==i||t[13]!==n?(u=n.slice(i,i+100),t[12]=i,t[13]=n,t[14]=u):u=t[14];let d=i+100<n.length?`…`:``,f;return t[15]!==s||t[16]!==l||t[17]!==u||t[18]!==d?(f=(0,z.jsxs)(z.Fragment,{children:[s,l,u,d]}),t[15]=s,t[16]=l,t[17]=u,t[18]=d,t[19]=f):f=t[19],f}function Y(e){let t=(0,L.c)(22),{zh:n}=e,[r,i]=o(),a=u(),s=(0,R.useRef)(null),c;t[0]===r?c=t[1]:(c=(r.get(`q`)??``).slice(0,160),t[0]=r,t[1]=c);let l=c,d=n?`搜索资料`:`Search files`,f,p;t[2]!==a||t[3]!==l?(f=()=>{let e=s.current;e&&(document.activeElement!==e||a===`POP`)&&(e.value=l)},p=[a,l],t[2]=a,t[3]=l,t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,R.useLayoutEffect)(f,p);let m;t[6]===i?m=t[7]:(m=function(e){i(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0})},t[6]=i,t[7]=m);let h=m,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(se,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=e=>h(e.target.value),t[9]=h,t[10]=_);let v;t[11]!==d||t[12]!==l||t[13]!==_?(v=(0,z.jsx)(`input`,{ref:s,defaultValue:l,maxLength:160,onChange:_,"aria-label":d,placeholder:d,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none`}),t[11]=d,t[12]=l,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==l||t[17]!==n?(y=l?(0,z.jsx)(`button`,{type:`button`,className:P(W,`size-6`),onClick:()=>{h(``),s.current&&(s.current.value=``,s.current.focus())},"aria-label":n?`清除搜索`:`Clear search`,children:(0,z.jsx)(he,{className:`size-4`})}):null,t[15]=h,t[16]=l,t[17]=n,t[18]=y):y=t[18];let b;return t[19]!==v||t[20]!==y?(b=(0,z.jsxs)(`div`,{role:`search`,className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge-subtle bg-surface-inset px-2.5 focus-within:ring-2 focus-within:ring-accent @min-[40rem]/space-list:w-[clamp(7rem,24cqw,18rem)]`,children:[g,v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function ft(e){let t=(0,L.c)(44),{zh:n}=e,[r,i]=o(),a=n?`文档`:`Documents`,s;t[0]===a?s=t[1]:(s=[`document`,a],t[0]=a,t[1]=s);let c=n?`表格`:`Spreadsheets`,l;t[2]===c?l=t[3]:(l=[`spreadsheet`,c],t[2]=c,t[3]=l);let u=n?`演示`:`Slides`,d;t[4]===u?d=t[5]:(d=[`presentation`,u],t[4]=u,t[5]=d);let f=n?`图片`:`Images`,p;t[6]===f?p=t[7]:(p=[`image`,f],t[6]=f,t[7]=p);let m=n?`音频`:`Audio`,h;t[8]===m?h=t[9]:(h=[`audio`,m],t[8]=m,t[9]=h);let g=n?`视频`:`Video`,_;t[10]===g?_=t[11]:(_=[`video`,g],t[10]=g,t[11]=_);let v=n?`压缩包`:`Archives`,y;t[12]===v?y=t[13]:(y=[`archive`,v],t[12]=v,t[13]=y);let S=n?`文件`:`Files`,C;t[14]===S?C=t[15]:(C=[`file`,S],t[14]=S,t[15]=C);let w;t[16]!==h||t[17]!==_||t[18]!==y||t[19]!==C||t[20]!==s||t[21]!==l||t[22]!==d||t[23]!==p?(w=[s,l,d,p,h,_,y,C],t[16]=h,t[17]=_,t[18]=y,t[19]=C,t[20]=s,t[21]=l,t[22]=d,t[23]=p,t[24]=w):w=t[24];let T=w,E;t[25]===n?E=t[26]:(E=(0,z.jsx)(Y,{zh:n}),t[25]=n,t[26]=E);let D;t[27]===r?D=t[28]:(D=r.get(`kind`)??`all`,t[27]=r,t[28]=D);let ee=n?`资料类型`:`File type`,O;t[29]===i?O=t[30]:(O=e=>i(t=>{let n=new URLSearchParams(t);return e.target.value===`all`?n.delete(`kind`):n.set(`kind`,e.target.value),n}),t[29]=i,t[30]=O);let te=n?`全部类型`:`All types`,k;t[31]===te?k=t[32]:(k=(0,z.jsx)(x,{value:`all`,children:te}),t[31]=te,t[32]=k);let A;t[33]===T?A=t[34]:(A=T.map(X),t[33]=T,t[34]=A);let j;t[35]!==D||t[36]!==ee||t[37]!==O||t[38]!==k||t[39]!==A?(j=(0,z.jsxs)(b,{value:D,align:`end`,"aria-label":ee,triggerClassName:`h-9 shrink-0`,onChange:O,children:[k,A]}),t[35]=D,t[36]=ee,t[37]=O,t[38]=k,t[39]=A,t[40]=j):j=t[40];let M;return t[41]!==E||t[42]!==j?(M=(0,z.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2`,children:[E,j]}),t[41]=E,t[42]=j,t[43]=M):M=t[43],M}function X(e){let[t,n]=e;return(0,z.jsx)(x,{value:t,children:n},t)}function pt(e){let t=(0,L.c)(25),{zh:n,onViewChange:r}=e,[i,a]=o(),s=n?`全部资料`:`All files`,c;t[0]===s?c=t[1]:(c={id:`all`,label:s,icon:ee},t[0]=s,t[1]=c);let l=n?`收藏`:`Favorites`,u;t[2]===l?u=t[3]:(u={id:`favorites`,label:l,icon:O},t[2]=l,t[3]=u);let d=n?`回收站`:`Trash`,f;t[4]===d?f=t[5]:(f={id:`trash`,label:d,icon:pe},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h;t[10]!==r||t[11]!==a?(h=function(e){r(),a(t=>{let n=new URLSearchParams(t);for(let e of[`view`,`item`,`version`,`q`,`kind`])n.delete(e);return e!==`all`&&n.set(`view`,e),n})},t[10]=r,t[11]=a,t[12]=h):h=t[12];let g=h,_=n?`资料库`:`Space`,v;t[13]===_?v=t[14]:(v=(0,z.jsx)(`h1`,{className:`sr-only`,children:_}),t[13]=_,t[14]=v);let y;t[15]===i?y=t[16]:(y=ct(i),t[15]=i,t[16]=y);let b=n?`资料范围`:`Library views`,x;t[17]!==g||t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,z.jsx)(He,{items:m,activeTab:y,onChange:g,ariaLabel:b,tabIdPrefix:`space-tab`,panelIdPrefix:`space-list`,className:`pb-0 [scrollbar-width:none]`,buttonClassName:`h-9 py-1.5`,scrollActiveIntoView:!0}),t[17]=g,t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==v||t[23]!==x?(S=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[v,x]}),t[22]=v,t[23]=x,t[24]=S):S=t[24],S}function Z(){let e=h(e=>e.language)===`zh`,t=Ue(e=>e.setPageHeader),n=Ue(e=>e.clearPageHeader),r=c(),i=s(),[u,m]=o(),_=l(),C=u.get(`version`),w=u.get(`sheet`)??void 0,T=u.get(`range`)??void 0,E=u.get(`proposal`)??void 0,D=u.get(`undo`)??void 0,[ee,te]=(0,R.useState)(st),[k,A]=(0,R.useState)(!1),[j,M]=(0,R.useState)(!1),[N,re]=(0,R.useState)(!1),[ae,oe]=(0,R.useState)(``),[se,le]=(0,R.useState)(),[ue,de]=(0,R.useState)(),[fe,pe]=(0,R.useState)(),[_e,ve]=(0,R.useState)(),ye=(0,R.useRef)(new Map),be=(0,R.useRef)(null),xe=(0,R.useRef)(null),Se=(0,R.useRef)(null),F=(0,R.useRef)(null),Ce=(0,R.useRef)(null),Ee=(0,R.useRef)(null),De=(0,R.useRef)(null),I=ct(u),Ve=(u.get(`q`)??``).slice(0,160),He=(0,R.useDeferredValue)(Ve),L=u.get(`item`),B=(0,R.useRef)(L);(0,R.useLayoutEffect)(()=>{B.current!==L&&(B.current=L,le(void 0),de(void 0),pe(void 0))},[L]);let V=f(({currentLocation:e,nextLocation:t})=>{if(!F.current?.hasChanges())return!1;if(e.pathname!==t.pathname)return!0;let n=new URLSearchParams(e.search),r=new URLSearchParams(t.search);return n.get(`item`)===r.get(`item`)?!r.has(`version`)&&Z?!1:n.get(`version`)!==r.get(`version`):!0});(0,R.useEffect)(()=>{if(V.state!==`blocked`)return;let e=!0;return(async()=>{let t=F.current,n=await t?.flushSave();e&&(!t||n?V.proceed():V.reset())})(),()=>{e=!1}},[V]);let Ze=u.get(`kind`),H=u.get(`taskId`)?`taskId`:u.get(`projectId`)?`projectId`:void 0,$e=(0,R.useCallback)(()=>{ve(void 0),oe(``),A(!1),M(!1)},[]);(0,R.useLayoutEffect)(()=>(t({startExtra:null,main:(0,z.jsx)(pt,{zh:e,onViewChange:$e}),end:(0,z.jsx)(ft,{zh:e}),className:`@max-[40rem]/space-list:h-auto @max-[40rem]/space-list:min-h-14 @max-[40rem]/space-list:gap-y-2 @max-[40rem]/space-list:py-2 @max-[40rem]/space-list:[&>:last-child]:col-span-full`}),n),[n,$e,t,e]),(0,R.useLayoutEffect)(()=>{Ee.current&&(Ee.current.scrollTop=0)},[I]);let U=Fe((e,t)=>{if(e&&!t?.nextCursor)return null;let n=new URLSearchParams({view:I,q:He});return Ze&&n.set(`kind`,Ze),H&&n.set(H,u.get(H)),e&&t?.nextCursor&&n.set(`cursor`,t.nextCursor),`${Te}?${n}`},je,{refreshInterval:4e3}),G=Pe(L?Ne(L):null,ke,{refreshInterval:e=>e?.currentVersion.mimeType===`application/vnd.xopc.univer-workbook+json`?0:4e3,revalidateOnFocus:!1}),K=U.data?.flatMap(e=>e.items)??[],q=G.data,ot=!!(C&&(w||E||D)),J=q&&se?.itemId===q.id&&se.versions.includes(q.currentVersion.id)?se:void 0,Y=J?.locationKey===i.key?q?.currentVersion:q?.versions.find(e=>e.id===C)??(ot?void 0:q?.currentVersion),X=Y?.mimeType===Ae,Z=X&&Y.id===q?.currentVersion.id,mt=Z&&J?J.seed:Y?.id;(0,R.useEffect)(()=>{if(V.state!==`unblocked`||!C||C===Y?.id||J?.locationKey!==i.key)return;let e=new URLSearchParams(u);e.delete(`version`),m(e,{replace:!0})},[i.key,V.state,J,u,C,m,Y?.id]);let ht=Y?.id===q?.currentVersion.id?K.find(e=>e.id===L)?.hit:void 0,Q=q?.origins.find(e=>e.versionId===Y?.id&&e.available)??q?.origins.find(e=>e.available)??q?.origin,gt=ut(Q),_t=Q?.projectId??q?.origins.find(e=>e.projectId)?.projectId,vt=ue?.itemId===q?.id&&!!ue?.open,yt=fe?.itemId===q?.id&&fe?.versionId!==q?.currentVersion.id,bt=!!(q&&C&&!q.versions.some(e=>e.id===C)),xt=G.mutate,St=(0,R.useCallback)(()=>F.current?.prepareChatContext()??Promise.resolve(null),[]),Ct=(0,R.useCallback)(async()=>F.current?.readSelection(),[]),wt=(0,R.useCallback)((e,t)=>{if(B.current===e.id)return xt(n=>!n||n.revision>e.revision?n:n.currentVersion.id!==e.currentVersion.id&&e.currentVersion.id!==t&&F.current?.hasChanges()?(pe({itemId:e.id,versionId:e.currentVersion.id}),{...n,title:e.title,favorite:e.favorite,revision:e.revision}):(pe(void 0),e),{revalidate:!1})},[xt]),Tt=(0,R.useCallback)(async()=>{L&&(await wt(await ke(Ne(L))),U.mutate())},[wt,U.mutate,L]),Et=(0,R.useCallback)(()=>{Tt().catch(()=>{})},[Tt]);(0,R.useEffect)(()=>{bt&&Tt().catch(()=>{})},[bt,Tt,C]);function Dt(){de(e=>e&&{...e,open:!1}),requestAnimationFrame(()=>Se.current?.focus({preventScroll:!0}))}function $(e){m(t=>{let n=new URLSearchParams(t);for(let[t,r]of Object.entries(e))r?n.set(t,r):n.delete(t);return n})}function Ot(e){A(!1),M(!1),oe(``),$({item:e,version:null,sheet:null,range:null,proposal:null,undo:null})}function kt(){Ot(null),L&&requestAnimationFrame(()=>ye.current.get(L)?.focus())}(0,R.useLayoutEffect)(()=>{L&&Ce.current&&getComputedStyle(Ce.current).visibility===`hidden`&&be.current?.focus({preventScroll:!0})},[_,L]),(0,R.useEffect)(()=>{if(!L)return;let e=e=>{if(!(e.key!==`Escape`||e.defaultPrevented)&&!(e.target instanceof Element&&e.target.closest(`[data-space-workbook], [data-workbook-chat]`))){if(k||j){A(!1),M(!1);return}m(e=>{let t=new URLSearchParams(e);return t.delete(`item`),t.delete(`version`),t}),requestAnimationFrame(()=>ye.current.get(L)?.focus())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[j,k,L,m]);function At(e,t){if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=K[t+(e.key===`ArrowDown`?1:-1)];n&&ye.current.get(n.id)?.focus()}async function jt(t){if(!N){re(!0),oe(``);try{await t()}catch{oe(e?`操作未完成,请重试`:`Could not complete the action. Try again.`),X?Tt().catch(()=>{}):G.mutate()}finally{re(!1)}}}function Mt(e,t,n,r){return jt(async()=>{let i=Ne(t.id),a=e===`restore`||e===`purge`?`/${e}`:``,o=t.revision,s=F.current;if(s&&Z&&L===t.id&&(e===`patch`||e===`trash`)){let e=await s.flushSave();if(!e)return;e!==Y.id&&(o=(await ke(i)).revision)}let c=await g(p(i+a),{method:e===`patch`?`PATCH`:e===`trash`?`DELETE`:`POST`,body:JSON.stringify({revision:o,...n})});e===`trash`&&ve({id:t.id,revision:o+1}),(e===`restore`||e===`purge`)&&ve(void 0),e===`patch`?B.current===t.id&&(A(!1),X?(await wt(c),r?.()):await G.mutate()):L===t.id&&Ot(null),await U.mutate()})}async function Nt(){!q||!Y||await jt(async()=>{let e=F.current,t=Z&&e?await e.flushSave():Y.id;if(!t)return;let n=await we(q.id,t),r=X?`${q.title.replace(/[\\/\x00-\x1f]/g,`_`)}.xlsx`:Y.fileName,i=X?new Blob([await a(()=>import(`./space-workbook-format-D1PqIvbd.js`).then(e=>n.text().then(t=>e.writeWorkbook(JSON.parse(t)))),__vite__mapDeps([219,220]))],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}):n,o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)})}function Pt(){!q||!Y||jt(async()=>{let e=await we(q.id,Y.id);if(e.size>33554432)throw Error(`Attachment too large`);let t=new globalThis.File([e],Y.fileName,{type:Y.mimeType}),n=new URLSearchParams({attachmentHandoff:ce(t)});Q?.projectId&&Q.available&&n.set(`projectId`,Q.projectId),r({pathname:`/chat/new`,search:`?${n}`},{state:{forceNewChat:!0}})})}function Ft(e){A(!1),$({item:e,version:null,sheet:null,range:null,proposal:null,undo:null,view:null,q:null,kind:null,projectId:null,taskId:null}),U.mutate()}function It(){jt(async()=>{let t=e?`未命名工作簿`:`Untitled workbook`,{blankWorkbook:n}=await a(async()=>{let{blankWorkbook:e}=await import(`./space-workbook-format-D1PqIvbd.js`);return{blankWorkbook:e}},__vite__mapDeps([219,220])),{id:r}=await Me(crypto.randomUUID(),t,n(t,e?`工作表 1`:`Sheet 1`));Ft(r)})}function Lt(t,n,r){jt(async()=>{try{let i=await Xe(await n(),t),a=i.name||(e?`导入的工作簿`:`Imported workbook`),{id:o}=await Me(crypto.randomUUID(),a,i,r);Ft(o)}catch(t){let n=t instanceof Error?t.message:``;oe(n===`limits`||t?.status===413?e?`表格过大。可先拆分数据,再分别导入。`:`This workbook is too large. Split the data into smaller files and try again.`:n===`array-formula`||n===`linked-formula`?e?`这份表格包含暂不支持转换的公式,可以继续预览原文件。`:`This workbook contains formulas that cannot be converted. You can still preview the original.`:e?`无法导入表格,请检查文件后重试。`:`Could not import this workbook. Check the file and try again.`)}})}function Rt(e){if(e.preventDefault(),!q)return;let t=String(new FormData(e.currentTarget).get(`title`)??``).trim();t&&(t===q.title?Bt():Mt(`patch`,q,{title:t}))}function zt(){requestAnimationFrame(()=>{document.activeElement===document.body&&xe.current?.focus({preventScroll:!0})})}function Bt(e=!0){A(!1),X&&e&&zt()}function Vt(e,t){if(!q||N)return;let n=e.trim();!n||n===q.title?Bt(t):Mt(`patch`,q,{title:n},t?zt:void 0)}let Ht=new Intl.DateTimeFormat(e?`zh-CN`:`en`,{month:`short`,day:`numeric`}),Ut=e=>Ht.format(e),Wt=q&&Y&&q.versions.length>1?(0,z.jsx)(b,{value:Y.id,"aria-label":e?X?`工作簿版本`:`资料版本`:X?`Workbook version`:`File version`,className:X?`max-w-32 shrink-0`:void 0,triggerClassName:X?`h-8 px-2 text-xs`:void 0,onChange:e=>{let t=e.target.value;t!==Y.id&&$({version:t===q.currentVersion.id?null:t,sheet:null,range:null,proposal:null,undo:null})},children:q.versions.map((t,n)=>(0,z.jsxs)(x,{value:t.id,children:[t.id===q.currentVersion.id?e?`最新版`:`Latest`:Ut(t.createdAt),` · v`,q.versions.length-n]},t.id))}):null,Gt=t=>t.origin?.label??(t.origin?.kind===`task`?e?`任务`:`Task`:t.origin?.kind===`automation`?e?`定时任务`:`Automation`:e?`对话`:`Chat`),Kt=ae||_e?(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge-subtle bg-surface-panel px-3 py-2 text-sm`,role:`status`,children:[(0,z.jsx)(`span`,{children:ae||(e?`已移到回收站`:`Moved to Trash`)}),_e?(0,z.jsx)(`button`,{type:`button`,disabled:N,className:`rounded-lg p-1 text-accent-fg`,onClick:()=>void Mt(`restore`,_e),children:e?`撤销`:`Undo`}):null]}):null;return(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,z.jsx)(`div`,{className:`mx-auto flex w-full max-w-[74rem] min-h-0 flex-1 px-3 pt-3 sm:px-5 sm:pt-5 @min-[58rem]/space:px-6`,children:(0,z.jsxs)(`section`,{ref:Ce,id:`space-list-${I}`,role:`tabpanel`,"aria-labelledby":`space-tab-${I}`,className:`@container/list flex min-w-0 flex-1 flex-col`,children:[I===`all`&&!H&&(!Ze||Ze===`spreadsheet`)?(0,z.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap justify-end gap-2`,children:[(0,z.jsx)(`input`,{ref:De,type:`file`,className:`hidden`,accept:`.xlsx,.csv,.tsv`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&Lt(t.name,async()=>t)}}),(0,z.jsxs)(`button`,{type:`button`,disabled:N,onClick:()=>De.current?.click(),title:e?`导入 XLSX、CSV 或 TSV 的数据、公式与基础布局`:`Import data, formulas and basic layout from XLSX, CSV or TSV`,className:`inline-flex min-h-10 items-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:[(0,z.jsx)(me,{className:`size-4`,"aria-hidden":!0}),e?`导入表格`:`Import workbook`]}),(0,z.jsxs)(`button`,{type:`button`,disabled:N,onClick:It,className:P(it,`inline-flex min-h-10 items-center gap-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`),children:[(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),e?`新建表格`:`New workbook`]})]}):null,H?(0,z.jsx)(`div`,{className:`mb-3 flex shrink-0 justify-end`,children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$({[H]:null}),className:`inline-flex min-h-9 items-center gap-1 rounded-lg bg-surface-inset px-2 py-1 text-sm text-fg-muted hover:bg-surface-hover`,children:[H===`projectId`?e?`当前项目`:`Project`:e?`当前任务`:`Task`,(0,z.jsx)(he,{className:`size-3.5`})]})}):null,(0,z.jsxs)(`div`,{ref:Ee,className:`min-h-0 flex-1 overflow-y-auto pb-5`,children:[U.isLoading?(0,z.jsx)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:Array.from({length:5},(e,t)=>(0,z.jsx)(ge,{className:`h-14 w-full rounded-xl`},t))}):null,U.error?(0,z.jsx)(`button`,{className:`rounded-lg py-3 text-sm text-accent-fg`,onClick:()=>void U.mutate(),children:e?`加载失败,重试`:`Could not load. Retry`}):null,!U.isLoading&&!U.error&&K.length===0?(0,z.jsx)(`p`,{className:`py-10 text-center text-sm text-fg-muted`,children:Ve?e?`没有匹配的资料`:`No matching results`:I===`favorites`?e?`暂无收藏`:`No favorites`:I===`trash`?e?`回收站为空`:`Trash is empty`:e?`暂无资料`:`No results yet`}):null,K.length>0?(0,z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-edge-subtle`,children:[(0,z.jsxs)(`div`,{className:P(at,`min-h-10 border-b border-edge-subtle bg-surface-inset text-xs font-medium text-fg-muted`),children:[(0,z.jsx)(`span`,{children:e?`名称`:`Name`}),(0,z.jsx)(`span`,{className:`hidden @xl/list:block`,children:e?`格式`:`Format`}),(0,z.jsx)(`span`,{className:`hidden @xl/list:block`,children:e?`来源`:`Source`}),(0,z.jsx)(`span`,{className:`min-w-[5rem] text-end`,children:e?`更新日期`:`Updated`})]}),(0,z.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:K.map((t,n)=>{let r=nt[t.kind],i=t.currentVersion,a=i.mimeType===`application/vnd.xopc.univer-workbook+json`?`XLSX`:/\.([a-z\d]{1,12})$/i.exec(i.fileName)?.[1]?.toUpperCase(),o=Oe(t.id,i.id),s=t.kind===`audio`&&I!==`trash`,c=t.origin?Gt(t):null;return(0,z.jsxs)(`li`,{className:`relative [contain-intrinsic-size:auto_55px] [content-visibility:auto]`,children:[(0,z.jsxs)(`button`,{type:`button`,title:t.title,ref:e=>{e?ye.current.set(t.id,e):ye.current.delete(t.id)},onKeyDown:e=>At(e,n),"aria-pressed":L===t.id,onClick:()=>Ot(t.id),className:P(at,`min-h-[54px] w-full py-1.5 text-start focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,L===t.id?`bg-accent-soft`:`hover:bg-surface-hover`),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5 sm:gap-3`,children:[s?(0,z.jsx)(`span`,{className:`w-11 shrink-0`,"aria-hidden":!0}):t.kind===`image`||t.kind===`video`?(0,z.jsx)(Ke,{kind:t.kind,src:o},i.id):(0,z.jsx)(qe,{icon:r}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:(0,z.jsx)(dt,{text:t.title,query:He.trim()})}),a||c?(0,z.jsxs)(`span`,{className:`block truncate text-xs text-fg-muted @xl/list:hidden`,children:[a,a&&c?` · `:null,c]}):null,t.hit?(0,z.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:(0,z.jsx)(dt,{text:t.hit.text,query:He.trim()})}):null]})]}),(0,z.jsx)(`span`,{className:`hidden @xl/list:block`,children:a?(0,z.jsx)(`span`,{className:`inline-block max-w-full truncate rounded bg-surface-inset px-1.5 py-0.5 align-middle text-xs font-medium text-fg-muted`,children:a}):(0,z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`—`})}),(0,z.jsx)(`span`,{className:`hidden truncate text-sm text-fg-muted @xl/list:block`,children:c??`—`}),(0,z.jsx)(`time`,{className:`min-w-[5rem] text-end text-xs whitespace-nowrap tabular-nums text-fg-muted`,children:Ut(t.updatedAt)})]}),s?(0,z.jsx)(Je,{src:o,title:t.title,zh:e},i.id):null]},t.id)})})]}):null,U.data?.at(-1)?.nextCursor?(0,z.jsx)(`button`,{className:`mt-3 rounded-lg py-2 text-sm text-accent-fg`,onClick:()=>void U.setSize(U.size+1),children:e?`加载更多`:`Load more`}):null]})]})}),L&&_?(0,We.createPortal)((0,z.jsxs)(`section`,{id:`space-file-preview`,"aria-label":X?e?`工作簿编辑器`:`Workbook editor`:e?`资料预览`:`File preview`,style:{"--space-preview-width":`${ee}%`},"data-space-workbook-surface":X?``:void 0,className:P(`file-preview-surface absolute inset-0 z-40 flex min-h-0 min-w-0`,!X&&`@min-[58rem]/space:relative @min-[58rem]/space:inset-auto @min-[58rem]/space:w-[var(--space-preview-width)] @min-[58rem]/space:shrink-0 @min-[58rem]/space:border-s @min-[58rem]/space:border-edge-subtle`),children:[X?null:(0,z.jsx)(lt,{zh:e,width:ee,onResize:te}),(0,z.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,z.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center gap-1 border-b border-edge-subtle px-3 py-2`,children:[(0,z.jsx)(`button`,{type:`button`,className:P(W,!X&&`@min-[58rem]/space:hidden`),onClick:kt,"aria-label":e?`返回资料库`:`Back to library`,children:(0,z.jsx)(y,{className:`size-4`})}),X&&k&&q?(0,z.jsx)(`input`,{defaultValue:q.title,maxLength:240,autoFocus:!0,readOnly:N,onFocus:e=>e.currentTarget.select(),onBlur:e=>Vt(e.currentTarget.value,!1),onKeyDown:e=>{e.key!==`Enter`&&e.key!==`Escape`||(e.stopPropagation(),!(N||e.nativeEvent.isComposing||e.keyCode===229)&&(e.preventDefault(),e.key===`Enter`?Vt(e.currentTarget.value,!0):Bt()))},"aria-label":e?`工作簿名称`:`Workbook name`,className:`h-9 min-w-0 flex-1 rounded-lg border border-edge bg-surface-inset px-2 text-sm font-semibold text-fg outline-none focus:border-accent`},q.id):(0,z.jsx)(`h2`,{ref:be,tabIndex:-1,className:`min-w-0 flex-1 text-sm leading-5 font-semibold wrap-anywhere text-fg`,children:X&&q&&!q.trashedAt?(0,z.jsx)(`button`,{type:`button`,ref:xe,title:e?`重命名工作簿`:`Rename workbook`,disabled:N,className:`block min-h-9 max-w-full truncate rounded-lg px-2 text-start hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>A(!0),children:q.title}):q?.title??(e?`预览`:`Preview`)}),X?Wt:null,q&&!q.trashedAt?(0,z.jsxs)(z.Fragment,{children:[X?(0,z.jsxs)(`button`,{type:`button`,ref:Se,className:P(W,`w-auto gap-1.5 px-2`,vt&&`bg-accent-soft text-accent-fg`),"aria-expanded":vt,"aria-controls":ue?.itemId===q.id?`workbook-chat`:void 0,"aria-label":e?`工作簿对话`:`Workbook chat`,onClick:()=>vt?Dt():de({itemId:q.id,open:!0}),children:[(0,z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`hidden whitespace-nowrap @min-[34rem]/space:inline`,children:e?`工作簿对话`:`Workbook chat`})]}):null,(0,z.jsx)(`button`,{type:`button`,className:P(W,q.favorite&&`text-accent-fg`),"aria-pressed":q.favorite,"aria-label":e?`收藏`:`Favorite`,disabled:N,onClick:()=>void Mt(`patch`,q,{favorite:!q.favorite}),children:(0,z.jsx)(O,{className:P(`size-4`,q.favorite&&`fill-current`)})}),(0,z.jsx)(`button`,{type:`button`,className:W,disabled:N,"aria-label":X?e?`下载此版本为 Excel`:`Download this version as Excel`:e?`下载`:`Download`,onClick:()=>void Nt(),children:(0,z.jsx)(v,{className:`size-4`})}),(0,z.jsxs)(Re,{children:[(0,z.jsx)(Be,{className:W,"aria-label":e?`更多操作`:`More actions`,children:(0,z.jsx)(S,{className:`size-4`})}),(0,z.jsx)(Ie,{children:(0,z.jsxs)(Le,{align:`end`,sideOffset:5,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,onCloseAutoFocus:e=>{X&&k&&e.preventDefault()},children:[(0,z.jsx)(ze,{className:rt,onClick:()=>A(!0),children:e?`重命名`:`Rename`}),(0,z.jsx)(ze,{className:P(rt,`text-red-600 dark:text-red-400`),disabled:N,onClick:()=>void Mt(`trash`,q),children:e?`移到回收站`:`Move to Trash`})]})})]})]}):null,X?null:(0,z.jsx)(`button`,{type:`button`,className:P(W,`hidden @min-[58rem]/space:inline-flex`),onClick:kt,"aria-label":e?`关闭预览`:`Close preview`,children:(0,z.jsx)(he,{className:`size-4`})})]}),!X&&k&&q?(0,z.jsxs)(`form`,{className:`flex shrink-0 flex-wrap items-center gap-2 px-3 py-2`,onSubmit:Rt,children:[(0,z.jsx)(`input`,{name:`title`,defaultValue:q.title,required:!0,maxLength:240,autoFocus:!0,"aria-label":e?`资料名称`:`Result name`,className:`min-w-24 flex-1 rounded-lg border border-edge bg-surface-panel px-2 py-2 text-sm`}),(0,z.jsx)(`button`,{className:it,disabled:N,children:e?`保存`:`Save`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-sm hover:bg-surface-hover`,onClick:()=>A(!1),children:e?`取消`:`Cancel`})]}):null,G.isLoading?(0,z.jsx)(ge,{className:`m-3 min-h-0 flex-1 rounded-xl`}):null,G.error?(0,z.jsx)(`p`,{className:`px-3 py-5 text-sm text-fg-muted`,children:e?`资料暂不可用`:`Result unavailable`}):null,q&&ot&&!Y?(0,z.jsxs)(`p`,{role:`status`,className:`px-3 py-5 text-sm text-fg-muted`,children:[e?`引用的工作簿版本已不可用。`:`The referenced workbook version is unavailable.`,(0,z.jsx)(`button`,{type:`button`,className:`ms-2 text-accent-fg`,onClick:()=>$({version:null,sheet:null,range:null,proposal:null,undo:null}),children:e?`打开最新版本`:`Open latest version`})]}):null,q&&Y?(0,z.jsxs)(z.Fragment,{children:[X&&(E||D)&&!q.trashedAt?(0,z.jsx)(et,{id:q.id,versionId:Y.id,proposalId:E,undo:D,zh:e,onClose:()=>$({proposal:null,undo:null}),onComplete:()=>{G.mutate(),U.mutate(),$({version:null,proposal:null,undo:null})}},`${E??``}:${D??``}`):null,X?(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(ge,{className:`m-3 min-h-0 flex-1 rounded-xl`}),children:(0,z.jsx)(tt,{id:q.id,versionId:Y.id,title:q.title,zh:e,editable:!q.trashedAt&&Z,controls:F,targetSheet:w,targetRange:T,newerVersionPending:yt,onCopy:Ft,onSaved:e=>{le(t=>({itemId:q.id,seed:mt,locationKey:i.key,versions:[...new Set([...t?.seed&&t.seed===mt?t.versions:[Y.id],e])]})),ke(Ne(q.id)).then(t=>wt(t,e)).catch(()=>{}),U.mutate()}},`${Z?`latest`:`history`}:${mt}`)}):(0,z.jsx)(Ge,{itemId:q.id,version:Y,hit:ht,download:Nt},Y.id),!X||ht||gt||q.trashedAt||Y.indexStatus===`pending`?(0,z.jsxs)(`div`,{className:`max-h-[45%] shrink-0 space-y-2 overflow-y-auto border-t border-edge-subtle px-3 py-2`,children:[ht?(0,z.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:(0,z.jsx)(dt,{text:ht.text,query:He.trim()})}):null,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:Q?Gt(q):null}),Y.indexStatus===`pending`?(0,z.jsx)(`span`,{children:e?`正在索引`:`Indexing`}):null,X?null:Wt]}),(0,z.jsx)(`footer`,{className:`flex flex-wrap items-center justify-between gap-2`,children:q.trashedAt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:it,disabled:N,onClick:()=>void Mt(`restore`,q),children:e?`恢复`:`Restore`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-lg px-2 py-2 text-sm text-red-600 hover:bg-surface-hover dark:text-red-400`,onClick:()=>M(!0),children:e?`永久删除`:`Delete permanently`})]}):(0,z.jsxs)(z.Fragment,{children:[gt?(0,z.jsx)(d,{className:`rounded-lg px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover`,to:gt,children:e?`查看来源`:`Open source`}):(0,z.jsx)(`span`,{}),!X&&Ye(Y.fileName)?(0,z.jsx)(`button`,{type:`button`,className:P(rt,`w-auto border border-edge`),disabled:N,title:e?`导入数据、公式与基础布局,保留原文件`:`Import data, formulas and basic layout as a separate workbook`,onClick:()=>Lt(Y.fileName,()=>we(q.id,Y.id),{id:q.id,versionId:Y.id}),children:e?`创建可编辑副本`:`Make an editable copy`}):null,X?null:(0,z.jsx)(`button`,{type:`button`,className:it,disabled:N||Y.sizeBytes>33554432,title:Y.sizeBytes>33554432?e?`超过对话附件大小上限`:`Exceeds the chat attachment size limit`:void 0,onClick:Pt,children:e?`在对话中使用`:`Use in chat`})]})}),j?(0,z.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge bg-surface-panel p-3 text-sm`,children:[(0,z.jsx)(`p`,{children:e?`永久删除「${q.title}」?`:`Delete “${q.title}” permanently?`}),(0,z.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,className:rt,onClick:()=>M(!1),children:e?`取消`:`Cancel`}),(0,z.jsx)(`button`,{type:`button`,className:P(rt,`text-red-600 dark:text-red-400`),disabled:N,onClick:()=>void Mt(`purge`,q),children:e?`删除`:`Delete`})]})]}):null]}):null]}):null,Kt]}),X&&q&&!q.trashedAt&&ue?.itemId===q.id?(0,z.jsx)(Qe,{id:q.id,open:vt,zh:e,originId:Q?.available?Q.conversationId:void 0,projectId:_t,onClose:Dt,readSelection:Ct,prepareSendContext:St,onRunSettled:Et},q.id):null]}),_):null,L&&_?null:Kt]})}export{Z as SpacePage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,d as a,f as o,h as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as l,l as u,n as d,o as f}from"./locale-store-5DzxIIeq.js";import{t as p}from"./messages-CGGOcV9B.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-DlirbHVs.js";import{G as x,T as S,g as C,ot as w,q as T,t as E}from"./chat-page-qrdWReZ2.js";import{t as D}from"./arrow-left-D880xG-P.js";import{f as O,i as k,u as A}from"./automation-display-DaVDNZz8.js";import{t as j}from"./check-DUBLcKHA.js";import{t as M}from"./chevron-right-BweFrslA.js";import{n as N,r as P}from"./popover-select-hRG1EzAY.js";import{t as F}from"./circle-BoO4YvTx.js";import{t as I}from"./ellipsis-0k4rZLoy.js";import{t as L}from"./external-link-DjqjBmc3.js";import{t as R}from"./file-icon-N6WjUhq_.js";import{t as ee}from"./folder-kanban-CpLlFI1o.js";import{t as te}from"./folder-open-CyzJ19I9.js";import{B as ne,H as re,I as ie,P as ae}from"./markdown-view-BwbjZnQ6.js";import{t as oe}from"./message-square-fVE7Ghj1.js";import{t as se}from"./pause-DuPxgSxk.js";import{t as ce}from"./play-kxZvpBg8.js";import{t as z}from"./x-B_N4OPjy.js";import{t as B}from"./cn-0WouolD0.js";import{t as le}from"./skeleton-DzdOeGYz.js";import{d as ue}from"./tasks-BIehlq7k.js";import{c as de}from"./api-CJvZsRen.js";import{ht as fe}from"./session-manager-BRzFtnn4.js";import{i as pe}from"./vendor-swr-CdRzEUwF.js";import{C as me,D as he,T as ge,_ as _e,a as ve,f as ye,i as be,l as xe,n as Se,r as Ce,u as we,x as Te}from"./workspace-preview-store-QUX-jyAL.js";import{t as Ee}from"./chat-agents-api-LVSL686y.js";import{t as V}from"./button-C5tRaJxt.js";import{r as De}from"./right-workspace-store-DOyKalyG.js";import{c as Oe}from"./composer-payload-handoff-Cbkv-F26.js";import{t as ke}from"./page-header-store-xgXJVGDC.js";import{t as Ae}from"./agent-avatar-display-BiHRFRo2.js";import{t as je}from"./automation-api-HQmKv0Sm.js";import{n as Me}from"./agent-display-names-Bje7vfSn.js";import{t as H}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ne}from"./confirm-dialog-MHCmEEUZ.js";import{l as Pe,m as Fe,o as Ie,r as Le,t as Re,u as ze}from"./dist-DaFr5KMw.js";import{d as Be,f as Ve,l as He,o as Ue,u as We}from"./automation-task-card-2EsZ1jBs.js";import{t as Ge}from"./date-picker-_G6tIiGk.js";import{t as Ke}from"./time-picker-otHjbob1.js";import{n as qe}from"./date-formatters-DukWSVwc.js";import{n as Je,r as Ye,t as Xe}from"./task-header-title-DAwu5vni.js";import{t as Ze}from"./date-time-picker-B3lS-ZGW.js";import{n as Qe,r as U,t as $e}from"./task-result-evidence-BqAt23uk.js";import{t as et}from"./page-context-capture-button-BcSfcOme.js";import{t as tt}from"./dependency-picker-DEPr5_Wk.js";var W=e(t(),1),G=n(),K=r();function nt(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function rt(e){let t=(0,G.c)(32),n,r,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=i(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=B(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>nt(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,K.jsx)(M,{"aria-hidden":!0,className:B(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,K.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==a||t[30]!==x?(S=(0,K.jsxs)(`details`,{...a,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=a,t[30]=x,t[31]=S):S=t[31],S}function it(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function at(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=it(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function ot(e){let t=(0,G.c)(28),{language:n,hasSchedule:r}=e,[a,o]=i(),s;t[0]===a?s=t[1]:(s=a.get(`taskSection`),t[0]=a,t[1]=s);let c=s,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(void 0),p=(0,W.useRef)(o),m=(0,W.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,W.useEffect)(h,g);let _=(0,W.useRef)(void 0),v=(0,W.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=nt(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=at(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,W.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,D]=(0,W.useState)(T),O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));D(r.map(st));let i=0,a=()=>{if(d.current)return;let e=it(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=O):O=t[9];let k;t[10]!==r||t[11]!==n?(k=[n,r,b],t[10]=r,t[11]=n,t[12]=k):k=t[12],(0,W.useEffect)(O,k);let A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{clearTimeout(f.current),_.current?.cancel()},A=[],t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,W.useEffect)(j,A);let M,N;t[15]===c?(M=t[16],N=t[17]):(M=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},N=[c,S],t[15]=c,t[16]=M,t[17]=N),(0,W.useEffect)(M,N);let P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=P):P=t[18];let F;t[19]!==C||t[20]!==E?(F=[C,E],t[19]=C,t[20]=E,t[21]=F):F=t[21],(0,W.useEffect)(P,F);let I=n===`zh`?`任务详情分区`:`Task detail sections`,L;t[22]!==C||t[23]!==E?(L=E.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:B(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=L):L=t[24];let R;return t[25]!==I||t[26]!==L?(R=(0,K.jsx)(H,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":I,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:L}),t[25]=I,t[26]=L,t[27]=R):R=t[27],R}function st(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var ct=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function lt(e){let t=(0,G.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,W.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=B(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,K.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=B(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,K.jsx)(j,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,K.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,K.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=`criterion:${r}:evidence`,O;t[24]!==n.text||t[25]!==d?(O=(0,K.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=O):O=t[26];let k=u?`验收依据`:`Acceptance evidence`,A;t[27]===k?A=t[28]:(A=(0,K.jsx)(`p`,{className:`font-medium text-fg`,children:k}),t[27]=k,t[28]=A);let M;t[29]!==n.method||t[30]!==m||t[31]!==u?(M=n.method?(0,K.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=M):M=t[32];let N;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(N=n.review?(0,K.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,qe(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=N):N=t[37];let P;t[38]!==n.note||t[39]!==r||t[40]!==i?(P=n.note&&n.note!==ct?(0,K.jsx)(U,{content:n.note,contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=P):P=t[41];let F;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(F=(0,K.jsx)($e,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=F):F=t[46];let I;t[47]!==p||t[48]!==u?(I=p?null:(0,K.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=I):I=t[49];let L;t[50]!==A||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,K.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[A,M,N,P,F,I]}),t[50]=A,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==D||t[58]!==O||t[59]!==L?(R=(0,K.jsx)(rt,{panelId:D,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:O,children:L}),t[57]=D,t[58]=O,t[59]=L,t[60]=R):R=t[60];let ee;return t[61]!==E||t[62]!==R?(ee=(0,K.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,R]}),t[61]=E,t[62]=R,t[63]=ee):ee=t[63],ee}function ut(e){let t=(0,G.c)(39),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u,reviewDisabled:d}=e,f=r===`zh`,p;t[0]===n?p=t[1]:(p=n.some(dt),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==f?(h=m?(0,K.jsx)(rt,{panelId:`acceptance:diagnostic`,title:f?`自动核验未完成:验收标准过于宽泛`:`Automatic verification incomplete: criteria are too broad`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,K.jsx)(`p`,{className:`mt-2 break-words`,children:ct})}):null,t[2]=m,t[3]=f,t[4]=h):h=t[4];let g=a||void 0,_;if(t[5]!==i||t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==l||t[12]!==d){let e;t[14]!==i||t[15]!==u||t[16]!==r||t[17]!==c||t[18]!==a||t[19]!==l||t[20]!==d?(e=(e,t)=>(0,K.jsx)(lt,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[14]=i,t[15]=u,t[16]=r,t[17]=c,t[18]=a,t[19]=l,t[20]=d,t[21]=e):e=t[21],_=n.map(e),t[5]=i,t[6]=u,t[7]=n,t[8]=r,t[9]=c,t[10]=a,t[11]=l,t[12]=d,t[13]=_}else _=t[13];let v;t[22]!==g||t[23]!==_?(v=(0,K.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[22]=g,t[23]=_,t[24]=v):v=t[24];let y;t[25]!==n.length||t[26]!==f?(y=n.length===0?(0,K.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[25]=n.length,t[26]=f,t[27]=y):y=t[27];let b;t[28]===s?b=t[29]:(b=s?(0,K.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[28]=s,t[29]=b);let x;t[30]!==o||t[31]!==i?(x=!i&&o?(0,K.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[30]=o,t[31]=i,t[32]=x):x=t[32];let S;return t[33]!==h||t[34]!==v||t[35]!==y||t[36]!==b||t[37]!==x?(S=(0,K.jsxs)(K.Fragment,{children:[h,v,y,b,x]}),t[33]=h,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function dt(e){return e.note===ct}function ft(e){let t=(0,G.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=Se(n),l;if(t[5]!==n.runs||t[6]!==n.task){let e;t[8]===n.task?e=t[9]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[8]=n.task,t[9]=e),l=new Set(n.runs.filter(e).map(yt)),t[5]=n.runs,t[6]=n.task,t[7]=l}else l=t[7];let u=l,d=n.context.filter(vt).map(_t),f=new Set(e.flatMap(gt).filter(Boolean)),p=new Set([...d.map(ht),...f].filter(Boolean)),m;t[10]===u?m=t[11]:(m=e=>u.has(e.runId),t[10]=u,t[11]=m);for(let e of n.receipts.filter(m))for(let t of e.evidence.filter(mt))t.uri&&p.has(t.uri)||(t.uri&&p.add(t.uri),d.push(t));let h=a?.summary.trim(),g=h&&h.length<=160&&!h.includes(`
|
|
2
|
-
`)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(h)?h:void 0,_=d.filter(e=>!f.has(e.uri)),v=i?`交付结果`:`Deliverables`,y;t[12]===v?y=t[13]:(y=(0,K.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:v}),t[12]=v,t[13]=y);let b;t[14]!==e||t[15]!==n||t[16]!==o||t[17]!==i?(b=e.length?(0,K.jsx)(`ul`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.map(e=>{let t=e.artifact?.title??e.reference?.title??e.id;return(0,K.jsxs)(`li`,{className:`min-w-0`,children:[(0,K.jsxs)(Ye,{item:e,conversationId:e.task?.conversationId??n.conversation.activeConversationId,backgroundPath:`${o.pathname}${o.search}`,zh:i,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,K.jsx)(R,{name:t}),(0,K.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t})]}),e.artifact?.availability===`available`&&e.artifact.uri?.startsWith(`media://outbound/`)?(0,K.jsx)(C,{file:e.artifact,zh:i}):null]},e.id)})}):null,t[14]=e,t[15]=n,t[16]=o,t[17]=i,t[18]=b):b=t[18];let x;t[19]!==n||t[20]!==r||t[21]!==_?(x=_.length?(0,K.jsx)($e,{evidence:_,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):null,t[19]=n,t[20]=r,t[21]=_,t[22]=x):x=t[22];let S;t[23]!==e||t[24]!==_.length||t[25]!==i?(S=!e.length&&!_.length?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}):null,t[23]=e,t[24]=_.length,t[25]=i,t[26]=S):S=t[26],s=(0,K.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl bg-surface-panel p-4`,children:[y,g?(0,K.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:g}):null,a&&a.completionVerdict!==`achieved`?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,b,x,S,a?null:(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),a&&(a.needsUser||a.remainingWork.length>0||a.nextAction||a.failure)?(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:a.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),a.remainingWork.length>0?(0,K.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:[...new Set(a.remainingWork)].map(pt)}):null,a.nextAction?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:a.nextAction}):null,a.failure?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-danger [overflow-wrap:anywhere]`,children:a.failure.recoveryAction}):null,a.needsUser?(0,K.jsx)(c,{className:`inline-flex min-h-9 items-center rounded-sm text-xs font-medium text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/40`,to:ae(n.task.id),children:i?`查看并决定`:`Review and decide`}):null]}):null]}),t[0]=n,t[1]=r,t[2]=o,t[3]=i,t[4]=s}else s=t[4];return s}function pt(e){return(0,K.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function mt(e){return e.kind===`artifact`}function ht(e){return e.uri}function gt(e){return[e.artifact?.uri,e.artifact?.shareUrl,e.artifact?.workspaceRelativePath]}function _t(e){return{kind:[`file`,`url`].includes(e.targetKind)?`artifact`:`source`,title:e.title??e.targetId,summary:``,...[`file`,`url`].includes(e.targetKind)?{uri:e.targetId}:{},provenance:`user`,strength:`observed`,observedAt:0}}function vt(e){return e.role===`deliverable`}function yt(e){return e.id}function bt(e){let t=(0,G.c)(19),{detail:n,language:r}=e,i=r===`zh`,a=Oe(r),o;t[0]===n?o=t[1]:(o=Se(n),t[0]=n,t[1]=o);let s=o,c;t[2]===s?.runId?c=t[3]:(c=e=>e.runId!==s?.runId,t[2]=s?.runId,t[3]=c);let l=n.receipts.filter(c),[u,d]=(0,W.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await me(s.runId,e),d(`saved`)}catch{d(`failed`)}}},t[4]=s,t[5]=f);let p=f,m;t[6]!==n||t[7]!==r?(m=(0,K.jsx)(T,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,K.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,K.jsx)(U,{content:s.summary,contentKey:`${n.task.id}:result:${s.runId}`,language:r}),s.evidence.length>0?(0,K.jsxs)(`details`,{children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,K.jsx)($e,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,K.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:result:${e.runId}`,language:r})]},e.runId))})]}):null,_;t[9]!==a||t[10]!==n.criterionReviewHistory||t[11]!==r||t[12]!==i?(_=n.criterionReviewHistory?.length?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:i?`历史验收判定`:`Past criterion reviews`}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2 text-sm`,children:n.criterionReviewHistory.map(e=>(0,K.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{children:e.criterionText}),(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a.verificationStatuses[e.status],` · `,qe(e.reviewedAt,r)]}),e.note?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.note}):null]},`${e.contractVersion}:${e.resultId??``}:${e.criterionIndex}`))})]}):null,t[9]=a,t[10]=n.criterionReviewHistory,t[11]=r,t[12]=i,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==_?(v=(0,K.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g,_]}),t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function xt(e){let t=(0,G.c)(33),{changes:n,language:r}=e,i=r===`zh`,a;t[0]===i?a=t[1]:(a=i?{backlog:`待办池`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`},t[0]=i,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=i?{board:`看板`,mobile:`移动端`,api:`手动操作`,runtime:`自动流转`,undo:`撤销`}:{board:`Board`,mobile:`Mobile`,api:`Manual update`,runtime:`Automatic`,undo:`Undo`},t[2]=i,t[3]=s);let c=s,l;t[4]===i?l=t[5]:(l=i?{done:`完成`,cancelled:`取消`,duplicate:`重复`,wont_do:`不做`}:{done:`Done`,cancelled:`Cancelled`,duplicate:`Duplicate`,wont_do:`Won’t do`},t[4]=i,t[5]=l);let u=l,d;t[6]===i?d=t[7]:(d=i?{user:`用户`,agent:`Agent`,system:`系统`,integration:`外部服务`}:{user:`User`,agent:`Agent`,system:`System`,integration:`Integration`},t[6]=i,t[7]=d);let f=d,p=i?`变更记录`:`Change log`,m;t[8]!==n.length||t[9]!==p?(m=(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[p,` (`,n.length,`)`]}),t[8]=n.length,t[9]=p,t[10]=m):m=t[10];let h;if(t[11]!==f||t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==u||t[16]!==c){let e;t[18]!==f||t[19]!==r||t[20]!==o||t[21]!==u||t[22]!==c?(e=e=>(0,K.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,K.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[f[e.actor.kind],e.actor.id?` (${e.actor.id})`:``,` · `,c[e.source],` · `,(0,K.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:qe(e.createdAt,r)})]})]},e.id),t[18]=f,t[19]=r,t[20]=o,t[21]=u,t[22]=c,t[23]=e):e=t[23],h=[...n].reverse().map(e),t[11]=f,t[12]=n,t[13]=r,t[14]=o,t[15]=u,t[16]=c,t[17]=h}else h=t[17];let g;t[24]===h?g=t[25]:(g=(0,K.jsx)(`ol`,{className:`mt-3 max-h-80 space-y-3 overflow-y-auto`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==n.length||t[27]!==i?(_=n.length?null:(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i?`暂无阶段变更记录`:`No phase changes yet`}),t[26]=n.length,t[27]=i,t[28]=_):_=t[28];let v;return t[29]!==m||t[30]!==g||t[31]!==_?(v=(0,K.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[m,g,_]}),t[29]=m,t[30]=g,t[31]=_,t[32]=v):v=t[32],v}function St({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=p(t),[o,s]=(0,W.useState)(null),l=(0,W.useRef)(!1),[u,d]=(0,W.useState)(null),f=e=>new Date(e).toLocaleString(i?`zh-CN`:`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`});async function m(e){if(!l.current){l.current=!0,s(e.id),d(null);try{r((await je.update(e.id,{enabled:!1,expectedRevision:e.updatedAtMs})).automation)}catch(e){d(e instanceof Error?e.message:a.automations.feedback.actionFailed)}finally{l.current=!1,s(null)}}}return(0,K.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,s=A(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,K.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`text-xs text-fg-muted`,children:s?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,K.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${f(Date.parse(r.at))}`:k(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,K.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,s?i?`已执行,无后续计划`:`Completed; no upcoming run`:e.enabled?e.state.nextRunAtMs===void 0?i?`暂无后续执行`:`No upcoming run`:f(e.state.nextRunAtMs):i?`已取消,不再自动执行`:`Disabled; no automatic runs`]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,K.jsx)(V,{variant:`secondary`,disabled:o!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,K.jsx)(V,{variant:`ghost`,disabled:o!==null,onClick:()=>void m(e),children:o===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,K.jsx)(V,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(c,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var Ct=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function wt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:o,automation:s}){let l=i===`zh`,u=p(i).automations,[d,f]=(0,W.useState)(()=>s?Be(s):{...Ve,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(!1),T=(0,W.useRef)(!1),[E,D]=(0,W.useState)(null),O=e=>f(t=>({...t,...e}));async function k(e){if(e.preventDefault(),!(T.current||x)&&(D(null),!(!d.name.trim()||!s&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){D(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=s?He(s,d).trigger:We(d).trigger,{automation:t}=s?await je.update(s.id,{trigger:e,...s.management?{}:{name:d.name.trim(),delivery:{...s.delivery,notificationPolicy:d.notificationPolicy}},...!s.management||s.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:s.updatedAtMs}):await je.create({...We(d),enabled:!0});S(t),o(t)}catch(e){D(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,K.jsx)(b,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,K.jsxs)(_,{children:[(0,K.jsx)(m,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,K.jsxs)(v,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[111] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,K.jsx)(y,{className:`text-base font-semibold text-fg`,children:s?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,K.jsx)(g,{asChild:!0,children:(0,K.jsx)(V,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,K.jsx)(z,{className:`size-4`})})})]}),(0,K.jsx)(h,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:s?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,K.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,K.jsx)(V,{asChild:!0,variant:`primary`,children:(0,K.jsx)(c,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,K.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,K.jsx)(V,{onClick:a,children:l?`完成`:`Done`})})]}):(0,K.jsxs)(`form`,{onSubmit:e=>void k(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,K.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,K.jsx)(`input`,{required:!0,readOnly:!!s?.management,className:Ct,value:d.name,onChange:e=>O({name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,K.jsxs)(N,{value:d.triggerMode,onChange:e=>O({triggerMode:e.target.value}),children:[s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`interval`?(0,K.jsx)(P,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`cron`?(0,K.jsx)(P,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,K.jsx)(P,{value:`once`,children:u.trigger.once}),(0,K.jsx)(P,{value:`daily`,children:u.trigger.daily}),(0,K.jsx)(P,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,K.jsx)(Ze,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>O({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,K.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,K.jsx)(`span`,{children:u.form.time}),(0,K.jsx)(Ke,{disabled:C,value:d.time,onChange:e=>O({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,K.jsx)(N,{value:d.weekday,onChange:e=>O({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,K.jsx)(P,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,K.jsx)(`input`,{required:!0,className:Ct,value:d.cronExpr,onChange:e=>O({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,K.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:Ct,value:d.intervalValue,onChange:e=>O({intervalValue:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,K.jsxs)(N,{value:d.intervalUnit,onChange:e=>O({intervalUnit:e.target.value}),children:[(0,K.jsx)(P,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,K.jsx)(P,{value:`hour`,children:l?`小时`:`Hours`}),(0,K.jsx)(P,{value:`day`,children:l?`天`:`Days`}),(0,K.jsx)(P,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,K.jsx)(Ue,{form:d,onChange:O,language:i}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,K.jsxs)(N,{disabled:!!s?.management,value:d.notificationPolicy,onChange:e=>O({notificationPolicy:e.target.value}),children:[(0,K.jsx)(P,{value:`attention`,children:u.draft.notifyAttention}),(0,K.jsx)(P,{value:`all`,children:u.draft.notifyAll}),(0,K.jsx)(P,{value:`none`,children:u.draft.notifyNone})]})]})]}),!s&&!r?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,K.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,K.jsx)(V,{type:`submit`,variant:`primary`,disabled:C||!s&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:s?s.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function Tt(e){let t=(0,G.c)(49),{detail:n,executorName:r,language:i,onUpdated:a,ref:o}=e,s=i===`zh`,l;t[0]===n.waits?l=t[1]:(l=n.waits.find(Ot),t[0]=n.waits,t[1]=l);let u=l,d,f,p,m,h,g,_,v,y;if(t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==u||t[7]!==o||t[8]!==s){d=n.allowedCommands.includes(`resolve_wait`)&&!u?n.waits.filter(Dt):[];let e=n.presentation.status===`needsUser`,l;t[18]===n?l=t[19]:(l=Se(n),t[18]=n,t[19]=l);let b=l,S;t[20]===n.runs?S=t[21]:(S=n.runs.find(Et),t[20]=n.runs,t[21]=S);let C=S,w=s?`等待开始执行。`:`Waiting to start.`,T=r?s?`${r} 正在处理任务。`:`${r} is working on the task.`:s?`任务处理中。`:`The task is in progress.`,E=s?`任务正在等待继续。`:`The task is waiting to resume.`,D=s?`正在检查执行结果。`:`Checking the result.`,O;t[22]!==w||t[23]!==T||t[24]!==E||t[25]!==D?(O={queued:w,running:T,waiting:E,verifying:D},t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k=O;p=n.presentation.reason??u?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?b?.summary??(s?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?s?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(C&&k[C.status])??b?.summary??(s?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),f=n.attention.length>0?(0,K.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=d.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`);return(0,K.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,previewHeight:72,children:(0,K.jsx)(x,{content:fe(e.summary),compact:!0,breaks:!0})}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,K.jsx)(c,{className:`mt-2 inline-flex min-h-11 items-center rounded-lg bg-accent-soft px-3 font-medium text-accent-fg`,to:ae(n.task.id),children:s?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,m=o,h=-1,g=s?`当前需要处理`:`Current action`,_=`rounded-xl bg-surface-panel p-4`;let A=e?s?`需要你处理`:`Your action needed`:s?`当前进展`:`Current progress`,j=d.length>1?` · ${d.length}`:``;t[27]!==A||t[28]!==j?(v=(0,K.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[A,j]}),t[27]=A,t[28]=j,t[29]=v):v=t[29];let M;t[30]!==n||t[31]!==a||t[32]!==s?(M=e=>(0,K.jsx)(Qe,{wait:e,detail:n,zh:s,onUpdated:a},e.id),t[30]=n,t[31]=a,t[32]=s,t[33]=M):M=t[33],y=d.map(M),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=u,t[7]=o,t[8]=s,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17];let b;t[34]!==d.length||t[35]!==f||t[36]!==n.task||t[37]!==i||t[38]!==p||t[39]!==s?(b=d.length>0?f?(0,K.jsxs)(`details`,{className:`mt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`等待详情`:`Waiting details`}),f]}):null:f??(0,K.jsx)(U,{content:p,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,K.jsx)(x,{content:fe(p),compact:!0})}),t[34]=d.length,t[35]=f,t[36]=n.task,t[37]=i,t[38]=p,t[39]=s,t[40]=b):b=t[40];let S;return t[41]!==m||t[42]!==h||t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==b?(S=(0,K.jsxs)(`section`,{ref:m,tabIndex:h,"aria-label":g,className:_,children:[v,y,b]}),t[41]=m,t[42]=h,t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b,t[48]=S):S=t[48],S}function Et(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function Dt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function Ot(e){return e.kind===`paused`}function kt(e){let t=(0,G.c)(17),{children:n,contentKey:r,language:a,className:o}=e,s=(0,W.useId)(),c=W.Children.toArray(n),[l,u]=i(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,K.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==a||t[11]!==u?(h=c.length>3?(0,K.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,K.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function At({taskId:e}){let t=u(e=>e.conversationId),n=d(e=>e.language),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)([]),[_,v]=(0,W.useState)(null),y=l(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=pe([`task-collaboration`,e,t],()=>f(`${y}?recent=1`),{revalidateOnFocus:!0}),C=[...new Map([...h,...b?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),w=async()=>{let e=C[0];if(!(!e||p)){m(!0);try{let t=await f(`${y}?recent=1&beforeSequence=${e.sequence}`);g(e=>[...t.items,...e])}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}}};(0,W.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&S()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[S,e]);let T=async()=>{if(!(!r.trim()||s)){c(!0),v(null);try{await f(y,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await S()}catch(e){v(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,K.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,K.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,K.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,K.jsx)(le,{className:`h-14 w-full`}),(0,K.jsx)(le,{className:`h-14 w-4/5`})]}):null,x?(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,K.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void w(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,C.map(t=>(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,K.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,K.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,K.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,K.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,K.jsx)(U,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,K.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),b&&!C.length?(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,K.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,K.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),_?(0,K.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,K.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void T(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function jt(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Mt(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Nt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Pt(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ft(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var It=[`backlog`,`ready`,`active`,`review`,`closed`],Lt=[`low`,`normal`,`high`,`critical`],Rt=(0,W.memo)(function(e){let t=(0,G.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&!i&&!(e===`closed`?a:n===`closed`&&o),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,K.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=It.map(e=>(0,K.jsx)(P,{value:e,disabled:d(e),children:Nt(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let h;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(h=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=h):h=t[16];let g;return t[17]!==f||t[18]!==h?(g=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,h]}),t[17]=f,t[18]=h,t[19]=g):g=t[19],g}),zt=(0,W.memo)(function(e){let t=(0,G.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=Lt.map(e=>(0,K.jsx)(P,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),Bt=(0,W.memo)(function(e){let t=(0,G.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,K.jsx)(Ge,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Vt=(0,W.memo)(function(e){let t=(0,G.c)(36),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,language:s,onChange:c}=e,l,u,d,f,m,h,g,_,v,y;if(t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==a||t[6]!==n){let{agentsSettings:e}=p(s);v=`grid gap-1.5 text-xs text-fg-muted`,t[17]===i?y=t[18]:(y=(0,K.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=N,u=`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,d=`border-0`,f=n,m=r,t[19]===c?h=t[20]:(h=e=>c(e.target.value),t[19]=c,t[20]=h),t[21]===a?g=t[22]:(g=(0,K.jsx)(P,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,K.jsx)(P,{value:t.id,children:Me(t,e)},t.id)),t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=a,t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else l=t[7],u=t[8],d=t[9],f=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_?(b=(0,K.jsxs)(l,{triggerClassName:u,contentClassName:d,value:f,disabled:m,onChange:h,children:[g,_]}),t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==v||t[34]!==y?(x=(0,K.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Ht=(0,W.memo)(function(e){let t=(0,G.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(Qt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,K.jsx)(tt,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ut=`xopc.taskDetail.chatPanelPercent`,Wt=42;function Gt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Wt:Math.min(r,Math.max(n,e))}function Kt(){try{let e=Number(window.localStorage.getItem(Ut));return Number.isFinite(e)&&e>=30&&e<=60?e:Wt}catch{return Wt}}function qt(e){let t=(0,G.c)(13),{items:n,empty:r,contentKey:i}=e,a=d(Yt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
|
|
3
|
-
`),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(Jt),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,K.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,K.jsx)(U,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function Jt(e){return(0,K.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,K.jsx)(F,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,K.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function Yt(e){return e.language}function Xt({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:s}){let[l,f]=i(),m=o(),h=d(e=>e.language),g=u(e=>e.conversationId),_=(0,W.useMemo)(()=>Oe(h),[h]),v=ke(e=>e.setPageHeader),y=ke(e=>e.clearPageHeader),b=De(e=>e.panes),x=S(e=>e.openForSession),{data:C,error:T,mutate:k,lastChange:A,conversationLoading:j,conversationError:M}=w(e),{data:N,error:P,mutate:F}=pe(e?[`task-detail-automations`,g]:null,()=>je.list(),{refreshInterval:3e4}),[R,z]=(0,W.useState)(null),[fe,me]=(0,W.useState)(null),[H,Be]=(0,W.useState)(()=>new Set),[Ve,He]=(0,W.useState)([]),[Ue,We]=(0,W.useState)(null),[Ge,Ke]=(0,W.useState)([]),[Ye,Ze]=(0,W.useState)(!1),[Qe,$e]=(0,W.useState)(``),[tt,G]=(0,W.useState)(!1),[at,st]=(0,W.useState)(``),[ct,lt]=(0,W.useState)(Kt),[dt,pt]=(0,W.useState)(!1),mt=(0,W.useRef)(null),ht=(0,W.useRef)(null),gt=(0,W.useRef)(null),{key:_t,state:vt}=a(),yt=vt?.focusTaskResults,Ct=!!C;(0,W.useEffect)(()=>{if(!Ct||yt!==e)return;let t=requestAnimationFrame(()=>{ht.current?.scrollIntoView?.({block:`start`}),ht.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[yt,_t,Ct,e]);let Et=(0,W.useRef)(null),Dt=(0,W.useRef)(null),[Ot,Nt]=(0,W.useState)(!1),It=(0,W.useRef)(!1),Lt=(0,W.useRef)(!1),Jt=(0,W.useRef)(``),Yt=(0,W.useRef)(null),Xt=(0,W.useRef)(null),Zt=(0,W.useRef)(null),Qt=(0,W.useRef)(C),[$t,q]=(0,W.useState)(null),[en,tn]=(0,W.useState)(null),[nn,rn]=(0,W.useState)(!1),[an,on]=(0,W.useState)(!1),[sn,cn]=(0,W.useState)(null),ln=(0,W.useRef)(null),un=(0,W.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),dn=C?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,fn=(0,W.useMemo)(()=>ne(l.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[l]),pn=(0,W.useCallback)(e=>t===`modal`&&n?ie(n,e):re(`/tasks/${encodeURIComponent(e)}`,fn),[n,t,fn]);Qt.current=C;let J=(0,W.useCallback)((e,t)=>{Be(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,W.useEffect)(()=>{z(null),me(null),q(null),Ze(!1),Yt.current=null,G(!1),tn(null),rn(!1),on(!1),cn(null)},[e]),(0,W.useEffect)(()=>{let e=!0;return Ee().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,W.useEffect)(()=>{if(!A||A.source===`user`)return;tn(A);let e=window.setTimeout(()=>tn(null),3500);return()=>window.clearTimeout(e)},[A]),(0,W.useEffect)(()=>{let t=C?.task.projectId,n=C?.dependencies??[];if(!t){Zt.current=null,We(null),He(n);return}Zt.current!==t&&(Zt.current=t,We(null));let r=!0;return de(t).then(t=>{if(!r)return;We(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});He([...i.values()])}).catch(()=>{r&&He(n)}),()=>{r=!1}},[dn,C?.task.projectId,e]);let Y=(0,W.useCallback)(async(t,n=`command`)=>{let r=Qt.current;if(r){J(n,!0),z(null),t.type===`signoff`&&me(null);try{await k(await we(e,t,r.task.version),{revalidate:!1})}catch{z(_.actionFailed),t.type===`signoff`&&me(_.actionFailed)}finally{J(n,!1)}}},[_.actionFailed,k,J,e]),mn=(0,W.useCallback)(async(t,n)=>{let r=Qt.current;if(!r)return!1;n&&J(n,!0),z(null);try{let n=ge(e,t,r.task.version);return await k(n,{optimisticData:Mt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return z(_.actionFailed),!1}finally{n&&J(n,!1)}},[_.actionFailed,k,J,e]),hn=()=>{C&&(Yt.current={value:C.task.title,version:C.task.version},q(null),$e(C.task.title),Ze(!0))},gn=()=>{It.current=!0,$e(Qt.current?.task.title??``),Yt.current=null,q(null),Ze(!1),queueMicrotask(()=>{It.current=!1})},_n=async(e=!1)=>{if(It.current){It.current=!1;return}let t=Qt.current;if(!t||H.has(`title`))return;let n=Qe.trim();if(!n){gn();return}let r=Yt.current;if(!e&&jt(r,t.task.version,t.task.title,n)){q(`title`);return}if(n===t.task.title){gn();return}await mn({title:n},`title`)&&(Yt.current=null,q(null),Ze(!1))},vn=async()=>{if(!C)return;if(Lt.current){Lt.current=!1;return}let e=at.trim(),t=Xt.current;if(jt(t,C.task.version,C.task.body??``,e)){q(`description`);return}if(at===Jt.current||e===(C.task.body??``).trim()){G(!1);return}await mn({body:e||null})&&(q(null),G(!1))},yn=(0,W.useCallback)(async e=>{let t=Qt.current;!t||e===t.task.phase||await Y({type:`move`,phase:e},`phase`)},[Y]),bn=(0,W.useCallback)(e=>{mn({priority:e},`priority`)},[mn]),xn=(0,W.useCallback)(e=>{mn({dueAt:Ft(e)},`dueAt`)},[mn]),Sn=(0,W.useCallback)(e=>{lt(e);try{window.localStorage.setItem(Ut,String(e))}catch{}},[]),Cn=(0,W.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Et.current?.clientWidth??0,n=e.key===`Home`?Wt:ct+(e.key===`ArrowLeft`?2:-2);Sn(Gt(n,t))},[ct,Sn]),wn=(0,W.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Et.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),pt(!0);let i=ct,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Gt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}pt(!1),Sn(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[ct,Sn]),Tn=(0,W.useCallback)(async t=>{let n=Qt.current;if(n){J(`dependencies`,!0),z(null);try{await k(await he(e,t,n.task.version),{revalidate:!1})}catch{z(_.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[_.dependencyUpdateFailed,k,J,e]),En=(0,W.useCallback)(async t=>{let n=Qt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),z(null);try{await k(await _e(e,t,n.task.version),{revalidate:!1})}catch{z(_.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[_.actionFailed,k,J,e]),Dn=(0,W.useCallback)(async()=>{J(`delete`,!0),z(null);try{await ye(e),r?r():m(fn,{replace:!0})}catch(e){z(e instanceof Error?e.message:_.actionFailed)}finally{J(`delete`,!1)}},[_.actionFailed,m,r,fn,J,e]),On=(0,W.useCallback)(async(t,n,r)=>{if(!t.acceptanceTarget)return!1;J(`acceptance`,!0),me(null),z(null);try{return await k(await Te(e,ue(e,t.task.latestContractVersion,n),r,t.task.version,t.task.latestContractVersion,t.acceptanceTarget.id),{revalidate:!1}),!0}catch{return me(_.actionFailed),z(_.actionFailed),k().catch(()=>void 0),!1}finally{J(`acceptance`,!1)}},[_.actionFailed,k,J,e]),kn=C?.task.title,An=kn!==void 0;if((0,W.useLayoutEffect)(()=>{let e=Dt.current,t=e?.parentElement;if(!An||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=it(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;Nt(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[An,e]),(0,W.useLayoutEffect)(()=>{s?.({taskId:e,title:kn,compact:Ot})},[Ot,s,e,kn]),(0,W.useLayoutEffect)(()=>{if(t!==`modal`)return v({startExtra:(0,K.jsx)(c,{to:fn,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,K.jsx)(D,{className:`size-4`})}),main:An?(0,K.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,K.jsx)(Xe,{label:Ue?`${Ue} / ${_.taskLabel}`:_.taskLabel,title:kn,compact:Ot})}):null,end:e?(0,K.jsx)(c,{to:`/space?taskId=${encodeURIComponent(e)}`,className:`rounded-lg px-2.5 py-2 text-sm text-fg-muted hover:bg-surface-hover`,children:h===`zh`?`成果`:`Results`}):null}),y},[y,Ot,_.backToWork,_.taskLabel,An,h,t,Ue,fn,v,e,kn]),T&&!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,K.jsx)(Je,{})});let jn=C.waits[0],X=C.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Mn=ve(C),Nn=Mn.length>0&&Mn.every(e=>e.status===`passed`),Pn=C.waits.find(e=>e.kind===`paused`),Fn=Se(C),In=Ce(C),Ln=_.detailStatuses[In],Rn=C.task.body?.trim()||C.task.contract?.objective.trim()||``,zn=C.allowedCommands.includes(`mark_ready`),Bn=C.allowedCommands.includes(`start`),Vn=C.allowedCommands.includes(`add_wait`),Hn=!jn&&!X&&Nn&&C.presentation.primaryAction?.type===`review`&&C.allowedCommands.includes(`close`),Un=C.allowedCommands.includes(`reopen`),Z=C.conversation.activeConversationId,Q=C.conversation.currentExecutorAgentId??C.task.delegateAgentId??C.task.ownerId,Wn=Ge.find(e=>e.id===Q),Gn=p(h).agentsSettings,Kn=Wn?Me(Wn,Gn):void 0,qn=X?.executorKind===`agent`?Ge.find(e=>e.id===(X.executorRef.agentId??C.conversation.currentExecutorAgentId)):void 0,Jn=qn?Me(qn,Gn):void 0,Yn=!!(Z&&b[Z]?.open),Xn=C.context.filter(e=>e.role!==`deliverable`),Zn=N?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],$=Zn.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),Qn=$.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],$n=e=>{F(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},er=e=>{cn(e),on(!0)},tr=()=>{N&&($.length===1?er($[0]):$.length>1?(ln.current&&(ln.current.open=!0),f(e=>nt(e,`schedule`,!0),{preventScrollReset:!0}),ln.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ln.current?.focus({preventScroll:!0})):(cn(null),on(!0)))},nr=C.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),rr=C.task.contract?.expectedOutputs??[],ir=C.task.contract?.constraints??[],ar=C.task.contract?.approvalRequired??[],or=C.task.contract?.assumptions??[],sr=C.task.contract?.risks??[],cr=ir.length>0||ar.length>0||or.length>0||sr.length>0,lr=(...e)=>!!en?.changedFields.some(t=>e.includes(t)),ur=C.allowedCommands.includes(`move`),dr=H.has(`command`),fr=H.has(`delete`),pr=X!==void 0,mr=()=>{let e=mt.current;e&&(e.open=!0,f(e=>nt(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},hr=C.presentation.primaryAction,gr=()=>{Q&&Y({type:`start`,executor:{kind:`agent`,agentId:Q}})},_r=()=>{ht.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ht.current?.focus({preventScroll:!0})},vr=(()=>{switch(hr?.type){case`mark_ready`:return{label:_.scheduleTask,activate:()=>void Y({type:`mark_ready`})};case`resume`:return{label:_.resumeTask,activate:()=>void Y({type:`resolve_wait`,waitId:hr.waitId})};case`resolve_wait`:{let t=C.waits.find(e=>e.id===hr.waitId),n=t&&t.condition.type!==`connection`&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`);return{label:h===`zh`?`处理待办`:`Resolve pending item`,activate:()=>n?gt.current?.focus():m(ae(e))}}case`inspect_run`:return{label:h===`zh`?`查看待处理事项`:`View pending issue`,activate:()=>gt.current?.focus()};case`review`:return{label:h===`zh`?`去验收`:`Review results`,activate:mr};case`signoff`:return{label:h===`zh`?`确认验收`:`Accept result`,activate:()=>void Y({type:`signoff`,resultId:hr.resultId})};case`view_results`:return{label:h===`zh`?`查看结果`:`View results`,activate:_r};case`retry_allocation`:return{label:h===`zh`?`重新分配`:`Retry assignment`,activate:()=>void Y({type:`retry_allocation`})};case`retry_run`:{let e=C.runs.find(e=>e.id===hr.runId),t=e?.executorKind===`agent`&&typeof e.executorRef.agentId==`string`?e.executorRef.agentId:void 0;return{label:h===`zh`?`重试任务`:`Retry task`,disabled:!t,activate:()=>{t&&Y({type:`start`,executor:{kind:`agent`,agentId:t}})}}}case`start`:return{label:_.runTask,activate:gr,disabled:!Q}}})(),yr=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[vr?(0,K.jsx)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:dr||vr.disabled,onClick:vr.activate,children:vr.label}):null,Un?(0,K.jsxs)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:dr,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,K.jsx)(ce,{className:`size-4`}),_.reopenTask]}):null,C.task.phase!==`review`&&!Pn&&Vn?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:dr,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,K.jsx)(se,{className:`size-4`}),_.pauseTask]}):null,!jn&&!X&&C.task.phase!==`closed`&&C.task.phase!==`review`?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`]}):null,(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:dr||fr,"aria-label":_.moreActions,children:(0,K.jsx)(I,{className:`size-4`,"aria-hidden":!0})})}),(0,K.jsx)(Ie,{children:(0,K.jsxs)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[C.task.phase===`review`&&!Pn&&Vn?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:_.pauseTask}):null,C.task.phase===`review`&&!jn&&!X?(0,K.jsx)(Le,{disabled:!N,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:tr,children:$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`}):null,C.task.phase===`review`&&!jn&&Bn&&Q?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Q}}),children:_.runTask}):null,zn&&(Bn||jn||C.task.phase===`review`)?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`mark_ready`}),children:_.scheduleTask}):null,X?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),z(null),k(xe(e,X.id,X.version),{revalidate:!1}).catch(()=>z(_.actionFailed)).finally(()=>J(`command`,!1))},children:_.cancelActiveRun}):null,X?(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`}):null,C.task.phase===`closed`?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`})]}),(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(pr){z(_.deleteActiveTaskBlocked);return}rn(!0)},children:_.deleteTask})]})})]})]});return(0,K.jsxs)(`div`,{ref:Et,className:`flex h-full min-h-0 flex-col overflow-hidden ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${ct}%`},children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col bg-surface-base lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,K.jsxs)(`header`,{ref:Dt,className:B(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,lr(`title`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Ue?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),Ue]}):null,Ue?(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,K.jsx)(`span`,{children:_.taskLabel}),en?(0,K.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:en.source===`agent`?h===`zh`?`Agent 刚刚更新`:`Updated by Agent`:h===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ye?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":h===`zh`?`任务标题`:`Task title`,rows:2,value:Qe,onFocus:e=>{Yt.current?.value===Qe&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>$e(e.target.value),onBlur:()=>void _n(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),gn()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl outline-none [field-sizing:content]`}):(0,K.jsx)(U,{content:C.task.title,contentKey:`${e}:title`,language:h,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,K.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,K.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:C.task.title,onClick:hn,children:C.task.title})})}),$t===`title`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:gn,children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:H.has(`title`),onClick:()=>void _n(!0),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,K.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,be(In)),children:Ln})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Q?(0,K.jsx)(Ae,{agentId:Q,avatar:Wn?.avatar,size:20,className:`shrink-0`}):null,(0,K.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[_.executorLabel,` · `,Kn??Q??_.unassigned]})]}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,qe(C.task.updatedAt,h))})]})]}),(0,K.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center justify-end gap-2 border-b border-edge-subtle bg-surface-panel px-4 py-2 sm:px-5`,"aria-label":h===`zh`?`任务操作`:`Task actions`,children:[yr,R?(0,K.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:R}):null,(0,K.jsx)(ot,{language:h,hasSchedule:$.length>0},e)]}),(0,K.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[In===`review`?null:(0,K.jsx)(Tt,{ref:gt,detail:C,executorName:Jn,language:h,onUpdated:e=>{k(e,{revalidate:!1})}}),(0,K.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":h===`zh`?`交付结果`:`Results`,ref:ht,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,K.jsx)(ft,{detail:C,language:h}),(0,K.jsx)(rt,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":h===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:mt,tabIndex:-1,"aria-label":_.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-2xl bg-surface-panel`,summaryClassName:`min-h-12 cursor-pointer px-4 py-2 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[h===`zh`?`验收`:`Acceptance`,(0,K.jsxs)(`span`,{"aria-live":`polite`,className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,children:[Mn.filter(e=>e.status===`passed`).length,`/`,Mn.length]})]}),children:(0,K.jsx)(ut,{criteria:Mn,language:h,closed:C.task.phase===`closed`,pending:H.has(`acceptance`),error:fe,reviewDisabled:!C.acceptanceTarget||C.presentation.primaryAction?.type===`inspect_run`,blockedReason:jn?h===`zh`?`请先处理待办事项`:`Resolve the pending request first`:X?h===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:(e,t)=>On(C,e,t),projectId:C.task.projectId,conversationId:Z??void 0},`${e}:${C.task.latestContractVersion}:${C.acceptanceTarget?.id??``}`)})]}),(0,K.jsx)(rt,{panelId:`report`,chevron:!0,defaultOpen:!0,"data-task-section":`report`,"data-task-section-label":h===`zh`?`执行报告`:`Report`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`完整执行报告`:`Full execution report`,children:(0,K.jsx)(bt,{detail:C,language:h},Fn?.runId??e)}),!N&&!P?(0,K.jsx)(le,{className:`h-9 rounded-lg`}):null,P?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,K.jsx)(V,{variant:`ghost`,onClick:()=>void F(),children:h===`zh`?`重试`:`Retry`})]}):null,$.length>0?(0,K.jsx)(rt,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":h===`zh`?`执行时间`:`Schedule`,ref:ln,tabIndex:-1,className:`scroll-mt-24 rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm text-fg-muted`,title:(0,K.jsxs)(K.Fragment,{children:[h===`zh`?`执行时间`:`Execution schedule`,` · `,$.length,Qn===void 0?``:` · ${h===`zh`?`下次执行:`:`Next run: `}${qe(Qn,h)}`]}),children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(St,{schedules:$,language:h,onEdit:er,onUpdated:$n})})}):null,(0,K.jsx)(rt,{panelId:`goal`,chevron:!0,defaultOpen:!0,"data-task-section":`goal`,"data-task-section-label":h===`zh`?`目标说明`:`Goal`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h===`zh`?`任务目标`:`Task goal`}),(0,K.jsx)(U,{content:C.task.contract?.objective||C.task.title,contentKey:`${e}:goal`,language:h,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,K.jsxs)(V,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:mr,children:[_.successDefinition,` · `,Mn.length]})]}),rr.length>0?(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedOutputs}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(qt,{contentKey:`${e}:expectedOutputs`,items:rr,empty:_.noDefinition})})]}):null,(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`body`)&&`task-detail-live-update`),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:_.taskDescription}),tt?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>st(e.target.value),onBlur:()=>void vn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Lt.current=!0,st(C.task.body??C.task.contract?.objective??``),G(!1),queueMicrotask(()=>{Lt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,K.jsxs)(`div`,{className:`mt-2`,children:[Rn&&Rn!==C.task.title?(0,K.jsx)(U,{content:Rn,contentKey:`${e}:description`,language:h}):(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:_.noTaskDescription}),(0,K.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=C.task.body??C.task.contract?.objective??``;Jt.current=e,Xt.current={value:C.task.body??``,version:C.task.version},q(null),st(e),G(!0)},children:h===`zh`?`编辑说明`:`Edit description`})]}),$t===`description`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(C.task.body??``),q(null),G(!1)},children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void mn({body:at.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),cr?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`contract`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),ir.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:constraints`,items:ir,empty:_.noDefinition})})]}):null,ar.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:approvalRequired`,items:ar,empty:_.noDefinition})})]}):null,or.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:assumptions`,items:or,empty:_.noDefinition})})]}):null,sr.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:risks`,items:sr,empty:_.noDefinition})})]}):null]}):null]})})}),(0,K.jsxs)(rt,{panelId:`management`,chevron:!0,defaultOpen:!0,"data-task-section":`management`,"data-task-section-label":h===`zh`?`任务管理`:`Management`,"aria-label":h===`zh`?`任务管理`:`Task management`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务管理`:`Task management`,children:[(0,K.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,K.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(Rt,{value:C.task.phase,disabled:H.has(`phase`),canMove:ur,canApprove:Hn,canReopen:Un,language:h,label:_.taskPhase,onChange:yn}),(0,K.jsx)(zt,{value:C.task.priority,disabled:H.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:bn}),(0,K.jsx)(Bt,{value:Pt(C.task.dueAt),disabled:H.has(`dueAt`),label:_.dueDate,onChange:xn}),(0,K.jsx)(Vt,{value:C.conversation.currentExecutorAgentId??``,disabled:H.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,language:h,onChange:En})]})]}),(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`dependencies`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[_.taskRelations,` · `,C.dependencies.length,` / `,C.dependents.length]}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,K.jsx)(Ht,{candidates:Ve,selected:C.dependencies,disabled:H.has(`dependencies`),labels:un,getTaskHref:pn,onChange:Tn})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),C.dependents.length>0?(0,K.jsx)(`div`,{className:`space-y-1.5`,children:C.dependents.map(t=>(0,K.jsx)(U,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:h,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,K.jsx)(c,{to:pn(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,K.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]}),C.task.phase===`closed`?null:(0,K.jsxs)(V,{variant:`ghost`,className:`my-3`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:_.scheduleRecurringTask]}),(0,K.jsxs)(`details`,{className:`mb-4 rounded-xl bg-surface-inset p-5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:h===`zh`?`关联内容`:`Related work`}),nr.length>0||C.runs.length>0||Zn.length>0||C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[nr.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`对话 · ${nr.length}`:`Conversations · ${nr.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:sessions`,language:h,className:`mt-2`,children:nr.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(c,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,Zn.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`自动化 · ${Zn.length}`:`Automations · ${Zn.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:automations`,language:h,className:`mt-2`,children:Zn.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(c,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.taskRelations}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:h===`zh`?`${C.dependencies.length} 个前置任务 · ${C.dependents.length} 个后续任务`:`${C.dependencies.length} prerequisites · ${C.dependents.length} dependents`})]}):null]}):(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h===`zh`?`还没有关联内容`:`No related work yet`}),(0,K.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,K.jsx)(et,{resource:{kind:`task`,id:C.task.id,revision:String(C.task.version)},disabled:Ye||tt||H.size>0})})]}),Xn.length>0?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`context`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,K.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Xn.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,K.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,K.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,K.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,K.jsx)(rt,{panelId:`activity`,chevron:!0,defaultOpen:!0,"data-task-section":`activity`,"data-task-section-label":h===`zh`?`活动留言`:`Activity`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-semibold text-fg`,title:h===`zh`?`活动记录与留言`:`Activity and updates`,children:(0,K.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,K.jsx)(At,{taskId:e},e),(0,K.jsx)(xt,{changes:C.phaseChanges,language:h})]})})]})]}),(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(ct),tabIndex:0,onPointerDown:wn,onKeyDown:Cn,onDoubleClick:()=>Sn(Wt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,K.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)]`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:h===`zh`?`执行对话`:`Execution chat`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[nr.length>1?(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:h===`zh`?`${nr.length} 段对话`:`${nr.length} conversations`})}),(0,K.jsx)(Ie,{children:(0,K.jsx)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:nr.map(t=>(0,K.jsx)(Le,{asChild:!0,children:(0,K.jsx)(c,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,Z?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:B(`size-8 p-0`,Yn&&`bg-surface-hover text-fg`),"aria-label":h===`zh`?`项目文件`:`Project files`,"aria-pressed":Yn,onClick:()=>{De.getState().openFiles(Z),x(Z)},children:(0,K.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,K.jsx)(V,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,K.jsx)(c,{to:ae(e),"aria-label":h===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,K.jsx)(L,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),Z?(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(E,{embedded:!0,conversationId:Z,taskId:e})}):j?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-danger`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),an?(0,K.jsx)(wt,{automation:sn??void 0,taskId:e,taskTitle:C.task.title,projectId:C.task.projectId,executorAgentId:Q,language:h,onClose:()=>on(!1),onCreated:$n},`${e}:${sn?.id??`new`}`):null,(0,K.jsx)(Ne,{open:nn,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,C.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{rn(!1),Dn()},onCancel:()=>rn(!1)})]})}function Zt(){let e=(0,G.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,K.jsx)(Xt,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Qt(e){return e.id}export{Zt as TaskDetailPage,Xt as TaskDetailView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./file-text-D12HbeVy.js";import{t as c}from"./markdown-view-BwbjZnQ6.js";import{t as l}from"./cn-0WouolD0.js";import{ht as u}from"./session-manager-BRzFtnn4.js";import{t as d,u as f}from"./workspace-preview-store-QUX-jyAL.js";import{t as p}from"./button-C5tRaJxt.js";import{t as m}from"./activity-store-9wMoZ4Ok.js";import{m as h,o as g}from"./shares-api-BxQqmxkq.js";var _=n(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:d,className:f,children:p}=e,m=o===void 0||o,h=s!==void 0&&s,g=d===void 0?240:d,b;t[0]===n?b=t[1]:(b=u(n),t[0]=n,t[1]=b),n=b;let x=(0,v.useId)(),S=(0,v.useRef)(null),[C,w]=(0,v.useState)(!1),[T,E]=i(),D;t[2]!==r||t[3]!==T?(D=T.getAll(`taskExpanded`).includes(r),t[2]=r,t[3]=T,t[4]=D):D=t[4];let O=D,k;t[5]===g?k=t[6]:(k=()=>{let e=S.current;if(!e)return;let t=()=>w(e.scrollHeight>g);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[5]=g,t[6]=k);let A;t[7]!==n||t[8]!==g?(A=[n,g],t[7]=n,t[8]=g,t[9]=A):A=t[9],(0,v.useLayoutEffect)(k,A);let j=C&&!O,M;t[10]===f?M=t[11]:(M=l(`min-w-0`,f),t[10]=f,t[11]=M);let N;t[12]!==j||t[13]!==g?(N=j?{maxHeight:g,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,g/3)}px), transparent)`}:void 0,t[12]=j,t[13]=g,t[14]=N):N=t[14];let P;t[15]!==h||t[16]!==p||t[17]!==n||t[18]!==m?(P=p??(m?(0,y.jsx)(c,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,y.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=p,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,y.jsx)(`div`,{ref:S,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==x||t[24]!==F||t[25]!==N?(I=(0,y.jsx)(`div`,{id:x,style:N,children:F}),t[23]=x,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==x||t[30]!==a||t[31]!==C||t[32]!==E?(L=C?(0,y.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":x,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>E(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return O||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?O?`收起`:`查看更多`:O?`Show less`:`Show more`}):null,t[27]=r,t[28]=O,t[29]=x,t[30]=a,t[31]=C,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,y.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function x({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),h=(0,v.useRef)(null),g=e.kind===`approval`,_=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function b(a){if(!g&&!i.trim()||g&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);h.current?.signature!==c&&(h.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await f(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:g?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,h.current.key);d(!0),r(o),m({tone:`success`,title:g?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,y.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),b()},children:[g?(0,y.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,y.jsx)(`p`,{children:e.reason}),(0,y.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void b(`approve`),children:n?`批准`:`Approve`}),(0,y.jsx)(p,{type:`button`,disabled:o||u,onClick:()=>void b(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,y.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),_.length>0&&(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,y.jsx)(p,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,y.jsx)(p,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function S(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function C({uri:e,zh:t}){let[n,r]=(0,v.useState)(),[i,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``);async function m(){o(!0),u(``);try{let n=S(e,(await h()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{o(!1)}}async function _(){if(!(!n||i)){o(!0),u(``);try{let e=await g(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{o(!1)}}}return(0,y.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void m(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,y.jsx)(p,{type:`button`,disabled:i,onClick:()=>void _(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,y.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,y.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,y.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function w(e){let t=(0,_.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:c,compact:l}=e,u=l!==void 0&&l,f=d(T);if(!n.length)return null;let p=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,m;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==r||t[6]!==f){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==f?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),d=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,y.jsx)(b,{content:p,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,y.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,y.jsx)(o,{className:`size-4 shrink-0`}),(0,y.jsx)(`span`,{className:`min-w-0 break-words`,children:p})]}):d&&(r||i)?(0,y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>c?c(n):f(n,null,r,i),children:[(0,y.jsx)(s,{className:`size-4 shrink-0`}),p]}):(0,y.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:p})}),l&&e.kind===`artifact`&&(0,y.jsx)(C,{uri:n,zh:a===`zh`},n),u&&!l&&!(d&&(r||i))?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&e.summary?(0,y.jsx)(b,{content:e.summary,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,u?null:(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[8]=u,t[9]=i,t[10]=a,t[11]=c,t[12]=r,t[13]=f,t[14]=e):e=t[14],m=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=c,t[5]=r,t[6]=f,t[7]=m}else m=t[7];let h;return t[15]!==p||t[16]!==m?(h=(0,y.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":p,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function T(e){return e.setPath}export{x as n,b as r,w as t};
|