@xopcai/xopc 0.0.467 → 0.0.469
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/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CdEua6PR.js → activity-store-DKP2sWTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-l8GQ4I9J.js → agent-avatar-dicebear-BR85bT1W.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BO1bqKlR.js → agent-avatar-display-CIsejg_E.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Dj_H2kDD.js → agent-defaults-settings-panel-CxLUEl0V.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BQA2brAU.js → agent-plugin-dialog-Cvj04Ckm.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C5C5l13A.js → agents-DZftplJc.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DZ1lLnrj.js → agents-admin-api-BL8lN8gP.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DDWYNF7I.js → api-BnS9d0p6.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DVXcGKP-.js → api-V4P8zfkJ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B5-7E03Z.js → app-management-settings-panel-CAEry5Vu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-E_BcjEDM.js → appearance-settings-CphsmJgM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BjB_mjXu.js → apps-page-CXKTWj1s.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-MvSiDvxK.js → archive-plugin-DS6JWBPZ.js} +1 -1
- package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
- package/dist/gateway/static/root/assets/{automation-api-24NjW7qG.js → automation-api-GcRQ9wM4.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-C94Q3OEL.js → automation-result-state-Dcp0JX0w.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-BShRirWV.js → automation-run-list-BLejrWpG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-Bgq5Plux.js → automation-task-card-BNT3n0qu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-3WGWLdiW.js → automations-page-DqrAOReO.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
- package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-DAWXPErA.js → block-editor-jy5CCmhH.js} +9 -9
- package/dist/gateway/static/root/assets/{browser-settings-page-DI2PYAPC.js → browser-settings-page-Dd2eTtvL.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dyw8xW90.js → capabilities-CaJjMTli.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
- package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
- package/dist/gateway/static/root/assets/{chat-agents-api-BksS0CNy.js → chat-agents-api-Bim8--J9.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-aZIklMNN.js → chat-chart-block-B_c5sy7q.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4HoRIzf.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-VhBEUFmw.js → command-palette-api-DPtCt8Je.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-BhRAbdPW.js → composer-model-config-control-BF9PPSiu.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-nT-U6jcc.js → composer-notifications-B0IZsy8x.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-xEFHDnLo.js → composer-payload-handoff-CRCz17sd.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DXlH96m6.js → computer-settings-page-CtfitoMZ.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-D8vBFsbY.js → connected-providers-grid-DUHMZjyV.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-C8jPm7QO.js → connection-usage-guide-CM5qgMcK.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-B42yWHxS.js → connector-service-page-DLbBblN2.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-so2a7xrD.js → connectors-api-BUdH4tZQ.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-yhOZIiUZ.js → connectors-page-HHGB3r3Q.js} +1 -1
- package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-UEh3JM7r.js → date-picker-DRSq2kDz.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Dci0LfAU.js → date-time-picker--LGC1D3b.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BAU_GuBe.js → desktop-pet-1oXlQvjH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CYE2eTTf.js → desktop-pet-settings-GdOjz7W9.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-C7v4CIlF.js → dev-view-store-DnQ2nBtV.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-7NDkYmiZ.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DmRZY8kg.js → directory-picker-path-field-DBe_paLy.js} +1 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D8TAJgZ_.js → extension-debug-page-DIAyDA-a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CjfRKtQ4.js → extension-iframe-host-CCe4R7L7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-V1oFBxVi.js → extension-marketplace-api-baFXdV56.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-DZahH1Hd.js → extension-message-router-BD0ZamBV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMuHBIHa.js → extension-page-C09dlV3J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-lqJ1zIkA.js → extension-provider-BhluafoX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D5IfKVff.js → extension-settings-page-CB8KLYoG.js} +1 -1
- package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
- package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
- package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
- package/dist/gateway/static/root/assets/{file-preview-surface-B7B9qXm9.js → file-preview-surface-CeFFZo3a.js} +1 -1
- package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dk3FtNv1.js → gateway-config-swr-DVXDJNCI.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DMvo4pAc.js → gateway-realtime-BnwNxbyc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BpnGXAhi.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-C2h5R1eP.js → gateway-restart-Bws2Shaz.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DGPaikv5.js → gateway-settings-BU5Cp4Bw.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-yZn7ShiP.js → gateway-startup-retry-2jU7zCyx.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-gsAa0Kj9.js → global-defaults-api-CNyJ0dGb.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BBTtXpDD.js → home-page-8KwhWlYt.js} +3 -3
- package/dist/gateway/static/root/assets/{image-generation-api-DPn1SBMH.js → image-generation-api-CiqQSx5j.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Cc48Uq20.js → imports-page-B9JMNXwt.js} +1 -1
- package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
- package/dist/gateway/static/root/assets/index-D5hovYIw.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-QkJMw_uW.js → install-connector-dialog-BZjodnUC.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BZXqXuI4.js → keyboard-shortcuts-settings-A37hYJtR.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-D-bRvlZY.js → local-apps-page-Ct8z2B7R.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CZ19DRRK.js → local-session-drafts-CgAuYyKi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DIBIYLnI.js → locale-store-Cit_aHqC.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
- package/dist/gateway/static/root/assets/{management-api-EG5duPec.js → management-api-DG-yZnHK.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-B7RWHrwo.js → management-settings-CUQd0FJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-C30KvTaE.js → markdown-view-Dm01GIXv.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BZ1PDTYY.js → mcp-conversation-setup-page-YvPXchDz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CW5UoTx6.js → media-plugins-jsWNdARw.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DQveK9sk.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-COGICRIG.js → model-selector-Cg2kTsE7.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
- package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-enDU_32p.js → oauth-api-Bz_PU9R_.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-C2pfvPOI.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BaSooYGv.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-4-3RtO0q.js → page-context-draft-BjbX5zd7.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
- package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-DwMdjQ6H.js → personal-profile-settings-CNI5Eor6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-DiNpP_g3.js → personal-settings-panel-BcrpYRn9.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DUT-qRLZ.js → phone-dependencies-card-CJ3ovsW1.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-pvOciDNo.js → phone-model-connection-DKvOEjWH.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CD97E6C5.js → phone-model-picker-CNTcpY1A.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-BUZ1dh7s.js → phone-settings-page-DvX6okzz.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BwilERgv.js → phone-workspace-store-CKOW55gy.js} +1 -1
- package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
- package/dist/gateway/static/root/assets/{plugin-details-dialog-C_uOVmJv.js → plugin-details-dialog-BDoSffLO.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BSUgcO7-.js → preference-select-fields-BKmzpfHq.js} +1 -1
- package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
- package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
- package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
- package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dy6D5exJ.js → product-open-page-DXwOPgRP.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DEUPAilo.js → product-preview-content-DiQbeaCK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C4TV9RUd.js → product-preview-modal-BU7Qojpq.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-lOJ5Tz2V.js → project-understanding-Dv26vu9S.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-B3aGdPHy.js → projects-page-DGATZB23.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-C26HgxZY.js → providers-api-BXa2Aheb.js} +1 -1
- package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-pQ0eInzG.js → registry-api-BEnvt9-6.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CjWrYzjf.js → remote-access-hub-_7tmWand.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-Y9WRHOnz.js → resource-unavailable-fk26VrOL.js} +1 -1
- package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-BoJQ3u5o.js → runtime-tools-api-CL6CG-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DB7cfLrX.js → runtime-tools-settings-panel-CdvQRxCR.js} +1 -1
- package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-_rFmwIwY.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-a6wb0_Gf.js → session-api-CkOliupg.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
- package/dist/gateway/static/root/assets/{sessions-page-dEupc-3A.js → sessions-page-CN9ESZdY.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BYrXsPjK.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CnGJr2xp.js → settings-advanced-section-Zex2dJo7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DWRhupcY.js → settings-mode-store-Dk0bZQgo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D9A2DdJ_.js → settings-page-bCW4rave.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-wL2jvs-y.js → settings-page-header-B9Y_eGcH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BkUQVmyY.js → settings-page-layout-D1MgJ5zP.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-D238tuw-.js → setup-interaction-page-BYXDX0F2.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DXvYjIu3.js → setup-status-panel-Bhda3jS2.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-DFDJyl3N.js → share-link-dialog-BxFk4-4u.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
- package/dist/gateway/static/root/assets/{shares-api-CfFiW03g.js → shares-api-ChBHTPKN.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
- package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CWRhFSkA.js → skill-api-TQAyWHGS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-CmPp2czp.js → skill-list-api-D4eokPXx.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BGsSq3dj.js → skill-reload-api-Bm-8vhsQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DqD0FPeH.js → skills-page-CfhEcU8L.js} +1 -1
- package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
- package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
- package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-aw9C86I8.js → system-settings-panel-CvL5G2w1.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
- package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-C-zIBpzi.js → task-result-evidence-Bmgta9z9.js} +1 -1
- package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
- package/dist/gateway/static/root/assets/{terminal-panel-store-CgPqgrm7.js → terminal-panel-store-B1bAD5Xf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DxF7S6I2.js → theme-store-C1MxmBg7.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-Dvlunx28.js → tracing-settings-page-CvXDgIJQ.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CIte6n0U.js → tunnel-api-BkhCBt38.js} +1 -1
- package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
- package/dist/gateway/static/root/assets/{understanding-activity-store-C2RHmRo8.js → understanding-activity-store-BYGCmCVb.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CPeQIXS_.js → understanding-refresh-store-DaLVsdYS.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DPUjEj39.js → usage-page-C-NM6vtY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-xX2KrbXw.js → use-autosave-CvjQMyY8.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
- package/dist/gateway/static/root/assets/{use-realtime-voice-RQW5KnIN.js → use-realtime-voice-cugjs8cK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-B6QFV5gR.js → use-workspace-tree-Crfx5ctU.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-hKnsTcMk.js → user-model-page-BvnLbTYx.js} +1 -1
- package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BeEF7Thh.js → voice-api-key-field-M7KB_Gl1.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-vbBoKnqd.js → voice-config-api-BLGbUq3v.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CKn6X3qL.js → voice-input-shortcut-events-CxH3RDXi.js} +1 -1
- package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
- package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ddvqu02U.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BdBpri6P.js → work-discovery-page-DappIHQq.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DStgfCzQ.js → working-directory-picker-modal-W2QiUVjN.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DwpWKogz.js +1 -0
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CBHFZ2iQ.js → workspace-open-location-menu-Dh0TvTkH.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Cm0Saa8B.js → xopc-cloud-account-card-DGAGXbGI.js} +1 -1
- package/dist/gateway/static/root/index.html +136 -123
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/packages/gateway-contract/src/clarifications.js +20 -2
- package/dist/packages/gateway-contract/src/index.js +6 -4
- package/dist/packages/gateway-contract/src/music-generation.js +5 -2
- package/dist/packages/gateway-contract/src/space.js +23 -0
- package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/task-runs.js +1 -0
- package/dist/packages/gateway-contract/src/tasks.js +118 -6
- package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
- package/dist/packages/gateway-contract/src/video-generation.js +29 -4
- package/dist/src/agent/agent-manager.js +2 -2
- package/dist/src/agent/background-review/prompts.js +5 -1
- package/dist/src/agent/embedded/agent-profile-context.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
- package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
- package/dist/src/agent/orchestration/turn-recovery.js +25 -6
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service/webchat-tts.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/apply-patch.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -0
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-memory-tool.js +12 -10
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-task-tool.js +12 -7
- package/dist/src/agent/tools/publish-artifacts.js +2 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -0
- package/dist/src/agent/tools/tool-media.d.ts +3 -1
- package/dist/src/agent/tools/tool-media.js +2 -0
- package/dist/src/agent/tools/video-draft-tool.d.ts +1 -0
- package/dist/src/agent/tools/video-draft-tool.js +5 -1
- package/dist/src/agent/tools/xopc-use-tool.js +21 -4
- package/dist/src/agent-catalog/test-support.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +30 -6
- package/dist/src/automations/capabilities/write.js +2 -2
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/domain/types.d.ts +6 -0
- package/dist/src/automations/domain/validation.d.ts +60 -12
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.js +14 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +9 -9
- package/dist/src/computer/errors.d.ts +2 -2
- package/dist/src/computer/evaluation.d.ts +7 -7
- package/dist/src/computer/runtime.d.ts +4 -4
- package/dist/src/config/schema.d.ts +2 -2
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +2 -2
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory-learning.js +19 -3
- package/dist/src/gateway/hono/routes/models.js +7 -0
- package/dist/src/gateway/hono/routes/music-generation.js +26 -3
- package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/space.d.ts +3 -0
- package/dist/src/gateway/hono/routes/space.js +105 -0
- package/dist/src/gateway/hono/routes/tasks.js +27 -28
- package/dist/src/gateway/hono/routes/video-generation.js +9 -6
- package/dist/src/gateway/html-preview-shell.d.ts +1 -1
- package/dist/src/gateway/html-preview-shell.js +3 -0
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +10 -3
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
- package/dist/src/home-intelligence/follow-ups.js +2 -1
- package/dist/src/home-intelligence/routines.js +1 -1
- package/dist/src/local-apps/automation-proposals.d.ts +54 -12
- package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
- package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
- package/dist/src/media/session-references.d.ts +4 -1
- package/dist/src/media/session-references.js +40 -8
- package/dist/src/memory-learning/work-capture.js +2 -1
- package/dist/src/memory-learning/work-review.d.ts +2 -0
- package/dist/src/memory-learning/work-review.js +25 -2
- package/dist/src/music-generation/artifact.js +3 -1
- package/dist/src/music-generation/mureka.js +1 -1
- package/dist/src/music-generation/provider.d.ts +4 -1
- package/dist/src/music-generation/provider.js +6 -1
- package/dist/src/music-generation/providers.d.ts +3 -1
- package/dist/src/music-generation/providers.js +39 -16
- package/dist/src/music-generation/repository.d.ts +3 -1
- package/dist/src/music-generation/repository.js +12 -3
- package/dist/src/music-generation/tencent-mps.d.ts +11 -0
- package/dist/src/music-generation/tencent-mps.js +151 -0
- package/dist/src/music-generation/worker.js +16 -5
- package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
- package/dist/src/music-generation/xopc-cloud.js +38 -0
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- 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.js +16 -7
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +17 -7
- package/dist/src/personal-agent/request-service.js +6 -10
- package/dist/src/personal-agent/result-extraction.js +13 -13
- package/dist/src/personal-agent/schedules.d.ts +9 -0
- package/dist/src/personal-agent/schedules.js +44 -0
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +6 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -0
- package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
- package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
- package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
- package/dist/src/providers/xopc-cloud-media.js +67 -0
- package/dist/src/providers/xopc-cloud-model-source.js +4 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +1 -1
- package/dist/src/session/client-history.d.ts +4 -1
- package/dist/src/session/client-history.js +18 -0
- package/dist/src/session/compact-history.js +30 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/space/ingest.d.ts +36 -0
- package/dist/src/space/ingest.js +149 -0
- package/dist/src/space/repository.d.ts +39 -0
- package/dist/src/space/repository.js +325 -0
- package/dist/src/space/worker.d.ts +14 -0
- package/dist/src/space/worker.js +199 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +9 -2
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +8 -7
- package/dist/src/storage/sqlite/schema.sql +104 -0
- package/dist/src/storage/sqlite/transcript-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/278_music_job_error_code.sql +6 -0
- package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
- package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
- package/dist/src/tasks/capabilities/management.d.ts +15 -2
- package/dist/src/tasks/capabilities/management.js +8 -2
- package/dist/src/tasks/capabilities/read.js +14 -2
- package/dist/src/tasks/capabilities/relations.d.ts +13 -7
- package/dist/src/tasks/capabilities/write.d.ts +118 -2
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +7 -9
- package/dist/src/tasks/task-allocation-service.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +8 -2
- package/dist/src/tasks/task-application-service.js +94 -27
- package/dist/src/tasks/task-collaboration-repository.js +12 -1
- package/dist/src/tasks/task-context-assembler.js +9 -3
- package/dist/src/tasks/task-contract-planner.js +1 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
- package/dist/src/tasks/task-conversation-summary.js +3 -1
- package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
- package/dist/src/tasks/task-criterion-review-repository.js +70 -23
- package/dist/src/tasks/task-deliverables.d.ts +7 -0
- package/dist/src/tasks/task-deliverables.js +112 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-instruction-sequence.js +10 -3
- package/dist/src/tasks/task-json-acceptance.js +3 -5
- package/dist/src/tasks/task-origin-repository.d.ts +99 -1
- package/dist/src/tasks/task-origin-repository.js +67 -5
- package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
- package/dist/src/tasks/task-read-model-projector.js +123 -9
- package/dist/src/tasks/task-repository.d.ts +4 -1
- package/dist/src/tasks/task-repository.js +34 -11
- package/dist/src/tasks/task-research-repair.d.ts +2 -2
- package/dist/src/tasks/task-research-result.d.ts +1 -0
- package/dist/src/tasks/task-research-result.js +13 -3
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
- package/dist/src/tasks/task-result-delivery-repository.js +35 -17
- package/dist/src/tasks/task-result-delivery-service.js +22 -7
- package/dist/src/tasks/task-result-versions.d.ts +11 -0
- package/dist/src/tasks/task-result-versions.js +34 -0
- package/dist/src/tasks/task-run-coordinator.js +28 -15
- package/dist/src/tasks/task-run-dispatcher.js +29 -4
- package/dist/src/tasks/task-run-repository.d.ts +2 -0
- package/dist/src/tasks/task-run-repository.js +62 -19
- package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
- package/dist/src/tasks/task-workspace-verification.js +95 -0
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/user-model/action-rule-suggestions.js +4 -3
- package/dist/src/user-model/capture/evidence-policy.d.ts +7 -1
- package/dist/src/user-model/capture/evidence-policy.js +68 -2
- package/dist/src/user-model/capture/executor.js +62 -14
- package/dist/src/video-generation/artifact.js +3 -1
- package/dist/src/video-generation/drafts.d.ts +1 -0
- package/dist/src/video-generation/drafts.js +6 -0
- package/dist/src/video-generation/providers.d.ts +1 -0
- package/dist/src/video-generation/providers.js +37 -5
- package/dist/src/video-generation/repository.d.ts +5 -3
- package/dist/src/video-generation/repository.js +30 -8
- package/dist/src/video-generation/settings.d.ts +1 -0
- package/dist/src/video-generation/settings.js +10 -4
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CH9gYqIK.js +0 -9
- package/dist/gateway/static/root/assets/binary-plugins-MFVtTdvy.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-CFWTer_v.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-C2RB9fzC.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjaLTd6i.js +0 -8
- package/dist/gateway/static/root/assets/channels-DiDfjON8.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-BtMkdtxJ.js +0 -71
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-DIeg1mg8.js +0 -1
- package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +0 -1
- package/dist/gateway/static/root/assets/index-BJj-uZNl.js +0 -11
- package/dist/gateway/static/root/assets/index-DiWUK4sJ.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-wekatwet.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CukseY3k.js +0 -2
- package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-aRYHi2dh.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-D5BtgBxy.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +0 -1
- package/dist/gateway/static/root/assets/notes-api-BXevQivV.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DyM-3O_9.js +0 -8
- package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BPQpvC34.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
- package/dist/gateway/static/root/assets/personal-page-BB4Sv68K.js +0 -1
- package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-BlwtlUY7.js +0 -7
- package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BG2nDt98.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-BJkXktA-.js +0 -1
- package/dist/gateway/static/root/assets/right-workspace-store-DHHyicqQ.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-BYqg1BYz.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-Coh2B0j7.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-D5g6LOU-.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-DjyibJZ1.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-CyCv69rh.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-B85XIDFv.js +0 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DgsLOz6h.js +0 -3
- package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-C9GpCJQR.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Daf-LmiF.js +0 -15
- package/dist/gateway/static/root/assets/use-personal-profile-BJgaheR4.js +0 -1
- package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-BUrk4mwV.js +0 -1
- package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-CscTRODe.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CyPjTDSx.js +0 -1
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-JSGIA79T.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-DNLnuHlf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Cit_aHqC.js";import{t as a}from"./calendar-days-hw_Y-g-s.js";import{t as ee}from"./chevron-left-DqFhpbvK.js";import{t as te}from"./chevron-right-BweFrslA.js";import{c as ne,l as re,u as ie}from"./popover-select-CLsphyzA.js";import{t as ae}from"./cn-0WouolD0.js";import{c as oe,n as se,s as ce}from"./dist-GJ8-1PAx.js";var o=e(t(),1),le=n();function s(e){return String(e).padStart(2,`0`)}function ue(e){return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}function de(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function fe(e,t){let n=de(e);return n?t===`zh`?`${n.getFullYear()}/${s(n.getMonth()+1)}/${s(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var c=r();function pe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function l(e){let t=(0,le.c)(106),{value:n,onChange:r,disabled:s,className:l,ariaLabel:ve,placeholder:ye,min:u,max:d}=e,f=i(_e),p=f===`zh`?`zh-CN`:`en`,be;t[0]===n?be=t[1]:(be=de(n),t[0]=n,t[1]=be);let m=be,[h,xe]=(0,o.useState)(!1),[Se,Ce]=(0,o.useState)(null),g;t[2]===m?g=t[3]:(g=()=>m??new Date,t[2]=m,t[3]=g);let[_,we]=(0,o.useState)(g),Te=ne(Se),Ee=ie(re(),Te!==null),v=+(f===`zh`),y,b;t[4]!==h||t[5]!==n?(y=()=>{if(!h)return;let e=de(n);e&&we(e)},b=[h,n],t[4]=h,t[5]=n,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,o.useEffect)(y,b);let x;t[8]!==_||t[9]!==v?(x=pe(_,v),t[8]=_,t[9]=v,t[10]=x):x=t[10];let De=x,S;if(t[11]!==p||t[12]!==v){let e=new Date(2026,7,23,12);S=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+v+n),new Intl.DateTimeFormat(p,{weekday:`narrow`}).format(r)}),t[11]=p,t[12]=v,t[13]=S}else S=t[13];let Oe=S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=ue(new Date),t[14]=C):C=t[14];let w=C,T;t[15]===m?T=t[16]:(T=m?ue(m):``,t[15]=m,t[16]=T);let E=T,D;t[17]!==p||t[18]!==_?(D=new Intl.DateTimeFormat(p,{year:`numeric`,month:`long`}).format(_),t[17]=p,t[18]=_,t[19]=D):D=t[19];let ke=D,O;t[20]===r?O=t[21]:(O=e=>{r(e),xe(!1)},t[20]=r,t[21]=O);let k=O,Ae=oe,je=s&&`cursor-not-allowed opacity-50`,A;t[22]!==l||t[23]!==je?(A=ae(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,je,l),t[22]=l,t[23]=je,t[24]=A):A=t[24];let Me=!n&&`text-fg-subtle`,j;t[25]===Me?j=t[26]:(j=ae(`min-w-0 truncate tabular-nums`,Me),t[25]=Me,t[26]=j);let M;t[27]!==f||t[28]!==ye||t[29]!==n?(M=fe(n,f)||ye||(f===`zh`?`选择日期`:`Select date`),t[27]=f,t[28]=ye,t[29]=n,t[30]=M):M=t[30];let N;t[31]!==j||t[32]!==M?(N=(0,c.jsx)(`span`,{className:j,children:M}),t[31]=j,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,c.jsx)(a,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=P):P=t[34];let F;t[35]!==ve||t[36]!==s||t[37]!==A||t[38]!==N?(F=(0,c.jsx)(ce,{asChild:!0,children:(0,c.jsxs)(`button`,{ref:Ce,type:`button`,disabled:s,"aria-label":ve,className:A,children:[N,P]})}),t[35]=ve,t[36]=s,t[37]=A,t[38]=N,t[39]=F):F=t[39];let Ne=oe,Pe=Te??void 0,Fe=oe,Ie=Te??void 0,Le=ae(Ee,`max-h-[var(--radix-popover-content-available-height)] w-[19rem] max-w-[var(--radix-popover-content-available-width)] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 shadow-float outline-none`),Re=f===`zh`?`上个月`:`Previous month`,I,L;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>we(ge),L=(0,c.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[40]=I,t[41]=L):(I=t[40],L=t[41]);let R;t[42]===Re?R=t[43]:(R=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Re,onClick:I,children:L}),t[42]=Re,t[43]=R);let z;t[44]===ke?z=t[45]:(z=(0,c.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ke}),t[44]=ke,t[45]=z);let ze=f===`zh`?`下个月`:`Next month`,B,V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>we(he),V=(0,c.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[46]=B,t[47]=V):(B=t[46],V=t[47]);let H;t[48]===ze?H=t[49]:(H=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":ze,onClick:B,children:V}),t[48]=ze,t[49]=H);let U;t[50]!==R||t[51]!==z||t[52]!==H?(U=(0,c.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[R,z,H]}),t[50]=R,t[51]=z,t[52]=H,t[53]=U):U=t[53];let W;t[54]===Oe?W=t[55]:(W=(0,c.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:Oe.map(me)}),t[54]=Oe,t[55]=W);let G;if(t[56]!==De||t[57]!==p||t[58]!==d||t[59]!==u||t[60]!==k||t[61]!==E||t[62]!==_){let e;t[64]!==p||t[65]!==d||t[66]!==u||t[67]!==k||t[68]!==E||t[69]!==_?(e=e=>{let t=ue(e),n=t===E,r=t===w,i=e.getMonth()!==_.getMonth(),a=!!(u&&t<u||d&&t>d);return(0,c.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-disabled":a,disabled:a,"aria-label":new Intl.DateTimeFormat(p,{dateStyle:`full`}).format(e),className:ae(`mx-auto flex h-9 w-full max-w-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i&&`text-fg-disabled`,a&&`cursor-not-allowed opacity-35 hover:bg-transparent`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-on-accent hover:bg-accent-hover`),onClick:()=>k(t),children:e.getDate()},t)},t[64]=p,t[65]=d,t[66]=u,t[67]=k,t[68]=E,t[69]=_,t[70]=e):e=t[70],G=De.map(e),t[56]=De,t[57]=p,t[58]=d,t[59]=u,t[60]=k,t[61]=E,t[62]=_,t[63]=G}else G=t[63];let K;t[71]===G?K=t[72]:(K=(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:G}),t[71]=G,t[72]=K);let Be=!n,q;t[73]===k?q=t[74]:(q=()=>k(``),t[73]=k,t[74]=q);let Ve=f===`zh`?`清除`:`Clear`,J;t[75]!==Be||t[76]!==q||t[77]!==Ve?(J=(0,c.jsx)(`button`,{type:`button`,disabled:Be,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:q,children:Ve}),t[75]=Be,t[76]=q,t[77]=Ve,t[78]=J):J=t[78];let He=!!(u&&w<u||d&&w>d),Y;t[79]===k?Y=t[80]:(Y=()=>k(w),t[79]=k,t[80]=Y);let Ue=f===`zh`?`今天`:`Today`,X;t[81]!==He||t[82]!==Y||t[83]!==Ue?(X=(0,c.jsx)(`button`,{type:`button`,disabled:He,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80 disabled:pointer-events-none disabled:opacity-35`,onClick:Y,children:Ue}),t[81]=He,t[82]=Y,t[83]=Ue,t[84]=X):X=t[84];let Z;t[85]!==J||t[86]!==X?(Z=(0,c.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=Z):Z=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,c.jsx)(se,{className:`fill-surface-overlay`}),t[88]=We):We=t[88];let Q;t[89]!==Fe.Content||t[90]!==Ie||t[91]!==Le||t[92]!==U||t[93]!==W||t[94]!==K||t[95]!==Z?(Q=(0,c.jsxs)(Fe.Content,{align:`start`,sideOffset:6,collisionPadding:12,collisionBoundary:Ie,className:Le,children:[U,W,K,Z,We]}),t[89]=Fe.Content,t[90]=Ie,t[91]=Le,t[92]=U,t[93]=W,t[94]=K,t[95]=Z,t[96]=Q):Q=t[96];let $;t[97]!==Ne.Portal||t[98]!==Pe||t[99]!==Q?($=(0,c.jsx)(Ne.Portal,{container:Pe,children:Q}),t[97]=Ne.Portal,t[98]=Pe,t[99]=Q,t[100]=$):$=t[100];let Ge;return t[101]!==h||t[102]!==Ae.Root||t[103]!==F||t[104]!==$?(Ge=(0,c.jsxs)(Ae.Root,{open:h,onOpenChange:xe,children:[F,$]}),t[101]=h,t[102]=Ae.Root,t[103]=F,t[104]=$,t[105]=Ge):Ge=t[105],Ge}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Cit_aHqC.js";import{t as a}from"./cn-0WouolD0.js";import{t as o}from"./date-picker-DRSq2kDz.js";import{t as s}from"./time-picker-C1PXAXZF.js";var c=n(),l=e(t(),1),u=r();function d(e){let t=(0,c.c)(33),{label:n,value:r,onChange:d,defaultTime:p,disabled:m,className:h}=e,g=(0,l.useId)(),_=i(f)===`zh`,v,y;if(t[0]!==r){let[e,n]=r.split(`T`);v=e,y=n?.slice(0,5),t[0]=r,t[1]=v,t[2]=y}else v=t[1],y=t[2];let b=y,x;t[3]===h?x=t[4]:(x=a(`grid min-w-0 gap-2 text-sm text-fg`,h),t[3]=h,t[4]=x);let S;t[5]!==n||t[6]!==g?(S=(0,u.jsx)(`span`,{id:g,children:n}),t[5]=n,t[6]=g,t[7]=S):S=t[7];let C=`${n} · ${_?`日期`:`Date`}`,w;t[8]!==p||t[9]!==d||t[10]!==b?(w=e=>d(e?`${e}T${b||p}`:``),t[8]=p,t[9]=d,t[10]=b,t[11]=w):w=t[11];let T;t[12]!==v||t[13]!==m||t[14]!==C||t[15]!==w?(T=(0,u.jsx)(o,{ariaLabel:C,disabled:m,value:v,className:`border border-edge bg-surface-panel hover:bg-surface-hover`,onChange:w}),t[12]=v,t[13]=m,t[14]=C,t[15]=w,t[16]=T):T=t[16];let E=`${n} · ${_?`时间`:`Time`}`,D=m||!v,O=b??``,k;t[17]!==v||t[18]!==d?(k=e=>d(`${v}T${e}`),t[17]=v,t[18]=d,t[19]=k):k=t[19];let A;t[20]!==k||t[21]!==E||t[22]!==D||t[23]!==O?(A=(0,u.jsx)(s,{ariaLabel:E,disabled:D,value:O,onChange:k}),t[20]=k,t[21]=E,t[22]=D,t[23]=O,t[24]=A):A=t[24];let j;t[25]!==A||t[26]!==T?(j=(0,u.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(5.5rem,0.6fr)] gap-2`,children:[T,A]}),t[25]=A,t[26]=T,t[27]=j):j=t[27];let M;return t[28]!==g||t[29]!==j||t[30]!==x||t[31]!==S?(M=(0,u.jsxs)(`div`,{role:`group`,"aria-labelledby":g,className:x,children:[S,j]}),t[28]=g,t[29]=j,t[30]=x,t[31]=S,t[32]=M):M=t[32],M}function f(e){return e.language}export{d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-DIBIYLnI.js";import{t as a}from"./messages-BDBGlBKh.js";import{t as o}from"./resource-unavailable-Y9WRHOnz.js";import{t as s}from"./chevron-down-ccbiQQz_.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./desktop-pet-narrative-JqMsz4rn.js";import{t as u}from"./desktop-pet-sprite-D5YYq2zC.js";var d=e(t(),1),f=n(),p=9e4,m=3e4,h=20*6e4,g=45e3,_=45*6e4,v=58;function y(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=p}function b(e,t){return e.state===`running`&&t-e.timestamp>=m}function x(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function S(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>v?`${n.slice(0,v-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function C(e,t,n){if(b(e,t))return n.stale;if(y(e,t))return n.longRunning}function w(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function ee(e){let t=e.now-e.lastActivityAt,n=t>=h?(t-h)%_:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=g&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:b(e,n)||t===`playful`||t===`companion`&&y(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.conversationId}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??l(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`loopi`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=a(i(e=>e.language)).desktopPet,[t,n]=(0,d.useState)(z),[r,o]=(0,d.useState)({}),[l,f]=(0,d.useState)({}),[p,m]=(0,d.useState)(Date.now()),[h,g]=(0,d.useState)(()=>Date.now()),[v,y]=(0,d.useState)(0),[b,T]=(0,d.useState)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(!1),B=(0,d.useRef)(null),V=(0,d.useRef)(null),H=(0,d.useRef)(null),U=(0,d.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),W=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),G=(0,d.useMemo)(()=>j(Object.values(r),p),[r,p]),K=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>!A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),q=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=K[0]??G[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=b??(J?P(J):te),Y=e.personaPhrases[U?.persona?.tone??`calm`],X=ee({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:K.length,activeCount:G.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,d.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),o(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>o(t=>(g(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,d.useEffect)(()=>{if(!t.relationshipMoment)return;T(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>T(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,d.useLayoutEffect)(()=>{let e=B.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[V.current,H.current].filter(e=>e!==null).map(e=>({left:e.offsetLeft,top:e.offsetTop,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}));if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom)),o=Math.round(132*W),s=o+(V.current?8+V.current.offsetHeight:0);t.setContentSize({width:Math.ceil(Math.max(i-n,o)),height:Math.ceil(Math.max(a-r,s))})},r=new ResizeObserver(n);return r.observe(e),V.current&&r.observe(V.current),H.current&&r.observe(H.current),n(),()=>r.disconnect()},[X,K.length,t.prefs.collapsed,W]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),o(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(l).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,d.useCallback)(e=>{e.button===0&&(D.current={pointerId:e.pointerId,x:e.screenX,y:e.screenY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,d.useCallback)(e=>{let t=D.current;!t||t.pointerId!==e.pointerId||(t.moved||Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4)&&(t.moved=!0,T(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,d.useCallback)(e=>{let t=D.current;if(!t||e&&t.pointerId!==e.pointerId)return;D.current=null;let n=e?.type===`pointerup`&&Number.isFinite(e.screenX)&&Number.isFinite(e.screenY),r=t.moved||n&&Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4;r&&n&&window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}),window.electronAPI?.pet?.endDrag(),r&&(T(`released`),window.setTimeout(()=>T(null),700),O.current=!0,window.setTimeout(()=>{O.current=!1},0))},[]);(0,d.useEffect)(()=>{let e=e=>Q(e),t=()=>Q();return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,t)}},[Q]);let oe=()=>{O.current||Z()};if(!U)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*W)}px`,"--desktop-pet-menu-size":`${Math.round(28*W)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*W)}px`},$=t.prefs.collapsed?K.length:q;return(0,N.jsxs)(`div`,{ref:B,className:`desktop-pet-window`,"data-reduced-motion":t.prefs.reducedMotion,style:se,children:[!t.prefs.collapsed&&K.length>0?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue`,children:K.map(t=>{let n=C(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=S(t,e.tipCompleteSummary),i=w(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(U,t,Y),a,!!(r||n||i)),s=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:x(t,p,e.tipTargetSuffix)]})]}),s?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:s}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(c,{size:12})})]},t.conversationId)})}):null,X?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(U.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+_),children:(0,N.jsx)(c,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:H,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&T(`greet`)},onPointerLeave:()=>{D.current||T(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q,title:e.openApp,children:(0,N.jsx)(u,{animationKey:J?.runId,pet:U,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*W)},U.id)})]})]})}function V(){let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=window.electronAPI?.pet?(0,N.jsx)(B,{}):(0,N.jsx)(o,{kind:`desktop`,backTo:`/`}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Cit_aHqC.js";import{t as a}from"./messages-DQveK9sk.js";import{t as o}from"./resource-unavailable-fk26VrOL.js";import{t as s}from"./chevron-down-ccbiQQz_.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./desktop-pet-narrative-JqMsz4rn.js";import{t as u}from"./desktop-pet-sprite-D5YYq2zC.js";var d=e(t(),1),f=n(),p=9e4,m=3e4,h=20*6e4,g=45e3,_=45*6e4,v=58;function y(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=p}function b(e,t){return e.state===`running`&&t-e.timestamp>=m}function x(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function S(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>v?`${n.slice(0,v-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function C(e,t,n){if(b(e,t))return n.stale;if(y(e,t))return n.longRunning}function w(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function ee(e){let t=e.now-e.lastActivityAt,n=t>=h?(t-h)%_:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=g&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:b(e,n)||t===`playful`||t===`companion`&&y(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.conversationId}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??l(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`loopi`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=a(i(e=>e.language)).desktopPet,[t,n]=(0,d.useState)(z),[r,o]=(0,d.useState)({}),[l,f]=(0,d.useState)({}),[p,m]=(0,d.useState)(Date.now()),[h,g]=(0,d.useState)(()=>Date.now()),[v,y]=(0,d.useState)(0),[b,T]=(0,d.useState)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(!1),B=(0,d.useRef)(null),V=(0,d.useRef)(null),H=(0,d.useRef)(null),U=(0,d.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),W=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),G=(0,d.useMemo)(()=>j(Object.values(r),p),[r,p]),K=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>!A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),q=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=K[0]??G[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=b??(J?P(J):te),Y=e.personaPhrases[U?.persona?.tone??`calm`],X=ee({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:K.length,activeCount:G.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,d.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),o(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>o(t=>(g(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,d.useEffect)(()=>{if(!t.relationshipMoment)return;T(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>T(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,d.useLayoutEffect)(()=>{let e=B.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[V.current,H.current].filter(e=>e!==null).map(e=>({left:e.offsetLeft,top:e.offsetTop,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}));if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom)),o=Math.round(132*W),s=o+(V.current?8+V.current.offsetHeight:0);t.setContentSize({width:Math.ceil(Math.max(i-n,o)),height:Math.ceil(Math.max(a-r,s))})},r=new ResizeObserver(n);return r.observe(e),V.current&&r.observe(V.current),H.current&&r.observe(H.current),n(),()=>r.disconnect()},[X,K.length,t.prefs.collapsed,W]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),o(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(l).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,d.useCallback)(e=>{e.button===0&&(D.current={pointerId:e.pointerId,x:e.screenX,y:e.screenY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,d.useCallback)(e=>{let t=D.current;!t||t.pointerId!==e.pointerId||(t.moved||Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4)&&(t.moved=!0,T(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,d.useCallback)(e=>{let t=D.current;if(!t||e&&t.pointerId!==e.pointerId)return;D.current=null;let n=e?.type===`pointerup`&&Number.isFinite(e.screenX)&&Number.isFinite(e.screenY),r=t.moved||n&&Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4;r&&n&&window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}),window.electronAPI?.pet?.endDrag(),r&&(T(`released`),window.setTimeout(()=>T(null),700),O.current=!0,window.setTimeout(()=>{O.current=!1},0))},[]);(0,d.useEffect)(()=>{let e=e=>Q(e),t=()=>Q();return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,t)}},[Q]);let oe=()=>{O.current||Z()};if(!U)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*W)}px`,"--desktop-pet-menu-size":`${Math.round(28*W)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*W)}px`},$=t.prefs.collapsed?K.length:q;return(0,N.jsxs)(`div`,{ref:B,className:`desktop-pet-window`,"data-reduced-motion":t.prefs.reducedMotion,style:se,children:[!t.prefs.collapsed&&K.length>0?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue`,children:K.map(t=>{let n=C(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=S(t,e.tipCompleteSummary),i=w(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(U,t,Y),a,!!(r||n||i)),s=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:x(t,p,e.tipTargetSuffix)]})]}),s?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:s}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(c,{size:12})})]},t.conversationId)})}):null,X?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(U.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+_),children:(0,N.jsx)(c,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:H,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&T(`greet`)},onPointerLeave:()=>{D.current||T(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q,title:e.openApp,children:(0,N.jsx)(u,{animationKey:J?.runId,pet:U,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*W)},U.id)})]})]})}function V(){let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=window.electronAPI?.pet?(0,N.jsx)(B,{}):(0,N.jsx)(o,{kind:`desktop`,backTo:`/`}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-DIBIYLnI.js";import{t as o}from"./messages-BDBGlBKh.js";import{t as s}from"./resource-unavailable-Y9WRHOnz.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{n as l,r as u}from"./popover-select-CLsphyzA.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./external-link-DjqjBmc3.js";import{t as p}from"./message-square-plus-XP0tGdlV.js";import{n as m,t as h}from"./wand-sparkles-CkSL-3Fy.js";import{t as g}from"./rotate-ccw-JM1TBLpp.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{n as y}from"./interaction-BdhHBbYa.js";import{n as b}from"./electron-env-DHOGevH3.js";import{t as x}from"./refresh-button-DiWdGAaX.js";import{t as S}from"./desktop-pet-sprite-D5YYq2zC.js";import{n as C,t as w}from"./settings-page-header-wL2jvs-y.js";import"./settings-page-layout-BkUQVmyY.js";var T=n(),E=e(t(),1),D=r();function O(e){let t=(0,T.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,D.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,D.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,D.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center justify-between gap-3 py-3`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function k(){let e=o(a(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,E.useState)(null),[T,k]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),M=typeof window<`u`?window.electronAPI?.pet:void 0,N=(0,E.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),P=(0,E.useCallback)(async()=>{if(M){k(!0);try{r(await M.getState())}finally{k(!1)}}},[M]);if((0,E.useEffect)(()=>{if(M)return P(),M.onStateChanged(r)},[M,P]),!b()||!M)return(0,D.jsx)(s,{kind:`desktop`,backTo:`/settings/overview`});if(!n)return(0,D.jsxs)(C,{gap:`gap-4`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle}),(0,D.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-24 rounded-xl`}),(0,D.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(v,{className:`h-16 rounded-xl`},t))})]})})]});let F=async e=>{k(!0);try{r(await M.setPrefs(e))}finally{k(!1)}},I=async e=>{e?(await M.show(),r(await M.getState())):r(await M.setPrefs({enabled:!1}))},L=e=>{F({selectedPetId:e})},R=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},z=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},B=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=R(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},V=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),H=()=>{z(e.createChatDraft)},U=t=>{let n=V(e.optimizeChatDraft,{id:t.id,name:R(t).name,description:R(t).description,sourcePrompt:B(t)});z(n)},W=t=>{let n=V(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails});z(n)},G=A??n.prefs.sizePercent,K=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),q=async(e=G)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));j(null),t!==n.prefs.sizePercent&&await F({sizePercent:t})};return(0,D.jsxs)(C,{gap:`gap-5`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle,actions:(0,D.jsx)(x,{className:`size-9 shrink-0 p-0`,disabled:T,label:e.refresh,onClick:P})}),(0,D.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:gap-6`,children:[(0,D.jsx)(`div`,{className:`grid h-40 w-40 shrink-0 place-items-center self-center rounded-xl bg-surface-hover/35`,children:N?(0,D.jsx)(S,{pet:N,action:`idle`,displayHeight:Math.round(104*G/100),reducedMotion:n.prefs.reducedMotion}):null}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-6 gap-y-2`,children:[(0,D.jsx)(`h2`,{className:`break-words text-xl font-semibold text-fg`,children:N?R(N).name:e.title}),(0,D.jsx)(O,{title:e.enable,checked:n.prefs.enabled,disabled:T,onChange:e=>void I(e)})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondSummary.replace(`{days}`,String(K)).replace(`{tasks}`,String(n.relationship.completedTaskCount))}),n.pets.length>1?(0,D.jsx)(`div`,{className:`mt-4 max-w-56`,children:(0,D.jsx)(l,{"aria-label":e.petList,value:N?.id??``,onChange:e=>L(e.target.value),disabled:T,children:n.pets.map(e=>(0,D.jsx)(u,{value:e.id,children:R(e).name},e.id))})}):null,N&&!N.builtin?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>U(N),className:`mt-3 inline-flex min-h-9 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(m,{className:`size-3.5`}),e.optimizeInChat]}):null]})]}),(0,D.jsx)(`div`,{className:`border-t border-edge px-5 py-2`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:H,className:_(`inline-flex min-h-10 items-center gap-2 text-xs font-medium text-fg-muted hover:text-accent-fg`,y.press),children:[(0,D.jsx)(h,{className:`size-4`}),e.createTitle]})})]}),n.petIssues.length>0?(0,D.jsxs)(`section`,{className:`rounded-xl border border-danger/20 bg-danger/5 p-4`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium text-danger`,children:[(0,D.jsx)(d,{className:`size-4`}),e.invalidPets]}),(0,D.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.petIssues.map(t=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,D.jsx)(`p`,{className:`break-words`,children:t.reason}),(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer`,children:e.issueDetails}),(0,D.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:t.dir}),t.details?.length?(0,D.jsx)(`p`,{className:`mt-1 break-words`,children:t.details.join(`; `)}):null]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 text-xs font-medium text-danger`,children:[(0,D.jsx)(p,{className:`size-3.5`}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null,(0,D.jsxs)(`section`,{"aria-label":e.displayGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.displayGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.showOnStartup,checked:n.prefs.showOnStartup,disabled:T,onChange:e=>void F({showOnStartup:e})}),(0,D.jsx)(O,{title:e.alwaysOnTop,checked:n.prefs.alwaysOnTop,disabled:T,onChange:e=>void F({alwaysOnTop:e})}),(0,D.jsx)(O,{title:e.bubbles,checked:n.prefs.bubbleEnabled,disabled:T,onChange:e=>void F({bubbleEnabled:e})}),(0,D.jsxs)(`div`,{className:`py-3`,children:[(0,D.jsxs)(`label`,{htmlFor:`desktop-pet-size`,className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[e.size,(0,D.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-muted`,children:[G,`%`]})]}),(0,D.jsx)(`input`,{id:`desktop-pet-size`,type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:G,disabled:T,onChange:e=>j(Number(e.target.value)),onBlur:()=>void q(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&q()},onPointerUp:()=>void q()})]})]})]}),(0,D.jsxs)(`section`,{"aria-label":e.interactionGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.interactionGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.proactiveTips,checked:n.prefs.proactiveTipsEnabled,disabled:T,onChange:e=>void F({proactiveTipsEnabled:e})}),(0,D.jsx)(O,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:T,onChange:e=>void F({interactionEnabled:e})}),(0,D.jsx)(O,{title:e.reducedMotion,checked:n.prefs.reducedMotion,disabled:T,onChange:e=>void F({reducedMotion:e})}),(0,D.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-3 py-3`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,D.jsxs)(l,{"aria-label":e.behaviorMode,className:`w-36`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,disabled:T,onChange:e=>void F({behaviorMode:e.target.value}),children:[(0,D.jsx)(u,{value:`focus`,children:e.behaviorFocus}),(0,D.jsx)(u,{value:`companion`,children:e.behaviorCompanion}),(0,D.jsx)(u,{value:`playful`,children:e.behaviorPlayful})]})]})]})]}),(0,D.jsxs)(`details`,{className:`group rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium text-fg [&::-webkit-details-marker]:hidden`,children:[e.advanced,(0,D.jsx)(c,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`})]}),(0,D.jsxs)(`div`,{className:`space-y-3 border-t border-edge px-4 pb-4`,children:[(0,D.jsx)(O,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:T,onChange:e=>void F({clickThroughWhenIdle:e})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge pt-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.customPets}),(0,D.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void M.openCustomPetsDir(),className:`inline-flex min-h-10 shrink-0 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(f,{className:`size-3.5`}),e.openFolder]})]}),(0,D.jsxs)(`button`,{type:`button`,className:_(`inline-flex min-h-10 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg disabled:opacity-50`,y.press),disabled:T,onClick:()=>void M.resetPosition().then(r),children:[(0,D.jsx)(g,{className:`size-3.5`}),e.resetPosition]})]})]})]})}export{k as DesktopPetSettings};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./messages-DQveK9sk.js";import{t as s}from"./resource-unavailable-fk26VrOL.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{n as l,r as u}from"./popover-select-CLsphyzA.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./external-link-DjqjBmc3.js";import{t as p}from"./message-square-plus-XP0tGdlV.js";import{n as m,t as h}from"./wand-sparkles-CkSL-3Fy.js";import{t as g}from"./rotate-ccw-JM1TBLpp.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{n as y}from"./interaction-BdhHBbYa.js";import{n as b}from"./electron-env-DHOGevH3.js";import{t as x}from"./refresh-button-DiWdGAaX.js";import{t as S}from"./desktop-pet-sprite-D5YYq2zC.js";import{n as C,t as w}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";var T=n(),E=e(t(),1),D=r();function O(e){let t=(0,T.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,D.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,D.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,D.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center justify-between gap-3 py-3`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function k(){let e=o(a(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,E.useState)(null),[T,k]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),M=typeof window<`u`?window.electronAPI?.pet:void 0,N=(0,E.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),P=(0,E.useCallback)(async()=>{if(M){k(!0);try{r(await M.getState())}finally{k(!1)}}},[M]);if((0,E.useEffect)(()=>{if(M)return P(),M.onStateChanged(r)},[M,P]),!b()||!M)return(0,D.jsx)(s,{kind:`desktop`,backTo:`/settings/overview`});if(!n)return(0,D.jsxs)(C,{gap:`gap-4`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle}),(0,D.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-24 rounded-xl`}),(0,D.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(v,{className:`h-16 rounded-xl`},t))})]})})]});let F=async e=>{k(!0);try{r(await M.setPrefs(e))}finally{k(!1)}},I=async e=>{e?(await M.show(),r(await M.getState())):r(await M.setPrefs({enabled:!1}))},L=e=>{F({selectedPetId:e})},R=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},z=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},B=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=R(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},V=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),H=()=>{z(e.createChatDraft)},U=t=>{let n=V(e.optimizeChatDraft,{id:t.id,name:R(t).name,description:R(t).description,sourcePrompt:B(t)});z(n)},W=t=>{let n=V(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails});z(n)},G=A??n.prefs.sizePercent,K=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),q=async(e=G)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));j(null),t!==n.prefs.sizePercent&&await F({sizePercent:t})};return(0,D.jsxs)(C,{gap:`gap-5`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle,actions:(0,D.jsx)(x,{className:`size-9 shrink-0 p-0`,disabled:T,label:e.refresh,onClick:P})}),(0,D.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:gap-6`,children:[(0,D.jsx)(`div`,{className:`grid h-40 w-40 shrink-0 place-items-center self-center rounded-xl bg-surface-hover/35`,children:N?(0,D.jsx)(S,{pet:N,action:`idle`,displayHeight:Math.round(104*G/100),reducedMotion:n.prefs.reducedMotion}):null}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-6 gap-y-2`,children:[(0,D.jsx)(`h2`,{className:`break-words text-xl font-semibold text-fg`,children:N?R(N).name:e.title}),(0,D.jsx)(O,{title:e.enable,checked:n.prefs.enabled,disabled:T,onChange:e=>void I(e)})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondSummary.replace(`{days}`,String(K)).replace(`{tasks}`,String(n.relationship.completedTaskCount))}),n.pets.length>1?(0,D.jsx)(`div`,{className:`mt-4 max-w-56`,children:(0,D.jsx)(l,{"aria-label":e.petList,value:N?.id??``,onChange:e=>L(e.target.value),disabled:T,children:n.pets.map(e=>(0,D.jsx)(u,{value:e.id,children:R(e).name},e.id))})}):null,N&&!N.builtin?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>U(N),className:`mt-3 inline-flex min-h-9 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(m,{className:`size-3.5`}),e.optimizeInChat]}):null]})]}),(0,D.jsx)(`div`,{className:`border-t border-edge px-5 py-2`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:H,className:_(`inline-flex min-h-10 items-center gap-2 text-xs font-medium text-fg-muted hover:text-accent-fg`,y.press),children:[(0,D.jsx)(h,{className:`size-4`}),e.createTitle]})})]}),n.petIssues.length>0?(0,D.jsxs)(`section`,{className:`rounded-xl border border-danger/20 bg-danger/5 p-4`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium text-danger`,children:[(0,D.jsx)(d,{className:`size-4`}),e.invalidPets]}),(0,D.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.petIssues.map(t=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,D.jsx)(`p`,{className:`break-words`,children:t.reason}),(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer`,children:e.issueDetails}),(0,D.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:t.dir}),t.details?.length?(0,D.jsx)(`p`,{className:`mt-1 break-words`,children:t.details.join(`; `)}):null]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 text-xs font-medium text-danger`,children:[(0,D.jsx)(p,{className:`size-3.5`}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null,(0,D.jsxs)(`section`,{"aria-label":e.displayGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.displayGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.showOnStartup,checked:n.prefs.showOnStartup,disabled:T,onChange:e=>void F({showOnStartup:e})}),(0,D.jsx)(O,{title:e.alwaysOnTop,checked:n.prefs.alwaysOnTop,disabled:T,onChange:e=>void F({alwaysOnTop:e})}),(0,D.jsx)(O,{title:e.bubbles,checked:n.prefs.bubbleEnabled,disabled:T,onChange:e=>void F({bubbleEnabled:e})}),(0,D.jsxs)(`div`,{className:`py-3`,children:[(0,D.jsxs)(`label`,{htmlFor:`desktop-pet-size`,className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[e.size,(0,D.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-muted`,children:[G,`%`]})]}),(0,D.jsx)(`input`,{id:`desktop-pet-size`,type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:G,disabled:T,onChange:e=>j(Number(e.target.value)),onBlur:()=>void q(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&q()},onPointerUp:()=>void q()})]})]})]}),(0,D.jsxs)(`section`,{"aria-label":e.interactionGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.interactionGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.proactiveTips,checked:n.prefs.proactiveTipsEnabled,disabled:T,onChange:e=>void F({proactiveTipsEnabled:e})}),(0,D.jsx)(O,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:T,onChange:e=>void F({interactionEnabled:e})}),(0,D.jsx)(O,{title:e.reducedMotion,checked:n.prefs.reducedMotion,disabled:T,onChange:e=>void F({reducedMotion:e})}),(0,D.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-3 py-3`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,D.jsxs)(l,{"aria-label":e.behaviorMode,className:`w-36`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,disabled:T,onChange:e=>void F({behaviorMode:e.target.value}),children:[(0,D.jsx)(u,{value:`focus`,children:e.behaviorFocus}),(0,D.jsx)(u,{value:`companion`,children:e.behaviorCompanion}),(0,D.jsx)(u,{value:`playful`,children:e.behaviorPlayful})]})]})]})]}),(0,D.jsxs)(`details`,{className:`group rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium text-fg [&::-webkit-details-marker]:hidden`,children:[e.advanced,(0,D.jsx)(c,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`})]}),(0,D.jsxs)(`div`,{className:`space-y-3 border-t border-edge px-4 pb-4`,children:[(0,D.jsx)(O,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:T,onChange:e=>void F({clickThroughWhenIdle:e})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge pt-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.customPets}),(0,D.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void M.openCustomPetsDir(),className:`inline-flex min-h-10 shrink-0 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(f,{className:`size-3.5`}),e.openFolder]})]}),(0,D.jsxs)(`button`,{type:`button`,className:_(`inline-flex min-h-10 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg disabled:opacity-50`,y.press),disabled:T,onClick:()=>void M.resetPosition().then(r),children:[(0,D.jsx)(g,{className:`size-3.5`}),e.resetPosition]})]})]})]})}export{k as DesktopPetSettings};
|
package/dist/gateway/static/root/assets/{dev-view-store-C7v4CIlF.js → dev-view-store-DnQ2nBtV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-Cit_aHqC.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({showRawToolData:!1,setShowRawToolData:t=>e({showRawToolData:t})}),{name:`xopc-web-dev-view`}));export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-DIBIYLnI.js";import{t as s}from"./messages-BDBGlBKh.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-Cc4hUNTt.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-BkEO3eBe.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-enDU_32p.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-CIte6n0U.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-Cc4hUNTt.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-CauYDM-y.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-Bz_PU9R_.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-BkhCBt38.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-W2QiUVjN.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{p as h}from"./product-delivery-4gEqUIsK.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.projects.get":`Read approved project details`,"capability:xopc.projects.list":`Search approved projects`,"capability:xopc.projects.list_milestones":`Read approved project milestones`,"capability:xopc.projects.list_updates":`Read approved project progress updates`,"capability:xopc.projects.update":`Update approved project metadata at an exact version`,"capability:xopc.projects.create_milestone":`Create milestones in approved projects`,"capability:xopc.projects.update_milestone":`Update milestones in approved projects`,"capability:xopc.projects.create_update":`Record progress in approved projects`,"capability:xopc.tasks.create":`Capture tasks without starting execution`,"capability:xopc.tasks.update":`Edit approved task details at an exact version`,"capability:xopc.files.read":`Read explicitly selected files and import selected attachments`,"capability:xopc.files.propose_export":`Propose a file export for host review`,"capability:xopc.connectors.describe":`Read contracts of approved connector operations`,"capability:xopc.connectors.read":`Run approved connector read operations on the selected account`,"capability:xopc.connectors.propose_write":`Propose connector writes for individual host review`,"capability:xopc.apps.get_request":`Read this app’s resource request outcomes`,"capability:xopc.automations.simulate":`Validate a proposed automation without running it`,"capability:xopc.automations.propose":`Submit automation changes for separate host review`,"capability:xopc.automations.get_proposal":`Read this app’s proposal review outcomes`,"capability:xopc.automations.history":`Recover this app’s authorized run history`,"capability:xopc.automations.run_events":`Read this app’s sanitized run progress events`,"capability:xopc.automations.list":`List approved automation summaries`,"capability:xopc.automations.get":`Read approved automation summaries`,"capability:xopc.automations.run":`Run individually approved automation configurations (may cause external effects and costs)`,"capability:xopc.automations.get_run":`Read results of runs submitted by this app`,"capability:xopc.automations.cancel":`Request cancellation of runs submitted by this app`,"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.projects.get":`读取授权项目详情`,"capability:xopc.projects.list":`搜索授权项目`,"capability:xopc.projects.list_milestones":`读取授权项目里程碑`,"capability:xopc.projects.list_updates":`读取授权项目进展`,"capability:xopc.projects.update":`按精确版本更新授权项目资料`,"capability:xopc.projects.create_milestone":`在授权项目内创建里程碑`,"capability:xopc.projects.update_milestone":`更新授权项目的里程碑`,"capability:xopc.projects.create_update":`记录授权项目进展`,"capability:xopc.tasks.create":`收集任务,不启动执行`,"capability:xopc.tasks.update":`按精确版本编辑授权任务资料`,"capability:xopc.files.read":`读取逐项授权的文件及手动选择的附件`,"capability:xopc.files.propose_export":`提出文件导出请求,由宿主审核`,"capability:xopc.connectors.describe":`读取授权连接器操作的接口定义`,"capability:xopc.connectors.read":`在指定账户执行授权的连接器读取操作`,"capability:xopc.connectors.propose_write":`提出连接器写入请求,由宿主逐次审核`,"capability:xopc.apps.get_request":`读取此应用资源请求的结果`,"capability:xopc.automations.simulate":`验证自动化方案,不执行操作`,"capability:xopc.automations.propose":`提交自动化变更,由宿主另行审核`,"capability:xopc.automations.get_proposal":`读取此应用提案的审核结果`,"capability:xopc.automations.history":`恢复此应用有权读取的运行历史`,"capability:xopc.automations.run_events":`读取此应用运行的脱敏进度事件`,"capability:xopc.automations.list":`列出授权范围内的自动化摘要`,"capability:xopc.automations.get":`读取授权范围内的自动化摘要`,"capability:xopc.automations.run":`运行逐项确认的自动化配置(可能产生外部影响和费用)`,"capability:xopc.automations.get_run":`读取此应用发起的自动化运行结果`,"capability:xopc.automations.cancel":`请求取消此应用发起的自动化运行`,"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:r===`automations`?o?`自动化`:`Automations`:r===`files`?o?`文件`:`Files`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(92),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(F),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(te),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(ee),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y=o?`读取自动化的范围`:`Automations this app may read`,b;t[15]===r?b=t[16]:(b=r.some(P),t[15]=r,t[16]=b);let x;t[17]!==y||t[18]!==b?(x={key:`automationsRead`,label:y,kind:`automations`,visible:b},t[17]=y,t[18]=b,t[19]=x):x=t[19];let w=o?`创建和更新任务的范围`:`Tasks this app may capture or edit`,T;t[20]===r?T=t[21]:(T=r.some(N),t[20]=r,t[21]=T);let E;t[22]!==w||t[23]!==T?(E={key:`tasksWrite`,label:w,kind:`tasks`,visible:T},t[22]=w,t[23]=T,t[24]=E):E=t[24];let L=o?`读取项目的范围`:`Projects this app may read`,R;t[25]===r?R=t[26]:(R=r.some(M),t[25]=r,t[26]=R);let B;t[27]!==L||t[28]!==R?(B={key:`projectsRead`,label:L,kind:`projects`,visible:R},t[27]=L,t[28]=R,t[29]=B):B=t[29];let V=o?`更新项目和进度的范围`:`Projects this app may update`,H;t[30]===r?H=t[31]:(H=r.some(j),t[30]=r,t[31]=H);let U;t[32]!==V||t[33]!==H?(U={key:`projectsWrite`,label:V,kind:`projects`,visible:H},t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==x||t[36]!==E||t[37]!==B||t[38]!==U||t[39]!==l||t[40]!==m||t[41]!==_?(W=[l,m,_,x,E,B,U],t[35]=x,t[36]=E,t[37]=B,t[38]=U,t[39]=l,t[40]=m,t[41]=_,t[42]=W):W=t[42];let G=W,K;t[43]!==n||t[44]!==a||t[45]!==r||t[46]!==i||t[47]!==o?(K=r.some(A)?(0,S.jsx)(z,{extensionId:n,value:i,onChange:a,zh:o}):null,t[43]=n,t[44]=a,t[45]=r,t[46]=i,t[47]=o,t[48]=K):K=t[48];let q;t[49]!==n||t[50]!==a||t[51]!==r||t[52]!==i||t[53]!==o?(q=r.includes(`capability:xopc.files.read`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`文件与附件读取`:`File and attachment reads`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesRead.mode===`selected`,onChange:e=>a({...i,filesRead:e.target.checked?{mode:`selected`,ids:[]}:{mode:`none`}})}),o?`允许读取以下选定的工作区文件(每个最多 512 KiB)`:`Allow reading these selected workspace files (up to 512 KiB each)`]}),i.filesRead.mode===`selected`?(0,S.jsx)(C,{extensionId:n,kind:`files`,values:i.filesRead.ids,zh:o,onChange:e=>a({...i,filesRead:{mode:`selected`,ids:e}})}):null,(0,S.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesImport,onChange:e=>a({...i,filesImport:e.target.checked})}),o?`允许在宿主中逐次选择并导入本机附件`:`Allow choosing a local attachment in the host for each import`]})]}):null,t[49]=n,t[50]=a,t[51]=r,t[52]=i,t[53]=o,t[54]=q):q=t[54];let J;t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==o?(J=r.includes(`capability:xopc.files.propose_export`)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesExport,onChange:e=>a({...i,filesExport:e.target.checked})}),o?`允许提出文件导出请求;每次均需在宿主确认保存,不直接覆盖 Gateway 文件`:`Allow export requests; each browser save requires host confirmation and does not overwrite Gateway files`]}):null,t[55]=a,t[56]=r,t[57]=i,t[58]=o,t[59]=J):J=t[59];let Y;t[60]!==a||t[61]!==r||t[62]!==i||t[63]!==o?(Y=r.some(k)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.automationProposals,onChange:e=>a({...i,automationProposals:e.target.checked})}),o?`允许模拟和提交自动化提案;创建、修改或启用仍须在宿主逐项审核`:`Allow simulation and automation proposals; creation, changes and activation still require host review`]}):null,t[60]=a,t[61]=r,t[62]=i,t[63]=o,t[64]=Y):Y=t[64];let X;t[65]!==a||t[66]!==r||t[67]!==i||t[68]!==o?(X=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、4096 输出 token,支持文本或 JSON。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 4096 output tokens per call, as text or JSON. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[65]=a,t[66]=r,t[67]=i,t[68]=o,t[69]=X):X=t[69];let Z;t[70]!==n||t[71]!==a||t[72]!==r||t[73]!==i||t[74]!==o?(Z=r.some(O)?(0,S.jsx)(I,{extensionId:n,value:i,onChange:a,zh:o}):null,t[70]=n,t[71]=a,t[72]=r,t[73]=i,t[74]=o,t[75]=Z):Z=t[75];let Q;t[76]===G?Q=t[77]:(Q=G.filter(D),t[76]=G,t[77]=Q);let $;t[78]!==n||t[79]!==a||t[80]!==Q||t[81]!==i||t[82]!==o?($=Q.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`||e.kind===`tasks`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),e.kind===`notes`?o?`包括此应用创建的笔记`:`Include notes created by this app`:o?`包括此应用创建的任务`:`Include tasks created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:e.kind===`projects`?[...new Set([...t.ids,...t.projectIds])]:t.ids,onChange:n=>r({...t,ids:n,...e.kind===`projects`?{projectIds:[]}:{}}),zh:o}),e.kind===`projects`?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]})]}):null]},e.key)}),t[78]=n,t[79]=a,t[80]=Q,t[81]=i,t[82]=o,t[83]=$):$=t[83];let ne;return t[84]!==K||t[85]!==q||t[86]!==J||t[87]!==Y||t[88]!==X||t[89]!==Z||t[90]!==$?(ne=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[K,q,J,Y,X,Z,$]}),t[84]=K,t[85]=q,t[86]=J,t[87]=Y,t[88]=X,t[89]=Z,t[90]=$,t[91]=ne):ne=t[91],ne}function D(e){return e.visible}function O(e){return/capability:xopc.automations.(run|cancel)$/.test(e)}function k(e){return/capability:xopc.automations.(propose|get_proposal|simulate)$/.test(e)}function A(e){return/capability:xopc.connectors./.test(e)}function j(e){return/capability:xopc.projects.(update|create_milestone|update_milestone|create_update)$/.test(e)}function M(e){return/capability:xopc.projects.(get|list|list_milestones|list_updates)$/.test(e)}function N(e){return/capability:xopc.tasks.(create|update)$/.test(e)}function P(e){return/capability:xopc.automations.(get|list|get_run|history|run_events)$/.test(e)}function ee(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function te(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function F(e){return/capability:xopc.notes.(get|list)$/.test(e)}function I(e){let t=(0,v.c)(34),{extensionId:n,value:r,onChange:i,zh:a}=e,[o,s]=(0,_.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},t[0]=c):c=t[0];let[l,u]=(0,_.useState)(c),{data:d,error:f,isLoading:p}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=automations&search=${encodeURIComponent(o)}`,R),h;t[1]!==r.automationsRun.approvals||t[2]!==r.automationsRun.mode?(h=r.automationsRun.mode===`selected`?r.automationsRun.approvals:[],t[1]=r.automationsRun.approvals,t[2]=r.automationsRun.mode,t[3]=h):h=t[3];let y=h,b;t[4]!==i||t[5]!==r?(b=e=>i({...r,automationsRun:e.length?{mode:`selected`,approvals:e}:{mode:`none`}}),t[4]=i,t[5]=r,t[6]=b):b=t[6];let x=b,C=a?`允许执行的自动化`:`Approved automation execution`,w;t[7]===C?w=t[8]:(w=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:C}),t[7]=C,t[8]=w);let T=a?`所选自动化可能使用 Agent 工具、修改文件或向外发送结果,并产生费用。请展开检查后再勾选。应用只能运行确认过的配置,每小时最多 20 次;配置变化需重新授权。授权到期或撤权后,受限运行会中止后续调用。`:`These automations may use Agent tools, change files, send results externally and incur costs. Inspect each before approving. Up to 20 submissions per app per hour. Configuration changes require new approval. Expiry or revocation stops further calls in bounded runs.`,E;t[9]===T?E=t[10]:(E=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-warning`,children:T}),t[9]=T,t[10]=E);let D=a?`搜索可执行自动化`:`Search executable automations`,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>s(e.target.value),t[11]=O):O=t[11];let k=a?`搜索自动化`:`Search automations`,A;t[12]!==o||t[13]!==k||t[14]!==D?(A=(0,S.jsx)(`input`,{"aria-label":D,value:o,onChange:O,placeholder:k,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[12]=o,t[13]=k,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==y||t[17]!==d?.items||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==x||t[22]!==a?(j=p?(0,S.jsx)(m,{className:`mt-2 h-16`}):f?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载自动化`:`Could not load automations`}):(d?.items??[]).map(e=>{let t=y.some(t=>t.id===e.id&&t.configurationDigest===e.configurationDigest&&t.authority.model&&t.authority.maxRuns>0&&t.authority.expiresAt>Date.now()),n=!t&&y.some(t=>t.id===e.id),r=e.review.action,i=l[e.id]??y.find(t=>t.id===e.id)?.authority??{model:!1,tools:!1,dataWrite:!1,externalSend:!1,expiresAt:Date.now()+36e5,maxRuns:1,maxCostMicrousd:1e6},o=n=>{u(t=>({...t,[e.id]:n})),t&&x([...y.filter(t=>t.id!==e.id),...n.model?[{id:e.id,configurationDigest:e.configurationDigest,authority:n}]:[]])};return(0,S.jsxs)(`details`,{className:`mt-2 rounded-md border border-edge p-2 text-xs text-fg`,children:[(0,S.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.title,n?a?`(配置已改变,需重新确认)`:` (changed; review again)`:``]}),(0,S.jsxs)(`div`,{className:`mt-2 space-y-2 break-words`,children:[(0,S.jsxs)(`p`,{children:[a?`执行方式`:`Action`,`: `,r.kind===`agent`?`Agent`:r.kind===`task_command`?a?`任务命令`:`Task command`:r.kind]}),r.instruction?(0,S.jsx)(`p`,{className:`whitespace-pre-wrap`,children:r.instruction}):null,r.agentId?(0,S.jsxs)(`p`,{children:[`Agent: `,r.agentId]}):null,r.model?(0,S.jsxs)(`p`,{children:[a?`模型`:`Model`,`: `,r.model]}):null,r.workingDirectory?(0,S.jsxs)(`p`,{children:[a?`工作目录`:`Working directory`,`: `,r.workingDirectory]}):null,r.mcpSourceId?(0,S.jsxs)(`p`,{children:[`MCP: `,r.mcpSourceId]}):null,r.taskId?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`p`,{children:[a?`任务`:`Task`,`: `,r.taskId]}),(0,S.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:JSON.stringify(r.command,null,2)})]}):null,(0,S.jsxs)(`p`,{children:[a?`执行策略`:`Safety`,`: `,e.review.safety?.mode??`auto_apply`,` / `,e.review.conversationMode]}),(0,S.jsxs)(`p`,{children:[a?`超时与重试`:`Timeout / retries`,`: `,e.review.reliability?.executionTimeoutSeconds??r.timeoutSeconds??(a?`宿主默认`:`Host default`),` / `,e.review.reliability?.retryCount??0]}),(0,S.jsxs)(`p`,{children:[a?`结果投递`:`Delivery`,`: `,e.review.delivery.destinations.map(L).join(`, `)||(a?`无`:`None`)]}),[`model`,`tools`,`dataWrite`,`externalSend`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i[e],onChange:t=>o({...i,[e]:t.target.checked})}),{model:a?`允许模型处理(上下文会发送给模型供应商)`:`Allow model processing (context is disclosed to the provider)`,tools:a?`允许本地文件读取工具`:`Allow local file read tools`,dataWrite:a?`允许本地文件写入(工具写入还需允许工具)`:`Allow local file writes (tool writes also require tools)`,externalSend:a?`允许向以上已审核目标投递结果`:`Allow delivery to the reviewed external destinations`}[e]]},e)),(0,S.jsx)(`p`,{className:`text-fg-muted`,children:a?`不开放 Shell、浏览器、MCP 或嵌套委托。预算按已知模型价格预留最坏情况费用,不代表供应商账单封顶;价格未知时拒绝执行。有效期结束或撤权会中止后续调用。`:`Shell, browser, MCP and nested delegation are unavailable. Known model prices reserve worst-case usage; this is not a provider billing guarantee. Unknown pricing is denied. Expiry or revocation stops further calls.`}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`有效时长(分钟)`:`Valid for (minutes)`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`43200`,value:Math.max(0,Math.ceil((i.expiresAt-Date.now())/6e4)),onChange:e=>o({...i,expiresAt:Date.now()+Number(e.target.value)*6e4}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`本次授权最多运行次数`:`Maximum runs for this approval`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:i.maxRuns,onChange:e=>o({...i,maxRuns:Number(e.target.value)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`模型预留预算(美元)`:`Model reservation budget (USD)`,(0,S.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`0.001`,value:i.maxCostMicrousd/1e6,onChange:e=>o({...i,maxCostMicrousd:Math.round(Number(e.target.value)*1e6)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,disabled:!e.runnable||!i.model||i.expiresAt<=Date.now()||i.maxRuns<1,checked:t,onChange:t=>x([...y.filter(t=>t.id!==e.id),...t.target.checked?[{id:e.id,configurationDigest:e.configurationDigest,authority:i}]:[]])}),e.runnable?a?`允许此应用运行以上配置`:`Allow this app to run this configuration`:a?`此自动化当前不可授权执行`:`This automation cannot currently be approved`]})]})]},e.id)}),t[16]=y,t[17]=d?.items,t[18]=l,t[19]=f,t[20]=p,t[21]=x,t[22]=a,t[23]=j):j=t[23];let M;t[24]!==y.length||t[25]!==x||t[26]!==a?(M=y.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>x([]),children:[a?`清除所有执行授权`:`Clear all execution approvals`,` (`,y.length,`)`]}):null,t[24]=y.length,t[25]=x,t[26]=a,t[27]=M):M=t[27];let N;return t[28]!==A||t[29]!==j||t[30]!==M||t[31]!==w||t[32]!==E?(N=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[w,E,A,j,M]}),t[28]=A,t[29]=j,t[30]=M,t[31]=w,t[32]=E,t[33]=N):N=t[33],N}function L(e){return[e.kind,e.endpoint??e.conversationId??e.pathTemplate??e.channelId,e.targetId??e.templateId].filter(Boolean).join(`: `)}function R(e){return o(i(e))}function z(e){let t=(0,v.c)(25),{extensionId:n,value:r,onChange:i,zh:a}=e,{data:o,error:s,isLoading:c}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=connectors`,B),l;t[0]!==r.connectors.bindings||t[1]!==r.connectors.mode?(l=r.connectors.mode===`selected`?r.connectors.bindings:[],t[0]=r.connectors.bindings,t[1]=r.connectors.mode,t[2]=l):l=t[2];let u=l,d=a?`外部服务与账户`:`External services and accounts`,f;t[3]===d?f=t[4]:(f=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:d}),t[3]=d,t[4]=f);let p=a?`仅允许以下账户和操作。读取受连接器现有策略约束;写入每次另行审核。重新连接或操作契约变化后需重新选择,可能产生外部服务费用。`:`Only these accounts and actions. Reads retain existing connector policy; writes require a separate review each time. Reconnection or contract changes require a new selection. External service fees may apply.`,h;t[5]===p?h=t[6]:(h=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p}),t[5]=p,t[6]=h);let _;t[7]!==u||t[8]!==o?.items||t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==r||t[13]!==a?(_=c?(0,S.jsx)(m,{className:`h-20`}):s?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载连接器`:`Could not load connectors`}):(o?.items??[]).map(e=>(0,S.jsxs)(`label`,{className:`my-2 flex items-start gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:u.some(t=>JSON.stringify(t)===JSON.stringify(e.binding)),onChange:t=>{let n=u.filter(t=>!(t.toolRef===e.binding.toolRef&&t.accountId===e.binding.accountId));t.target.checked&&n.push(e.binding),i({...r,connectors:n.length?{mode:`selected`,bindings:n}:{mode:`none`}})}}),e.title]},e.id)),t[7]=u,t[8]=o?.items,t[9]=s,t[10]=c,t[11]=i,t[12]=r,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==u.length||t[16]!==i||t[17]!==r||t[18]!==a?(y=u.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>i({...r,connectors:{mode:`none`}}),children:[a?`清除连接器授权`:`Clear connector approvals`,` (`,u.length,`)`]}):null,t[15]=u.length,t[16]=i,t[17]=r,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==h||t[22]!==_||t[23]!==y?(b=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[f,h,_,y]}),t[20]=f,t[21]=h,t[22]=_,t[23]=y,t[24]=b):b=t[24],b}function B(e){return o(i(e))}function V(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(U),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=M):M=t[8];let N=l,P=H,ee=l,te=C.permissionTitle.replace(`{{name}}`,o),F;t[9]!==ee.Title||t[10]!==te?(F=(0,S.jsx)(ee.Title,{className:`text-base font-semibold text-fg`,children:te}),t[9]=ee.Title,t[10]=te,t[11]=F):F=t[11];let I;t[12]===i?I=t[13]:(I=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=I);let L;t[14]!==C.permissionSubtitle||t[15]!==I?(L=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,I]}),t[14]=C.permissionSubtitle,t[15]=I,t[16]=L):L=t[16];let R;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(R=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=R):R=t[20];let z;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(z=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=z):z=t[27];let B;t[28]!==R||t[29]!==z?(B=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[R,z]}),t[28]=R,t[29]=z,t[30]=B):B=t[30];let V;t[31]===y?V=t[32]:(V=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=V);let W;t[33]===C.deny?W=t[34]:(W=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=W);let G;t[35]!==m||t[36]!==f||t[37]!==T?(G=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=G):G=t[38];let K;t[39]!==p||t[40]!==C.allow||t[41]!==G?(K=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:G,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=G,t[42]=K):K=t[42];let q;t[43]!==W||t[44]!==K?(q=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[W,K]}),t[43]=W,t[44]=K,t[45]=q):q=t[45];let J;t[46]!==F||t[47]!==L||t[48]!==B||t[49]!==V||t[50]!==q||t[51]!==N.Content||t[52]!==P?(J=(0,S.jsxs)(N.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:P,children:[F,L,B,V,q]}),t[46]=F,t[47]=L,t[48]=B,t[49]=V,t[50]=q,t[51]=N.Content,t[52]=P,t[53]=J):J=t[53];let Y;t[54]!==J||t[55]!==j.Portal||t[56]!==M?(Y=(0,S.jsxs)(j.Portal,{children:[M,J]}),t[54]=J,t[55]=j.Portal,t[56]=M,t[57]=Y):Y=t[57];let X;return t[58]!==r||t[59]!==n||t[60]!==Y||t[61]!==A.Root?(X=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Y}),t[58]=r,t[59]=n,t[60]=Y,t[61]=A.Root,t[62]=X):X=t[62],X}function H(e){return e.preventDefault()}function U(e){return e.language}async function W(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function G(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,W as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-Cit_aHqC.js";import{t as i}from"./messages-DQveK9sk.js";import{r as a}from"./extension-provider-BhluafoX.js";import{n as o,t as s}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,l as a,n as o,o as s}from"./locale-store-DIBIYLnI.js";import{t as ee}from"./messages-BDBGlBKh.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-DxF7S6I2.js";import{n as g}from"./extension-provider-lqJ1zIkA.js";import{r as _}from"./extension-message-router-DZahH1Hd.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-DIeg1mg8.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,l as a,n as o,o as s}from"./locale-store-Cit_aHqC.js";import{t as ee}from"./messages-DQveK9sk.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-C1MxmBg7.js";import{n as g}from"./extension-provider-BhluafoX.js";import{r as _}from"./extension-message-router-BD0ZamBV.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-BqtUnmq-.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t}from"./locale-store-
|
|
1
|
+
import{a as e,i as t}from"./locale-store-Cit_aHqC.js";async function n(n=``){let i=await e(t(`/api/marketplace${n.trim()?`?q=${encodeURIComponent(n.trim())}`:``}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!Array.isArray(a.extensions))throw Error(a.error??`Invalid response`);return a.extensions}async function r(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function i(n){let i=await e(t(`/api/marketplace/packages/${encodeURIComponent(n.trim())}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.id)throw Error(a.error??`Invalid response`);return a.payload}async function a(n){let i=await e(t(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.extensionId)throw Error(a.error??`Invalid response`);return a.payload}async function o(n){let i=await e(t(`/api/extensions/${encodeURIComponent(n.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n.enabled})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error?.message??`Invalid response`);return a.payload}async function s(n){let i=await e(t(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:n})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error??`Invalid response`);return a.payload}export{s as a,o as i,i as n,a as r,n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-
|
|
1
|
+
import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-Cit_aHqC.js";import{c as a,m as o,p as s,u as c,y as l}from"./schemas-CCWMleym.js";import{f as u}from"./product-delivery-4gEqUIsK.js";import{i as d,p as f,t as p}from"./session-manager-BVS3zxRZ.js";import{t as m}from"./capabilities-YmBD7oK8.js";import{t as h}from"./activity-store-DKP2sWTJ.js";import{i as g}from"./theme-store-C1MxmBg7.js";var _=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function v(e,t,n){let r=new p,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),f(e,i),await new d().send(t,e,n,i.thinkingLevel)}var y=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function b(e){let t=getComputedStyle(document.documentElement),n={};for(let e of y){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}async function x(t,n,r){let i=500;for(;!n.aborted;){try{let a=await e(t,{signal:n,headers:{Accept:`text/event-stream`}});if(!a.ok||!a.body){r({type:`error`,message:`Run subscription unavailable; review access before retrying`});return}let o=a.body.pipeThrough(new TextDecoderStream).getReader(),s=``;try{for(;;){let e=await o.read();if(e.done)break;s=(s+e.value).replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`);let t;for(;(t=s.indexOf(`
|
|
4
4
|
|
package/dist/gateway/static/root/assets/{extension-page-DMuHBIHa.js → extension-page-C09dlV3J.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-fk26VrOL.js";import{t as o}from"./page-header-store-1-lflHAx.js";import{r as s,s as c}from"./extension-provider-BhluafoX.js";import{t as l}from"./extension-iframe-host-CCe4R7L7.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=s(),p=o(h),g=o(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
|