@xopcai/xopc 0.0.424 → 0.0.426
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-AI081rxe.js → activity-store-D_DXNHba.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DupnTbL7.js → agent-avatar-dicebear-CjaQxFQt.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-CmEj6Uqy.js → agent-avatar-display-6Z4m31Fz.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-IEV5yKuu.js → agent-defaults-settings-panel-Dne9A10p.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-D_njOuFA.js → agent-plugin-dialog-BoHL-b1o.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-B_yg9nA3.js → agents-CIiIlVBp.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-CUZUolwG.js → agents-admin-api-u5c3GREg.js} +1 -1
- package/dist/gateway/static/root/assets/{api-bpQ7yR10.js → api-C3Tp9MkF.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CWWEVThO.js → api-CRT9ZyH0.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C0_hxwgg.js → app-management-settings-panel-C8yc3yHG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CLh-qnCC.js → appearance-settings-BELgtR3O.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Bjtm3Rgi.js → apps-page-vgS1CHDj.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-dGnstkhB.js → archive-plugin-BCQnOkV8.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-MB2xCoFF.js → automation-api-hRsGx-qe.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-DJQflY78.js → automation-result-state-CMfVTv_i.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-DXgBxVE2.js → automation-task-card-MnzgyTVA.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D3O7M2FH.js → automations-page-CdIPdwF0.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-Dk3FVWoX.js → automations-workspace-C3xZLafX.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-BrVJXmYf.js → binary-plugins-CIB5cbvQ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dok4sfT3.js → block-editor-BQtTLe6Q.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-PJbT3CxW.js → browser-automation-inputs-DeraGZ1y.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-kkpX1Q7K.js → browser-automations-page-SpPzRNqU.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-control-api-Bg4wnkeA.js → browser-control-api-CbbPvhHR.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BrgX_Yb2.js → browser-settings-page-BD1uF_Nb.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BMaJizw4.js → capabilities-BGE6hiUE.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Cs6Jt5Gl.js → capabilities-DLMuj21P.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-D5hvAG6D.js → capabilities-page-Bda4mSdf.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BrEvm4IH.js → capabilities-settings-panel-B2B7no22.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-1jQgGVc9.js → channels-NtsjZThx.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BAOWaUJf.js → chat-agents-api-D8YS5amE.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DeWrb9XR.js → chat-chart-block-DCzUECct.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-BnOCCAXG.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C544n0-R.js → chat-terminal-dock-Dl-OTkJI.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-D9PXzY8b.js → command-palette-api-Dijix7V6.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-CYXfjpem.js → composer-payload-handoff-CQc-VTaL.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJmod8-w.js → computer-settings-page-B-lGMimW.js} +1 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-CcXe9kz5.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-BqDbTOTp.js → connector-service-page-C8InhrMt.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-CwRuUnH4.js → connectors-api-DEJU8mgn.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Mq9Bvoax.js → connectors-page-Ci0L2How.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DWaT0IC0.js → date-picker-kqic8j73.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DV9XAt6F.js → dependency-picker-cbC6-2Ya.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Dffq2NxL.js → desktop-pet-DFNehTtd.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-narrative-CS8qJpNO.js → desktop-pet-narrative-ChwjpnsG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CrB1ICax.js → desktop-pet-settings-BDS7_tQ_.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-liRgSkcT.js → dev-view-store-CeZZLOc6.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-_3BJFWVQ.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-EKqQLQrE.js → directory-picker-path-field-Di0h3ws4.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-D-b1X6ro.js → discussion-annotation-sync-ClKEyXmN.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-wD97GeG0.js → extension-debug-page-DwB5KMGk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-B4Q1CjvW.js → extension-iframe-host-Cqg1K70e.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-ak1_K3u8.js → extension-marketplace-api-DRBszrCR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DWFI4iIh.js → extension-page-DyrQtG82.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BZwcaU5Y.js → extension-provider-C_uKqJxP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-cn4KS42C.js → extension-settings-page-BAMQHzkX.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-c3gDD9sM.js → file-preview-surface-DfkXvFnc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dmt5JhZU.js → gateway-config-swr-BOCt_zOo.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CJtDXQCt.js → gateway-realtime-BL_Cf0OQ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BHBOPF_q.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-DInvvT5u.js → gateway-restart-CHf8qY7H.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BZXdv2FE.js → gateway-settings-uAboiElC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-s2KcWekp.js → gateway-startup-retry-CvkJYurV.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-DtnmDd87.js → global-defaults-api-BWMbKu72.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CAVjA5rO.js → home-page-D6pCBY1V.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-RQQokgE9.js → image-generation-api-CQxZSTWA.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BP_4TubV.js → imports-page-C90644id.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cc41XQid.css +1 -0
- package/dist/gateway/static/root/assets/index-CnOYR6jq.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-BNzNuXJ8.js → install-connector-dialog-BuNXON0P.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DNRQFepg.js → keyboard-shortcuts-settings-CbeubKe1.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CvY5XxbX.js → local-app-workbench-page-CP-BkbB6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DfwEvd8G.js → local-apps-page-C6zFgwkr.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CuDdIyxR.js → local-session-drafts-BJ1B1dQ7.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-TQcz_Vjt.js → locale-store-Br7IfbXK.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-eq49F1Rt.js → logs-page-CpVCvAWE.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BaYXDMOJ.js → management-settings-I-pXv4ML.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D4nII6Zv.js → markdown-view-DrVAMlwc.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-MvlAY405.js → media-plugins-Ba6vUE4J.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ByFlEbsu.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-nsoNHqif.js → model-selector-CXcxc30J.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-CFIazNIF.js → models-hub-cache-Bd-fYUrV.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-KPzbHiEW.js → note-detail-panel-CbpLXAVh.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-cLGiF8oU.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-HVxR5bRD.js → notes-api-CUlhTRv0.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-yShJeR3i.js → notes-page-eoKX85K5.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-CfKjRVnb.js → oauth-api-DMMdeaNd.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-D4uqONWr.js → oauth-provider-connect-C8BXow79.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-B98nlKTc.js → page-context-capture-button-CBFK41OS.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-HcuK45iu.js → page-context-draft-LF33STHC.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-Du44NIEJ.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-_d72UP_d.js → personal-avatar-D6CzIIfo.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-B19h_3WQ.js → personal-page-CXR1Gy0x.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CfwtGyue.js → personal-settings-panel-DnYapLo7.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-D8bqsDk_.js → phone-dependencies-card-DBiKtzwz.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CL_Zn6Xd.js → phone-model-picker-BmSxEr7M.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-C5Jia8eQ.js → phone-settings-page-vg65qilc.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-FBfrfkYq.js → phone-workspace-store-SN7hfddU.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-gAq2KPzK.js → plugin-details-dialog-B3Hn2cbx.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-Ck8GAX_y.js → preference-select-fields-Cu_ZC9Up.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-BJ9oTnNs.js → product-automation-feedback-Tn2dUJWM.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dw9hUdxP.js → product-open-page-Nf-Oqf1h.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-C0iPzmSm.js → product-preview-content-D6NwUm3A.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-COFtHoh6.js → product-preview-modal-BfNcGgXA.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-C5Amjah-.js → project-detail-page-Ch-ZMyTu.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-DpL9ADQU.js → project-understanding-B1BK7Ixi.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-gGg9nM2t.js → projects-page-B7cetxao.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-D6JJRlJb.js → providers-api-DOnNfkwQ.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-DxX1xKyt.js → recording-upload-RAhaLUcQ.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BfXzBR1D.js → registry-api-DFDvOTg4.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BZA4StwC.js → remote-access-hub-DWsOWetc.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-X-SIrZYI.js → resource-unavailable-TQcRCpAg.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-CWRb0UCt.js → route-preload-Zc5Z3fNv.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-1DjsPyQ5.js → runtime-tools-api-9o3Wfji1.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BnCtyORj.js → runtime-tools-settings-panel-BGiXeHF5.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-ChSOfHHh.js → service-recommendation-list-BEnNx0u7.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-rvY5aWw8.js → session-api-Bs3r_d2_.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-ChUtTAoG.js +23 -0
- package/dist/gateway/static/root/assets/{sessions-page-DAS2IUGT.js → sessions-page-Bt52kBvJ.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BI4DMz4_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-ZKRIuk7h.js → settings-advanced-section-CURRjsLK.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-CtJ8pEfm.js → settings-mode-store-CiRpsdTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B3pUce-_.js → settings-page-GtsbT6as.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DuNCn8i-.js → settings-page-header-DBL0_u0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DeNC8YHJ.js → settings-page-layout-IAvpbz4A.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Fc3vuz_h.js → setup-status-panel-A6uMpGRy.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-B3hwjVAx.js → share-link-dialog-D1otGSXD.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D_9oFzGS.js → share-preview-page-L9KYu8M7.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BoUpXmxq.js → shares-api-D8Q-m46d.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Drfuvepz.js → shares-settings-Bmfadz8A.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-By2HhJ9O.js → skill-api-uKU4sRiv.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-TaUCzS8Y.js → skill-list-api-BzKzG-xG.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CN2fpS1n.js → skill-reload-api-DkUXekcd.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-LzGLique.js → skills-page-BZklXTX9.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Cuyg8Ml3.js → system-settings-panel-CsvcFoaJ.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-SjZGW1Dx.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-DDubAU_5.js → task-result-evidence-B8xUiwW3.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-BNs75Wdr.js → terminal-panel-store-DJVC7HqA.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DB1ZfBUm.js → theme-store-Dlnmgryi.js} +1 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +1 -0
- package/dist/gateway/static/root/assets/{tracing-settings-page-TvtX4Goh.js → tracing-settings-page-MvG4SH64.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-COoVEdV9.js → tunnel-api-BB7u79ID.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-Dr_MLgYe.js → understanding-activity-store-C4bblRnQ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-DGmLGEqw.js → understanding-refresh-store-BvCj9-Ue.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DP6eb6ed.js → usage-page-Cv4Je5XJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-itwjDYUb.js → use-autosave-YHxQ-UZg.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-hjIGlI_2.js → use-composer-attachments-vDdxHtUb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-ClLa0g8D.js → use-file-preview-expanded-Ce2mgYme.js} +2 -2
- package/dist/gateway/static/root/assets/{use-personal-profile-vhWk6tTU.js → use-personal-profile-D2Un8G1L.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-dfXXjA2-.js → use-workspace-tree-BQEiJzK7.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-D8dswPWd.js → user-model-page-DRSsn4EV.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BIfBySnN.js → voice-api-key-field-DCM69u8Y.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-J4o59ICE.js → voice-config-api-CrULrSKC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-B1mlpUdC.js → voice-input-shortcut-events-DFMNIyy4.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-xxaSOOmq.js → voice-transcribe-api-Bbyj0yGR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DqwT1E5u.js → work-discovery-overlay-CVe9UmFl.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BzYQmPLT.js → work-discovery-page-CtqkRMN5.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-D2Zf3GOG.js → working-directory-picker-modal-CDZ1xh3o.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Bnx3eS2M.js → workspace-api-tbifz2zY.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-4cZ26iaD.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-D13qHzVr.js → workspace-file-preview-dialog-BubQwQwU.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-Cou-ig1H.js → workspace-open-location-menu-DZk3MBSa.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DQGPKxHA.js → xopc-cloud-account-card-CIavPUr3.js} +1 -1
- package/dist/gateway/static/root/index.html +81 -81
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +33 -3
- package/dist/src/agent/embedded/run-turn.js +64 -4
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +6 -0
- package/dist/src/agent/tools/computer-use-tool.js +18 -5
- package/dist/src/agent/tools/phone-use-tool.js +12 -2
- package/dist/src/computer/agent-context.d.ts +21 -0
- package/dist/src/computer/agent-context.js +107 -0
- package/dist/src/computer/broker.d.ts +4 -2
- package/dist/src/computer/broker.js +26 -11
- package/dist/src/computer/diagnostics.d.ts +60 -6
- package/dist/src/computer/diagnostics.js +45 -4
- package/dist/src/computer/errors.d.ts +1 -1
- package/dist/src/computer/errors.js +4 -0
- package/dist/src/computer/evaluation.d.ts +2 -2
- package/dist/src/computer/native-timing.d.ts +15 -0
- package/dist/src/computer/native-timing.js +49 -0
- package/dist/src/computer/program-runtime.d.ts +22 -0
- package/dist/src/computer/program-runtime.js +105 -0
- package/dist/src/computer/runtime.d.ts +36 -2
- package/dist/src/computer/runtime.js +269 -58
- package/dist/src/config/models-json.d.ts +12 -0
- package/dist/src/config/schema.d.ts +18 -0
- package/dist/src/gateway/hono/routes/phone-setup.js +12 -7
- package/dist/src/gateway/hono/routes/phone.js +2 -4
- package/dist/src/gateway/service/config-coordinator.d.ts +6 -0
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/gateway/xopc-cloud-capability-setup.js +9 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/phone/adb-driver.d.ts +15 -1
- package/dist/src/phone/adb-driver.js +104 -41
- package/dist/src/phone/autoglm-protocol.d.ts +36 -0
- package/dist/src/phone/autoglm-protocol.js +88 -0
- package/dist/src/phone/autoglm-upstream-prompt.d.ts +2 -0
- package/dist/src/phone/autoglm-upstream-prompt.js +5 -0
- package/dist/src/phone/autoglm-upstream.LICENSE +201 -0
- package/dist/src/phone/cloud-adb-connection.d.ts +3 -0
- package/dist/src/phone/cloud-adb-connection.js +105 -31
- package/dist/src/phone/cloud-adb.js +18 -6
- package/dist/src/phone/completion-recovery.d.ts +6 -0
- package/dist/src/phone/completion-recovery.js +30 -0
- package/dist/src/phone/contracts.d.ts +24 -0
- package/dist/src/phone/contracts.js +12 -1
- package/dist/src/phone/execution-trace.d.ts +51 -0
- package/dist/src/phone/execution-trace.js +78 -0
- package/dist/src/phone/gui-protocol.d.ts +7 -0
- package/dist/src/phone/gui-protocol.js +302 -0
- package/dist/src/phone/model-adapter.d.ts +10 -2
- package/dist/src/phone/model-adapter.js +136 -62
- package/dist/src/phone/model-response.d.ts +5 -0
- package/dist/src/phone/model-response.js +118 -0
- package/dist/src/phone/runtime.d.ts +4 -0
- package/dist/src/phone/runtime.js +154 -18
- package/dist/src/phone/text-session.d.ts +14 -0
- package/dist/src/phone/text-session.js +39 -0
- package/dist/src/phone/ui-dump-binary.d.ts +1 -1
- package/dist/src/phone/ui-dump-binary.js +1 -1
- package/dist/src/phone/ui-session.d.ts +24 -0
- package/dist/src/phone/ui-session.js +210 -0
- package/dist/src/process/phone-process.d.ts +1 -0
- package/dist/src/process/phone-process.js +11 -1
- package/dist/src/providers/env-keys.js +2 -0
- package/dist/src/providers/index.js +11 -0
- package/dist/src/providers/model-catalog-types.d.ts +1 -1
- package/dist/src/providers/model-supplements.d.ts +1 -1
- package/dist/src/providers/model-supplements.js +6 -3
- package/dist/src/providers/phone-models.d.ts +3 -0
- package/dist/src/providers/phone-models.js +33 -0
- package/dist/src/providers/presentation.js +0 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/platform-catalog.d.ts +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/chat-page-CafkCKOj.js +0 -72
- package/dist/gateway/static/root/assets/connected-providers-grid-b46VH4uy.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-1du1hfi5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DcsZyYEa.js +0 -1
- package/dist/gateway/static/root/assets/index-BS9mjvSL.js +0 -11
- package/dist/gateway/static/root/assets/index-pT-m6l6b.css +0 -1
- package/dist/gateway/static/root/assets/messages-DaLmc4W1.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DticJxxh.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-D6SzJ9Ch.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-D2rbRfX3.js +0 -23
- package/dist/gateway/static/root/assets/settings-advanced-gate-CYDQybNF.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-6A9337pK.js +0 -2
- package/dist/gateway/static/root/assets/tool-friendly-title-DGmi7rCQ.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-COUVwj-p.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s,p as c}from"./locale-store-TQcz_Vjt.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{t as u}from"./markdown-view-D4nII6Zv.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-0WouolD0.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DfWfZ9iu.js";import{r as y,t as b}from"./chat-chart-block-DeWrb9XR.js";var x=l(`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`}]]),S=n(),C=e(t(),1),w=r(),T=(0,C.createContext)(null);function E(){let e=(0,S.c)(1),t=(0,C.useContext)(T);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:D},e[0]=t):t=e[0],t}return t}function D(){}function O(e){let t=(0,S.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,C.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,y=a!==null,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||o(null)},t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(p,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=x):x=t[3];let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=f(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=E):E=t[4];let D=a?.alt||`Image preview`,O;t[5]===D?O=t[6]:(O=(0,w.jsx)(_,{className:`sr-only`,children:D}),t[5]=D,t[6]=O);let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,w.jsx)(d,{className:`size-5`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===i?A=t[9]:(A=(0,w.jsx)(m,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,"aria-label":i,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:k})}),t[8]=i,t[9]=A);let j;t[10]===a?j=t[11]:(j=a?(0,w.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=j);let M;t[12]!==A||t[13]!==j||t[14]!==O?(M=(0,w.jsxs)(h,{children:[x,(0,w.jsxs)(g,{className:E,"aria-describedby":void 0,children:[O,A,j]})]}),t[12]=A,t[13]=j,t[14]=O,t[15]=M):M=t[15];let N;t[16]!==M||t[17]!==y?(N=(0,w.jsx)(v,{open:y,onOpenChange:b,children:M}),t[16]=M,t[17]=y,t[18]=N):N=t[18];let P;return t[19]!==n||t[20]!==N?(P=(0,w.jsxs)(T.Provider,{value:u,children:[n,N]}),t[19]=n,t[20]=N,t[21]=P):P=t[21],P}var k=`xopc-attachment`,A=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,j=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function M(e,t){return`${k}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function N(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(A),a=r.match(j),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 P(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var F=new Map,I=``;function L(e,t,n){return`${n}:${e}:${t}`}function R(){let e=o.getState().conversationId??``;if(e!==I){for(let e of F.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);F.clear(),I=e}}async function ee(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);return r||(r={blob:(async()=>{let n=await i(a(P(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},F.set(n,r)),r.blob}async function z(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);if(r||(r={blob:ee(e,t),objectUrl:null,refCount:0},F.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function B(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,F.delete(n)))}var V={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},H=null,U=null,W=null,G=null;function K(){return H||(H=new Audio,H.addEventListener(`timeupdate`,()=>{J.setState({currentTime:H.currentTime})}),H.addEventListener(`loadedmetadata`,()=>{let e=H.duration;Number.isFinite(e)&&J.setState({duration:e})}),H.addEventListener(`ended`,()=>{J.setState({playing:!1,currentTime:0}),H.currentTime=0}),H.addEventListener(`pause`,()=>{J.setState({playing:!1})}),H.addEventListener(`play`,()=>{J.setState({playing:!0})})),H}function q(){W&&G&&B(W,G),U=null,W=null,G=null}var J=c()((e,t)=>({...V,play:async(n,r,i)=>{let a=K(),o=t();if(o.noteId===n&&o.attachmentId===r&&U){a.play();return}a.pause(),q(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await z(n,r);U=t,W=n,G=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}),q()}},pause:()=>{K().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=K();n.currentTime=t,e({currentTime:t})},reset:()=>{K().pause(),K().src=``,q(),e(V)}}));function Y(e,t){return M(e,t)}function te(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 ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function X(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 ne(i));return i.json()}function re(e){let t=(0,S.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=N(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[p,m]=(0,C.useState)(d?null:s),[h,g]=(0,C.useState)(!1),_,v;if(t[11]!==a||t[12]!==d||t[13]!==s?(_=()=>{if(g(!1),!d){m(s);return}let e=!1;return m(null),z(d.noteId,d.attachmentId).then(t=>{e||m(t)}).catch(()=>{e||(g(!0),a?.())}),()=>{e=!0,B(d.noteId,d.attachmentId)}},v=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,C.useEffect)(_,v),h){let e;t[16]===n?e=t[17]:(e=f(`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,w.jsx)(x,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,w.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!p){let e;t[22]===n?e=t[23]:(e=f(`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,w.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let y;t[27]!==p||t[28]!==i?(y=i?()=>i(p):void 0,t[27]=p,t[28]=i,t[29]=y):y=t[29];let b;t[30]===a?b=t[31]:(b=()=>{g(!0),a?.()},t[30]=a,t[31]=b);let T;return t[32]!==l||t[33]!==n||t[34]!==p||t[35]!==o||t[36]!==y||t[37]!==b?(T=(0,w.jsx)(`img`,{...o,src:p,alt:l,className:n,onClick:y,onError:b}),t[32]=l,t[33]=n,t[34]=p,t[35]=o,t[36]=y,t[37]=b,t[38]=T):T=t[38],T}function ie(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ae(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=N(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;z(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,B(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=N(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;z(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,B(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function oe(e){let t=(0,S.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,C.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,w.jsx)(b,{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 ae(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,C.useLayoutEffect)(c,l);let d;t[12]===n?d=t[13]:(d=ie(n),t[12]=n,t[13]=d);let f;t[14]===i.className?f=t[15]:(f=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=f);let p=f.join(` `),m;return t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==p?(m=(0,w.jsx)(`div`,{ref:a,children:(0,w.jsx)(y,{children:(0,w.jsx)(u,{content:d,mermaidActions:!0,...i,renderChart:s,className:p})})}),t[16]=s,t[17]=i,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}async function se(){return s(a(`/api/notes/project-summaries`))}async function ce(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 s(a(`/api/notes${n?`?${n}`:``}`))}async function le(e,t=`web`){return(await s(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function ue(e,t){return(await s(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 de(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 Z(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function fe(e){await s(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function pe(e){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function me(e,t){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function he(e,t,n){await s(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function ge(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function _e(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function ve(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ye(e){return s(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function be(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function xe(e,t={}){return s(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function Se(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Ce(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function we(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Te(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Q(e,t={}){return(await s(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 Ee(e,t,n){let r=new FormData;return r.append(`file`,t),(await X(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 X(a(`/api/notes`),n)).note}async function De(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 Z(n.id,{markdown:i})),n}async function Oe(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=`[${te(t)}](${Y(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function ke(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ae(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function je(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{Y as A,ve as C,Ee as D,Z as E,E as F,x as I,M,N,oe as O,O as P,be as S,je as T,xe as _,me as a,Oe as b,de as c,ge as d,ke as f,ce as g,Se as h,ue as i,J as j,re as k,Ce as l,pe as m,ye as n,Q as o,se as p,_e as r,fe as s,Te as t,Ae as u,le as v,he as w,we as x,De 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,o as s,p as c}from"./locale-store-Br7IfbXK.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{t as u}from"./markdown-view-DrVAMlwc.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-0WouolD0.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DfWfZ9iu.js";import{r as y,t as b}from"./chat-chart-block-DCzUECct.js";var x=l(`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`}]]),S=n(),C=e(t(),1),w=r(),T=(0,C.createContext)(null);function E(){let e=(0,S.c)(1),t=(0,C.useContext)(T);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:D},e[0]=t):t=e[0],t}return t}function D(){}function O(e){let t=(0,S.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,C.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,y=a!==null,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||o(null)},t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(p,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=x):x=t[3];let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=f(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=E):E=t[4];let D=a?.alt||`Image preview`,O;t[5]===D?O=t[6]:(O=(0,w.jsx)(_,{className:`sr-only`,children:D}),t[5]=D,t[6]=O);let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,w.jsx)(d,{className:`size-5`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===i?A=t[9]:(A=(0,w.jsx)(m,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,"aria-label":i,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:k})}),t[8]=i,t[9]=A);let j;t[10]===a?j=t[11]:(j=a?(0,w.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=j);let M;t[12]!==A||t[13]!==j||t[14]!==O?(M=(0,w.jsxs)(h,{children:[x,(0,w.jsxs)(g,{className:E,"aria-describedby":void 0,children:[O,A,j]})]}),t[12]=A,t[13]=j,t[14]=O,t[15]=M):M=t[15];let N;t[16]!==M||t[17]!==y?(N=(0,w.jsx)(v,{open:y,onOpenChange:b,children:M}),t[16]=M,t[17]=y,t[18]=N):N=t[18];let P;return t[19]!==n||t[20]!==N?(P=(0,w.jsxs)(T.Provider,{value:u,children:[n,N]}),t[19]=n,t[20]=N,t[21]=P):P=t[21],P}var k=`xopc-attachment`,A=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,j=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function M(e,t){return`${k}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function N(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(A),a=r.match(j),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 P(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var F=new Map,I=``;function L(e,t,n){return`${n}:${e}:${t}`}function R(){let e=o.getState().conversationId??``;if(e!==I){for(let e of F.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);F.clear(),I=e}}async function ee(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);return r||(r={blob:(async()=>{let n=await i(a(P(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},F.set(n,r)),r.blob}async function z(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);if(r||(r={blob:ee(e,t),objectUrl:null,refCount:0},F.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function B(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,F.delete(n)))}var V={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},H=null,U=null,W=null,G=null;function K(){return H||(H=new Audio,H.addEventListener(`timeupdate`,()=>{J.setState({currentTime:H.currentTime})}),H.addEventListener(`loadedmetadata`,()=>{let e=H.duration;Number.isFinite(e)&&J.setState({duration:e})}),H.addEventListener(`ended`,()=>{J.setState({playing:!1,currentTime:0}),H.currentTime=0}),H.addEventListener(`pause`,()=>{J.setState({playing:!1})}),H.addEventListener(`play`,()=>{J.setState({playing:!0})})),H}function q(){W&&G&&B(W,G),U=null,W=null,G=null}var J=c()((e,t)=>({...V,play:async(n,r,i)=>{let a=K(),o=t();if(o.noteId===n&&o.attachmentId===r&&U){a.play();return}a.pause(),q(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await z(n,r);U=t,W=n,G=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}),q()}},pause:()=>{K().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=K();n.currentTime=t,e({currentTime:t})},reset:()=>{K().pause(),K().src=``,q(),e(V)}}));function Y(e,t){return M(e,t)}function te(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 ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function X(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 ne(i));return i.json()}function re(e){let t=(0,S.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=N(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[p,m]=(0,C.useState)(d?null:s),[h,g]=(0,C.useState)(!1),_,v;if(t[11]!==a||t[12]!==d||t[13]!==s?(_=()=>{if(g(!1),!d){m(s);return}let e=!1;return m(null),z(d.noteId,d.attachmentId).then(t=>{e||m(t)}).catch(()=>{e||(g(!0),a?.())}),()=>{e=!0,B(d.noteId,d.attachmentId)}},v=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,C.useEffect)(_,v),h){let e;t[16]===n?e=t[17]:(e=f(`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,w.jsx)(x,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,w.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!p){let e;t[22]===n?e=t[23]:(e=f(`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,w.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let y;t[27]!==p||t[28]!==i?(y=i?()=>i(p):void 0,t[27]=p,t[28]=i,t[29]=y):y=t[29];let b;t[30]===a?b=t[31]:(b=()=>{g(!0),a?.()},t[30]=a,t[31]=b);let T;return t[32]!==l||t[33]!==n||t[34]!==p||t[35]!==o||t[36]!==y||t[37]!==b?(T=(0,w.jsx)(`img`,{...o,src:p,alt:l,className:n,onClick:y,onError:b}),t[32]=l,t[33]=n,t[34]=p,t[35]=o,t[36]=y,t[37]=b,t[38]=T):T=t[38],T}function ie(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ae(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=N(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;z(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,B(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=N(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;z(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,B(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function oe(e){let t=(0,S.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,C.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,w.jsx)(b,{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 ae(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,C.useLayoutEffect)(c,l);let d;t[12]===n?d=t[13]:(d=ie(n),t[12]=n,t[13]=d);let f;t[14]===i.className?f=t[15]:(f=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=f);let p=f.join(` `),m;return t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==p?(m=(0,w.jsx)(`div`,{ref:a,children:(0,w.jsx)(y,{children:(0,w.jsx)(u,{content:d,mermaidActions:!0,...i,renderChart:s,className:p})})}),t[16]=s,t[17]=i,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}async function se(){return s(a(`/api/notes/project-summaries`))}async function ce(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 s(a(`/api/notes${n?`?${n}`:``}`))}async function le(e,t=`web`){return(await s(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function ue(e,t){return(await s(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 de(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 Z(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function fe(e){await s(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function pe(e){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function me(e,t){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function he(e,t,n){await s(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function ge(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function _e(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function ve(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ye(e){return s(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function be(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function xe(e,t={}){return s(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function Se(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Ce(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function we(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Te(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Q(e,t={}){return(await s(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 Ee(e,t,n){let r=new FormData;return r.append(`file`,t),(await X(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 X(a(`/api/notes`),n)).note}async function De(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 Z(n.id,{markdown:i})),n}async function Oe(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=`[${te(t)}](${Y(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function ke(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ae(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function je(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{Y as A,ve as C,Ee as D,Z as E,E as F,x as I,M,N,oe as O,O as P,be as S,je as T,xe as _,me as a,Oe as b,de as c,ge as d,ke as f,ce as g,Se as h,ue as i,J as j,re as k,Ce as l,pe as m,ye as n,Q as o,se as p,_e as r,fe as s,Te as t,Ae as u,le as v,he as w,we as x,De 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 o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,l,n as u}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 o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,l,n as u}from"./locale-store-Br7IfbXK.js";import{t as d}from"./messages-ByFlEbsu.js";import{t as f}from"./archive-Dz0hferG.js";import{C as p,T as m,c as h,s as g,u as _}from"./discussion-annotation-sync-ClKEyXmN.js";import{t as v}from"./arrow-left-D880xG-P.js";import{t as y}from"./arrow-right-DSSvoX71.js";import{t as ee}from"./arrow-up-D5ZtR1QT.js";import{f as b}from"./product-automation-feedback-Tn2dUJWM.js";import{t as x}from"./calendar-days-hw_Y-g-s.js";import{t as te}from"./chevron-down-ccbiQQz_.js";import{t as ne}from"./popover-select-DD8fmrxH.js";import{t as re}from"./ellipsis-0k4rZLoy.js";import{t as ie}from"./file-text-D12HbeVy.js";import{t as ae}from"./folder-CN-pC3XL.js";import{A as S,D as C,E as w,_ as T,g as E,i as D,p as oe,s as se}from"./notes-api-CUlhTRv0.js";import{b as ce,l as O,n as k,r as le,t as ue,v as A,y as de}from"./recording-upload-RAhaLUcQ.js";import{t as fe}from"./loader-circle-CifKLtgG.js";import{z as pe}from"./markdown-view-DrVAMlwc.js";import{t as me}from"./mic-CuUb7zc-.js";import{t as he}from"./paperclip-f1HujQY1.js";import{t as ge}from"./plus-Q2yW6OE7.js";import{t as _e}from"./search-DA7gz22f.js";import{t as ve}from"./sparkles-DHlfQFAF.js";import{t as ye}from"./star-BUWJqJ5c.js";import{t as be}from"./trash-2-DusmjVPV.js";import{t as xe}from"./upload-rrb46c3c.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-BI5TyibZ.js";import{i as Se}from"./vendor-swr-CdRzEUwF.js";import{r as Ce}from"./app-chrome-BeB4KgOf.js";import{t as we}from"./page-header-store-Du44NIEJ.js";import{t as Te}from"./sliding-tab-list-DuQyViqe.js";import{n as Ee}from"./index.module-Cd9ENXfk.js";import{t as De}from"./confirm-dialog-XGclfBqe.js";import{l as Oe,m as ke,o as Ae,r as je,t as Me}from"./dist-D3lWNSe7.js";import{i as Ne,t as P}from"./note-detail-panel-CbpLXAVh.js";var F=n(),I=e(t(),1),L=r();function R({projectId:e}){let t=u(e=>e.language)===`zh`,n=s(),r=(0,I.useRef)(null),i=(0,I.useRef)(null),[a,o]=(0,I.useState)(null),[c,l]=(0,I.useState)(null),[d,f]=(0,I.useState)(null);async function p(){let t=i.current;if(!(!t||a!==null)){o(0),l(null);try{let r=await _();if(r.consentAcknowledgedAt==null){f(r.consentPolicyVersion);return}let a=await ue(t.file,t.requestId),s=await h({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=s.discussion.id,await O({...a,serverDiscussionId:s.discussion.id,projectId:e}),s.discussion.audioAttachmentId||await k(a,s.discussion.id,o),await le(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(s.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(null)}}}return(0,L.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,L.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},p()}}}),(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:a!==null,onClick:()=>c&&i.current?void p():r.current?.click(),children:[(0,L.jsx)(xe,{className:`size-3.5`}),a===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${a}%`]}),d===null?null:(0,L.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,L.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void g(d).then(()=>(f(null),p())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,L.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Pe(e){e.note??=await D({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 C(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,` `)}](${S(t,e.id)})`);e.note=await w(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
2
|
|
|
3
3
|
`)}`})}return{noteId:t,conversationId:(await T(t,{projectId:e.projectId})).conversationId}}function Fe(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var z={meeting:b,requirements:ie,research:A,weekly:x};function Ie({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:o}){let c=i.home,l=s(),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)([]),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),[re,ie]=(0,I.useState)(``),S=(0,I.useRef)(null),C=(0,I.useRef)(!1),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=v||!!S.current,D=f?c.templateOptions[f]:null,oe=!!(u.trim()||g.length);async function se(){if(!(C.current||!oe&&!S.current)){C.current=!0,y(!0),x(null),S.current??={requestId:crypto.randomUUID(),title:u.trim().split(`
|
|
4
4
|
`)[0]?.slice(0,80)||D?.label||i.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${D?`${D.prompt}\n`:``}${u.trim()}`,projectId:t||void 0,files:[...g],attachments:[],materialHeading:c.materialsHeading};try{let e=await Pe(S.current);r(),l(Fe(e.conversationId,e.noteId,c.agentPrompt))}catch(e){S.current.note&&r(),x(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{C.current=!1,y(!1)}}}function ce(){S.current=null,x(null),d(``),_([]),p(null),h(!1),T.current?.focus()}return(0,L.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,L.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,L.jsxs)(`fieldset`,{disabled:E,className:`min-w-0`,children:[(0,L.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,L.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.agentResultHint}),D?(0,L.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,L.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[D.label,` · `]}),D.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-Br7IfbXK.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-Br7IfbXK.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{t as s}from"./button-CnRSIP6m.js";import{a as c}from"./vendor-swr-CdRzEUwF.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-Bd-fYUrV.js";import{a as d,n as f,r as p}from"./oauth-api-DMMdeaNd.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}){let v=r(e=>e.language),{mutate:y}=c(),b=v===`zh`,[x,S]=(0,m.useState)(`idle`),[C,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(null),D=(0,m.useRef)(!1),O=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{D.current=!0,O.current?.close(),O.current=null},[]);let k=async()=>{D.current=!1,w(null),E(null),S(`waiting`);let t=l();t||(O.current?.close(),O.current=window.open(`about:blank`,`xopc-oauth`),O.current&&(O.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!D.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),D.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,E(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 O.current&&!O.current.closed&&O.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 y(g),await u(),O.current?.close(),O.current=null,S(`connected`),h?.();return}}}catch(e){O.current?.close(),O.current=null,D.current||(S(`idle`),w(e instanceof Error?e.message:b?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},A=n||x===`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}),A?(0,_.jsx)(i,{className:`size-4 text-emerald-500`,"aria-label":b?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x===`waiting`?b?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:A?b?`已通过 OAuth 连接。`:`Connected with OAuth.`:b?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),x===`waiting`&&T?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:T,target:`_blank`,rel:`noreferrer`,children:b?`打开授权页面`:`Open authorization page`}):null,C?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:C}):null]})]}),(0,_.jsxs)(s,{type:`button`,variant:A?`secondary`:`primary`,disabled:x===`waiting`,onClick:()=>void k(),children:[x===`waiting`?(0,_.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x===`waiting`?b?`等待授权…`:`Waiting…`:A?b?`重新授权`:`Reauthorize`:b?`授权`:`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-Br7IfbXK.js";import{t as s}from"./messages-ByFlEbsu.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-ChUtTAoG.js";import{t as d}from"./capabilities-DLMuj21P.js";import{n as f,t as p}from"./page-context-draft-LF33STHC.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=s(o(e=>e.language)).chat.pageContext,v=i(),y=r().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=a(e=>e.baseUrl),D=a(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&a.getState().baseUrl===E&&a.getState().conversationId===D;try{let n=f.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(!f.put(p(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`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:[b?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-Br7IfbXK.js";import{_ as t}from"./local-session-drafts-BJ1B1dQ7.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-Br7IfbXK.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-_d72UP_d.js → personal-avatar-D6CzIIfo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{t as r}from"./loopi-CNtmi9FU.js";import{t as i}from"./agent-avatar-display-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{t as r}from"./loopi-CNtmi9FU.js";import{t as i}from"./agent-avatar-display-6Z4m31Fz.js";var a=n(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),o=e(),s=t(),c={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`};function l(e){let t=(0,o.c)(8),{appearance:n,agentId:a,className:l}=e,u=l===void 0?``:l;if(n===`custom`&&a){let e;return t[0]!==a||t[1]!==u?(e=(0,s.jsx)(i,{agentId:a,avatar:`xopc:custom`,className:u}),t[0]=a,t[1]=u,t[2]=e):e=t[2],e}let d=n===`custom`?`idle`:c[n],f=`personal-avatar-motion inline-flex items-center justify-center ${u}`,p;t[3]===d?p=t[4]:(p=(0,s.jsx)(r,{variant:`avatar`,mood:d,className:`size-full`}),t[3]=d,t[4]=p);let m;return t[5]!==f||t[6]!==p?(m=(0,s.jsx)(`span`,{className:f,"aria-hidden":`true`,children:p}),t[5]=f,t[6]=p,t[7]=m):m=t[7],m}export{a as n,l as t};
|
package/dist/gateway/static/root/assets/{personal-page-B19h_3WQ.js → personal-page-CXR1Gy0x.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-TQcz_Vjt.js";import{t as c}from"./messages-DaLmc4W1.js";import{t as l,v as u}from"./chat-page-CafkCKOj.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./arrow-up-right-T72JbQ1Q.js";import{t as m}from"./check-DUBLcKHA.js";import{t as h}from"./popover-select-DD8fmrxH.js";import{t as g}from"./list-todo-CTVRto8O.js";import{F as _}from"./markdown-view-D4nII6Zv.js";import{n as v,s as y,t as b}from"./install-connector-dialog-BNzNuXJ8.js";import{n as x,t as S}from"./personal-avatar-_d72UP_d.js";import{t as C}from"./play-kxZvpBg8.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as ee}from"./square-DMK_fB-3.js";import{t as T}from"./upload-rrb46c3c.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./skeleton-BI5TyibZ.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dist-CaUuvp8-.js";import{S as P,d as F,t as I}from"./session-manager-D2rbRfX3.js";import{l as te}from"./voice-transcribe-api-xxaSOOmq.js";import{a as ne,r as re}from"./connectors-api-CwRuUnH4.js";import{n as ie}from"./voice-call-context-BM2A4bLz.js";import{t as ae}from"./page-header-store-D6SzJ9Ch.js";import{s as L}from"./agent-avatar-display-CmEj6Uqy.js";import{l as R,n as oe,t as se}from"./voice-config-api-J4o59ICE.js";import{t as z}from"./date-formatters-DukWSVwc.js";var B=n(),V=e(t(),1),H=r(),U=[`intro`,`identity`,`voice`,`connections`],ce=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function W(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function G(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 s(a(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),L(e)}function le({modelsAvailable:e,onCreated:t}){let n=o(e=>e.language)===`zh`,r=o(e=>e.language),[l,u]=(0,V.useState)(`intro`),[p,h]=(0,V.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,_]=(0,V.useState)(!1),[x,w]=(0,V.useState)(!1),[ee,E]=(0,V.useState)(null),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[M,N]=(0,V.useState)(null),[P,F]=(0,V.useState)(!0),[I,ie]=(0,V.useState)([]),[ae,L]=(0,V.useState)(null),z=(0,V.useRef)(null),B=(0,V.useRef)(null),[le,ue]=(0,V.useState)([]),[K,de]=(0,V.useState)(!0),[fe,q]=(0,V.useState)([]),[J,pe]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=!1;return s(a(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),h(t.payload.draft))}).catch(t=>{e||E(t instanceof Error?t.message:String(t))}).finally(()=>{e||_(!0)}),()=>{e=!0}},[]),(0,V.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:l,draft:p})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[p,g,l]),(0,V.useEffect)(()=>{let e=!1;return se().then(t=>{e||(t.tts&&t.enabled?N({provider:t.tts.provider,model:t.tts.model,enabled:!0}):F(!1))}).catch(()=>{e||F(!1)}),()=>{e=!0}},[]),(0,V.useEffect)(()=>{if(!M?.enabled)return;let e=!1;return oe(M.provider,M.model,`realtime`).then(t=>{e||ie(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||F(!1)}),()=>{e=!0}},[M]),(0,V.useEffect)(()=>{if(l!==`connections`)return;let e=!1;return de(!0),Promise.allSettled([re({page:1,pageSize:24,verification:`verified`}),ne()]).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`&&q(n.value),de(!1)}}),()=>{e=!0}},[l]),(0,V.useEffect)(()=>()=>{B.current?.abort(),z.current?.close()},[]),(0,V.useEffect)(()=>()=>{A&&URL.revokeObjectURL(A)},[A]);let me=async(e,t=p)=>{await s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},Y=async e=>{E(null);let t=U[Math.max(0,Math.min(U.length-1,U.indexOf(l)+e))];try{await me(t)}catch(e){E(e instanceof Error?e.message:String(e))}},he=async(n=!1)=>{if(!(!e||x)){w(!0),E(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:p,r=e.voice&&M?.enabled&&I.some(t=>t.id===e.voice)?{provider:M.provider,model:M.model,voice:e.voice}:void 0,i=(await s(a(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,o=!1;if(!n&&O)try{await G(i.agentId,O),i=(await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{o=!0}t(i,o)}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(!1)}}},X=(0,V.useCallback)(async e=>{B.current?.abort(),z.current?.close();let t=new AbortController;B.current=t,L(e),E(null);try{let n=new te;z.current=n,await n.start();let r=await R(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>L(null))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e)),L(null)}},[]);if(!g)return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,H.jsx)(D,{className:`h-10 w-2/3`}),(0,H.jsx)(D,{className:`h-64 w-full rounded-2xl`}),(0,H.jsx)(D,{className:`h-12 w-full rounded-xl`})]});let Z=U.indexOf(l),ge={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?`}[l];return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,H.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[Z>0?(0,H.jsxs)(`button`,{type:`button`,disabled:x,onClick:()=>void Y(-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,H.jsx)(d,{className:`size-4`}),n?`上一步`:`Back`]}):(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,H.jsx)(i,{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,H.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":Z+1,"aria-valuemin":1,"aria-valuemax":U.length,children:U.map((e,t)=>(0,H.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=Z?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,H.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,H.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,H.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:A?(0,H.jsx)(`img`,{src:A,alt:``,className:`size-14 rounded-xl object-cover`}):(0,H.jsx)(S,{appearance:p.appearance,className:`size-14`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,H.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:p.displayName||`Ada`})]})]}),(0,H.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${Z+1} 步 · 共 ${U.length} 步`:`Step ${Z+1} of ${U.length}`}),(0,H.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ge}),l===`intro`&&(0,H.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,H.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,H.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,H.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),l===`identity`&&(0,H.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,H.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,H.jsx)(`input`,{value:p.displayName,maxLength:60,onChange:e=>h(t=>({...t,displayName:e.target.value})),onBlur:()=>h(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,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[ce.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":!O&&p.appearance===e.id,onClick:()=>{k(null),j(null),h(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 ${!O&&p.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,H.jsx)(S,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,H.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 ${O?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,H.jsx)(T,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,H.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)){E(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}k(t),j(URL.createObjectURL(t))}}})]})]}),(0,H.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.`})]})]}),l===`voice`&&(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.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.`}),P?(0,H.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(D,{className:`h-20 rounded-xl`}),(0,H.jsx)(D,{className:`h-20 rounded-xl`})]}):M?.enabled&&I.length>0?(0,H.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!p.voice,onClick:()=>h(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 ${p.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`}),I.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${p.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.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":p.voice===e.id,onClick:()=>h(t=>({...t,voice:e.id})),children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void X(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,H.jsx)(C,{className:`size-4 ${ae===e.id?`text-accent`:``}`})})]},e.id))]}):(0,H.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,H.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,H.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),l===`connections`&&(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.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,H.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,H.jsx)(D,{className:`h-18 rounded-xl`}),(0,H.jsx)(D,{className:`h-18 rounded-xl`})]}):(0,H.jsx)(`div`,{className:`mt-5 space-y-2`,children:le.length?le.map(e=>{let t=W(fe.find(t=>t.connectorId===e.id));return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,H.jsx)(v,{connector:e,size:`sm`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,H.jsx)(m,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,H.jsx)(`button`,{type:`button`,onClick:()=>pe(y(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,H.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,H.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,H.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),ee&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:ee})]},l)}),(0,H.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,H.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,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l===`intro`&&(0,H.jsx)(`button`,{type:`button`,disabled:!e||x,onClick:()=>void he(!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`}),l===`voice`&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{let e={...p,voice:null};h(e),E(null),me(`connections`,e).catch(e=>E(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,H.jsxs)(`button`,{type:`button`,disabled:x||l===`connections`&&!e,onClick:()=>l===`connections`?void he():void Y(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:[x?n?`正在创建…`:`Creating…`:l===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!x&&(0,H.jsx)(f,{className:`size-4`})]})]})]})}),J&&(0,H.jsx)(b,{draft:J,onChange:pe,onClose:()=>pe(null),t:c(r).connectorsSettings,onInstalled:async()=>{q(await ne()),pe(null)}})]})}function ue({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!0),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)([]),[g,_]=(0,V.useState)(e.voicePreference?.voice??``),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(null),[S,w]=(0,V.useState)(null),T=(0,V.useRef)(null),E=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await se();if(e||(o(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};f(n);let r=await oe(n.provider,n.model,`realtime`);e||m(r)}catch(t){e||x(t instanceof Error?t.message:String(t))}finally{e||c(!1)}})(),()=>{e=!0}},[]),(0,V.useEffect)(()=>()=>{E.current?.abort(),T.current?.close()},[]);let O=()=>{E.current?.abort(),E.current=null,T.current?.close(),T.current=null,w(null)},k=async e=>{if(S!==null){O();return}O(),x(null);let n=new AbortController;E.current=n,w(e);try{let t=new te;T.current=t,await t.start();let r=await R(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{E.current===n&&(w(null),E.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;x(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}E.current===n&&O()}},A=async e=>{if(v||e===g)return;O();let t=g;_(e),u(``),y(!0),x(null);try{await n(e&&d?{provider:d.provider,model:d.model,voice:e}:null)||_(t)}catch(e){_(t),x(e instanceof Error?e.message:String(e))}finally{y(!1)}},j=p.find(e=>e.id===g),M=t?`默认声音`:`Default voice`,N=j?.name||(g?t?`当前音色不可用`:`Current voice unavailable`:M),P=l.trim().toLocaleLowerCase(),F=p.filter(e=>!P||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(P)).map(e=>({value:e.id,label:e.name}));return(0,H.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),s?(0,H.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,H.jsx)(D,{className:`h-10 w-full`})}):d&&p.length?(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(h,{value:g,selectedLabel:N,options:F,placeholder:M,emptyLabel:M,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:v,onChange:e=>void A(e),searchPlaceholder:p.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:l,onSearchChange:u,statusMessage:P&&!F.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,H.jsxs)(`button`,{type:`button`,disabled:v||!!(g&&!j),onClick:()=>void k(g),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:S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,"aria-label":S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,children:[S===null?(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,H.jsx)(ee,{className:`size-4 text-accent`,"aria-hidden":!0}),S===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:j?.description||j?.style||(g?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,H.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,H.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,H.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,H.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:v,onChange:e=>{let t=e.target.checked;y(!0),r(t).catch(e=>x(String(e))).finally(()=>y(!1))}})]}),b&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:b})]})}var K=new I;function de({conversationId:e,zh:t,onSaved:n}){let r=P(t=>t.sessions[e]),[i,a]=(0,V.useState)(!0),[o,s]=(0,V.useState)(``);(0,V.useEffect)(()=>{let t=!0;return K.loadSessionAgentConfig(e).then(n=>{t&&F(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function d(t,i){P.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{F(e,await K.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await K.loadSessionAgentConfig(e).catch(()=>null);throw n&&F(e,n),t}finally{P.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,H.jsx)(D,{className:`h-9 w-full`}):(0,H.jsx)(u,{chat:c(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:d,onThinkingChange:e=>d(r?.model??``,e)}),o&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var fe=5;function q(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 J(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 pe(e){let t=(0,B.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=J(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===n.id?s=t[4]:(s=_(`/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,H.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=q(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,H.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,H.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,H.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=z(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let v;t[17]===g?v=t[18]:(v=(0,H.jsx)(`span`,{children:g}),t[17]=g,t[18]=v);let y;t[19]!==v||t[20]!==f?(y=(0,H.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,m,v]}),t[19]=v,t[20]=f,t[21]=y):y=t[21];let b;t[22]!==y||t[23]!==d?(b=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,y]}),t[22]=y,t[23]=d,t[24]=b):b=t[24];let x;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,H.jsx)(p,{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]=x):x=t[25];let S;return t[26]!==b||t[27]!==s||t[28]!==l?(S=(0,H.jsxs)(i,{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,b,x]}),t[26]=b,t[27]=s,t[28]=l,t[29]=S):S=t[29],S}var me=[{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 Y(){let e=ie(),t=(0,V.useRef)(e);t.current=e;let n=o(e=>e.language)===`zh`,r=ae(e=>e.setPageHeader),i=ae(e=>e.clearPageHeader),[c,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(Promise.resolve()),[p,m]=(0,V.useState)([]),[h,_]=(0,V.useState)(!0),[v,y]=(0,V.useState)(0),[b,C]=(0,V.useState)(null),[ee,P]=(0,V.useState)(!1),[F,I]=(0,V.useState)(`loopi`),[te,ne]=(0,V.useState)(!1),re=(0,V.useRef)(null),R=(0,V.useRef)(null),oe=(0,V.useRef)(null),[se,z]=(0,V.useState)(``),[B,U]=(0,V.useState)(!1),[ce,W]=(0,V.useState)(!1),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)(null),[Y,he]=(0,V.useState)(!1),[X,Z]=(0,V.useState)(!1),[ge,_e]=(0,V.useState)(!1),[Q,ve]=(0,V.useState)(0),$=(0,V.useRef)(0),ye=(0,V.useCallback)(()=>{K(!1),W(!1),U(!0)},[]),be=(0,V.useCallback)(()=>{K(!1),W(!1),U(e=>!e)},[]),xe=(0,V.useCallback)(async()=>{try{let[e,t]=await Promise.all([s(a(`/api/personal-agent`)),s(a(`/api/personal-agent/models`))]);d.current=e.payload,u(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),m(t.payload),e.payload&&(z(e.payload.displayName),I(e.payload.appearance))}catch(e){C(e instanceof Error?e.message:String(e))}finally{_(!1)}},[]);(0,V.useEffect)(()=>{xe()},[xe]);let Se=(0,V.useCallback)(e=>{y(e=>e+1),C(null);let t=f.current.then(async()=>{let t=d.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let o=await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:i},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return d.current=o.payload,u(o.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:o.payload})),!0}catch(e){return C(e instanceof Error?e.message:String(e)),!1}}).finally(()=>y(e=>e-1));return f.current=t,t},[]),Ce=(0,V.useCallback)(async()=>{let e=++$.current;K(!0),J(null),he(!1),Z(!1),_e(!1),ve(0);try{let t=await s(a(`/api/personal-agent/activity?limit=${fe}&offset=0`));if(e!==$.current)return;J(t.payload),ve(t.payload.items.length)}catch{e===$.current&&he(!0)}},[]),we=(0,V.useCallback)(async()=>{if(!q||X||Q>=q.total)return;let e=$.current;Z(!0),_e(!1);try{let t=await s(a(`/api/personal-agent/activity?limit=${fe}&offset=${Q}`));if(e!==$.current)return;J(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),ve(e=>e+t.payload.items.length)}catch{e===$.current&&_e(!0)}finally{e===$.current&&Z(!1)}},[q,Q,X]);(0,V.useEffect)(()=>{if(!G||!q||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=$.current;try{let t=await s(a(`/api/personal-agent/activity?limit=${Math.max(fe,Math.min(100,Q))}&offset=0`));if(e!==$.current)return;J(t.payload),ve(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)}},[q,Q,X,G]);let Te=async e=>{if(!c||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){C(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){C(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}ne(!0),C(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await s(a(`/api/agents/${encodeURIComponent(c.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),L(c.agentId),I(`custom`),W(!1),await Se({appearance:`custom`})}catch(e){C(e instanceof Error?e.message:String(e))}finally{ne(!1)}};(0,V.useLayoutEffect)(()=>{let a=c?.state===`ready`,o=a?c.appearance:F,s=a?c.displayName:`Ada`;return r({startExtra:null,main:(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[a?(0,H.jsx)(`button`,{ref:oe,type:`button`,onClick:be,"aria-expanded":B,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":n?`编辑${s}的资料`:`Edit ${s}'s profile`,title:n?`资料`:`Profile`,children:(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,H.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})})}):(0,H.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,H.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})}),(0,H.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:a?(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{c?.state===`ready`&&t.current.open({conversationId:c.conversationId,name:c.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,H.jsx)(x,{className:`size-5`})}),(0,H.jsxs)(A,{open:G,onOpenChange:e=>{e?Ce():K(!1)},children:[(0,H.jsx)(M,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-pressed":G,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,H.jsx)(g,{className:`size-5`})})}),(0,H.jsx)(O,{children:(0,H.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] 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,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:q?n?`最近更新 · 共 ${q.total} 项`:`Recently updated · ${q.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,H.jsx)(j,{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":n?`关闭活动`:`Close activity`,children:(0,H.jsx)(E,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!q&&!Y&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{className:`h-18 rounded-2xl`}),(0,H.jsx)(D,{className:`h-18 rounded-2xl`}),(0,H.jsx)(D,{className:`h-18 rounded-2xl`})]}),Y&&(0,H.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),q?.items.length===0&&(0,H.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,H.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),q&&q.items.length>0&&(0,H.jsx)(`div`,{className:`space-y-2`,children:q.items.map(e=>(0,H.jsx)(pe,{item:e,zh:n},e.id))}),q&&Q<q.total&&(0,H.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>void we(),disabled:X,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:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ge&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,H.jsx)(`button`,{ref:R,type:`button`,onClick:be,"aria-expanded":B,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`编辑资料`:`Edit profile`,children:(0,H.jsx)(w,{className:`size-5`})})]}):null}),()=>i()},[q,Y,Q,X,ge,F,i,we,Ce,c,r,G,B,be,e.active,n]);function Ee(){return c?(0,H.jsxs)(A,{open:B,onOpenChange:e=>{U(e),e||W(!1)},children:[(0,H.jsx)(N,{virtualRef:R}),(0,H.jsx)(O,{children:(0,H.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(R.current?.contains(e.target)||oe.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex w-[min(22rem,calc(100vw-1rem))] flex-col rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,H.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-4 pt-4 text-center`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:te,onClick:()=>W(e=>!e),"aria-expanded":ce,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`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,H.jsx)(S,{appearance:F,agentId:c.agentId,className:`size-16`})}),(0,H.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:se,onChange:e=>z(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(z(t),Se({displayName:t})):z(d.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=d.current?.displayName??``,z(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`}),v>0&&(0,H.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,H.jsxs)(`div`,{className:`space-y-4 px-4 py-4`,children:[b&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:b}),ce&&(0,H.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,H.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[me.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{I(e.id),W(!1),Se({appearance:e.id})},"aria-pressed":F===e.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 ${F===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,H.jsx)(S,{appearance:e.id,className:`size-8`})}),(0,H.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,H.jsx)(`input`,{ref:re,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Te(t),e.currentTarget.value=``}}),(0,H.jsxs)(`button`,{type:`button`,disabled:te,onClick:()=>re.current?.click(),"aria-pressed":F===`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 ${F===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:F===`custom`?(0,H.jsx)(S,{appearance:`custom`,agentId:c.agentId,className:`size-8`}):(0,H.jsx)(T,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:te?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,H.jsx)(ue,{onGreetingChange:e=>Se({voiceCallPreferences:{openingGreetingEnabled:e}}),record:c,zh:n,onSelectVoice:e=>Se({voicePreference:e})}),(0,H.jsx)(`div`,{className:`border-t border-edge pt-4`,children:(0,H.jsx)(de,{conversationId:c.conversationId,zh:n,onSaved:async()=>{let e=await s(a(`/api/personal-agent`));e.ok&&e.payload&&(d.current=e.payload,u(e.payload))}})})]})]})})]}):null}return h?(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,H.jsx)(D,{className:`h-20 w-20 rounded-full`}),(0,H.jsx)(D,{className:`h-9 w-72`}),(0,H.jsx)(D,{className:`h-44 w-full rounded-2xl`})]}):c?.state===`ready`?(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ee&&(0,H.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,H.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{P(!1),ye()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(l,{embedded:!0,personal:!0,personalWelcome:{name:c.displayName,addressAs:c.userCallName??void 0,avatar:(0,H.jsx)(S,{appearance:c.appearance,agentId:c.agentId,className:`size-14`}),opening:n?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:c.conversationId})})}),Ee()]}):(0,H.jsx)(le,{modelsAvailable:p.length>0,onCreated:(e,t)=>{d.current=e,u(e),z(e.displayName),P(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Y 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{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-Br7IfbXK.js";import{t as c}from"./messages-ByFlEbsu.js";import{t as l,v as u}from"./chat-page-BnOCCAXG.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./arrow-up-right-T72JbQ1Q.js";import{t as m}from"./check-DUBLcKHA.js";import{t as h}from"./popover-select-DD8fmrxH.js";import{t as g}from"./list-todo-CTVRto8O.js";import{F as _}from"./markdown-view-DrVAMlwc.js";import{n as v,s as y,t as b}from"./install-connector-dialog-BuNXON0P.js";import{n as x,t as S}from"./personal-avatar-D6CzIIfo.js";import{t as C}from"./play-kxZvpBg8.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as ee}from"./square-DMK_fB-3.js";import{t as T}from"./upload-rrb46c3c.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./skeleton-BI5TyibZ.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dist-CaUuvp8-.js";import{S as P,d as F,t as I}from"./session-manager-ChUtTAoG.js";import{l as te}from"./voice-transcribe-api-Bbyj0yGR.js";import{a as ne,r as re}from"./connectors-api-DEJU8mgn.js";import{n as ie}from"./voice-call-context-BM2A4bLz.js";import{t as ae}from"./page-header-store-Du44NIEJ.js";import{s as L}from"./agent-avatar-display-6Z4m31Fz.js";import{l as R,n as oe,t as se}from"./voice-config-api-CrULrSKC.js";import{t as z}from"./date-formatters-DukWSVwc.js";var B=n(),V=e(t(),1),H=r(),U=[`intro`,`identity`,`voice`,`connections`],ce=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function W(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function G(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 s(a(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),L(e)}function le({modelsAvailable:e,onCreated:t}){let n=o(e=>e.language)===`zh`,r=o(e=>e.language),[l,u]=(0,V.useState)(`intro`),[p,h]=(0,V.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,_]=(0,V.useState)(!1),[x,w]=(0,V.useState)(!1),[ee,E]=(0,V.useState)(null),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[M,N]=(0,V.useState)(null),[P,F]=(0,V.useState)(!0),[I,ie]=(0,V.useState)([]),[ae,L]=(0,V.useState)(null),z=(0,V.useRef)(null),B=(0,V.useRef)(null),[le,ue]=(0,V.useState)([]),[K,de]=(0,V.useState)(!0),[fe,q]=(0,V.useState)([]),[J,pe]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=!1;return s(a(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),h(t.payload.draft))}).catch(t=>{e||E(t instanceof Error?t.message:String(t))}).finally(()=>{e||_(!0)}),()=>{e=!0}},[]),(0,V.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:l,draft:p})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[p,g,l]),(0,V.useEffect)(()=>{let e=!1;return se().then(t=>{e||(t.tts&&t.enabled?N({provider:t.tts.provider,model:t.tts.model,enabled:!0}):F(!1))}).catch(()=>{e||F(!1)}),()=>{e=!0}},[]),(0,V.useEffect)(()=>{if(!M?.enabled)return;let e=!1;return oe(M.provider,M.model,`realtime`).then(t=>{e||ie(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||F(!1)}),()=>{e=!0}},[M]),(0,V.useEffect)(()=>{if(l!==`connections`)return;let e=!1;return de(!0),Promise.allSettled([re({page:1,pageSize:24,verification:`verified`}),ne()]).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`&&q(n.value),de(!1)}}),()=>{e=!0}},[l]),(0,V.useEffect)(()=>()=>{B.current?.abort(),z.current?.close()},[]),(0,V.useEffect)(()=>()=>{A&&URL.revokeObjectURL(A)},[A]);let me=async(e,t=p)=>{await s(a(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},Y=async e=>{E(null);let t=U[Math.max(0,Math.min(U.length-1,U.indexOf(l)+e))];try{await me(t)}catch(e){E(e instanceof Error?e.message:String(e))}},he=async(n=!1)=>{if(!(!e||x)){w(!0),E(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:p,r=e.voice&&M?.enabled&&I.some(t=>t.id===e.voice)?{provider:M.provider,model:M.model,voice:e.voice}:void 0,i=(await s(a(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,o=!1;if(!n&&O)try{await G(i.agentId,O),i=(await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{o=!0}t(i,o)}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(!1)}}},X=(0,V.useCallback)(async e=>{B.current?.abort(),z.current?.close();let t=new AbortController;B.current=t,L(e),E(null);try{let n=new te;z.current=n,await n.start();let r=await R(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>L(null))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e)),L(null)}},[]);if(!g)return(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,H.jsx)(D,{className:`h-10 w-2/3`}),(0,H.jsx)(D,{className:`h-64 w-full rounded-2xl`}),(0,H.jsx)(D,{className:`h-12 w-full rounded-xl`})]});let Z=U.indexOf(l),ge={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?`}[l];return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,H.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[Z>0?(0,H.jsxs)(`button`,{type:`button`,disabled:x,onClick:()=>void Y(-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,H.jsx)(d,{className:`size-4`}),n?`上一步`:`Back`]}):(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,H.jsx)(i,{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,H.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":Z+1,"aria-valuemin":1,"aria-valuemax":U.length,children:U.map((e,t)=>(0,H.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=Z?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,H.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,H.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,H.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:A?(0,H.jsx)(`img`,{src:A,alt:``,className:`size-14 rounded-xl object-cover`}):(0,H.jsx)(S,{appearance:p.appearance,className:`size-14`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,H.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:p.displayName||`Ada`})]})]}),(0,H.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${Z+1} 步 · 共 ${U.length} 步`:`Step ${Z+1} of ${U.length}`}),(0,H.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ge}),l===`intro`&&(0,H.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,H.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,H.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,H.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),l===`identity`&&(0,H.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,H.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,H.jsx)(`input`,{value:p.displayName,maxLength:60,onChange:e=>h(t=>({...t,displayName:e.target.value})),onBlur:()=>h(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,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[ce.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":!O&&p.appearance===e.id,onClick:()=>{k(null),j(null),h(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 ${!O&&p.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,H.jsx)(S,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,H.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 ${O?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,H.jsx)(T,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,H.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)){E(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}k(t),j(URL.createObjectURL(t))}}})]})]}),(0,H.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.`})]})]}),l===`voice`&&(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.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.`}),P?(0,H.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(D,{className:`h-20 rounded-xl`}),(0,H.jsx)(D,{className:`h-20 rounded-xl`})]}):M?.enabled&&I.length>0?(0,H.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!p.voice,onClick:()=>h(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 ${p.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`}),I.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${p.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.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":p.voice===e.id,onClick:()=>h(t=>({...t,voice:e.id})),children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void X(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,H.jsx)(C,{className:`size-4 ${ae===e.id?`text-accent`:``}`})})]},e.id))]}):(0,H.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,H.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,H.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),l===`connections`&&(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.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,H.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,H.jsx)(D,{className:`h-18 rounded-xl`}),(0,H.jsx)(D,{className:`h-18 rounded-xl`})]}):(0,H.jsx)(`div`,{className:`mt-5 space-y-2`,children:le.length?le.map(e=>{let t=W(fe.find(t=>t.connectorId===e.id));return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,H.jsx)(v,{connector:e,size:`sm`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,H.jsx)(m,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,H.jsx)(`button`,{type:`button`,onClick:()=>pe(y(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,H.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,H.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,H.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),ee&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:ee})]},l)}),(0,H.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,H.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,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l===`intro`&&(0,H.jsx)(`button`,{type:`button`,disabled:!e||x,onClick:()=>void he(!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`}),l===`voice`&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{let e={...p,voice:null};h(e),E(null),me(`connections`,e).catch(e=>E(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,H.jsxs)(`button`,{type:`button`,disabled:x||l===`connections`&&!e,onClick:()=>l===`connections`?void he():void Y(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:[x?n?`正在创建…`:`Creating…`:l===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!x&&(0,H.jsx)(f,{className:`size-4`})]})]})]})}),J&&(0,H.jsx)(b,{draft:J,onChange:pe,onClose:()=>pe(null),t:c(r).connectorsSettings,onInstalled:async()=>{q(await ne()),pe(null)}})]})}function ue({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!0),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)([]),[g,_]=(0,V.useState)(e.voicePreference?.voice??``),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(null),[S,w]=(0,V.useState)(null),T=(0,V.useRef)(null),E=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await se();if(e||(o(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};f(n);let r=await oe(n.provider,n.model,`realtime`);e||m(r)}catch(t){e||x(t instanceof Error?t.message:String(t))}finally{e||c(!1)}})(),()=>{e=!0}},[]),(0,V.useEffect)(()=>()=>{E.current?.abort(),T.current?.close()},[]);let O=()=>{E.current?.abort(),E.current=null,T.current?.close(),T.current=null,w(null)},k=async e=>{if(S!==null){O();return}O(),x(null);let n=new AbortController;E.current=n,w(e);try{let t=new te;T.current=t,await t.start();let r=await R(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{E.current===n&&(w(null),E.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;x(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}E.current===n&&O()}},A=async e=>{if(v||e===g)return;O();let t=g;_(e),u(``),y(!0),x(null);try{await n(e&&d?{provider:d.provider,model:d.model,voice:e}:null)||_(t)}catch(e){_(t),x(e instanceof Error?e.message:String(e))}finally{y(!1)}},j=p.find(e=>e.id===g),M=t?`默认声音`:`Default voice`,N=j?.name||(g?t?`当前音色不可用`:`Current voice unavailable`:M),P=l.trim().toLocaleLowerCase(),F=p.filter(e=>!P||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(P)).map(e=>({value:e.id,label:e.name}));return(0,H.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),s?(0,H.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,H.jsx)(D,{className:`h-10 w-full`})}):d&&p.length?(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(h,{value:g,selectedLabel:N,options:F,placeholder:M,emptyLabel:M,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:v,onChange:e=>void A(e),searchPlaceholder:p.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:l,onSearchChange:u,statusMessage:P&&!F.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,H.jsxs)(`button`,{type:`button`,disabled:v||!!(g&&!j),onClick:()=>void k(g),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:S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,"aria-label":S===null?t?`试听${N}`:`Preview ${N}`:t?`停止试听`:`Stop preview`,children:[S===null?(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,H.jsx)(ee,{className:`size-4 text-accent`,"aria-hidden":!0}),S===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,H.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:j?.description||j?.style||(g?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,H.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,H.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,H.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,H.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:v,onChange:e=>{let t=e.target.checked;y(!0),r(t).catch(e=>x(String(e))).finally(()=>y(!1))}})]}),b&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:b})]})}var K=new I;function de({conversationId:e,zh:t,onSaved:n}){let r=P(t=>t.sessions[e]),[i,a]=(0,V.useState)(!0),[o,s]=(0,V.useState)(``);(0,V.useEffect)(()=>{let t=!0;return K.loadSessionAgentConfig(e).then(n=>{t&&F(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function d(t,i){P.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{F(e,await K.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await K.loadSessionAgentConfig(e).catch(()=>null);throw n&&F(e,n),t}finally{P.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,H.jsx)(D,{className:`h-9 w-full`}):(0,H.jsx)(u,{chat:c(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:d,onThinkingChange:e=>d(r?.model??``,e)}),o&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var fe=5;function q(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 J(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 pe(e){let t=(0,B.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=J(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===n.id?s=t[4]:(s=_(`/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,H.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=q(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,H.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,H.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,H.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=z(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let v;t[17]===g?v=t[18]:(v=(0,H.jsx)(`span`,{children:g}),t[17]=g,t[18]=v);let y;t[19]!==v||t[20]!==f?(y=(0,H.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,m,v]}),t[19]=v,t[20]=f,t[21]=y):y=t[21];let b;t[22]!==y||t[23]!==d?(b=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,y]}),t[22]=y,t[23]=d,t[24]=b):b=t[24];let x;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,H.jsx)(p,{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]=x):x=t[25];let S;return t[26]!==b||t[27]!==s||t[28]!==l?(S=(0,H.jsxs)(i,{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,b,x]}),t[26]=b,t[27]=s,t[28]=l,t[29]=S):S=t[29],S}var me=[{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 Y(){let e=ie(),t=(0,V.useRef)(e);t.current=e;let n=o(e=>e.language)===`zh`,r=ae(e=>e.setPageHeader),i=ae(e=>e.clearPageHeader),[c,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(Promise.resolve()),[p,m]=(0,V.useState)([]),[h,_]=(0,V.useState)(!0),[v,y]=(0,V.useState)(0),[b,C]=(0,V.useState)(null),[ee,P]=(0,V.useState)(!1),[F,I]=(0,V.useState)(`loopi`),[te,ne]=(0,V.useState)(!1),re=(0,V.useRef)(null),R=(0,V.useRef)(null),oe=(0,V.useRef)(null),[se,z]=(0,V.useState)(``),[B,U]=(0,V.useState)(!1),[ce,W]=(0,V.useState)(!1),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)(null),[Y,he]=(0,V.useState)(!1),[X,Z]=(0,V.useState)(!1),[ge,_e]=(0,V.useState)(!1),[Q,ve]=(0,V.useState)(0),$=(0,V.useRef)(0),ye=(0,V.useCallback)(()=>{K(!1),W(!1),U(!0)},[]),be=(0,V.useCallback)(()=>{K(!1),W(!1),U(e=>!e)},[]),xe=(0,V.useCallback)(async()=>{try{let[e,t]=await Promise.all([s(a(`/api/personal-agent`)),s(a(`/api/personal-agent/models`))]);d.current=e.payload,u(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),m(t.payload),e.payload&&(z(e.payload.displayName),I(e.payload.appearance))}catch(e){C(e instanceof Error?e.message:String(e))}finally{_(!1)}},[]);(0,V.useEffect)(()=>{xe()},[xe]);let Se=(0,V.useCallback)(e=>{y(e=>e+1),C(null);let t=f.current.then(async()=>{let t=d.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let o=await s(a(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:i},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return d.current=o.payload,u(o.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:o.payload})),!0}catch(e){return C(e instanceof Error?e.message:String(e)),!1}}).finally(()=>y(e=>e-1));return f.current=t,t},[]),Ce=(0,V.useCallback)(async()=>{let e=++$.current;K(!0),J(null),he(!1),Z(!1),_e(!1),ve(0);try{let t=await s(a(`/api/personal-agent/activity?limit=${fe}&offset=0`));if(e!==$.current)return;J(t.payload),ve(t.payload.items.length)}catch{e===$.current&&he(!0)}},[]),we=(0,V.useCallback)(async()=>{if(!q||X||Q>=q.total)return;let e=$.current;Z(!0),_e(!1);try{let t=await s(a(`/api/personal-agent/activity?limit=${fe}&offset=${Q}`));if(e!==$.current)return;J(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),ve(e=>e+t.payload.items.length)}catch{e===$.current&&_e(!0)}finally{e===$.current&&Z(!1)}},[q,Q,X]);(0,V.useEffect)(()=>{if(!G||!q||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=$.current;try{let t=await s(a(`/api/personal-agent/activity?limit=${Math.max(fe,Math.min(100,Q))}&offset=0`));if(e!==$.current)return;J(t.payload),ve(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)}},[q,Q,X,G]);let Te=async e=>{if(!c||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){C(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){C(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}ne(!0),C(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await s(a(`/api/agents/${encodeURIComponent(c.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),L(c.agentId),I(`custom`),W(!1),await Se({appearance:`custom`})}catch(e){C(e instanceof Error?e.message:String(e))}finally{ne(!1)}};(0,V.useLayoutEffect)(()=>{let a=c?.state===`ready`,o=a?c.appearance:F,s=a?c.displayName:`Ada`;return r({startExtra:null,main:(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[a?(0,H.jsx)(`button`,{ref:oe,type:`button`,onClick:be,"aria-expanded":B,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":n?`编辑${s}的资料`:`Edit ${s}'s profile`,title:n?`资料`:`Profile`,children:(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,H.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})})}):(0,H.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,H.jsx)(S,{appearance:o,agentId:c?.agentId,className:`size-8`})}),(0,H.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:a?(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{c?.state===`ready`&&t.current.open({conversationId:c.conversationId,name:c.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,H.jsx)(x,{className:`size-5`})}),(0,H.jsxs)(A,{open:G,onOpenChange:e=>{e?Ce():K(!1)},children:[(0,H.jsx)(M,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-pressed":G,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,H.jsx)(g,{className:`size-5`})})}),(0,H.jsx)(O,{children:(0,H.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] 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,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:q?n?`最近更新 · 共 ${q.total} 项`:`Recently updated · ${q.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,H.jsx)(j,{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":n?`关闭活动`:`Close activity`,children:(0,H.jsx)(E,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!q&&!Y&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{className:`h-18 rounded-2xl`}),(0,H.jsx)(D,{className:`h-18 rounded-2xl`}),(0,H.jsx)(D,{className:`h-18 rounded-2xl`})]}),Y&&(0,H.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),q?.items.length===0&&(0,H.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,H.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),q&&q.items.length>0&&(0,H.jsx)(`div`,{className:`space-y-2`,children:q.items.map(e=>(0,H.jsx)(pe,{item:e,zh:n},e.id))}),q&&Q<q.total&&(0,H.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>void we(),disabled:X,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:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ge&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,H.jsx)(`button`,{ref:R,type:`button`,onClick:be,"aria-expanded":B,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`编辑资料`:`Edit profile`,children:(0,H.jsx)(w,{className:`size-5`})})]}):null}),()=>i()},[q,Y,Q,X,ge,F,i,we,Ce,c,r,G,B,be,e.active,n]);function Ee(){return c?(0,H.jsxs)(A,{open:B,onOpenChange:e=>{U(e),e||W(!1)},children:[(0,H.jsx)(N,{virtualRef:R}),(0,H.jsx)(O,{children:(0,H.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(R.current?.contains(e.target)||oe.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex w-[min(22rem,calc(100vw-1rem))] flex-col rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,H.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-4 pt-4 text-center`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:te,onClick:()=>W(e=>!e),"aria-expanded":ce,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`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,H.jsx)(S,{appearance:F,agentId:c.agentId,className:`size-16`})}),(0,H.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:se,onChange:e=>z(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(z(t),Se({displayName:t})):z(d.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=d.current?.displayName??``,z(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`}),v>0&&(0,H.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,H.jsxs)(`div`,{className:`space-y-4 px-4 py-4`,children:[b&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:b}),ce&&(0,H.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,H.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[me.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{I(e.id),W(!1),Se({appearance:e.id})},"aria-pressed":F===e.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 ${F===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,H.jsx)(S,{appearance:e.id,className:`size-8`})}),(0,H.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,H.jsx)(`input`,{ref:re,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Te(t),e.currentTarget.value=``}}),(0,H.jsxs)(`button`,{type:`button`,disabled:te,onClick:()=>re.current?.click(),"aria-pressed":F===`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 ${F===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,H.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:F===`custom`?(0,H.jsx)(S,{appearance:`custom`,agentId:c.agentId,className:`size-8`}):(0,H.jsx)(T,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:te?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,H.jsx)(ue,{onGreetingChange:e=>Se({voiceCallPreferences:{openingGreetingEnabled:e}}),record:c,zh:n,onSelectVoice:e=>Se({voicePreference:e})}),(0,H.jsx)(`div`,{className:`border-t border-edge pt-4`,children:(0,H.jsx)(de,{conversationId:c.conversationId,zh:n,onSaved:async()=>{let e=await s(a(`/api/personal-agent`));e.ok&&e.payload&&(d.current=e.payload,u(e.payload))}})})]})]})})]}):null}return h?(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,H.jsx)(D,{className:`h-20 w-20 rounded-full`}),(0,H.jsx)(D,{className:`h-9 w-72`}),(0,H.jsx)(D,{className:`h-44 w-full rounded-2xl`})]}):c?.state===`ready`?(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ee&&(0,H.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,H.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{P(!1),ye()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(l,{embedded:!0,personal:!0,personalWelcome:{name:c.displayName,addressAs:c.userCallName??void 0,avatar:(0,H.jsx)(S,{appearance:c.appearance,agentId:c.agentId,className:`size-14`}),opening:n?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:c.conversationId})})}),Ee()]}):(0,H.jsx)(le,{modelsAvailable:p.length>0,onCreated:(e,t)=>{d.current=e,u(e),z(e.displayName),P(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Y as PersonalPage};
|
|
@@ -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-Br7IfbXK.js";import{t as s}from"./popover-select-DD8fmrxH.js";import{t as c}from"./skeleton-BI5TyibZ.js";import{t as l}from"./personal-proactivity-DaRnbB1f.js";import{t as u}from"./use-personal-profile-D2Un8G1L.js";import{n as d,t as f}from"./settings-page-header-DBL0_u0Z.js";import"./settings-page-layout-IAvpbz4A.js";var p=n(),m=e(t(),1),h=r();function g(){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 _=g();function v({zh:e}){let[t,n]=(0,m.useState)(),[r,a]=(0,m.useState)(``),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(``),g=f.trim().toLowerCase().replaceAll(`_`,` `),v=[...new Set([..._,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(g)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,m.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 y(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,h.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,h.jsx)(c,{className:`h-9 w-full`}):t&&(0,h.jsxs)(h.Fragment,{children:[(0,h.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 y({mode:e})}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,h.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 y({quietStart:Number(e)})})]}),(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,h.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 y({quietEnd:Number(e)})})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,h.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:v,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:v.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&y({timezone:e})}})]}),(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function y(){let e=(0,p.c)(8),{displayName:t}=u(),n=a(b)===`zh`,r=n?`设置 ${t} 主动联系你的方式和免打扰时段。`:`Manage proactive messages from ${t} and quiet hours.`,i;e[0]!==t||e[1]!==r?(i=(0,h.jsx)(f,{title:t,subtitle:r}),e[0]=t,e[1]=r,e[2]=i):i=e[2];let o;e[3]===n?o=e[4]:(o=(0,h.jsx)(v,{zh:n}),e[3]=n,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,h.jsxs)(d,{children:[i,o]}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function b(e){return e.language}export{y 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-
|
|
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-Br7IfbXK.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"./button-CnRSIP6m.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{i as p}from"./vendor-swr-CdRzEUwF.js";import{a as m}from"./runtime-tools-api-9o3Wfji1.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}){let a=i(e=>e.language)===`zh`,[m,x]=(0,h.useState)(),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)({adb:``,scrcpy:``}),[E,D]=(0,h.useState)(),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(!1),{data:M,error:N,mutate:P}=p(g(),_,{refreshInterval:m?2500:0}),F=a?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},I=a?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function L(e,n){x(e),j(!1),k(``),D(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(w.adb.trim()):await y(e,n===`existing`?`import`:n,D,n===`existing`?w.scrcpy.trim():void 0),await P(),t?.(),k(a?`依赖已就绪。`:`Dependency is ready.`)}catch(e){j(!0),k(e instanceof Error?e.message:String(e))}finally{x(void 0),D(void 0)}}let R=M?.statuses.filter(t=>!e||t.kind!==`adb`),z=!!(R?.length&&R.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":a?`手机依赖状态`:`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:a?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${N?`text-danger`:`text-fg-muted`}`,children:[z&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N?a?`检测失败`:`Check failed`:M?z?a?`已就绪`:`Ready`:a?`需要配置`:`Setup needed`:a?`检测中`:`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:a?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(d,{variant:`ghost`,"aria-label":a?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!m,onClick:()=>void P(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),M?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,e?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:a?`阿里云连接无需本机 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":S,onClick:()=>C(e=>!e),children:S?a?`收起本机连接依赖`:`Hide local connection dependencies`:a?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,N?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:a?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):M?M.statuses.filter(t=>!e||S||t.kind!==`adb`).map(e=>(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:e.kind===`adb`?`ADB · Android Platform Tools`:`scrcpy server`}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[F[e.state],e.version?` · ${e.version}`:` · ${a?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?a?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?a?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(d,{disabled:!!m||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void L(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),m===e.kind||e.state===`installing`?a?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?a?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?a?`修复托管安装`:`Repair managed copy`:a?`安装`:`Install`]})]}),(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.kind===`adb`?a?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:a?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?a?`使用已有 ADB`:`Use existing ADB`:a?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[a?`当前文件:`:`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`?a?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:a?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?a?`已有 ADB 路径`:`Existing ADB path`:a?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:w[e.kind],disabled:!!m,onChange:t=>T(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`?a?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:a?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(d,{className:`mt-3`,disabled:!!m||!w[e.kind].trim(),onClick:()=>void L(e.kind,`existing`),children:a?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(d,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!m,onClick:()=>void L(`adb`,`detect`),children:a?`恢复自动检测`:`Use automatic detection`}):null]})]},e.kind)):(0,b.jsx)(f,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:E?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[I[E.phase]??E.phase,E.downloadedBytes&&E.totalBytes?` · ${Math.min(100,Math.round(E.downloadedBytes/E.totalBytes*100))}%`:``]}):O?(0,b.jsx)(`p`,{role:A?`alert`:`status`,className:A?`text-danger`:`text-fg-muted`,children:O}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:a?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-Br7IfbXK.js";import{n as i,r as a}from"./popover-select-DD8fmrxH.js";import{t as o}from"./skeleton-BI5TyibZ.js";import{i as s}from"./vendor-swr-CdRzEUwF.js";var c=e(),l=`phone-mock/settings-about`;async function u(e,t,i=t===void 0?`GET`:`POST`){let a=await r(n(`/api/phone${e}`),{method:i,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!a.ok)throw Error(a.error?.message??`Phone operation failed`);return a.payload}var d=()=>u(`/settings`),f=()=>u(`/devices`),p=()=>u(`/models`);async function m(e,t){return(await u(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}`)).applications}var h=t();function g(e){let t=(0,c.c)(25),{value:n,onChange:r,zh:l,disabled:u}=e,d=u!==void 0&&u,f=s(`phone-models`,p);if(!f.data&&!f.error){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,h.jsx)(o,{className:`h-11 w-full rounded-lg`}),t[0]=e):e=t[0],e}let m=l?`手机模型`:`Phone model`,g=d||!!f.error,_;t[1]===r?_=t[2]:(_=e=>r(e.target.value),t[1]=r,t[2]=_);let v=l?`未配置`:`Not configured`,y;t[3]===v?y=t[4]:(y=(0,h.jsx)(a,{value:``,children:v}),t[3]=v,t[4]=y);let b;t[5]!==f.data?.models||t[6]!==n||t[7]!==l?(b=n&&!f.data?.models.some(e=>e.id===n)&&(0,h.jsx)(a,{value:n,disabled:!0,children:l?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),t[5]=f.data?.models,t[6]=n,t[7]=l,t[8]=b):b=t[8];let x;t[9]!==f.data?.models||t[10]!==l?(x=f.data?.models.map(e=>(0,h.jsx)(a,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}${e.configured?``:l?` · 待配置凭据`:` · Credentials needed`}`},e.id)),t[9]=f.data?.models,t[10]=l,t[11]=x):x=t[11];let S;t[12]!==m||t[13]!==g||t[14]!==_||t[15]!==y||t[16]!==b||t[17]!==x||t[18]!==n?(S=(0,h.jsxs)(i,{"aria-label":m,value:n,disabled:g,onChange:_,children:[y,b,x]}),t[12]=m,t[13]=g,t[14]=_,t[15]=y,t[16]=b,t[17]=x,t[18]=n,t[19]=S):S=t[19];let C;t[20]===f.error?C=t[21]:(C=f.error&&(0,h.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(f.error)}),t[20]=f.error,t[21]=C);let w;return t[22]!==C||t[23]!==S?(w=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[S,C]}),t[22]=C,t[23]=S,t[24]=w):w=t[24],w}function _(e){let t=(0,c.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,h.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let l=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===l?u=t[3]:(u=(0,h.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,h.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,h.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==n||t[19]!==a?(v=n&&(0,h.jsx)(g,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==_?(y=(0,h.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[_,v]}),t[21]=v,t[22]=_,t[23]=y):y=t[23],y}export{f as a,u as c,m as i,g as n,p as o,l as r,d as s,_ as t};
|