@xopcai/xopc 0.0.467 → 0.0.468
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/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-CIV2R_El.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-Cl08_xtM.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DVXcGKP-.js → api-V4P8zfkJ.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-CncU5JvR.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/{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-sR61FFLn.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-3WGWLdiW.js → automations-page-BNzj3R7A.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CH9gYqIK.js → automations-workspace-BWpA-X_S.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-MFVtTdvy.js → binary-plugins-BjEE5sVq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DAWXPErA.js → block-editor-B4Yqbxab.js} +1 -1
- 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-CBSMm_jo.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CFWTer_v.js → capabilities-EmBa4Blq.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-C2RB9fzC.js → capabilities-page-BQf7oyqc.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +8 -0
- package/dist/gateway/static/root/assets/{channels-DiDfjON8.js → channels-oyMymJDx.js} +1 -1
- 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-CS-cORJt.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4HoRIzf.js → chat-terminal-dock-D6LH3W5H.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-CxeXJKxg.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-Bsec3-eZ.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-C0ZCUtxF.js} +1 -1
- 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-diuSsk-H.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-DIeg1mg8.js → extension-authoritative-grants-CVQ7q0DU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D8TAJgZ_.js → extension-debug-page-DrpE2lQ3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CjfRKtQ4.js → extension-iframe-host-hr60GwXQ.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-aoF3x4-X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMuHBIHa.js → extension-page-BfM8zli6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-lqJ1zIkA.js → extension-provider-BcSgVeKW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D5IfKVff.js → extension-settings-page-Db5t2Mz0.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-B7B9qXm9.js → file-preview-surface-CeFFZo3a.js} +1 -1
- 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-DsS2UT08.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-BJj-uZNl.js → index-DFa0pZhC.js} +5 -5
- package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-QkJMw_uW.js → install-connector-dialog-0_PeJJqO.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-wekatwet.js → local-app-workbench-page-OSinc6m6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-D-bRvlZY.js → local-apps-page-yBqRl5Bi.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-CukseY3k.js → logs-page-BJxQ_Jd5.js} +1 -1
- 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-D9HGIYXx.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-C30KvTaE.js → markdown-view-CiGdWuN3.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-C2lp7UmI.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-aRYHi2dh.js → models-hub-cache-CmdULYFt.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-D5BtgBxy.js → note-detail-panel-CVEG1JdF.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BXevQivV.js → notes-api-BQXOYFQ5.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DyM-3O_9.js → notes-page-Cc-c1Yhg.js} +1 -1
- 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-BW7zcXfb.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BaSooYGv.js → page-context-capture-button-Cw58-5P3.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-DwFwq_lI.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BPQpvC34.js → personal-avatar-B-Oes3ef.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BB4Sv68K.js → personal-page-DWPu-iwK.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-DwMdjQ6H.js → personal-profile-settings-CDrzvI35.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-DiNpP_g3.js → personal-settings-panel-CoZ3qWSr.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-UHVwbC3H.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-fS2IT-dK.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/{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/{product-automation-feedback-BlwtlUY7.js → product-automation-feedback-DrBclzH1.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dy6D5exJ.js → product-open-page-BMJ2x5m3.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DEUPAilo.js → product-preview-content-lkkZPvMa.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C4TV9RUd.js → product-preview-modal-DtUBJGs5.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-BG2nDt98.js → project-detail-page-DGFUj6jS.js} +1 -1
- 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-Dua6taaG.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-C26HgxZY.js → providers-api-B6eZLEnh.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BJkXktA-.js → recording-upload-DXxD6grq.js} +1 -1
- 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-Dy3-oGK1.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-DHHyicqQ.js → right-workspace-store-BzXnZDK5.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-BYqg1BYz.js → route-preload-8KCgPcjp.js} +2 -2
- package/dist/gateway/static/root/assets/{routine-panel-Coh2B0j7.js → routine-panel-BALhliq6.js} +2 -2
- 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/{service-recommendation-list-_rFmwIwY.js → service-recommendation-list-CsU74h1b.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-Cby6Nkib.js +25 -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-ByFNIBfp.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-Bsn4Wa4p.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DXvYjIu3.js → setup-status-panel-CstjOb7g.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-CyCv69rh.js → share-preview-page-9pOnypJv.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-CfFiW03g.js → shares-api-ChBHTPKN.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B85XIDFv.js → shares-settings-CJdVDQqf.js} +1 -1
- 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-CkkHufmv.js} +1 -1
- 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-DgsLOz6h.js → task-detail-page-BjBkKeIf.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-C-zIBpzi.js → task-result-evidence-dtN1sSjU.js} +1 -1
- 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/{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-C9GpCJQR.js → use-composer-attachments-BEYkb8cs.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-Daf-LmiF.js → use-file-preview-expanded-CQeo2Ztn.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-BJgaheR4.js → use-personal-profile-CKm5FaTl.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-RQW5KnIN.js → use-realtime-voice-lRHVixh4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-B6QFV5gR.js → use-workspace-tree-DrWnW1aA.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-hKnsTcMk.js → user-model-page-Bw1_PGdD.js} +1 -1
- 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-settings-BUrk4mwV.js → voice-settings-CssuMBjt.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ddvqu02U.js → work-discovery-overlay-DcZS4OMj.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BdBpri6P.js → work-discovery-page-CZF9iWPT.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-CscTRODe.js → workspace-api-BfApIXLw.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DwpWKogz.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-JSGIA79T.js → workspace-file-preview-dialog-BRhsCs1S.js} +1 -1
- 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-DNLnuHlf.js → workspace-preview-store-BrofEVle.js} +1 -1
- 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 +87 -87
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/music-generation.js +5 -2
- package/dist/src/agent/background-review/prompts.js +5 -1
- package/dist/src/agent/tools/personal-memory-tool.js +12 -10
- 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/cli/commands/doctor/checks/database-schema.js +1 -1
- 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 +24 -3
- package/dist/src/gateway/hono/routes/video-generation.js +1 -1
- 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/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 +16 -4
- package/dist/src/music-generation/repository.d.ts +3 -1
- package/dist/src/music-generation/repository.js +5 -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/personal-agent/prompts.js +1 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +1 -0
- package/dist/src/storage/sqlite/upgrades/278_music_job_error_code.sql +6 -0
- 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/drafts.d.ts +1 -0
- package/dist/src/video-generation/drafts.js +2 -0
- package/dist/src/video-generation/repository.d.ts +5 -3
- package/dist/src/video-generation/repository.js +22 -7
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjaLTd6i.js +0 -8
- package/dist/gateway/static/root/assets/chat-page-BtMkdtxJ.js +0 -71
- package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +0 -1
- package/dist/gateway/static/root/assets/index-DiWUK4sJ.css +0 -1
- package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +0 -1
- 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/workspace-editor-agent-store-CyPjTDSx.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./notes-api-BQXOYFQ5.js";
|
|
@@ -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{a as i,i as a,l as o,n as s,o as c,p as l}from"./locale-store-DIBIYLnI.js";import{t as u}from"./messages-BDBGlBKh.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-CY7CS_D3.js";import{t as _}from"./createLucideIcon-DPHK1VkS.js";import{t as v}from"./download-Dk-ZjtO6.js";import{K as y,t as b}from"./markdown-view-C30KvTaE.js";import{t as ee}from"./plus-Q2yW6OE7.js";import{t as te}from"./x-B_N4OPjy.js";import{t as x}from"./cn-0WouolD0.js";import{r as S,t as C}from"./chat-chart-block-aZIklMNN.js";var w=_(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),T=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),E=n(),D=e(t(),1),O=r(),k=(0,D.createContext)(null);function A(){let e=(0,E.c)(1),t=(0,D.useContext)(k);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:j},e[0]=t):t=e[0],t}return t}function j(){}function M({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=u(s(e=>e.language)).chat,[i,a]=(0,D.useState)(1),[o,c]=(0,D.useState)({x:0,y:0}),[l,_]=(0,D.useState)(!1),[b,S]=(0,D.useState)(!1),C=(0,D.useRef)(null),w=(0,D.useRef)(0),E=(0,D.useRef)(null),[A,j]=(0,D.useState)(null),M=(0,D.useCallback)((e,t)=>{E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current++,C.current=null,a(1),c({x:0,y:0}),_(!1),S(!1),j({src:e,alt:t})},[]),N=(0,D.useMemo)(()=>({openImage:M}),[M]);return(0,O.jsxs)(k.Provider,{value:N,children:[e,(0,O.jsx)(g,{open:A!==null,onOpenChange:e=>{e||(w.current++,j(null))},children:(0,O.jsxs)(p,{children:[(0,O.jsx)(d,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,O.jsxs)(m,{className:x(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),E.current?.isConnected&&E.current.focus({preventScroll:!0}))},children:[(0,O.jsx)(h,{className:`sr-only`,children:A?.alt||r.attachmentPreviewImage}),(0,O.jsx)(f,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,O.jsx)(te,{className:`size-5`,"aria-hidden":!0})})}),A&&n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,O.jsx)(y,{className:`size-5`})}),(0,O.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,O.jsx)(ee,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,O.jsx)(T,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:b,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=w.current;S(!0),_(!1);try{let t=await fetch(A.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==w.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===w.current&&_(!0)}finally{e===w.current&&S(!1)}},children:(0,O.jsx)(v,{className:`size-5`})})]}),l&&(0,O.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,A?(0,O.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(C.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=C.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{C.current=null},onPointerCancel:()=>{C.current=null},children:(0,O.jsx)(`img`,{src:A.src,alt:A.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var N=`xopc-attachment`,ne=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,re=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function P(e,t){return`${N}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function F(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(ne),a=r.match(re),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function ie(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var I=new Map,L=``;function R(e,t,n){return`${n}:${e}:${t}`}function z(){let e=o.getState().conversationId??``;if(e!==L){for(let e of I.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);I.clear(),L=e}}async function ae(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);return r||(r={blob:(async()=>{let n=await i(a(ie(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},I.set(n,r)),r.blob}async function B(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);if(r||(r={blob:ae(e,t),objectUrl:null,refCount:0},I.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function V(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,I.delete(n)))}var H={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},U=null,W=null,G=null,K=null;function q(){return U||(U=new Audio,U.addEventListener(`timeupdate`,()=>{Y.setState({currentTime:U.currentTime})}),U.addEventListener(`loadedmetadata`,()=>{let e=U.duration;Number.isFinite(e)&&Y.setState({duration:e})}),U.addEventListener(`ended`,()=>{Y.setState({playing:!1,currentTime:0}),U.currentTime=0}),U.addEventListener(`pause`,()=>{Y.setState({playing:!1})}),U.addEventListener(`play`,()=>{Y.setState({playing:!0})})),U}function J(){G&&K&&V(G,K),W=null,G=null,K=null}var Y=l()((e,t)=>({...H,play:async(n,r,i)=>{let a=q(),o=t();if(o.noteId===n&&o.attachmentId===r&&W){a.play();return}a.pause(),J(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await B(n,r);W=t,G=n,K=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),J()}},pause:()=>{q().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=q();n.currentTime=t,e({currentTime:t})},reset:()=>{q().pause(),q().src=``,J(),e(H)}}));function X(e,t){return P(e,t)}function oe(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function se(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function Z(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&o.getState().onUnauthorized(),!i.ok)throw Error(await se(i));return i.json()}function ce(e){let t=(0,E.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=F(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,D.useState)(d?null:s),[m,h]=(0,D.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),B(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,V(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,D.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=x(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsx)(w,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,O.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=x(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,O.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,O.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function le(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ue(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=F(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;B(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,V(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=F(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;B(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,V(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function de(e){let t=(0,E.c)(21),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,D.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,O.jsx)(C,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ue(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,D.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=le(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,O.jsx)(`div`,{ref:a,children:(0,O.jsx)(S,{children:(0,O.jsx)(b,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function fe(){return c(a(`/api/notes/project-summaries`))}async function pe(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return c(a(`/api/notes${n?`?${n}`:``}`))}async function me(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function he(e,t){return(await c(a(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function ge(e){let t=await i(a(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function _e(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ve(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function ye(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function be(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function xe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function Se(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function Ce(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function we(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function Te(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Ee(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function De(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Oe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ke(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Ae(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function je(e,t={}){return(await c(a(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Me(e,t,n){let r=new FormData;return r.append(`file`,t),(await Z(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await Z(a(`/api/notes`),n)).note}async function Ne(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await Q(n.id,{markdown:i})),n}async function Pe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${oe(t)}](${X(r.id,i.id)})`;return r.markdown!==a&&(r=await Q(r.id,{markdown:a,kind:`voice`})),r}async function Fe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ie(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Le(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{X as A,Ce as C,Me as D,Q as E,A as F,T as I,w as L,P as M,F as N,de as O,M as P,Te as S,Le as T,Ee as _,ye as a,Pe as b,ge as c,xe as d,Fe as f,pe as g,De as h,he as i,Y as j,ce as k,Oe as l,ve as m,we as n,je as o,fe as p,Se as r,_e as s,Ae as t,Ie as u,me as v,be as w,ke as x,Ne as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c,p as l}from"./locale-store-Cit_aHqC.js";import{t as u}from"./messages-DQveK9sk.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-CY7CS_D3.js";import{t as _}from"./createLucideIcon-DPHK1VkS.js";import{t as v}from"./download-Dk-ZjtO6.js";import{K as y,t as b}from"./markdown-view-CiGdWuN3.js";import{t as ee}from"./plus-Q2yW6OE7.js";import{t as te}from"./x-B_N4OPjy.js";import{t as x}from"./cn-0WouolD0.js";import{r as S,t as C}from"./chat-chart-block-CS-cORJt.js";var w=_(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),T=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),E=n(),D=e(t(),1),O=r(),k=(0,D.createContext)(null);function A(){let e=(0,E.c)(1),t=(0,D.useContext)(k);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:j},e[0]=t):t=e[0],t}return t}function j(){}function M({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=u(s(e=>e.language)).chat,[i,a]=(0,D.useState)(1),[o,c]=(0,D.useState)({x:0,y:0}),[l,_]=(0,D.useState)(!1),[b,S]=(0,D.useState)(!1),C=(0,D.useRef)(null),w=(0,D.useRef)(0),E=(0,D.useRef)(null),[A,j]=(0,D.useState)(null),M=(0,D.useCallback)((e,t)=>{E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current++,C.current=null,a(1),c({x:0,y:0}),_(!1),S(!1),j({src:e,alt:t})},[]),N=(0,D.useMemo)(()=>({openImage:M}),[M]);return(0,O.jsxs)(k.Provider,{value:N,children:[e,(0,O.jsx)(g,{open:A!==null,onOpenChange:e=>{e||(w.current++,j(null))},children:(0,O.jsxs)(p,{children:[(0,O.jsx)(d,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,O.jsxs)(m,{className:x(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),E.current?.isConnected&&E.current.focus({preventScroll:!0}))},children:[(0,O.jsx)(h,{className:`sr-only`,children:A?.alt||r.attachmentPreviewImage}),(0,O.jsx)(f,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,O.jsx)(te,{className:`size-5`,"aria-hidden":!0})})}),A&&n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,O.jsx)(y,{className:`size-5`})}),(0,O.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,O.jsx)(ee,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,O.jsx)(T,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:b,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=w.current;S(!0),_(!1);try{let t=await fetch(A.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==w.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===w.current&&_(!0)}finally{e===w.current&&S(!1)}},children:(0,O.jsx)(v,{className:`size-5`})})]}),l&&(0,O.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,A?(0,O.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(C.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=C.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{C.current=null},onPointerCancel:()=>{C.current=null},children:(0,O.jsx)(`img`,{src:A.src,alt:A.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var N=`xopc-attachment`,ne=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,re=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function P(e,t){return`${N}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function F(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(ne),a=r.match(re),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function ie(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var I=new Map,L=``;function R(e,t,n){return`${n}:${e}:${t}`}function z(){let e=o.getState().conversationId??``;if(e!==L){for(let e of I.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);I.clear(),L=e}}async function ae(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);return r||(r={blob:(async()=>{let n=await i(a(ie(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},I.set(n,r)),r.blob}async function B(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);if(r||(r={blob:ae(e,t),objectUrl:null,refCount:0},I.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function V(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,I.delete(n)))}var H={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},U=null,W=null,G=null,K=null;function q(){return U||(U=new Audio,U.addEventListener(`timeupdate`,()=>{Y.setState({currentTime:U.currentTime})}),U.addEventListener(`loadedmetadata`,()=>{let e=U.duration;Number.isFinite(e)&&Y.setState({duration:e})}),U.addEventListener(`ended`,()=>{Y.setState({playing:!1,currentTime:0}),U.currentTime=0}),U.addEventListener(`pause`,()=>{Y.setState({playing:!1})}),U.addEventListener(`play`,()=>{Y.setState({playing:!0})})),U}function J(){G&&K&&V(G,K),W=null,G=null,K=null}var Y=l()((e,t)=>({...H,play:async(n,r,i)=>{let a=q(),o=t();if(o.noteId===n&&o.attachmentId===r&&W){a.play();return}a.pause(),J(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await B(n,r);W=t,G=n,K=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),J()}},pause:()=>{q().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=q();n.currentTime=t,e({currentTime:t})},reset:()=>{q().pause(),q().src=``,J(),e(H)}}));function X(e,t){return P(e,t)}function oe(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function se(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function Z(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&o.getState().onUnauthorized(),!i.ok)throw Error(await se(i));return i.json()}function ce(e){let t=(0,E.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=F(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,D.useState)(d?null:s),[m,h]=(0,D.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),B(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,V(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,D.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=x(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsx)(w,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,O.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=x(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,O.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,O.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function le(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ue(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=F(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;B(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,V(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=F(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;B(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,V(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function de(e){let t=(0,E.c)(21),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,D.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,O.jsx)(C,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ue(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,D.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=le(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,O.jsx)(`div`,{ref:a,children:(0,O.jsx)(S,{children:(0,O.jsx)(b,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function fe(){return c(a(`/api/notes/project-summaries`))}async function pe(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return c(a(`/api/notes${n?`?${n}`:``}`))}async function me(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function he(e,t){return(await c(a(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function ge(e){let t=await i(a(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function _e(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ve(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function ye(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function be(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function xe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function Se(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function Ce(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function we(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function Te(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Ee(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function De(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Oe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ke(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Ae(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function je(e,t={}){return(await c(a(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Me(e,t,n){let r=new FormData;return r.append(`file`,t),(await Z(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await Z(a(`/api/notes`),n)).note}async function Ne(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await Q(n.id,{markdown:i})),n}async function Pe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${oe(t)}](${X(r.id,i.id)})`;return r.markdown!==a&&(r=await Q(r.id,{markdown:a,kind:`voice`})),r}async function Fe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ie(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Le(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{X as A,Ce as C,Me as D,Q as E,A as F,T as I,w as L,P as M,F as N,de as O,M as P,Te as S,Le as T,Ee as _,ye as a,Pe as b,ge as c,xe as d,Fe as f,pe as g,De as h,he as i,Y as j,ce as k,Oe as l,ve as m,we as n,je as o,fe as p,Se as r,_e as s,Ae as t,Ie as u,me as v,be as w,ke as x,Ne as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
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,l as a,m as ee,u as te}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as o,l as s,n as c}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{f as i,l as a,m as ee,u as te}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as o,l as s,n as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{t as u}from"./archive-Dz0hferG.js";import{N as d,R as f}from"./recording-upload-DXxD6grq.js";import{t as p}from"./arrow-left-D880xG-P.js";import{t as m}from"./arrow-right-DSSvoX71.js";import{t as h}from"./arrow-up-D5ZtR1QT.js";import{f as g}from"./product-automation-feedback-DrBclzH1.js";import{t as _}from"./calendar-days-hw_Y-g-s.js";import{t as ne}from"./chevron-down-ccbiQQz_.js";import{t as re}from"./popover-select-CLsphyzA.js";import{t as ie}from"./ellipsis-0k4rZLoy.js";import{t as v}from"./file-text-D12HbeVy.js";import{t as ae}from"./folder-CN-pC3XL.js";import{A as y,D as b,E as oe,_ as x,g as S,i as C,p as w,s as T}from"./notes-api-BQXOYFQ5.js";import{i as E,n as D,r as O,t as se}from"./star-CnYNmpLd.js";import{t as ce}from"./loader-circle-CifKLtgG.js";import{B as k}from"./markdown-view-CiGdWuN3.js";import{t as le}from"./mic-CuUb7zc-.js";import{t as A}from"./paperclip-f1HujQY1.js";import{t as ue}from"./plus-Q2yW6OE7.js";import{t as de}from"./search-DA7gz22f.js";import{t as fe}from"./sparkles-DHlfQFAF.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-DzdOeGYz.js";import{i as me}from"./vendor-swr-CdRzEUwF.js";import{r as he}from"./app-chrome-BeB4KgOf.js";import{t as ge}from"./page-header-store-DwFwq_lI.js";import{t as _e}from"./sliding-tab-list-CmcrqRzN.js";import{t as ve}from"./confirm-dialog-DrA5mTQp.js";import{n as ye}from"./index.module-Cd9ENXfk.js";import{l as be,m as xe,o as Se,r as Ce,t as we}from"./dist-ZrL34Ps4.js";import{a as Te,i as P,t as F}from"./note-detail-panel-CVEG1JdF.js";var I=e(t(),1),L=n();async function Ee(e){e.note??=await C({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await b(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${y(t,e.id)})`);e.note=await oe(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
2
|
|
|
3
3
|
`)}`})}return{noteId:t,conversationId:(await x(t,{projectId:e.projectId})).conversationId}}function R(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var z=r(),B={meeting:g,requirements:v,research:D,weekly:_};function De({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:ee}){let o=i.home,s=te(),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(!1),[m,g]=(0,I.useState)([]),[_,ie]=(0,I.useState)(!1),[v,y]=(0,I.useState)(null),[b,oe]=(0,I.useState)(``),x=(0,I.useRef)(null),S=(0,I.useRef)(!1),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=_||!!x.current,E=u?o.templateOptions[u]:null,D=!!(c.trim()||m.length);async function O(){if(!(S.current||!D&&!x.current)){S.current=!0,ie(!0),y(null),x.current??={requestId:crypto.randomUUID(),title:c.trim().split(`
|
|
4
4
|
`)[0]?.slice(0,80)||E?.label||i.titlePlaceholder,markdown:`## ${o.requestHeading}\n\n${E?`${E.prompt}\n`:``}${c.trim()}`,projectId:t||void 0,files:[...m],attachments:[],materialHeading:o.materialsHeading};try{let e=await Ee(x.current);r(),s(R(e.conversationId,e.noteId,o.agentPrompt))}catch(e){x.current.note&&r(),y(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{S.current=!1,ie(!1)}}}function se(){x.current=null,y(null),l(``),g([]),d(null),p(!1),w.current?.focus()}return(0,z.jsxs)(`section`,{"aria-label":o.askLabel,children:[(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),O()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,z.jsxs)(`fieldset`,{disabled:T,className:`min-w-0`,children:[(0,z.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,z.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),o.askLabel]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.agentResultHint}),E?(0,z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,z.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`font-medium`,children:[E.label,` · `]}),E.prompt.split(`
|
|
@@ -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";import{n}from"./electron-env-DHOGevH3.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a 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"./circle-check-C23XjkUj.js";import{t as a}from"./cloud-C4-yfnnk.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{a as s}from"./vendor-swr-CdRzEUwF.js";import{t as c}from"./button-Cc4hUNTt.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-CmdULYFt.js";import{a as d,n as f,r as p}from"./oauth-api-Bz_PU9R_.js";var m=e(t(),1),h=`xopc-onboarding-model-setup-dismissed`,g=`/api/models/cloud-onboarding`,_=n();function v({providerId:e,displayName:t,connected:n,onConnected:h,onPendingChange:v}){let y=r(e=>e.language),{mutate:b}=s(),x=y===`zh`,[S,C]=(0,m.useState)(`idle`),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(null),O=(0,m.useRef)(!1),k=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{O.current=!0,k.current?.close(),k.current=null},[]),(0,m.useEffect)(()=>(v?.(S===`waiting`),()=>v?.(!1)),[S,v]);let A=async()=>{O.current=!1,T(null),D(null),C(`waiting`);let t=l();t||(k.current?.close(),k.current=window.open(`about:blank`,`xopc-oauth`),k.current&&(k.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!O.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),O.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,D(i.authUrl),t){let e=await window.electronAPI?.shell?.openExternalUrl(i.authUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else k.current&&!k.current.closed&&k.current.location.replace(i.authUrl);if(i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){e===`xopc-cloud`&&await b(g),await u(),k.current?.close(),k.current=null,C(`connected`),h?.();return}}}catch(e){k.current?.close(),k.current=null,O.current||(C(`idle`),T(e instanceof Error?e.message:x?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},j=n||S===`connected`;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-inset p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,_.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-surface-active text-fg-muted`,children:(0,_.jsx)(a,{className:`size-5`,"aria-hidden":!0})}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),j?(0,_.jsx)(i,{className:`size-4 text-emerald-500`,"aria-label":x?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S===`waiting`?x?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:j?x?`已通过 OAuth 连接。`:`Connected with OAuth.`:x?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),S===`waiting`&&E?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:E,target:`_blank`,rel:`noreferrer`,children:x?`打开授权页面`:`Open authorization page`}):null,w?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:w}):null]})]}),(0,_.jsxs)(c,{type:`button`,variant:j?`secondary`:`primary`,disabled:S===`waiting`,onClick:()=>void A(),children:[S===`waiting`?(0,_.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S===`waiting`?x?`等待授权…`:`Waiting…`:j?x?`重新授权`:`Reauthorize`:x?`授权`:`Authorize`]})]})}export{g as n,h as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as a,n as o}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as a,n as o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./session-manager-Cby6Nkib.js";import{t as d}from"./capabilities-CBSMm_jo.js";import{r as f}from"./dist-ZrL34Ps4.js";import{n as p,t as m}from"./page-context-draft-BjbX5zd7.js";var h=e(t(),1),g=n();function _({resource:e,selection:t,label:n,disabled:_=!1,presentation:v=`button`}){let y=s(o(e=>e.language)).chat.pageContext,b=i(),x=r().key,[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(!1),D=(0,h.useRef)(0),O=a(e=>e.baseUrl),k=a(e=>e.conversationId);(0,h.useEffect)(()=>(E.current=!1,C(!1),T(!1),()=>{D.current+=1}),[x,e.kind,e.id,e.revision,t?.text,t?.draft,_,O,k]);async function A(){if(_||E.current)return;E.current=!0,C(!0),T(!1);let n=D.current,r=()=>D.current===n&&a.getState().baseUrl===O&&a.getState().conversationId===k;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await d(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new u().createSession();if(!r())return;if(!p.put(m(O,k,o.key),n))throw Error(`Context draft limit reached`);b(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&T(!0)}finally{D.current===n&&(E.current=!1,C(!1))}}let j=(0,g.jsxs)(`button`,{type:`button`,disabled:_||S,onClick:()=>void A(),"aria-busy":S,title:_?y.unavailable:n??y.capture,className:v===`menu`?`flex min-h-11 w-full items-center gap-2 rounded-md px-3 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover disabled:opacity-40`:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[S?(0,g.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n??y.capture]});return(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[v===`menu`?(0,g.jsx)(f,{asChild:!0,disabled:_||S,onSelect:e=>e.preventDefault(),children:j}):j,w?(0,g.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:y.unavailable}):null]})}export{_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-Cit_aHqC.js";import{v as t}from"./local-session-drafts-CgAuYyKi.js";function n(){let n=crypto.randomUUID(),r=crypto.randomUUID(),i=0,a=e(()=>({drafts:{}}));return{store:a,capture(e){return{envelope:t({version:1,clientInstanceId:n,tabId:r,sequence:++i,surface:`web`,capturedAt:Date.now(),resourceRefs:e.resourceRefs,selection:e.selection}),title:e.title,preview:e.text.slice(0,16e3),truncated:e.text.length>16e3}},put(e,t){let n=a.getState().drafts;return n[e]||Object.keys(n).length>=20?!1:(a.setState({drafts:{...n,[e]:structuredClone(t)}}),!0)},remove(e,t){let n=a.getState().drafts;if(n[e]!==t)return;let r={...n};delete r[e],a.setState({drafts:r})}}}var r=n();function i(e,t,n){return JSON.stringify([e,t??null,n])}export{r as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./locale-store-Cit_aHqC.js";var t={startExtra:null,main:null,end:null},n=e(e=>({...t,setPageHeader:t=>e(t),clearPageHeader:()=>e(t)}));export{n as t};
|
package/dist/gateway/static/root/assets/{personal-avatar-BPQpvC34.js → personal-avatar-B-Oes3ef.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./loopi-CNtmi9FU.js";import{t as r}from"./agent-avatar-display-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./loopi-CNtmi9FU.js";import{t as r}from"./agent-avatar-display-CIsejg_E.js";var i=e(),a=t(),o={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`};function s(e){let t=(0,i.c)(8),{appearance:s,agentId:c,className:l}=e,u=l===void 0?``:l;if(s===`custom`&&c){let e;return t[0]!==c||t[1]!==u?(e=(0,a.jsx)(r,{agentId:c,avatar:`xopc:custom`,className:u}),t[0]=c,t[1]=u,t[2]=e):e=t[2],e}let d=s===`custom`?`idle`:o[s],f=`personal-avatar-motion inline-flex items-center justify-center ${u}`,p;t[3]===d?p=t[4]:(p=(0,a.jsx)(n,{variant:`avatar`,mood:d,className:`size-full`}),t[3]=d,t[4]=p);let m;return t[5]!==f||t[6]!==p?(m=(0,a.jsx)(`span`,{className:f,"aria-hidden":`true`,children:p}),t[5]=f,t[6]=p,t[7]=m):m=t[7],m}export{s as t};
|
package/dist/gateway/static/root/assets/{personal-page-BB4Sv68K.js → personal-page-DWPu-iwK.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{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-DIBIYLnI.js";import{t as u}from"./messages-BDBGlBKh.js";import{t as d}from"./chat-page-BtMkdtxJ.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./arrow-right-DSSvoX71.js";import{a as m}from"./video-generation-D08uZbsu.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./list-todo-CTVRto8O.js";import{I as ee}from"./markdown-view-C30KvTaE.js";import{n as _,s as v,t as y}from"./install-connector-dialog-QkJMw_uW.js";import{t as b}from"./phone-DdhTnt6X.js";import{t as x}from"./play-kxZvpBg8.js";import{t as te}from"./settings-2-D-csvaET.js";import{t as ne}from"./upload-rrb46c3c.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{a as w,i as T,o as re,r as E,s as ie,t as D}from"./dist-GJ8-1PAx.js";import{a as O,r as k}from"./connectors-api-so2a7xrD.js";import{u as A}from"./use-realtime-voice-RQW5KnIN.js";import{n as ae}from"./voice-call-context-BM2A4bLz.js";import{t as oe}from"./page-header-store-C2ydtnXa.js";import{s as j}from"./agent-avatar-display-BO1bqKlR.js";import{t as M}from"./personal-avatar-BPQpvC34.js";import{d as se,i as N,r as P}from"./voice-config-api-vbBoKnqd.js";import{t as F}from"./date-formatters-DukWSVwc.js";import{t as ce}from"./personal-profile-settings-DwMdjQ6H.js";var I=n(),L=e(t(),1),R=r(),z=[`intro`,`identity`,`voice`,`connections`],B=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function le(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function V(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await l(s(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),j(e)}function H({modelsAvailable:e,onCreated:t}){let n=c(e=>e.language)===`zh`,r=c(e=>e.language),[i,o]=(0,L.useState)(`intro`),[d,m]=(0,L.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,ee]=(0,L.useState)(!1),[b,te]=(0,L.useState)(!1),[S,w]=(0,L.useState)(null),[T,re]=(0,L.useState)(null),[E,ie]=(0,L.useState)(null),[D,ae]=(0,L.useState)(null),[oe,j]=(0,L.useState)(!0),[F,ce]=(0,L.useState)([]),[I,H]=(0,L.useState)(null),U=(0,L.useRef)(null),W=(0,L.useRef)(null),[G,ue]=(0,L.useState)([]),[K,q]=(0,L.useState)(!0),[J,Y]=(0,L.useState)([]),[X,Z]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=!1;return l(s(`/api/personal-agent/onboarding`)).then(t=>{e||(o(t.payload.step),m(t.payload.draft))}).catch(t=>{e||w(t instanceof Error?t.message:String(t))}).finally(()=>{e||ee(!0)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:i,draft:d})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[d,g,i]),(0,L.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?ae({provider:t.tts.provider,model:t.tts.model,enabled:!0}):j(!1))}).catch(()=>{e||j(!1)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!D?.enabled)return;let e=!1;return N(D.provider,D.model,`realtime`).then(t=>{e||ce(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||j(!1)}),()=>{e=!0}},[D]),(0,L.useEffect)(()=>{if(i!==`connections`)return;let e=!1;return q(!0),Promise.allSettled([k({page:1,pageSize:24,verification:`verified`}),O()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];ue(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&Y(n.value),q(!1)}}),()=>{e=!0}},[i]),(0,L.useEffect)(()=>()=>{W.current?.abort(),U.current?.close()},[]),(0,L.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let Q=async(e,t=d)=>{await l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),o(e)},de=async e=>{w(null);let t=z[Math.max(0,Math.min(z.length-1,z.indexOf(i)+e))];try{await Q(t)}catch(e){w(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||b)){te(!0),w(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:d,r=e.voice&&D?.enabled&&F.some(t=>t.id===e.voice)?{provider:D.provider,model:D.model,voice:e.voice}:void 0,i=(await l(s(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&T)try{await V(i.agentId,T),i=(await l(s(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){w(e instanceof Error?e.message:String(e))}finally{te(!1)}}},pe=(0,L.useCallback)(async e=>{W.current?.abort(),U.current?.close();let t=new AbortController;W.current=t,H(e),w(null);try{let n=new A;U.current=n,await n.start();let r=await se(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>H(null))}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e)),H(null)}},[]);if(!g)return(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,R.jsx)(C,{className:`h-10 w-2/3`}),(0,R.jsx)(C,{className:`h-64 w-full rounded-2xl`}),(0,R.jsx)(C,{className:`h-12 w-full rounded-xl`})]});let $=z.indexOf(i),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[i];return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,R.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,R.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void de(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,R.jsx)(f,{className:`size-4`}),n?`上一步`:`Back`]}):(0,R.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,R.jsx)(a,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,R.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":z.length,children:z.map((e,t)=>(0,R.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,R.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,R.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,R.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,R.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,R.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,R.jsx)(M,{appearance:d.appearance,className:`size-14`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,R.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:d.displayName||`Ada`})]})]}),(0,R.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${z.length} 步`:`Step ${$+1} of ${z.length}`}),(0,R.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),i===`intro`&&(0,R.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,R.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,R.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),i===`identity`&&(0,R.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,R.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,R.jsx)(`input`,{value:d.displayName,maxLength:60,onChange:e=>m(t=>({...t,displayName:e.target.value})),onBlur:()=>m(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[B.map(e=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":!T&&d.appearance===e.id,onClick:()=>{re(null),ie(null),m(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!T&&d.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,R.jsx)(M,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,R.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${T?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,R.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,R.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){w(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}re(t),ie(URL.createObjectURL(t))}}})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),i===`voice`&&(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(C,{className:`h-20 rounded-xl`}),(0,R.jsx)(C,{className:`h-20 rounded-xl`})]}):D?.enabled&&F.length>0?(0,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":!d.voice,onClick:()=>m(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${d.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),F.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${d.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":d.voice===e.id,onClick:()=>m(t=>({...t,voice:e.id})),children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,R.jsx)(x,{className:`size-4 ${I===e.id?`text-accent`:``}`})})]},e.id))]}):(0,R.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,R.jsx)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`connections`&&(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),K?(0,R.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-xl`}),(0,R.jsx)(C,{className:`h-18 rounded-xl`})]}):(0,R.jsx)(`div`,{className:`mt-5 space-y-2`,children:G.length?G.map(e=>{let t=le(J.find(t=>t.connectorId===e.id));return(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,R.jsx)(_,{connector:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,R.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,R.jsx)(h,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>Z(v(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,R.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,R.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,R.jsx)(a,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},i)}),(0,R.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[i===`intro`&&(0,R.jsx)(`button`,{type:`button`,disabled:!e||b,onClick:()=>void fe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),i===`voice`&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let e={...d,voice:null};m(e),w(null),Q(`connections`,e).catch(e=>w(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,R.jsxs)(`button`,{type:`button`,disabled:b||i===`connections`&&!e,onClick:()=>i===`connections`?void fe():void de(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[b?n?`正在创建…`:`Creating…`:i===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!b&&(0,R.jsx)(p,{className:`size-4`})]})]})]})}),X&&(0,R.jsx)(y,{draft:X,onChange:Z,onClose:()=>Z(null),t:u(r).connectorsSettings,onInstalled:async()=>{Y(await O()),Z(null)}})]})}var U=5;function W(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function G(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ue(e){let t=(0,I.c)(30),{item:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=G(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===n.id?s=t[4]:(s=ee(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,R.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=W(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,R.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,R.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=F(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,R.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==f?(v=(0,R.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==d?(y=(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,v]}),t[22]=v,t[23]=d,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,R.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==s||t[28]!==l?(x=(0,R.jsxs)(a,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,y,b]}),t[26]=y,t[27]=s,t[28]=l,t[29]=x):x=t[29],x}function K(){let e=o(),t=i(),n=ae(),r=(0,L.useRef)(n);r.current=n;let a=c(e=>e.language)===`zh`,u=oe(e=>e.setPageHeader),f=oe(e=>e.clearPageHeader),[p,m]=(0,L.useState)(null),[h,ee]=(0,L.useState)([]),[_,v]=(0,L.useState)(!0),[y,x]=(0,L.useState)(null),[ne,O]=(0,L.useState)(!1),[k,A]=(0,L.useState)(!1),j=(0,L.useRef)(null),se=(0,L.useRef)(null),N=(0,L.useRef)(null),[P,F]=(0,L.useState)(!1),[I,z]=(0,L.useState)(null),[B,le]=(0,L.useState)(!1),[V,W]=(0,L.useState)(!1),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(0),Y=(0,L.useRef)(0),X=(0,L.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),Z=(0,L.useRef)(null),Q=(0,L.useRef)(null),de=(0,L.useCallback)(e=>{let t=Q.current;Q.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]),fe=(0,L.useCallback)(e=>{let t=N.current;N.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]);(0,L.useLayoutEffect)(()=>{let e=k?N.current:P?Q.current:null;Z.current=e,r.current.setMiniAnchor(e)},[k,P]),(0,L.useEffect)(()=>()=>r.current.setMiniAnchor(null),[]);let pe=(0,L.useCallback)(()=>{r.current.minimize(),F(!1),A(e=>!e)},[]);(0,L.useEffect)(()=>{n.expanded&&(A(!1),F(!1))},[n.expanded]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let $=(0,L.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(s(`/api/personal-agent`)),l(s(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),ee(t.payload)}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,L.useEffect)(()=>{$()},[$]);let me=(0,L.useCallback)(async()=>{r.current.minimize(),A(!1);let e=++Y.current;F(!0),z(null),le(!1),W(!1),K(!1),J(0);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{e===Y.current&&le(!0)}},[]),he=(0,L.useCallback)(async()=>{if(!I||V||q>=I.total)return;let e=Y.current;W(!0),K(!1);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=${q}`));if(e!==Y.current)return;z(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),J(e=>e+t.payload.items.length)}catch{e===Y.current&&K(!0)}finally{e===Y.current&&W(!1)}},[I,q,V]);return(0,L.useEffect)(()=>{if(!P||!I||V)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Y.current;try{let t=await l(s(`/api/personal-agent/activity?limit=${Math.max(U,Math.min(100,q))}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[I,q,V,P]),(0,L.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=a?`语音通话`:`Voice call`,i=()=>{A(!1),F(!1),e&&r.current.open({conversationId:p.conversationId,name:p.displayName})},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return u({startExtra:null,main:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e?(0,R.jsx)(`button`,{ref:se,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`编辑${s}的资料`:`Edit ${s}'s profile`,title:a?`设置`:`Settings`,children:(0,R.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})})}):(0,R.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})}),(0,R.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:e?(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":n.expanded,onClick:i,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":t,title:t,children:(0,R.jsx)(b,{className:`size-5`})}),(0,R.jsxs)(re,{open:P,onOpenChange:e=>{e?me():F(!1)},children:[(0,R.jsx)(ie,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"aria-pressed":P,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`正在做的事`:`Activity`,children:(0,R.jsx)(g,{className:`size-5`})})}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:de,onInteractOutside:e=>{e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`)&&e.preventDefault()},side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`派发的任务`:`Delegated tasks`,className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我推进的事`:`Delegated work`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:I?a?`最近更新 · 共 ${I.total} 项`:`Recently updated · ${I.total} total`:a?`查看任务进展与结果`:`Follow progress and results`})]}),(0,R.jsx)(E,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭活动`:`Close activity`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-5 pt-3`,children:[!I&&!B&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`})]}),B&&(0,R.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`暂时无法读取任务`:`Could not load tasks`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:a?`重试`:`Try again`})]}),I?.items.length===0&&(0,R.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,R.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:a?`还没有派发的任务`:`No delegated work yet`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),I&&I.items.length>0&&(0,R.jsx)(`div`,{className:`space-y-2`,children:I.items.map(e=>(0,R.jsx)(ue,{item:e,zh:a},e.id))}),I&&q<I.total&&(0,R.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void he(),disabled:V,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:V?a?`正在加载…`:`Loading…`:a?`加载更多`:`Load more`}),G&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,R.jsx)(`button`,{ref:j,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`Ada 设置`:`Ada settings`,children:(0,R.jsx)(te,{className:`size-5`})})]}):null}),()=>f()},[I,B,q,V,G,f,he,me,p,u,P,k,pe,de,n.active,n.expanded,a]),_?(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,R.jsx)(C,{className:`h-20 w-20 rounded-full`}),(0,R.jsx)(C,{className:`h-9 w-72`}),(0,R.jsx)(C,{className:`h-44 w-full rounded-2xl`})]}):y&&!p?(0,R.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,R.jsx)(`p`,{children:y}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`text-accent hover:underline`,children:a?`重试`:`Retry`})]}):p?.state===`ready`?(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ne&&(0,R.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,R.jsx)(`span`,{children:a?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),X()},className:`shrink-0 text-accent hover:underline`,children:a?`打开设置`:`Open settings`})]}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(d,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,avatar:(0,R.jsx)(M,{appearance:p.appearance,agentId:p.agentId,className:`size-14`}),opening:a?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,R.jsxs)(re,{open:k,onOpenChange:A,children:[(0,R.jsx)(D,{virtualRef:j}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:fe,side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`Ada 快捷设置`:`Ada quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(j.current?.contains(e.target)||se.current?.contains(e.target)||N.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(22rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`快捷设置`:`Quick settings`}),(0,R.jsx)(E,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭设置`:`Close settings`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:(0,R.jsx)(ce,{zh:a,onOpenVoiceServices:X})}),(0,R.jsx)(`button`,{type:`button`,onClick:X,className:`shrink-0 border-t border-edge px-4 py-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:a?`更多设置`:`More settings`})]})})]})]}):(0,R.jsx)(H,{modelsAvailable:h.length>0,onCreated:(e,t)=>{m(e),O(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{K as PersonalPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-Cit_aHqC.js";import{t as u}from"./messages-DQveK9sk.js";import{t as d}from"./chat-page-hcsqrv-7.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./arrow-right-DSSvoX71.js";import{a as m}from"./video-generation-D08uZbsu.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./list-todo-CTVRto8O.js";import{I as ee}from"./markdown-view-CiGdWuN3.js";import{n as _,s as v,t as y}from"./install-connector-dialog-0_PeJJqO.js";import{t as b}from"./phone-DdhTnt6X.js";import{t as x}from"./play-kxZvpBg8.js";import{t as te}from"./settings-2-D-csvaET.js";import{t as ne}from"./upload-rrb46c3c.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{a as w,i as T,o as re,r as E,s as ie,t as D}from"./dist-GJ8-1PAx.js";import{a as O,r as k}from"./connectors-api-BUdH4tZQ.js";import{u as A}from"./use-realtime-voice-lRHVixh4.js";import{n as ae}from"./voice-call-context-BM2A4bLz.js";import{t as oe}from"./page-header-store-DwFwq_lI.js";import{s as j}from"./agent-avatar-display-CIsejg_E.js";import{t as M}from"./personal-avatar-B-Oes3ef.js";import{d as se,i as N,r as P}from"./voice-config-api-BLGbUq3v.js";import{t as F}from"./date-formatters-DukWSVwc.js";import{t as ce}from"./personal-profile-settings-CDrzvI35.js";var I=n(),L=e(t(),1),R=r(),z=[`intro`,`identity`,`voice`,`connections`],B=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function le(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function V(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await l(s(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),j(e)}function H({modelsAvailable:e,onCreated:t}){let n=c(e=>e.language)===`zh`,r=c(e=>e.language),[i,o]=(0,L.useState)(`intro`),[d,m]=(0,L.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,ee]=(0,L.useState)(!1),[b,te]=(0,L.useState)(!1),[S,w]=(0,L.useState)(null),[T,re]=(0,L.useState)(null),[E,ie]=(0,L.useState)(null),[D,ae]=(0,L.useState)(null),[oe,j]=(0,L.useState)(!0),[F,ce]=(0,L.useState)([]),[I,H]=(0,L.useState)(null),U=(0,L.useRef)(null),W=(0,L.useRef)(null),[G,ue]=(0,L.useState)([]),[K,q]=(0,L.useState)(!0),[J,Y]=(0,L.useState)([]),[X,Z]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=!1;return l(s(`/api/personal-agent/onboarding`)).then(t=>{e||(o(t.payload.step),m(t.payload.draft))}).catch(t=>{e||w(t instanceof Error?t.message:String(t))}).finally(()=>{e||ee(!0)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:i,draft:d})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[d,g,i]),(0,L.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?ae({provider:t.tts.provider,model:t.tts.model,enabled:!0}):j(!1))}).catch(()=>{e||j(!1)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!D?.enabled)return;let e=!1;return N(D.provider,D.model,`realtime`).then(t=>{e||ce(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||j(!1)}),()=>{e=!0}},[D]),(0,L.useEffect)(()=>{if(i!==`connections`)return;let e=!1;return q(!0),Promise.allSettled([k({page:1,pageSize:24,verification:`verified`}),O()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];ue(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&Y(n.value),q(!1)}}),()=>{e=!0}},[i]),(0,L.useEffect)(()=>()=>{W.current?.abort(),U.current?.close()},[]),(0,L.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let Q=async(e,t=d)=>{await l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),o(e)},de=async e=>{w(null);let t=z[Math.max(0,Math.min(z.length-1,z.indexOf(i)+e))];try{await Q(t)}catch(e){w(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||b)){te(!0),w(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:d,r=e.voice&&D?.enabled&&F.some(t=>t.id===e.voice)?{provider:D.provider,model:D.model,voice:e.voice}:void 0,i=(await l(s(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&T)try{await V(i.agentId,T),i=(await l(s(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){w(e instanceof Error?e.message:String(e))}finally{te(!1)}}},pe=(0,L.useCallback)(async e=>{W.current?.abort(),U.current?.close();let t=new AbortController;W.current=t,H(e),w(null);try{let n=new A;U.current=n,await n.start();let r=await se(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>H(null))}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e)),H(null)}},[]);if(!g)return(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,R.jsx)(C,{className:`h-10 w-2/3`}),(0,R.jsx)(C,{className:`h-64 w-full rounded-2xl`}),(0,R.jsx)(C,{className:`h-12 w-full rounded-xl`})]});let $=z.indexOf(i),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[i];return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,R.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,R.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void de(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,R.jsx)(f,{className:`size-4`}),n?`上一步`:`Back`]}):(0,R.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,R.jsx)(a,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,R.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":z.length,children:z.map((e,t)=>(0,R.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,R.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,R.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,R.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,R.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,R.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,R.jsx)(M,{appearance:d.appearance,className:`size-14`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,R.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:d.displayName||`Ada`})]})]}),(0,R.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${z.length} 步`:`Step ${$+1} of ${z.length}`}),(0,R.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),i===`intro`&&(0,R.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,R.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,R.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),i===`identity`&&(0,R.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,R.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,R.jsx)(`input`,{value:d.displayName,maxLength:60,onChange:e=>m(t=>({...t,displayName:e.target.value})),onBlur:()=>m(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[B.map(e=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":!T&&d.appearance===e.id,onClick:()=>{re(null),ie(null),m(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!T&&d.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,R.jsx)(M,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,R.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${T?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,R.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,R.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){w(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}re(t),ie(URL.createObjectURL(t))}}})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),i===`voice`&&(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(C,{className:`h-20 rounded-xl`}),(0,R.jsx)(C,{className:`h-20 rounded-xl`})]}):D?.enabled&&F.length>0?(0,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":!d.voice,onClick:()=>m(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${d.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),F.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${d.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":d.voice===e.id,onClick:()=>m(t=>({...t,voice:e.id})),children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,R.jsx)(x,{className:`size-4 ${I===e.id?`text-accent`:``}`})})]},e.id))]}):(0,R.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,R.jsx)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`connections`&&(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),K?(0,R.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-xl`}),(0,R.jsx)(C,{className:`h-18 rounded-xl`})]}):(0,R.jsx)(`div`,{className:`mt-5 space-y-2`,children:G.length?G.map(e=>{let t=le(J.find(t=>t.connectorId===e.id));return(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,R.jsx)(_,{connector:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,R.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,R.jsx)(h,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>Z(v(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,R.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,R.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,R.jsx)(a,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},i)}),(0,R.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[i===`intro`&&(0,R.jsx)(`button`,{type:`button`,disabled:!e||b,onClick:()=>void fe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),i===`voice`&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let e={...d,voice:null};m(e),w(null),Q(`connections`,e).catch(e=>w(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,R.jsxs)(`button`,{type:`button`,disabled:b||i===`connections`&&!e,onClick:()=>i===`connections`?void fe():void de(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[b?n?`正在创建…`:`Creating…`:i===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!b&&(0,R.jsx)(p,{className:`size-4`})]})]})]})}),X&&(0,R.jsx)(y,{draft:X,onChange:Z,onClose:()=>Z(null),t:u(r).connectorsSettings,onInstalled:async()=>{Y(await O()),Z(null)}})]})}var U=5;function W(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function G(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ue(e){let t=(0,I.c)(30),{item:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=G(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===n.id?s=t[4]:(s=ee(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,R.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=W(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,R.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,R.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=F(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,R.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==f?(v=(0,R.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==d?(y=(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,v]}),t[22]=v,t[23]=d,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,R.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==s||t[28]!==l?(x=(0,R.jsxs)(a,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,y,b]}),t[26]=y,t[27]=s,t[28]=l,t[29]=x):x=t[29],x}function K(){let e=o(),t=i(),n=ae(),r=(0,L.useRef)(n);r.current=n;let a=c(e=>e.language)===`zh`,u=oe(e=>e.setPageHeader),f=oe(e=>e.clearPageHeader),[p,m]=(0,L.useState)(null),[h,ee]=(0,L.useState)([]),[_,v]=(0,L.useState)(!0),[y,x]=(0,L.useState)(null),[ne,O]=(0,L.useState)(!1),[k,A]=(0,L.useState)(!1),j=(0,L.useRef)(null),se=(0,L.useRef)(null),N=(0,L.useRef)(null),[P,F]=(0,L.useState)(!1),[I,z]=(0,L.useState)(null),[B,le]=(0,L.useState)(!1),[V,W]=(0,L.useState)(!1),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(0),Y=(0,L.useRef)(0),X=(0,L.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),Z=(0,L.useRef)(null),Q=(0,L.useRef)(null),de=(0,L.useCallback)(e=>{let t=Q.current;Q.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]),fe=(0,L.useCallback)(e=>{let t=N.current;N.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]);(0,L.useLayoutEffect)(()=>{let e=k?N.current:P?Q.current:null;Z.current=e,r.current.setMiniAnchor(e)},[k,P]),(0,L.useEffect)(()=>()=>r.current.setMiniAnchor(null),[]);let pe=(0,L.useCallback)(()=>{r.current.minimize(),F(!1),A(e=>!e)},[]);(0,L.useEffect)(()=>{n.expanded&&(A(!1),F(!1))},[n.expanded]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let $=(0,L.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(s(`/api/personal-agent`)),l(s(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),ee(t.payload)}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,L.useEffect)(()=>{$()},[$]);let me=(0,L.useCallback)(async()=>{r.current.minimize(),A(!1);let e=++Y.current;F(!0),z(null),le(!1),W(!1),K(!1),J(0);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{e===Y.current&&le(!0)}},[]),he=(0,L.useCallback)(async()=>{if(!I||V||q>=I.total)return;let e=Y.current;W(!0),K(!1);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=${q}`));if(e!==Y.current)return;z(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),J(e=>e+t.payload.items.length)}catch{e===Y.current&&K(!0)}finally{e===Y.current&&W(!1)}},[I,q,V]);return(0,L.useEffect)(()=>{if(!P||!I||V)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Y.current;try{let t=await l(s(`/api/personal-agent/activity?limit=${Math.max(U,Math.min(100,q))}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[I,q,V,P]),(0,L.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=a?`语音通话`:`Voice call`,i=()=>{A(!1),F(!1),e&&r.current.open({conversationId:p.conversationId,name:p.displayName})},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return u({startExtra:null,main:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e?(0,R.jsx)(`button`,{ref:se,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`编辑${s}的资料`:`Edit ${s}'s profile`,title:a?`设置`:`Settings`,children:(0,R.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})})}):(0,R.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})}),(0,R.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:e?(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":n.expanded,onClick:i,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":t,title:t,children:(0,R.jsx)(b,{className:`size-5`})}),(0,R.jsxs)(re,{open:P,onOpenChange:e=>{e?me():F(!1)},children:[(0,R.jsx)(ie,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"aria-pressed":P,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`正在做的事`:`Activity`,children:(0,R.jsx)(g,{className:`size-5`})})}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:de,onInteractOutside:e=>{e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`)&&e.preventDefault()},side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`派发的任务`:`Delegated tasks`,className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我推进的事`:`Delegated work`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:I?a?`最近更新 · 共 ${I.total} 项`:`Recently updated · ${I.total} total`:a?`查看任务进展与结果`:`Follow progress and results`})]}),(0,R.jsx)(E,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭活动`:`Close activity`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-5 pt-3`,children:[!I&&!B&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`})]}),B&&(0,R.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`暂时无法读取任务`:`Could not load tasks`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:a?`重试`:`Try again`})]}),I?.items.length===0&&(0,R.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,R.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:a?`还没有派发的任务`:`No delegated work yet`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),I&&I.items.length>0&&(0,R.jsx)(`div`,{className:`space-y-2`,children:I.items.map(e=>(0,R.jsx)(ue,{item:e,zh:a},e.id))}),I&&q<I.total&&(0,R.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void he(),disabled:V,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:V?a?`正在加载…`:`Loading…`:a?`加载更多`:`Load more`}),G&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,R.jsx)(`button`,{ref:j,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`Ada 设置`:`Ada settings`,children:(0,R.jsx)(te,{className:`size-5`})})]}):null}),()=>f()},[I,B,q,V,G,f,he,me,p,u,P,k,pe,de,n.active,n.expanded,a]),_?(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,R.jsx)(C,{className:`h-20 w-20 rounded-full`}),(0,R.jsx)(C,{className:`h-9 w-72`}),(0,R.jsx)(C,{className:`h-44 w-full rounded-2xl`})]}):y&&!p?(0,R.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,R.jsx)(`p`,{children:y}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`text-accent hover:underline`,children:a?`重试`:`Retry`})]}):p?.state===`ready`?(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ne&&(0,R.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,R.jsx)(`span`,{children:a?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),X()},className:`shrink-0 text-accent hover:underline`,children:a?`打开设置`:`Open settings`})]}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(d,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,avatar:(0,R.jsx)(M,{appearance:p.appearance,agentId:p.agentId,className:`size-14`}),opening:a?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,R.jsxs)(re,{open:k,onOpenChange:A,children:[(0,R.jsx)(D,{virtualRef:j}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:fe,side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`Ada 快捷设置`:`Ada quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(j.current?.contains(e.target)||se.current?.contains(e.target)||N.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(22rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`快捷设置`:`Quick settings`}),(0,R.jsx)(E,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭设置`:`Close settings`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:(0,R.jsx)(ce,{zh:a,onOpenVoiceServices:X})}),(0,R.jsx)(`button`,{type:`button`,onClick:X,className:`shrink-0 border-t border-edge px-4 py-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:a?`更多设置`:`More settings`})]})})]})]}):(0,R.jsx)(H,{modelsAvailable:h.length>0,onCreated:(e,t)=>{m(e),O(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{K as PersonalPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,o as a}from"./locale-store-DIBIYLnI.js";import{t as o}from"./messages-BDBGlBKh.js";import{n as s,r as c,t as l}from"./popover-select-CLsphyzA.js";import{t as u}from"./play-kxZvpBg8.js";import{t as d}from"./square-DMK_fB-3.js";import{t as f}from"./upload-rrb46c3c.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{n as m,t as h}from"./voice-CDlC6XMH.js";import{D as g,p as _,t as v}from"./session-manager-D5g6LOU-.js";import{t as y}from"./composer-model-config-control-BhRAbdPW.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-Cc4hUNTt.js";import{u as S}from"./use-realtime-voice-RQW5KnIN.js";import{s as C}from"./agent-avatar-display-BO1bqKlR.js";import{t as w}from"./personal-avatar-BPQpvC34.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-vbBoKnqd.js";var A=e(t(),1),j=n();function M({preferences:e,settings:t,failed:n,disabled:r,zh:i,onChange:a,onOpenServices:o,children:l}){let[u,d]=(0,A.useState)(null),f=(0,A.useRef)(0),g=u??e?.enginePreference??`auto`;async function _(e){if(e===g)return;let t=++f.current;d(e);try{await a({enginePreference:e})}finally{t===f.current&&d(null)}}let v=t?.defaultForNatural?h:t?.legacyModel,y=e?.naturalModel,b=y??v,S=b===h,C=t?.naturalModels??(t?.legacyModel?[{id:t.legacyModel,name:t.legacyModelLabel??t.legacyModel,tools:void 0}]:[]),w=C.find(e=>e.id===b),T=y&&y!==`boson/higgs-realtime`&&!C.some(e=>e.id===y);return(0,j.jsx)(`section`,{className:`space-y-3`,"aria-label":i?`语音通话设置`:`Voice call settings`,children:(0,j.jsxs)(`fieldset`,{disabled:r,className:`space-y-3`,children:[(0,j.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{children:i?`通话引擎`:`Call engine`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`通话引擎`:`Call engine`,value:g,onChange:e=>{_(e.target.value)},children:[(0,j.jsx)(c,{value:`auto`,children:i?`自动选择`:`Automatic`}),(0,j.jsx)(c,{value:`natural`,children:i?`实时语音`:`Realtime voice`}),(0,j.jsx)(c,{value:`assistant`,children:i?`助手语音`:`Assistant voice`})]})]}),(0,j.jsx)(`div`,{inert:g===`natural`,"aria-hidden":g===`natural`,className:g===`natural`?`hidden`:``,children:l(g!==`natural`)}),(0,j.jsxs)(`div`,{inert:g===`assistant`,"aria-hidden":g===`assistant`,className:`space-y-3 ${g===`assistant`?`hidden`:``}`,children:[!t&&!n&&(0,j.jsx)(p,{className:`h-10 w-full`}),n&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i?`无法读取自然语音模型。`:`Could not load natural voice models.`}),t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`通话模型`:`Call model`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音模型`:`Natural voice model`,value:y??`inherit`,onChange:e=>a({naturalModel:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统`:`Follow system`,v?` · ${v===`boson/higgs-realtime`?`Higgs Realtime`:t.legacyModelLabel??v}`:``]}),C.map(e=>(0,j.jsxs)(c,{value:e.id,children:[e.name,e.tools===!1?i?` · 仅对话`:` · Conversation only`:``]},e.id)),(t.credentialSource||y===`boson/higgs-realtime`)&&(0,j.jsx)(c,{value:`boson/higgs-realtime`,children:`Higgs Realtime`}),T&&(0,j.jsxs)(c,{value:y,children:[y,` · `,i?`不可用`:`Unavailable`]})]}),w?.tools===!1&&(0,j.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`此模型仅支持语音交流,不能交办任务。自动选择时会使用具备行动能力的备用引擎。`:`This model supports conversation only. Automatic selection uses the fallback Agent engine to retain actions.`})]}),S&&(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`声音`:`Voice`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音音色`:`Natural voice`,value:e?.higgsVoice??`inherit`,onChange:e=>a({higgsVoice:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统音色`:`Follow system voice`,` · `,t.voice==="default"?i?`模型默认`:`Model default`:t.voice]}),m.map(e=>(0,j.jsx)(c,{value:e,children:e==="default"?i?`模型默认`:`Model default`:e},e))]})]}),o&&(!b||T||S&&!t.credentialSource)&&(0,j.jsx)(x,{type:`button`,variant:`ghost`,onClick:o,children:i?`设置自然语音服务`:`Set up natural voice`})]})]})]})})}var N=new v;function P({conversationId:e,zh:t,onSaved:n}){let r=g(t=>t.sessions[e]),[i,a]=(0,A.useState)(!0),[s,c]=(0,A.useState)(``);(0,A.useEffect)(()=>{let t=!0;return N.loadSessionAgentConfig(e).then(n=>{t&&_(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){g.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{_(e,await N.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await N.loadSessionAgentConfig(e).catch(()=>null);throw n&&_(e,n),t}finally{g.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型`:`Chat model`}),i?(0,j.jsx)(p,{className:`h-9 w-full`}):(0,j.jsx)(y,{chat:o(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:s})]})}function F({record:e,zh:t,onSelectVoice:n,onGreetingChange:i,onOpenServices:a,active:o=!0}){let[s,c]=(0,A.useState)(!1),[f,m]=(0,A.useState)(!0),[h,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)([]),[x,C]=(0,A.useState)(e.voicePreference?.voice??``),[w,D]=(0,A.useState)(!1),[k,M]=(0,A.useState)(null),[N,P]=(0,A.useState)(null),[F,I]=(0,A.useState)(null),L=(0,A.useRef)(null),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await O();if(e||(c(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};v(n);let r=await E(n.provider,n.model,`realtime`);e||b(r)}catch(t){e||P(t instanceof Error?t.message:String(t))}finally{e||m(!1)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>()=>{R.current?.abort(),L.current?.close()},[]);let z=(0,A.useCallback)(()=>{R.current?.abort(),R.current=null,L.current?.close(),L.current=null,I(null)},[]);(0,A.useEffect)(()=>{o||z()},[o,z]);let B=async e=>{if(F!==null){z();return}z(),P(null);let n=new AbortController;R.current=n,I(e);try{let t=new S;L.current=t,await t.start();let r=await T(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{R.current===n&&(I(null),R.current=null,L.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;P(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}R.current===n&&z()}},V=async e=>{if(w||e===x)return;z();let t=x;C(e),g(``),D(!0),P(null);try{await n(e&&_?{provider:_.provider,model:_.model,voice:e}:null)||C(t)}catch(e){C(t),P(e instanceof Error?e.message:String(e))}finally{D(!1)}},H=y.find(e=>e.id===x),U=t?`默认声音`:`Default voice`,W=H?.name||(x?t?`当前音色不可用`:`Current voice unavailable`:U),G=h.trim().toLocaleLowerCase(),K=y.filter(e=>!G||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(G)).map(e=>({value:e.id,label:e.name}));return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h4`,{className:`text-sm text-fg`,children:t?`声音`:`Voice`}),f?(0,j.jsx)(`div`,{className:`mt-1`,"aria-busy":`true`,children:(0,j.jsx)(p,{className:`h-10 w-full`})}):_&&y.length?(0,j.jsxs)(`div`,{className:`mt-1 space-y-2`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(l,{value:x,selectedLabel:W,options:K,side:`top`,placeholder:U,emptyLabel:U,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:w,onChange:e=>void V(e),searchPlaceholder:y.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:h,onSearchChange:g,statusMessage:G&&!K.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,j.jsxs)(`button`,{type:`button`,disabled:w||!!(x&&!H),onClick:()=>void B(x),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,"aria-label":F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,children:[F===null?(0,j.jsx)(u,{className:`size-4`,"aria-hidden":!0}):(0,j.jsx)(d,{className:`size-4 text-accent`,"aria-hidden":!0}),F===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(H?.description||H?.style||!x)&&(0,j.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:H?.description||H?.style||(t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,j.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,a?(0,j.jsx)(`button`,{type:`button`,onClick:a,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`}):(0,j.jsx)(r,{to:`/settings/personal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),i&&s&&(0,j.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`接通时问候`:`Greet me when connected`,(0,j.jsx)(`input`,{type:`checkbox`,checked:k??e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:w||k!==null,onChange:e=>{let t=e.target.checked;M(t),i(t).catch(e=>P(String(e))).finally(()=>M(null))}})]}),N&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:N})]})}var I=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function L({zh:e,onOpenVoiceServices:t}){let[n,o]=(0,A.useState)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(Promise.resolve()),[l,u]=(0,A.useState)(!0),[d,m]=(0,A.useState)(0),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`loopi`),[y,x]=(0,A.useState)(!1),S=(0,A.useRef)(null),[T,E]=(0,A.useState)(``),[O,N]=(0,A.useState)(!1),L=(0,A.useCallback)(async()=>{g(null);try{let e=await a(i(`/api/personal-agent`));s.current=e.payload,o(e.payload),e.payload&&(E(e.payload.displayName),v(e.payload.appearance))}catch(e){g(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]);(0,A.useEffect)(()=>{L()},[L]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==s.current?.displayName&&E(t.displayName),t.appearance!==s.current?.appearance&&v(t.appearance),s.current=t,o(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let{data:R,error:z}=b(n?.state===`ready`?i(k):null,D),B=(0,A.useCallback)((e,t=!0)=>{t&&m(e=>e+1),g(null);let n=c.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,c=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(c)===JSON.stringify(t.voicePreference)&&!e.voiceCallPreferences)return!0;try{let l=await a(i(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:c},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=l.payload,o(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return g(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&m(e=>e-1)});return c.current=n,n},[]),V=async t=>{if(!n||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){g(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){g(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}x(!0),g(null);try{let e=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await a(i(`/api/agents/${encodeURIComponent(n.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(n.agentId),v(`custom`),N(!1),await B({appearance:`custom`})}catch(e){g(e instanceof Error?e.message:String(e))}finally{x(!1)}};return l?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(p,{className:`h-20 w-full`}),(0,j.jsx)(p,{className:`h-48 w-full`})]}):n?.state===`ready`?(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 资料与通话设置`:`Ada profile and call settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>N(e=>!e),"aria-expanded":O,"aria-controls":`personal-appearance-options`,"aria-label":e?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,j.jsx)(w,{appearance:_,agentId:n.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:T,onChange:e=>E(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(E(t),B({displayName:t})):E(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,E(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,j.jsxs)(`div`,{className:`space-y-5`,children:[h&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),O&&(0,j.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:e?`形象`:`Appearance`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[I.map(t=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{v(t.id),N(!1),B({appearance:t.id})},"aria-pressed":_===t.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_===t.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${t.color}`,children:(0,j.jsx)(w,{appearance:t.id,className:`size-8`})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e?t.zh:t.en})]},t.id)),(0,j.jsx)(`input`,{ref:S,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":e?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&V(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>S.current?.click(),"aria-pressed":_===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${_===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:_===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:n.agentId,className:`size-8`}):(0,j.jsx)(f,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:y?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:n.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}}),(0,j.jsx)(M,{preferences:n.voiceCallPreferences,settings:R,failed:!!z,disabled:d>0,zh:e,onOpenServices:t,onChange:e=>B({voiceCallPreferences:e},e.enginePreference===void 0),children:r=>(0,j.jsx)(F,{active:r,onOpenServices:t,onGreetingChange:e=>B({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:n,zh:e,onSelectVoice:e=>B({voicePreference:e})})})]})]}):(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[h?(0,j.jsx)(`p`,{role:`alert`,children:h}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),h?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]})}export{L as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,o as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./messages-DQveK9sk.js";import{n as s,r as c,t as l}from"./popover-select-CLsphyzA.js";import{t as u}from"./play-kxZvpBg8.js";import{t as d}from"./square-DMK_fB-3.js";import{t as f}from"./upload-rrb46c3c.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{n as m,t as h}from"./voice-CDlC6XMH.js";import{D as g,p as _,t as v}from"./session-manager-Cby6Nkib.js";import{t as y}from"./composer-model-config-control-BF9PPSiu.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-Cc4hUNTt.js";import{u as S}from"./use-realtime-voice-lRHVixh4.js";import{s as C}from"./agent-avatar-display-CIsejg_E.js";import{t as w}from"./personal-avatar-B-Oes3ef.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-BLGbUq3v.js";var A=e(t(),1),j=n();function M({preferences:e,settings:t,failed:n,disabled:r,zh:i,onChange:a,onOpenServices:o,children:l}){let[u,d]=(0,A.useState)(null),f=(0,A.useRef)(0),g=u??e?.enginePreference??`auto`;async function _(e){if(e===g)return;let t=++f.current;d(e);try{await a({enginePreference:e})}finally{t===f.current&&d(null)}}let v=t?.defaultForNatural?h:t?.legacyModel,y=e?.naturalModel,b=y??v,S=b===h,C=t?.naturalModels??(t?.legacyModel?[{id:t.legacyModel,name:t.legacyModelLabel??t.legacyModel,tools:void 0}]:[]),w=C.find(e=>e.id===b),T=y&&y!==`boson/higgs-realtime`&&!C.some(e=>e.id===y);return(0,j.jsx)(`section`,{className:`space-y-3`,"aria-label":i?`语音通话设置`:`Voice call settings`,children:(0,j.jsxs)(`fieldset`,{disabled:r,className:`space-y-3`,children:[(0,j.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{children:i?`通话引擎`:`Call engine`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`通话引擎`:`Call engine`,value:g,onChange:e=>{_(e.target.value)},children:[(0,j.jsx)(c,{value:`auto`,children:i?`自动选择`:`Automatic`}),(0,j.jsx)(c,{value:`natural`,children:i?`实时语音`:`Realtime voice`}),(0,j.jsx)(c,{value:`assistant`,children:i?`助手语音`:`Assistant voice`})]})]}),(0,j.jsx)(`div`,{inert:g===`natural`,"aria-hidden":g===`natural`,className:g===`natural`?`hidden`:``,children:l(g!==`natural`)}),(0,j.jsxs)(`div`,{inert:g===`assistant`,"aria-hidden":g===`assistant`,className:`space-y-3 ${g===`assistant`?`hidden`:``}`,children:[!t&&!n&&(0,j.jsx)(p,{className:`h-10 w-full`}),n&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i?`无法读取自然语音模型。`:`Could not load natural voice models.`}),t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`通话模型`:`Call model`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音模型`:`Natural voice model`,value:y??`inherit`,onChange:e=>a({naturalModel:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统`:`Follow system`,v?` · ${v===`boson/higgs-realtime`?`Higgs Realtime`:t.legacyModelLabel??v}`:``]}),C.map(e=>(0,j.jsxs)(c,{value:e.id,children:[e.name,e.tools===!1?i?` · 仅对话`:` · Conversation only`:``]},e.id)),(t.credentialSource||y===`boson/higgs-realtime`)&&(0,j.jsx)(c,{value:`boson/higgs-realtime`,children:`Higgs Realtime`}),T&&(0,j.jsxs)(c,{value:y,children:[y,` · `,i?`不可用`:`Unavailable`]})]}),w?.tools===!1&&(0,j.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`此模型仅支持语音交流,不能交办任务。自动选择时会使用具备行动能力的备用引擎。`:`This model supports conversation only. Automatic selection uses the fallback Agent engine to retain actions.`})]}),S&&(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`声音`:`Voice`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音音色`:`Natural voice`,value:e?.higgsVoice??`inherit`,onChange:e=>a({higgsVoice:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统音色`:`Follow system voice`,` · `,t.voice==="default"?i?`模型默认`:`Model default`:t.voice]}),m.map(e=>(0,j.jsx)(c,{value:e,children:e==="default"?i?`模型默认`:`Model default`:e},e))]})]}),o&&(!b||T||S&&!t.credentialSource)&&(0,j.jsx)(x,{type:`button`,variant:`ghost`,onClick:o,children:i?`设置自然语音服务`:`Set up natural voice`})]})]})]})})}var N=new v;function P({conversationId:e,zh:t,onSaved:n}){let r=g(t=>t.sessions[e]),[i,a]=(0,A.useState)(!0),[s,c]=(0,A.useState)(``);(0,A.useEffect)(()=>{let t=!0;return N.loadSessionAgentConfig(e).then(n=>{t&&_(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){g.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{_(e,await N.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await N.loadSessionAgentConfig(e).catch(()=>null);throw n&&_(e,n),t}finally{g.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型`:`Chat model`}),i?(0,j.jsx)(p,{className:`h-9 w-full`}):(0,j.jsx)(y,{chat:o(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:s})]})}function F({record:e,zh:t,onSelectVoice:n,onGreetingChange:i,onOpenServices:a,active:o=!0}){let[s,c]=(0,A.useState)(!1),[f,m]=(0,A.useState)(!0),[h,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)([]),[x,C]=(0,A.useState)(e.voicePreference?.voice??``),[w,D]=(0,A.useState)(!1),[k,M]=(0,A.useState)(null),[N,P]=(0,A.useState)(null),[F,I]=(0,A.useState)(null),L=(0,A.useRef)(null),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await O();if(e||(c(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};v(n);let r=await E(n.provider,n.model,`realtime`);e||b(r)}catch(t){e||P(t instanceof Error?t.message:String(t))}finally{e||m(!1)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>()=>{R.current?.abort(),L.current?.close()},[]);let z=(0,A.useCallback)(()=>{R.current?.abort(),R.current=null,L.current?.close(),L.current=null,I(null)},[]);(0,A.useEffect)(()=>{o||z()},[o,z]);let B=async e=>{if(F!==null){z();return}z(),P(null);let n=new AbortController;R.current=n,I(e);try{let t=new S;L.current=t,await t.start();let r=await T(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{R.current===n&&(I(null),R.current=null,L.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;P(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}R.current===n&&z()}},V=async e=>{if(w||e===x)return;z();let t=x;C(e),g(``),D(!0),P(null);try{await n(e&&_?{provider:_.provider,model:_.model,voice:e}:null)||C(t)}catch(e){C(t),P(e instanceof Error?e.message:String(e))}finally{D(!1)}},H=y.find(e=>e.id===x),U=t?`默认声音`:`Default voice`,W=H?.name||(x?t?`当前音色不可用`:`Current voice unavailable`:U),G=h.trim().toLocaleLowerCase(),K=y.filter(e=>!G||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(G)).map(e=>({value:e.id,label:e.name}));return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h4`,{className:`text-sm text-fg`,children:t?`声音`:`Voice`}),f?(0,j.jsx)(`div`,{className:`mt-1`,"aria-busy":`true`,children:(0,j.jsx)(p,{className:`h-10 w-full`})}):_&&y.length?(0,j.jsxs)(`div`,{className:`mt-1 space-y-2`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(l,{value:x,selectedLabel:W,options:K,side:`top`,placeholder:U,emptyLabel:U,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:w,onChange:e=>void V(e),searchPlaceholder:y.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:h,onSearchChange:g,statusMessage:G&&!K.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,j.jsxs)(`button`,{type:`button`,disabled:w||!!(x&&!H),onClick:()=>void B(x),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,"aria-label":F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,children:[F===null?(0,j.jsx)(u,{className:`size-4`,"aria-hidden":!0}):(0,j.jsx)(d,{className:`size-4 text-accent`,"aria-hidden":!0}),F===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(H?.description||H?.style||!x)&&(0,j.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:H?.description||H?.style||(t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,j.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,a?(0,j.jsx)(`button`,{type:`button`,onClick:a,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`}):(0,j.jsx)(r,{to:`/settings/personal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),i&&s&&(0,j.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`接通时问候`:`Greet me when connected`,(0,j.jsx)(`input`,{type:`checkbox`,checked:k??e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:w||k!==null,onChange:e=>{let t=e.target.checked;M(t),i(t).catch(e=>P(String(e))).finally(()=>M(null))}})]}),N&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:N})]})}var I=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function L({zh:e,onOpenVoiceServices:t}){let[n,o]=(0,A.useState)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(Promise.resolve()),[l,u]=(0,A.useState)(!0),[d,m]=(0,A.useState)(0),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`loopi`),[y,x]=(0,A.useState)(!1),S=(0,A.useRef)(null),[T,E]=(0,A.useState)(``),[O,N]=(0,A.useState)(!1),L=(0,A.useCallback)(async()=>{g(null);try{let e=await a(i(`/api/personal-agent`));s.current=e.payload,o(e.payload),e.payload&&(E(e.payload.displayName),v(e.payload.appearance))}catch(e){g(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]);(0,A.useEffect)(()=>{L()},[L]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==s.current?.displayName&&E(t.displayName),t.appearance!==s.current?.appearance&&v(t.appearance),s.current=t,o(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let{data:R,error:z}=b(n?.state===`ready`?i(k):null,D),B=(0,A.useCallback)((e,t=!0)=>{t&&m(e=>e+1),g(null);let n=c.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,c=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(c)===JSON.stringify(t.voicePreference)&&!e.voiceCallPreferences)return!0;try{let l=await a(i(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:c},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=l.payload,o(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return g(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&m(e=>e-1)});return c.current=n,n},[]),V=async t=>{if(!n||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){g(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){g(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}x(!0),g(null);try{let e=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await a(i(`/api/agents/${encodeURIComponent(n.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(n.agentId),v(`custom`),N(!1),await B({appearance:`custom`})}catch(e){g(e instanceof Error?e.message:String(e))}finally{x(!1)}};return l?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(p,{className:`h-20 w-full`}),(0,j.jsx)(p,{className:`h-48 w-full`})]}):n?.state===`ready`?(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 资料与通话设置`:`Ada profile and call settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>N(e=>!e),"aria-expanded":O,"aria-controls":`personal-appearance-options`,"aria-label":e?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,j.jsx)(w,{appearance:_,agentId:n.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:T,onChange:e=>E(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(E(t),B({displayName:t})):E(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,E(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,j.jsxs)(`div`,{className:`space-y-5`,children:[h&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),O&&(0,j.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:e?`形象`:`Appearance`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[I.map(t=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{v(t.id),N(!1),B({appearance:t.id})},"aria-pressed":_===t.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_===t.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${t.color}`,children:(0,j.jsx)(w,{appearance:t.id,className:`size-8`})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e?t.zh:t.en})]},t.id)),(0,j.jsx)(`input`,{ref:S,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":e?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&V(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>S.current?.click(),"aria-pressed":_===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${_===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:_===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:n.agentId,className:`size-8`}):(0,j.jsx)(f,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:y?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:n.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}}),(0,j.jsx)(M,{preferences:n.voiceCallPreferences,settings:R,failed:!!z,disabled:d>0,zh:e,onOpenServices:t,onChange:e=>B({voiceCallPreferences:e},e.enginePreference===void 0),children:r=>(0,j.jsx)(F,{active:r,onOpenServices:t,onGreetingChange:e=>B({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:n,zh:e,onSelectVoice:e=>B({voicePreference:e})})})]})]}):(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[h?(0,j.jsx)(`p`,{role:`alert`,children:h}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),h?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]})}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{i,n as a,o}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{i,n as a,o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./popover-select-CLsphyzA.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{gt as l}from"./session-manager-Cby6Nkib.js";import{t as u}from"./voice-settings-CssuMBjt.js";import{t as d}from"./use-personal-profile-CKm5FaTl.js";import{n as f,t as p}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";import{t as m}from"./personal-profile-settings-CDrzvI35.js";var h=n(),g=e(t(),1),_=r();function v(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var y=v();function b({zh:e}){let[t,n]=(0,g.useState)(),[r,a]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(``),m=f.trim().toLowerCase().replaceAll(`_`,` `),h=[...new Set([...y,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(m)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,g.useEffect)(()=>{let e=!0;return o(i(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(l.parse(t.payload))}).catch(t=>{e&&a(String(t))}),()=>{e=!1}},[]);async function v(e){if(!(!t||u)){d(!0),a(``);try{let r=await o(i(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(l.parse(r.payload))}catch(e){a(String(e));let t=await o(i(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(l.parse(t.payload))}finally{d(!1)}}}return(0,_.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,_.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,_.jsx)(c,{className:`h-9 w-full`}):t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void v({mode:e})}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietStart:Number(e)})})]}),(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietEnd:Number(e)})})]})]}),(0,_.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,_.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:h,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:h.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&v({timezone:e})}})]}),(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,_.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function x(){let e=(0,h.c)(22),{displayName:t}=d(),n=a(S)===`zh`,[r,i]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{i(!0),s(!0)},e[0]=c):c=e[0];let l=c,v;e[1]===t?v=e[2]:(v=(0,_.jsx)(p,{title:t}),e[1]=t,e[2]=v);let y,x;e[3]===n?(y=e[4],x=e[5]):(y=(0,_.jsx)(m,{zh:n,onOpenVoiceServices:l}),x=(0,_.jsx)(b,{zh:n}),e[3]=n,e[4]=y,e[5]=x);let C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{i(e.currentTarget.open),e.currentTarget.open&&s(!0)},e[6]=C):C=e[6];let w=n?`语音服务设置`:`Voice service settings`,T;e[7]===w?T=e[8]:(T=(0,_.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:w}),e[7]=w,e[8]=T);let E;e[9]===o?E=e[10]:(E=o&&(0,_.jsx)(u,{capability:`conversation`}),e[9]=o,e[10]=E);let D;e[11]===E?D=e[12]:(D=(0,_.jsx)(`div`,{className:`mt-4`,children:E}),e[11]=E,e[12]=D);let O;e[13]!==r||e[14]!==T||e[15]!==D?(O=(0,_.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,open:r,onToggle:C,children:[T,D]}),e[13]=r,e[14]=T,e[15]=D,e[16]=O):O=e[16];let k;return e[17]!==v||e[18]!==y||e[19]!==x||e[20]!==O?(k=(0,_.jsxs)(f,{children:[v,y,x,O]}),e[17]=v,e[18]=y,e[19]=x,e[20]=O,e[21]=k):k=e[21],k}function S(e){return e.language}export{x as PersonalSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i,o as a}from"./locale-store-DIBIYLnI.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-Cc4hUNTt.js";import{a as m}from"./runtime-tools-api-BoJQ3u5o.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r,initialPlatform:a=`android`}){let m=i(e=>e.language)===`zh`,[x,S]=(0,h.useState)(a),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)({adb:``,scrcpy:``,hdc:``,hoscrcpy:``,java:``}),[j,M]=(0,h.useState)(),[N,P]=(0,h.useState)(``),[F,I]=(0,h.useState)(!1),{data:L,error:R,mutate:z}=f(g(),_,{refreshInterval:T?2500:0}),B=m?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},V=m?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function H(e,n){E(e),I(!1),P(``),M(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(k.adb.trim()):await y(e,n===`existing`?`import`:n,M,n===`existing`?k.scrcpy.trim():void 0),await z(),t?.(),P(m?`依赖已就绪。`:`Dependency is ready.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0)}}let U=t=>x===`harmonyos`?[`hdc`,`hoscrcpy`,`java`].includes(t):t===`scrcpy`||t===`adb`&&(!e||D),W=L?.statuses.filter(e=>U(e.kind));async function G(){w(!0),I(!1),P(``);try{for(let e of[`hdc`,`java`,`hoscrcpy`])if((await _()).statuses.find(t=>t.kind===e)?.state!==`ready`&&(E(e),await y(e,`install`,M),!(await _()).statuses.some(t=>t.kind===e&&t.state===`ready`)))throw Error(m?`${e} 安装后验证未通过。`:`${e} failed validation after installation.`);P(m?`鸿蒙连接组件已就绪,可以连接手机。`:`HarmonyOS components are ready. Connect your phone.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0),w(!1),await z(),t?.()}}let K=!!(W?.length&&W.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":m?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:m?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${R?`text-danger`:`text-fg-muted`}`,children:[K&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),R?m?`检测失败`:`Check failed`:L?K?m?`已就绪`:`Ready`:m?`需要配置`:`Setup needed`:m?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(p,{variant:`ghost`,"aria-label":m?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!T,onClick:()=>void z(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),L?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,(0,b.jsx)(`div`,{className:`flex gap-2`,role:`group`,"aria-label":m?`手机系统`:`Phone platform`,children:[`android`,`harmonyos`].map(e=>(0,b.jsx)(p,{variant:x===e?`secondary`:`ghost`,disabled:!!T||C,"aria-pressed":x===e,onClick:()=>S(e),children:e===`android`?`Android`:m?`鸿蒙`:`HarmonyOS`},e))}),x===`harmonyos`?(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`无需安装 DevEco Studio。HDC 只下载当前电脑的可执行文件和 USB 库,约 6 MB;Java 和投屏库独立安装。`:`No DevEco Studio required. HDC downloads only the executable and USB library for this computer, about 6 MB. Java and the video library are installed separately.`}),(0,b.jsxs)(p,{disabled:!!T||C||!W?.some(e=>e.state!==`ready`&&e.canInstall),onClick:()=>void G(),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),C?m?`正在安装鸿蒙组件…`:`Installing HarmonyOS components…`:m?`一键安装缺失组件`:`Install missing components`]})]}):null,e&&x===`android`?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:m?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":D,onClick:()=>O(e=>!e),children:D?m?`收起本机连接依赖`:`Hide local connection dependencies`:m?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,R?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):L?L.statuses.filter(e=>U(e.kind)).map(e=>{let t={adb:`ADB · Android Platform Tools`,scrcpy:`scrcpy server`,hdc:`HDC · OpenHarmony`,hoscrcpy:`HOScrcpy · 1.0.18-beta`,java:`Java · Amazon Corretto JDK`}[e.kind];return(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:t}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[B[e.state],e.version?` · ${e.version}`:` · ${m?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?m?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?m?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(p,{disabled:!!T||C||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void H(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),T===e.kind||e.state===`installing`?m?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?m?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?m?`修复托管安装`:`Repair managed copy`:m?`安装`:`Install`]})]}),e.distribution?(0,b.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.distribution}):null,(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x===`harmonyos`?e.kind===`hdc`?m?`用于 USB 连接、截图和基础操作。`:`USB connection, screenshots and basic actions.`:m?`用于实时投屏;缺失时仍可使用截图。`:`Required for live video; snapshots remain available without it.`:e.kind===`adb`?m?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:m?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),x===`android`?(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?m?`使用已有 ADB`:`Use existing ADB`:m?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[m?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?m?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:m?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?m?`已有 ADB 路径`:`Existing ADB path`:m?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:k[e.kind],disabled:!!T,onChange:t=>A(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?m?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:m?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(p,{className:`mt-3`,disabled:!!T||!k[e.kind].trim(),onClick:()=>void H(e.kind,`existing`),children:m?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(p,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!T,onClick:()=>void H(`adb`,`detect`),children:m?`恢复自动检测`:`Use automatic detection`}):null]}):null]},e.kind)}):(0,b.jsx)(d,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:j?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[V[j.phase]??j.phase,j.downloadedBytes&&j.totalBytes?` · ${Math.min(100,Math.round(j.downloadedBytes/j.totalBytes*100))}%`:``]}):N?(0,b.jsx)(`p`,{role:F?`alert`:`status`,className:F?`text-danger`:`text-fg-muted`,children:N}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:m?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i,o as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-Cc4hUNTt.js";import{a as m}from"./runtime-tools-api-CL6CG-qq.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r,initialPlatform:a=`android`}){let m=i(e=>e.language)===`zh`,[x,S]=(0,h.useState)(a),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)({adb:``,scrcpy:``,hdc:``,hoscrcpy:``,java:``}),[j,M]=(0,h.useState)(),[N,P]=(0,h.useState)(``),[F,I]=(0,h.useState)(!1),{data:L,error:R,mutate:z}=f(g(),_,{refreshInterval:T?2500:0}),B=m?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},V=m?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function H(e,n){E(e),I(!1),P(``),M(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(k.adb.trim()):await y(e,n===`existing`?`import`:n,M,n===`existing`?k.scrcpy.trim():void 0),await z(),t?.(),P(m?`依赖已就绪。`:`Dependency is ready.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0)}}let U=t=>x===`harmonyos`?[`hdc`,`hoscrcpy`,`java`].includes(t):t===`scrcpy`||t===`adb`&&(!e||D),W=L?.statuses.filter(e=>U(e.kind));async function G(){w(!0),I(!1),P(``);try{for(let e of[`hdc`,`java`,`hoscrcpy`])if((await _()).statuses.find(t=>t.kind===e)?.state!==`ready`&&(E(e),await y(e,`install`,M),!(await _()).statuses.some(t=>t.kind===e&&t.state===`ready`)))throw Error(m?`${e} 安装后验证未通过。`:`${e} failed validation after installation.`);P(m?`鸿蒙连接组件已就绪,可以连接手机。`:`HarmonyOS components are ready. Connect your phone.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0),w(!1),await z(),t?.()}}let K=!!(W?.length&&W.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":m?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:m?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${R?`text-danger`:`text-fg-muted`}`,children:[K&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),R?m?`检测失败`:`Check failed`:L?K?m?`已就绪`:`Ready`:m?`需要配置`:`Setup needed`:m?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(p,{variant:`ghost`,"aria-label":m?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!T,onClick:()=>void z(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),L?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,(0,b.jsx)(`div`,{className:`flex gap-2`,role:`group`,"aria-label":m?`手机系统`:`Phone platform`,children:[`android`,`harmonyos`].map(e=>(0,b.jsx)(p,{variant:x===e?`secondary`:`ghost`,disabled:!!T||C,"aria-pressed":x===e,onClick:()=>S(e),children:e===`android`?`Android`:m?`鸿蒙`:`HarmonyOS`},e))}),x===`harmonyos`?(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`无需安装 DevEco Studio。HDC 只下载当前电脑的可执行文件和 USB 库,约 6 MB;Java 和投屏库独立安装。`:`No DevEco Studio required. HDC downloads only the executable and USB library for this computer, about 6 MB. Java and the video library are installed separately.`}),(0,b.jsxs)(p,{disabled:!!T||C||!W?.some(e=>e.state!==`ready`&&e.canInstall),onClick:()=>void G(),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),C?m?`正在安装鸿蒙组件…`:`Installing HarmonyOS components…`:m?`一键安装缺失组件`:`Install missing components`]})]}):null,e&&x===`android`?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:m?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":D,onClick:()=>O(e=>!e),children:D?m?`收起本机连接依赖`:`Hide local connection dependencies`:m?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,R?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):L?L.statuses.filter(e=>U(e.kind)).map(e=>{let t={adb:`ADB · Android Platform Tools`,scrcpy:`scrcpy server`,hdc:`HDC · OpenHarmony`,hoscrcpy:`HOScrcpy · 1.0.18-beta`,java:`Java · Amazon Corretto JDK`}[e.kind];return(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:t}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[B[e.state],e.version?` · ${e.version}`:` · ${m?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?m?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?m?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(p,{disabled:!!T||C||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void H(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),T===e.kind||e.state===`installing`?m?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?m?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?m?`修复托管安装`:`Repair managed copy`:m?`安装`:`Install`]})]}),e.distribution?(0,b.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.distribution}):null,(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x===`harmonyos`?e.kind===`hdc`?m?`用于 USB 连接、截图和基础操作。`:`USB connection, screenshots and basic actions.`:m?`用于实时投屏;缺失时仍可使用截图。`:`Required for live video; snapshots remain available without it.`:e.kind===`adb`?m?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:m?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),x===`android`?(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?m?`使用已有 ADB`:`Use existing ADB`:m?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[m?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?m?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:m?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?m?`已有 ADB 路径`:`Existing ADB path`:m?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:k[e.kind],disabled:!!T,onChange:t=>A(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?m?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:m?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(p,{className:`mt-3`,disabled:!!T||!k[e.kind].trim(),onClick:()=>void H(e.kind,`existing`),children:m?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(p,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!T,onClick:()=>void H(`adb`,`detect`),children:m?`恢复自动检测`:`Use automatic detection`}):null]}):null]},e.kind)}):(0,b.jsx)(d,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:j?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[V[j.phase]??j.phase,j.downloadedBytes&&j.totalBytes?` · ${Math.min(100,Math.round(j.downloadedBytes/j.totalBytes*100))}%`:``]}):N?(0,b.jsx)(`p`,{role:F?`alert`:`status`,className:F?`text-danger`:`text-fg-muted`,children:N}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:m?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};
|