@xopcai/xopc 0.0.378 → 0.0.381
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-Xnu0H9yx.js → activity-store-D2oKh5ik.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sKMpwYNC.js → agent-avatar-dicebear-BnMiU8HX.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Ddv61pUQ.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-CxZeGEuL.js → agent-plugin-dialog-C7z3r3Z3.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BstMN5nH.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-DFBVz3bV.js → agents-admin-api-D-DNV0ms.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CWqbEntC.js → app-management-settings-panel-D2boumUX.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-QznCLnam.js → appearance-settings-Cwf53Rqo.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-wbVq-6PP.js → apps-page-CwWCU5Ib.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BclI5H7-.js → archive-plugin-DivP9LfK.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CTKIwPAS.js → automations-page-DztgYZdC.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-SVRa19EF.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D9FwadCs.js → binary-plugins-f-JnMRA1.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dqqtybdf.js → block-editor-CEnzVIbk.js} +39 -39
- package/dist/gateway/static/root/assets/{browser-automation-inputs-FGALoJY8.js → browser-automation-inputs-DD-SUHmv.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-hQbQFWl-.js → browser-automations-page-m-9ETOOE.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-DQvfXaeq.js → browser-settings-page-DN37CRLL.js} +2 -2
- package/dist/gateway/static/root/assets/{cn-JdwAhgNB.js → bundle-mjs-rHxsej31.js} +1 -1
- package/dist/gateway/static/root/assets/{button-CS04eWY9.js → button-aIC072nz.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CQuaJBPv.js → capabilities-BOJYAeEJ.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-ClI4hof_.js → capabilities-Bf6NYuvT.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-D1MJHORS.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DmwDOIlV.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-XMz78V4c.js → capability-header-actions-DG-feQV0.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-icon-BYm2-nS-.js → capability-icon-DVoZxEgW.js} +1 -1
- package/dist/gateway/static/root/assets/channels-Bl6g4Dg9.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dr3rujcs.js → chat-terminal-dock-CE3tIjLW.js} +2 -2
- package/dist/gateway/static/root/assets/cn-0WouolD0.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-G2lMB7CR.js → computer-settings-page-UMzIyZN5.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Cne5MBuz.js → connector-service-page-P6yEnQ6H.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DXhBTvqp.js +1 -0
- package/dist/gateway/static/root/assets/{copy-text-row-C1gaJwlZ.js → copy-text-row-C7egVuKr.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-yGmnkoC5.js → date-picker-eg-Uf9Wx.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CdKC_TNa.js → dependency-picker-BEn7eZXu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C4d305Me.js → desktop-pet-DPAFil05.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-hCS9Mddt.js → desktop-pet-settings-DK38Nevi.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-sprite-DTqXSpqf.js → desktop-pet-sprite-BP6iMVw1.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C6qeCyfO.js → device-pairing-wizard-DaRk9VLg.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-kYdBIm8m.js → directory-picker-path-field-Dm7jp0Y9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-odpIjn1q.js → extension-debug-page-DJ1wFpMs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C6Jn5baO.js → extension-page-tPkDLwrG.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DB4M3dc8.js → extension-provider-Dnz8j6Q_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Clx81lZy.js → extension-settings-page-Vp9FPajP.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-pBVU4PxA.js → fallback-models-DirZnl7x.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-ArYo4YFd.js → gateway-config-swr-f-4qw3AG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BaE0shFY.js → gateway-realtime-BGhPOSfz.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BYe-jWB1.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CRbb12ar.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BRCCiCBH.js → gateway-startup-retry-90pvxKox.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-BH65IIbJ.js +1 -0
- package/dist/gateway/static/root/assets/highlighted-body-KQOG7T2V-DdDvTjik.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BeIZyioN.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B5FwRmo9.js → image-generation-api-CtDjTXwX.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-7s8jzc2G.js → imports-page-KIeykeaL.js} +1 -1
- package/dist/gateway/static/root/assets/index-DxydK_AA.js +255 -0
- package/dist/gateway/static/root/assets/index-_xgO2IDa.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CyFSxteg.js → keyboard-shortcuts-settings-5Df9Rng_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B-hYeH8P.js → local-app-workbench-page-BSuq_SAr.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CFt8G-ae.js → local-apps-page-D5-69OHu.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CLR702g5.js → local-session-drafts-CrD74S6k.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CeoW7A5a.js → locale-store-pmT2B_By.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BQ9AzAj9.js → logs-page-DHYqPwJ3.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-BDuuXJ5t.js → management-settings-uIgzZZ_J.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DSjfHfaW.css → markdown-view-ByJbFign.css} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-CZlvyzow.js +66 -0
- package/dist/gateway/static/root/assets/{media-plugins-hqKbHVyi.js → media-plugins-BtFqN13D.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DOTWm1iy.js +1 -0
- package/dist/gateway/static/root/assets/mermaid-render-604gISVe.js +134 -0
- package/dist/gateway/static/root/assets/{messages-BpEhZm54.js → messages-Ib6DaUTo.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-cache-3slk24cw.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-G_6LpTik.js → note-detail-panel-sujG9ZmW.js} +3 -3
- package/dist/gateway/static/root/assets/{note-image-lightbox-1qg2v-9j.js → note-image-lightbox-BYNLO2pt.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-B0QQSN4M.js → notes-api-D-VLGhjV.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-C_4Ib15d.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-Dp1RoS6x.js → page-context-capture-button-DErqGBBe.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-D2xpUV26.js → page-tabs-BLGO2VIm.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CC3W2EZ0.js +1 -0
- package/dist/gateway/static/root/assets/{popover-select-BgSdSbCL.js → popover-select-DHC7J4lG.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dvey7GwU.js → preview-open-alternatives-BJU2fmPn.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DZyCQVVW.js → product-open-page-B3qxtYyi.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CrfIfrVJ.js → product-preview-content-NOhtxfkq.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-7BFqLZj4.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-DZ98gcjB.js → projects-page-qhnc7oNj.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Dzl61MkW.js → registry-api-Bi4muyaZ.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CS-zmmtV.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-Cg9dqJon.js → runtime-tools-api-9bk1payF.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-oEdBs0He.js → runtime-tools-settings-panel-B55OozGG.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CVlz-PiN.js → scenes-page-BJZqRz8a.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DIC8IlM1.js → schema-form-BND8Hs4C.js} +1 -1
- package/dist/gateway/static/root/assets/{secret-input-D93UrW4C.js → secret-input-BxWHx6J6.js} +1 -1
- package/dist/gateway/static/root/assets/send-session-input-BtF5UWGp.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-CVHFZq_A.js → session-api-D2J6VacQ.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-64DD1cxN.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-U5k3iucx.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D8dOvd8T.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-exRhP9xn.js → settings-form-section-num14vSv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CAmWMaOT.js → settings-loading-skeleton-BTqvr_Fw.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CN0_Np6E.js → settings-page-DOMl-bv4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-X1x-2Cp9.js → settings-page-layout-Dx5S-Msc.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Dgpd7bk0.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-C0gKFt8r.js → share-link-dialog-BnqkFFBZ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DxQ6yfYv.js → share-preview-page-aGjIkYmH.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-tR66Fdly.js → shares-api-cGtd3rjc.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-C_ZOqMjz.js → shares-settings-DmFLUeqg.js} +1 -1
- package/dist/gateway/static/root/assets/{skeleton-BwbyijEw.js → skeleton-BI5TyibZ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BFhU0NNu.js → skill-api-C9AYuE_b.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-D_04Mpcb.js → skill-reload-api-VT8F0enn.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-4-d-lfhq.js → skills-page-CJIhQfG2.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DHhaFWty.js → system-settings-panel-Cg0qUX2j.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CHBEI5uz.js → task-detail-page-C-VbndI4.js} +2 -2
- package/dist/gateway/static/root/assets/{task-expandable-content-AGJtkFIu.js → task-expandable-content-UI-0Elqy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DezB9Sal.js → theme-store-D7m5Eng5.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-BEHmd2wL.js → tracing-settings-page-CawYzT24.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Bbb_6pV4.js → tunnel-api-B8bvJesa.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-BEiWznDq.js → usage-page-DdA0F-qo.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BtTE5X_M.js → use-autosave-jrZBPSWn.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-BBHrVqB7.js → use-composer-attachments-hTgxke6e.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-CQmLEkdj.js → use-file-preview-expanded-tMUDUWVH.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-Bs6hUk15.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-tQsUdQnu.js → voice-api-key-field-Bp8brswu.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-69Yqf0QM.js → voice-config-api-415pyWx8.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Cvf8u31v.js → work-discovery-overlay-CcIDsZWn.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CqYp6zjF.js → workflow-run-setup-panel-YP4TJpWE.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CYqVuquq.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Bu6Csrxf.js → workspace-api-C01xjDt2.js} +2 -2
- package/dist/gateway/static/root/assets/xml-_d7dTN2Q.js +3 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-D3Cyk8pp.js → xopc-cloud-account-card-Cspd770Z.js} +1 -1
- package/dist/gateway/static/root/index.html +38 -35
- package/dist/package.js +1 -1
- package/dist/packages/realtime-protocol/src/voice-catalog.js +7 -2
- package/dist/src/agent/embedded/run-turn.js +38 -0
- package/dist/src/agent/embedded/session-runner.js +21 -3
- package/dist/src/agent/embedded/tool-metadata.d.ts +2 -1
- package/dist/src/agent/external-tools/index.js +6 -3
- package/dist/src/agent/external-tools/tool-registry.d.ts +2 -1
- package/dist/src/agent/prompt/response-language.js +9 -1
- package/dist/src/agent/session/session-config-service.js +0 -13
- package/dist/src/agent/tasks/task-judge-service.d.ts +2 -2
- package/dist/src/agent/tasks/task-judge-service.js +16 -9
- package/dist/src/agent/tools/xopc-use-tool.js +6 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +2 -2
- package/dist/src/cli/bin.js +2 -2
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/auth.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/gateway-ssh-tunnel.js +1 -1
- package/dist/src/cli/commands/import.js +1 -1
- package/dist/src/cli/commands/mcp.js +2 -2
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/platform.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/endpoint-tools/registry.d.ts +4 -1
- package/dist/src/endpoint-tools/registry.js +14 -0
- package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
- package/dist/src/gateway/chat-stream/mapper.js +4 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -1
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/gateway/hono/routes/chat-model-config.d.ts +0 -4
- package/dist/src/gateway/hono/routes/chat-model-config.js +0 -6
- package/dist/src/gateway/hono/routes/devices.js +1 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +4 -2
- package/dist/src/gateway/hono/routes/voice.js +12 -4
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +8 -3
- package/dist/src/gateway/side-chat/manager.js +1 -1
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +4 -3
- package/dist/src/personal-agent/prompts.d.ts +1 -0
- package/dist/src/personal-agent/prompts.js +29 -5
- package/dist/src/personal-agent/reply-composer.js +19 -4
- package/dist/src/personal-agent/reply-style.d.ts +4 -2
- package/dist/src/personal-agent/reply-style.js +57 -5
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/tasks/capabilities/write.js +10 -1
- package/dist/src/tasks/task-application-service.js +5 -4
- package/dist/src/tasks/task-context-assembler.js +1 -0
- package/dist/src/tasks/task-contract-definition.d.ts +1 -1
- package/dist/src/tasks/task-contract-definition.js +2 -2
- package/dist/src/tasks/task-contract-planner.d.ts +1 -0
- package/dist/src/tasks/task-contract-planner.js +2 -1
- package/dist/src/tasks/task-language.d.ts +7 -0
- package/dist/src/tasks/task-language.js +15 -0
- package/dist/src/tasks/task-read-model-projector.js +3 -2
- package/dist/src/tasks/task-result-delivery-service.js +2 -1
- package/dist/src/tasks/task-run-coordinator.js +22 -8
- package/dist/src/tasks/task-run-dispatcher.js +8 -6
- package/dist/src/voice/platform-catalog.d.ts +1 -0
- package/dist/src/voice/platform-settings.d.ts +1 -1
- package/dist/src/voice/platform-settings.js +6 -2
- package/dist/src/voice/platform-streams.js +4 -1
- package/dist/src/voice/realtime/agentEngine.js +51 -2
- package/dist/src/voice/realtime/engine.d.ts +4 -0
- package/dist/src/voice/realtime/omniRoute.d.ts +1 -1
- package/dist/src/voice/realtime/omniRoute.js +4 -1
- package/dist/src/voice/realtime/runtime.js +3 -3
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +6 -2
- package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DLrGOiCS.js +0 -1
- package/dist/gateway/static/root/assets/agents-CUnG8q3J.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BblZP4ft.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-page-CbPvaNJF.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CjApEiV4.js +0 -8
- package/dist/gateway/static/root/assets/channels-CJUz97Cw.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CbxL6ENI.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CHAa_VNb.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BcSr6MzW.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CKeRXki2.js +0 -2
- package/dist/gateway/static/root/assets/index-B3BVcMQj.js +0 -106
- package/dist/gateway/static/root/assets/index-BU0KqtLI.css +0 -1
- package/dist/gateway/static/root/assets/markdown-view-CdqdeQqI.js +0 -201
- package/dist/gateway/static/root/assets/models-hub-cache-D0yA-nf6.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-kBo3rUvj.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-Bf07rfSd.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-C3wJ8U07.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BvhaF5Pi.js +0 -1
- package/dist/gateway/static/root/assets/send-session-input-C449pdoe.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-CKFTwYtq.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DtB119_G.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-2ciK8mPP.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-VtNv07PN.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-B4Gwo5T7.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DMzGl3CE.js +0 -6
package/dist/gateway/static/root/assets/{capabilities-ClI4hof_.js → capabilities-Bf6NYuvT.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,g as i,h as ee,i as a,l as o,n as te,o as s,p as c,r as l,s as u,t as d,u as f,v as ne}from"./schemas-CObaziC7.js";import{c as re,f as ie,g as ae,l as oe,n as p,o as m,p as h,u as g,v as _}from"./tasks-DwKXgZ-I.js";import{i as v,n as se,t as ce}from"./local-apps-yys1VChX.js";import{g as y,h as b}from"./local-session-drafts-CLR702g5.js";var x=f({id:c(),kind:d([`task`,`connector_approval`]),title:c(),detail:c().optional(),reason:d([`needs_input`,`blocked`,`user_input`,`user_approval`,`dependency`,`external`,`scheduled`,`retry`,`paused`,`overdue`,`due_soon`,`decision_needed`,`approval_required`]),urgency:d([`now`,`soon`]),href:c(),projectId:c().optional(),projectName:c().optional(),dueAt:o().int().nonnegative().optional(),updatedAt:o(),response:e(`kind`,[f({kind:u(`connector_approval`),approvalId:c()}),f({kind:u(`task`),taskId:c(),canRetry:a()})]).optional()});f({id:c(),kind:d([`automation_run`,`workflow_run`]),runId:c(),title:c(),detail:c(),reason:d([`run_failed`,`run_timeout`]),href:c(),updatedAt:o(),conversationId:c().optional()});var S=e(`type`,[f({type:u(`task_review`),label:c(),taskId:c()}),f({type:u(`retry_task`),label:c(),taskId:c()}),f({type:u(`open`),label:c(),href:c()}),f({type:u(`connector_decision`),label:c(),approvalId:c(),decision:d([`approve`,`deny`])}),f({type:u(`retry_run`),label:c(),subjectKind:d([`automation_run`,`workflow_run`]),runId:c()}),f({type:u(`acknowledge_run`),label:c(),subjectKind:d([`automation_run`,`workflow_run`]),runId:c()})]),C=f({id:c(),kind:d([`decision`,`failure`,`running`,`scheduled`]),title:c(),summary:c(),recommendation:c().optional(),dueAt:o().int().nonnegative().optional(),statusLabel:c().optional(),updatedAt:o(),openAction:S.optional(),primaryAction:S.optional(),secondaryActions:l(S).max(2).default([])}),le=f({conversationId:c(),runId:c(),title:c().optional(),agentId:c().optional(),updatedAt:o()}),ue=r({id:c().trim().min(1).max(300),sourceType:d([`project`,`task`,`conversation`,`scene`,`calendar`,`mail`,`communication`,`file`,`user_model`]),sourceRef:c().trim().min(1).max(1e3),revision:c().trim().min(1).max(300),observation:c().trim().min(1).max(1e3),observedAt:o().int().nonnegative(),freshUntil:o().int().nonnegative(),href:c().trim().min(1).max(2e3).optional()}),de=r({kind:d([`connector`,`skill`,`agent`]),capability:c().trim().min(1).max(200),resolvedId:c().trim().min(1).max(300).optional(),readiness:d([`ready`,`needs_setup`,`unavailable`]),required:a(),recoveryPath:c().trim().min(1).max(2e3).optional(),reason:c().trim().min(1).max(500).optional()}),fe=r({kind:d([`connector`,`skill`,`agent`]),capability:c().trim().min(1).max(200),code:d([`not_installed`,`disabled`,`agent_not_allowed`,`scope_too_narrow`,`connection_missing`,`account_selection_required`,`reauthorization_required`,`requirements_unmet`,`model_invocation_disabled`,`tool_gated`,`agent_unavailable`]),message:c().trim().min(1).max(500),recoveryPath:c().trim().min(1).max(2e3)}),pe=e(`state`,[r({state:u(`ready`)}),r({state:u(`needs_setup`),blockers:l(fe).min(1).max(12),recoveryActions:l(r({capability:c().trim().min(1).max(200),href:c().trim().min(1).max(2e3)})).min(1).max(12),degradedAction:r({mode:u(`degraded_start`)}).optional()})]),w=r({id:c().trim().min(1).max(200),revision:o().int().positive(),kind:d([`project_next_step`,`delivery_risk`,`meeting_prep`,`commitment_follow_up`,`automation_candidate`]),projectId:c().trim().min(1).max(200).optional(),title:c().trim().min(1).max(160),outcome:c().trim().min(1).max(1e3),rationale:c().trim().min(1).max(1500),evidence:l(ue).min(1).max(8),confidence:d([`high`,`medium`,`low`]),urgency:d([`now`,`today`,`this_week`]),estimatedMinutes:o().int().min(1).max(480).optional(),risk:d([`analysis`,`external_read`,`file_write`,`external_write`]),proposedSteps:l(c().trim().min(1).max(500)).min(1).max(6),capabilities:l(de).max(12),verification:l(c().trim().min(1).max(500)).max(8),actionPrompt:c().trim().min(1).max(4e3),degradedActionPrompt:c().trim().min(1).max(4e3).optional(),continuation:e(`kind`,[r({kind:u(`scene`),reason:u(`prior_success`),href:c().trim().min(1).max(2e3)}),r({kind:u(`automation`),reason:u(`repeated_success`),href:c().trim().min(1).max(4e3),successCount:o().int().min(2)})]).optional(),actions:r({canStart:a(),canDiscuss:a(),degradedStartAvailable:a()}),generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative()}),me=r({id:c().trim().min(1).max(200),revision:o().int().positive(),question:c().trim().min(1).max(500),options:l(r({id:c().trim().min(1).max(100),label:c().trim().min(1).max(200)})).min(2).max(3),evidenceIds:l(c().trim().min(1).max(300)).min(1).max(8)}),he=e(`state`,[r({state:u(`disabled`)}),r({state:u(`quiet`),reason:d([`no_change`,`insufficient_value`,`model_unavailable`,`generation_failed`,`budget_exhausted`])}),r({state:u(`refreshing`),previous:w.optional(),requestedAt:o().int().nonnegative()}),r({state:u(`clarification`),question:me,generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative()}),r({state:u(`ready`),primary:w,alternatives:l(w).max(2),placement:d([`primary`,`compact`]),generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative(),stale:a()})]);r({idempotencyKey:c().trim().min(1).max(200),locale:c().trim().max(30).optional()}),r({idempotencyKey:c().trim().min(1).max(200),expectedRevision:o().int().positive(),kind:d([`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]),reasonCode:c().trim().min(1).max(100).optional(),note:c().trim().min(1).max(1e3).optional(),snoozedUntil:o().int().nonnegative().optional()}),r({idempotencyKey:c().trim().min(1).max(200)});var ge=r({items:l(r({opportunity:w,status:d([`available`,`started`,`discussing`,`completed`,`snoozed`,`dismissed`,`expired`,`superseded`]),feedbackKind:d([`started`,`discussed`,`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]).optional(),updatedAt:o().int().nonnegative(),snoozedUntil:o().int().nonnegative().optional(),href:c().trim().min(1).max(2e3).optional()})).max(100)});r({idempotencyKey:c().trim().min(1).max(200),expectedRevision:o().int().positive(),mode:d([`start`,`degraded_start`,`discuss`])});var _e=e(`outcome`,[r({outcome:u(`task`),taskId:c(),href:c()}),r({outcome:u(`chat_draft`),href:c()}),r({outcome:u(`needs_setup`),preflight:pe})]),ve=f({runningConversations:l(le).default([]),needsUser:l(C),background:l(C),backgroundCount:o().int().nonnegative(),decisions:l(x),advisor:he,attentionPolicy:f({visibleDecisionCount:o().int().nonnegative(),suppressedDecisionCount:o().int().nonnegative(),visibleAttentionCount:o().int().nonnegative(),suppressedAttentionCount:o().int().nonnegative()}).default({visibleDecisionCount:0,suppressedDecisionCount:0,visibleAttentionCount:0,suppressedAttentionCount:0})});r({window:r({since:o().int().nonnegative(),until:o().int().nonnegative()}),currentStrategyVersion:c().trim().min(1).max(100),generations:r({total:o().int().nonnegative(),succeeded:o().int().nonnegative(),quiet:o().int().nonnegative(),failed:o().int().nonnegative(),estimatedCostUsd:o().nonnegative()}),outcomes:r({opportunities:o().int().nonnegative(),started:o().int().nonnegative(),discussed:o().int().nonnegative(),completed:o().int().nonnegative(),corrected:o().int().nonnegative(),expired:o().int().nonnegative()}),rates:r({start:o().min(0).max(1),completionFromStarted:o().min(0).max(1),correction:o().min(0).max(1)}),feedback:r({alreadyDone:o().int().nonnegative(),irrelevant:o().int().nonnegative(),tooEarly:o().int().nonnegative(),sourceIncorrect:o().int().nonnegative(),lessLikeThis:o().int().nonnegative()}),strategies:l(r({version:c().trim().min(1).max(100),generations:o().int().nonnegative(),opportunities:o().int().nonnegative(),started:o().int().nonnegative(),completed:o().int().nonnegative()}))});var ye=f({northStar:f({weeklyTrustedProgress:o(),weeklyActiveUsers:o(),trustedProgressPerWeeklyActiveUser:o()}),tasks:f({total:o(),achieved:o(),partial:o(),notAchieved:o(),userCorrected:o(),achievementRate:o(),correctionRate:o(),trusted:o(),trustedRate:o()})});function be(e){return ve.parse(e)}var xe=e(`kind`,[f({kind:u(`once`),at:c()}),f({kind:u(`interval`),everyMs:o().positive(),anchorMs:o().optional()}),f({kind:u(`cron`),expr:c(),tz:c().optional()})]),T=e(`kind`,[f({kind:u(`manual`)}),f({kind:u(`schedule`),schedule:xe}),f({kind:u(`webhook`),secretId:c().optional()}),f({kind:u(`event`),eventType:c(),source:c().optional(),payloadMatch:n(c(),ee([c(),o(),a(),te()])).optional()})]),E=e(`kind`,[f({kind:u(`agent`),agentId:c().optional(),instruction:c(),workingDirectory:c().optional(),model:c().optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`workflow`),workflowId:c(),agentId:c().optional(),input:i().optional(),inputEnvelope:i().optional(),goal:c().optional(),concurrency:o().int().positive().optional(),maxSubagents:o().int().nonnegative().optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`browser_automation`),automationId:c(),inputs:n(c(),i()).optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`task_command`),taskId:c(),command:p}),f({kind:u(`system`),capability:d([`home.advisor.refresh`,`personal.proactivity.tick`,`memory.temporal_sweep`,`memory.daily_reconciliation`,`memory.weekly_knowledge`])})]),D=d([`queued`,`running`,`cancelling`,`succeeded`,`failed`,`cancelled`,`timeout`]),O=e(`kind`,[f({key:c(),kind:u(`gateway_event`)}),f({key:c(),kind:u(`webhook`),endpoint:c().url().startsWith(`https://`),secretId:c()}),f({key:c(),kind:u(`file`),targetId:c(),pathTemplate:c()}),f({key:c(),kind:u(`card`),channelId:c(),templateId:c()})]),k=f({id:c(),name:c(),description:c().optional(),projectId:c().optional(),enabled:a(),trigger:T,action:E,safety:f({mode:d([`suggest_only`,`ask_before_apply`,`auto_apply`])}).optional(),conversationMode:d([`new_session`,`continuous`]).optional(),delivery:f({notificationPolicy:d([`attention`,`all`,`none`]),destinations:l(O)}),reliability:f({executionTimeoutSeconds:o().positive().optional(),retryCount:o().int().nonnegative().optional(),maxConcurrentRuns:o().int().positive().optional(),disableAfterConsecutiveFailures:o().int().positive().optional()}).optional(),management:f({owner:c(),editable:l(d([`enabled`,`trigger`])),runnable:a(),deletable:a()}).optional(),state:f({nextRunAtMs:o().optional(),runningRunId:c().optional(),lastRunAtMs:o().optional(),lastRunStatus:D.optional(),lastError:c().optional(),consecutiveFailures:o().int().nonnegative().optional()}),createdAtMs:o(),updatedAtMs:o()}),A=f({id:c(),automationId:c(),automationName:c(),status:D,triggerSnapshot:T,actionSnapshot:E,manual:a(),createdAtMs:o(),startedAtMs:o().optional(),endedAtMs:o().optional(),durationMs:o().optional(),summary:c().optional(),error:c().optional(),conversationId:c().optional(),workflowRunId:c().optional(),model:c().optional(),deadlineAtMs:o().optional(),currentPhase:d([`queued`,`action`,`cancelling`,`completed`]).optional(),cancelRequestedAtMs:o().optional(),cancelConfirmedAtMs:o().optional(),termination:f({reason:d([`completed`,`failed`,`user_cancelled`,`deadline_exceeded`]),component:d([`automation`,`agent_turn`,`tool`,`mcp`,`process`]).optional(),componentName:c().optional(),cancellationConfirmed:a()}).optional(),heartbeatAtMs:o().optional(),leaseOwner:c().optional(),leaseExpiresAtMs:o().optional(),attemptNumber:o().int().positive().optional(),rootRunId:c().optional()}),j=f({id:c(),runId:c(),automationId:c(),type:d([`run.queued`,`run.started`,`run.deadline_resolved`,`run.cancel_requested`,`run.cancel_confirmed`,`run.cancellation_unconfirmed`,`run.recovered`,`action.started`,`action.retry_scheduled`,`action.completed`,`action.failed`,`run.completed`]),message:c(),data:i().optional(),createdAtMs:o()}),M=f({totalAutomations:o().int().nonnegative(),enabledAutomations:o().int().nonnegative(),runningRuns:o().int().nonnegative(),failedLastHour:o().int().nonnegative(),nextRun:f({automationId:c(),name:c(),runAtMs:o()}).optional(),pendingEvents:o().int().nonnegative(),oldestPendingEventAgeMs:o().int().nonnegative(),projectionDeadLetters:o().int().nonnegative(),pendingRunDeliveries:o().int().nonnegative(),runDeliveryDeadLetters:o().int().nonnegative(),pendingResultDeliveries:o().int().nonnegative(),resultDeliveryDeadLetters:o().int().nonnegative(),activeExecutions:o().int().nonnegative(),activeDeliveryLeases:o().int().nonnegative()}),N=c().trim().min(1).max(200),P=l(N).max(100).refine(e=>new Set(e).size===e.length,`Duplicate identifiers`),Se=[`no_change`,`observation`,`artifact`,`decision`,`state_change`,`effect_proposal`,`receipt`],F=[`needs_setup`,`active`,`paused`,`completed`,`archived`],Ce=e(`kind`,[r({kind:u(`personal`)}),r({kind:u(`project`),id:N}),r({kind:u(`conversation`),id:N}),r({kind:u(`objects`),ids:P.refine(e=>e.length>0)})]),we=r({timeoutSeconds:o().int().min(1).max(600),maxIterations:o().int().min(1).max(30),maxToolCalls:o().int().min(0).max(100),maxOutputTokens:o().int().min(1).max(32768)}),I=r({kind:c().regex(/^[a-z][a-z0-9_-]{0,63}$/),instruction:c().trim().min(1).max(32e3),limits:we}),L=r({schemaVersion:u(1),key:c().regex(/^[a-z][a-z0-9-]{0,79}$/),version:c().regex(/^\d+\.\d+\.\d+$/),title:c().trim().min(1).max(120),description:c().trim().min(1).max(2e3),goalMode:d([`finite`,`ongoing`]),contextProviders:P,triggers:l(e(`type`,[r({id:N,type:u(`manual`)}),r({id:N,type:u(`event`),eventType:N}),r({id:N,type:u(`schedule`)})])).min(1).max(20).refine(e=>new Set(e.map(e=>e.id)).size===e.length,`Duplicate trigger IDs`),execution:I,allowedOutcomeKinds:l(d(Se)).min(1),allowedEffectHandlers:P}),Te=r({accountIds:P,contextProviders:P,effectHandlers:P}),Ee=r({expectedRevision:o().int().nonnegative(),content:c().trim().max(32e3),validUntil:o().int().nonnegative().nullable().default(null)}),R=r({templateKey:N,templateVersion:N,goal:c().trim().min(1).max(12e3),scope:Ce,permissions:Te}),z=R.extend({id:N,ownerId:N,workspaceId:c().min(1),status:d(F),setupMissing:l(c()).optional(),revision:o().int().positive()}),De=R.pick({goal:!0,scope:!0,permissions:!0}).extend({expectedRevision:o().int().positive()}),Oe=r({expectedRevision:o().int().positive(),status:d(F)}),B=r({subjectId:N,accountId:N,dueAt:o().int().nonnegative()}),ke=r({expectedRevision:o().int().positive(),dueAt:o().int().nonnegative().optional(),status:d([`watching`,`paused`,`completed`]).optional()}).refine(e=>e.dueAt!==void 0||e.status!==void 0,`Work item update is empty`),V=B.extend({id:N,activationId:N,revision:o().int().positive(),status:d([`watching`,`paused`,`completed`])}),H=o().int().min(0).max(23),U=r({level:d([`quiet`,`balanced`,`active`]).default(`balanced`),timezone:c().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}}).default(`Asia/Shanghai`),quietStartHour:H.default(22),quietEndHour:H.default(8),dailyNotificationLimit:o().int().min(0).max(30).default(3),digestEnabled:a().default(!1),digestHour:H.default(18),digestMinute:o().int().min(0).max(59).default(0),preferredChannel:d([`in_app`,`browser`]).default(`browser`),suppressWhileViewing:a().default(!0),checksPaused:a().default(!1),checksPausedUntil:c().datetime({offset:!0}).nullable().default(null),notificationsMuted:a().default(!1)}),W=U.shape;r({expectedRevision:o().int().nonnegative(),level:W.level.removeDefault().optional(),timezone:W.timezone.removeDefault().optional(),quietStartHour:W.quietStartHour.removeDefault().optional(),quietEndHour:W.quietEndHour.removeDefault().optional(),dailyNotificationLimit:W.dailyNotificationLimit.removeDefault().optional(),digestEnabled:W.digestEnabled.removeDefault().optional(),digestHour:W.digestHour.removeDefault().optional(),digestMinute:W.digestMinute.removeDefault().optional(),preferredChannel:W.preferredChannel.removeDefault().optional(),suppressWhileViewing:W.suppressWhileViewing.removeDefault().optional(),checksPaused:W.checksPaused.removeDefault().optional(),checksPausedUntil:W.checksPausedUntil.removeDefault().optional(),notificationsMuted:W.notificationsMuted.removeDefault().optional()});var Ae=r({expectedRevision:o().int().nonnegative(),rating:d([`useful`,`not_useful`]),note:c().trim().max(2e3).optional()}),je=r({weekdays:l(o().int().min(0).max(6)).min(1).max(7).refine(e=>new Set(e).size===e.length,`Duplicate weekdays`),hour:o().int().min(0).max(23),minute:o().int().min(0).max(59),timeZone:c().trim().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid time zone`)});d([`http`,`agent`,`cli`,`automation`,`mcp`,`extension`]),d([`INVALID_INPUT`,`FORBIDDEN`,`NOT_FOUND`,`REVISION_CONFLICT`,`CONTRACT_CHANGED`,`APPROVAL_REQUIRED`,`IN_PROGRESS`,`UNAVAILABLE`,`OUTCOME_UNKNOWN`,`CANCELLED`,`INTERNAL`]);var Me=r({majorVersion:o().int().positive(),descriptorDigest:c().regex(/^[a-f0-9]{64}$/),input:s(),idempotencyKey:c().min(1).max(200).optional()}),Ne=f({triggerSummary:c(),actionSummary:c(),safetyNotes:l(c()),requiredConfirmations:l(c()),canRunNow:a(),runNowBlockedReason:c().optional()});r({agentId:c().trim().min(1).max(64).optional(),language:d([`en`,`zh`]).default(`en`)}),f({draftId:c(),explanation:c(),assumptions:l(c()),risks:l(c()),automation:t({name:c(),trigger:s(),action:s()}),simulation:Ne,repairAttempts:o().int().nonnegative()}),f({draftId:c(),patch:n(c(),s()),explanation:c(),expectedEffect:c(),risks:l(c()),requiresApproval:a(),repairAttempts:o().int().nonnegative()});var Pe=r({eventId:c().min(1),kind:d([`note`,`task`,`project`,`automation`,`scene`,`local_app`]),id:c().min(1),revision:o().int().nonnegative(),operation:d([`created`,`updated`,`deleted`]),operationId:c().optional()}),G=r({id:c().trim().min(1).max(512)}),K=r({limit:o().int().min(1).max(100).default(50),afterId:c().max(200).default(``)});f({activation:z}),Oe.extend({id:c().min(1).max(512)}),f({activation:z}),U.extend({revision:o().int().positive()}),Ae.extend({id:c().min(1).max(512)}),f({revision:o().int().positive()}),G.extend({read:a()}),f({ok:u(!0),presentationId:c(),read:a()}),G.extend({triggerKey:c().min(1).max(200),expectedRevision:o().int().nonnegative(),schedule:je}),f({revision:o().int().positive()}),De.extend({id:c().min(1).max(512)}),f({activation:z}),f({intentId:c()}),Ee.extend({id:c().min(1).max(512)}),f({revision:o().int().positive()}),B.extend({id:c().min(1).max(512)}),f({workItem:V}),ke.safeExtend({id:c().min(1).max(512)}),f({workItem:V});var q=t({id:c(),activationId:c(),outcomeId:c(),status:c(),content:s(),readOnly:a(),createdAt:o(),sources:l(f({kind:c(),title:c(),sender:c(),href:c()})),sourceHealth:n(c(),s()).nullable()});G.extend({expectedVersion:o().int().positive(),reason:c().trim().min(1).max(4096).default(`TaskRun cancelled`)}),G.extend({rating:d([`helpful`,`not_helpful`]),reason:c().trim().max(4096).optional()}),f({ok:u(!0),feedback:f({id:c(),runId:c(),rating:d([`helpful`,`not_helpful`]),reason:c().optional(),createdAt:o()})}),f({ok:u(!0),run:h,receipt:g,model:m.pick({task:!0,operationalState:!0,attention:!0,allowedCommands:!0}),executionStopConfirmed:u(!1)}),G.extend({enabled:a(),expectedRevision:o().int().nonnegative()}),f({ok:u(!0),automation:k.loose()}).extend({run:A.loose()}),f({ok:u(!0),cancelled:a(),confirmed:a()}),f({ok:u(!0),marked:u(!0)}),r({projectId:c().trim().min(1).max(512).optional()}),f({ok:u(!0),count:o().int().nonnegative()}),G.extend({reason:c().trim().min(1).max(2e3)}),r({runId:c().trim().min(1).max(200),destinationKey:c().trim().min(1).max(100),reason:c().trim().min(1).max(2e3)}),f({ok:u(!0),accepted:u(!0)}),G.extend({expectedRevision:o().int().nonnegative().nullable()}),f({ok:u(!0),removed:a(),automation:k.loose().optional(),cancelRunId:c().optional()});var Fe=r({status:d([`inbox`,`processed`,`archived`,`trashed`]).optional(),kind:d([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]).optional(),tag:c().max(512).optional(),projectId:c().min(1).max(512).optional(),unassigned:a().optional(),agentEdited:a().optional(),search:c().max(4096).optional(),pinned:a().optional(),limit:o().int().min(1).max(100).default(20),offset:o().int().min(0).default(0),sortBy:d([`createdAt`,`updatedAt`,`lastOpenedAt`]).optional(),sortOrder:d([`asc`,`desc`]).optional()}),J=t({id:c().min(1),markdown:c(),kind:d([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]),status:d([`inbox`,`processed`,`archived`,`trashed`]),createdAt:o(),updatedAt:o(),title:c().optional(),localVersion:o().optional()}),Ie=f({note:J});G.extend({expectedRevision:o().int().positive(),revokeShares:a().default(!0)}),f({deleted:u(!0),revokedShares:o().int().nonnegative()});var Le=r({title:c().max(1e3).optional(),markdown:c().max(2e6).default(``),kind:J.shape.kind.optional(),tags:l(c().max(512)).max(100).optional(),capturedVia:r({channel:d([`app`,`web`,`electron`,`tui`,`telegram`,`wechat`,`feishu`]),platform:d([`ios`,`android`,`harmonyos`]).optional()}).default({channel:`web`}),pinned:a().default(!1),projectId:c().min(1).optional()});r({id:c().min(1),expectedRevision:o().int().positive(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]).optional(),patch:r({title:c().max(1e3).optional(),markdown:c().max(2e6).optional(),tags:l(c().max(512)).max(100).optional(),pinned:a().optional(),kind:J.shape.kind.optional(),status:J.shape.status.optional(),localVersion:o().int().positive().optional(),ai:n(c(),s()).optional(),aiDeep:t({processedAt:o()}).optional()})}),r({text:c().trim().min(1).max(2e6),capturedVia:Le.shape.capturedVia}),r({id:c().min(1),expectedRevision:o().int().positive().optional(),content:c().trim().min(1).max(2e6),heading:c().trim().min(1).max(1e3).default(`AI 讨论沉淀`)}),r({id:c().min(1),timestamp:o().int().positive(),expectedRevision:o().int().positive()});var Re=t({items:l(t({id:c().min(1)})),total:o().int().nonnegative()}),ze=r({phase:ae.optional(),priority:oe.optional(),projectId:c().min(1).max(512).optional(),search:c().max(4096).optional(),limit:o().int().min(1).max(200).default(50),offset:o().int().nonnegative().default(0)}),Y=t({id:c().min(1),name:c(),slug:c(),status:d([`planned`,`active`,`paused`,`completed`,`cancelled`,`archived`]),executionMode:d([`local_checkout`,`managed_worktree`]),successCriteria:l(c()),scope:n(c(),i()),nonGoals:l(c()),health:d([`unknown`,`on_track`,`at_risk`,`off_track`]),version:o().int().positive(),createdAt:o(),updatedAt:o(),workspaceRoot:c().optional(),defaultAgentId:c().optional()}),Be=r({id:c().trim().min(1),expectedVersion:o().int().positive(),pinned:a()});f({ok:u(!0),project:Y}),r({workspacePath:c().trim().min(1).max(4096),agentId:c().trim().min(1).max(512).optional(),defaultAgentId:c().trim().max(512).optional(),projectKind:d([`auto`,`coding`,`general`,`unknown`]).optional(),autoCreate:a().default(!1),conversationId:ne().optional()}),f({ok:u(!0),project:Y.nullable(),reason:d([`exact`,`contained`,`auto_created`]).optional(),created:a().optional()}),Be.omit({pinned:!0}),f({ok:u(!0),deleted:u(!0),executionStopConfirmed:u(!1)});var X={name:c().trim().min(1).max(1e3).optional(),description:c().max(2e4).optional(),defaultAgentId:c().trim().max(512).optional(),workspaceRoot:c().trim().min(1).max(4096).optional(),createWorkspaceRoot:a().optional(),executionMode:Y.shape.executionMode.optional(),brief:c().max(2e4).optional(),instructions:c().max(1e5).optional(),outcome:c().max(2e4).optional(),successCriteria:l(c().max(4096)).max(100).optional(),scope:n(c(),s()).optional(),nonGoals:l(c().max(4096)).max(100).optional(),health:Y.shape.health.optional(),ownerId:c().max(512).optional(),targetAt:o().finite().optional()};r({...X,projectKind:d([`auto`,`coding`,`general`,`unknown`]).optional(),autoUnderstand:a().default(!1)}).refine(e=>!!(e.name||e.workspaceRoot),`name or workspaceRoot is required`),r({id:c().trim().min(1),expectedVersion:o().int().positive(),patch:r({...X,status:Y.shape.status.optional(),description:X.description.unwrap().nullable().optional(),defaultAgentId:X.defaultAgentId.unwrap().nullable().optional(),workspaceRoot:c().trim().max(4096).nullable().optional(),brief:X.brief.unwrap().nullable().optional(),instructions:X.instructions.unwrap().nullable().optional(),outcome:X.outcome.unwrap().nullable().optional(),ownerId:X.ownerId.unwrap().nullable().optional(),targetAt:X.targetAt.unwrap().nullable().optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),`Empty project patch`)});var Ve=r({status:Y.shape.status.optional(),search:c().max(4096).optional(),sortBy:d([`updatedAt`,`createdAt`,`name`]).optional(),sortOrder:d([`asc`,`desc`]).optional(),limit:o().int().min(1).max(500).default(50),offset:o().int().nonnegative().default(0)}),Z=t({id:c(),projectId:c(),title:c(),status:d([`planned`,`active`,`completed`,`cancelled`]),sortOrder:o(),createdAt:o(),updatedAt:o()}),Q=t({id:c(),projectId:c(),summary:c(),health:Y.shape.health,createdAt:o()}),$={title:c().trim().min(1).max(1e3),description:c().max(2e4).optional(),status:Z.shape.status.optional(),targetAt:o().int().nonnegative().optional(),sortOrder:o().int().optional()};r({projectId:c().trim().min(1),...$}),r({projectId:c().trim().min(1),id:c().trim().min(1),expectedRevision:o().int().nonnegative(),patch:r({...$,description:c().max(2e4).nullable().optional(),targetAt:o().int().nonnegative().nullable().optional()}).partial().refine(e=>Object.values(e).some(e=>e!==void 0),`Empty milestone patch`)}).omit({patch:!0}),f({ok:u(!0),milestone:Z,project:Y}),f({ok:u(!0),deleted:u(!0)}),r({projectId:c().trim().min(1),expectedVersion:o().int().positive(),health:Y.shape.health,summary:c().trim().min(1).max(2e4),progress:l(c().max(1e4)).max(100).default([]),risks:l(c().max(1e4)).max(100).default([]),nextSteps:l(c().max(1e4)).max(100).default([])}),f({ok:u(!0),update:Q,project:Y});var He={"xopc.context.resolve":{input:b,output:y},"xopc.notes.preview_edit":{input:G.extend({instruction:c().trim().min(1).max(16e3),markdown:c().max(2e6).optional(),context:t({type:d([`selection`,`section`,`block`,`note`]),range:r({start:o().int().nonnegative(),end:o().int().nonnegative()})}).optional()}),output:f({message:c(),patch:f({id:c(),summary:c(),operations:l(f({type:u(`replaceRange`),from:o().int().nonnegative(),to:o().int().nonnegative(),markdown:c()}))})})},"xopc.automations.get_run":{input:G,output:f({ok:u(!0),run:A.loose()})},"xopc.automations.run_events":{input:G,output:f({ok:u(!0),events:l(j.loose())})},"xopc.automations.metrics":{input:r({}),output:f({ok:u(!0),metrics:M})},"xopc.automations.events":{input:r({type:c().trim().min(1).max(512).optional(),source:c().trim().min(1).max(512).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(f({event:f({id:c(),type:c(),schemaVersion:o().int(),source:c(),subject:f({kind:c(),id:c()}).optional(),payload:n(c(),i()),occurredAtMs:o(),ingestedAtMs:o(),correlationId:c(),causationId:c().optional(),rootEventId:c(),chainDepth:o().int(),dedupeKey:c().optional(),trust:d([`system`,`user`,`connector`,`untrusted_webhook`])}),projectionStatus:d([`pending`,`projecting`,`retrying`,`projected`,`dead_letter`]),projectionAttempts:o().int(),projectionError:c().optional(),deliveries:l(f({automationId:c(),status:d([`pending`,`retrying`,`queued`,`completed`,`failed`,`cancelled`,`skipped`,`dead_letter`]),runId:c().optional(),attempts:o().int(),lastError:c().optional()}))}))})},"xopc.automations.deliveries":{input:r({runId:c().trim().min(1).max(200).optional(),status:d([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(f({runId:c(),destinationKey:c(),kind:c(),status:d([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]),attempts:o().int(),nextAttemptAtMs:o(),lastError:c().optional(),createdAtMs:o(),updatedAtMs:o()}))})},"xopc.automations.product_events":{input:r({eventType:c().trim().min(1).max(512),source:c().trim().min(1).max(512).optional(),payloadKey:c().trim().min(1).max(512).optional(),payloadValue:c().max(4096).optional(),limit:o().int().min(1).max(100).default(10)}).refine(e=>e.payloadKey===void 0==(e.payloadValue===void 0),`payloadKey and payloadValue must be supplied together`),output:f({ok:u(!0),items:l(f({run:A.loose(),triggerEvent:j.loose()}))})},"xopc.automations.list":{input:r({projectId:c().trim().min(1).optional()}),output:f({ok:u(!0),items:l(k.loose()),projectId:c().optional()})},"xopc.automations.get":{input:G,output:f({ok:u(!0),automation:k.loose()})},"xopc.automations.history":{input:r({automationId:c().trim().min(1).optional(),projectId:c().trim().min(1).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(A.loose()),projectId:c().optional()})},"xopc.scenes.templates":{input:r({}),output:f({templates:l(L)})},"xopc.scenes.mail_accounts":{input:r({}),output:f({accounts:l(f({id:c(),label:c()}))})},"xopc.scenes.mail_sources":{input:K,output:f({sources:l(f({id:c(),accountId:c(),subject:c(),sender:c()})),nextCursor:c().nullable()})},"xopc.scenes.results":{input:K.extend({activationId:c().min(1).max(200).optional()}),output:f({outcomes:l(q),nextCursor:c().nullable()})},"xopc.scenes.get_presentation":{input:G,output:f({outcome:q})},"xopc.scenes.get_feedback":{input:G,output:f({feedback:f({rating:d([`useful`,`not_useful`]),note:c(),revision:o().int().nonnegative()}).nullable()})},"xopc.scenes.digest_results":{input:K.extend({id:c().min(1).max(512)}),output:f({outcomes:l(q),nextCursor:c().nullable()})},"xopc.scenes.metrics":{input:r({days:o().int().min(1).max(90).default(7)}),output:f({window:f({since:o(),until:o(),days:o().int()}),ratedOutcomes:o().int().nonnegative(),usefulOutcomes:o().int().nonnegative(),unhelpfulOutcomes:o().int().nonnegative(),scenesWithUsefulOutcomes:o().int().nonnegative(),checks:o().int().nonnegative(),failedChecks:o().int().nonnegative(),skippedChecks:o().int().nonnegative()})},"xopc.scenes.diagnostics":{input:r({}),output:f({checksPaused:a(),currentModel:c().nullable(),pendingChecks:o().int().nonnegative(),oldestDueWaitMs:o().nonnegative(),notifications:l(f({status:c(),count:o().int().nonnegative()})),activations:l(n(c(),s()))})},"xopc.scenes.get_preferences":{input:r({}),output:U.extend({revision:o().int().nonnegative()})},"xopc.scenes.preflight":{input:R,output:f({ready:a(),missing:l(c())})},"xopc.scenes.get_template":{input:r({key:c().min(1).max(200),version:c().min(1).max(200)}),output:f({template:L})},"xopc.scenes.list":{input:K,output:f({activations:l(z),nextCursor:c().nullable()})},"xopc.scenes.get":{input:G,output:f({activation:z,runs:l(t({id:c(),status:c(),attempt:o().int(),reason:c().nullable(),createdAt:o()})),schedules:l(t({triggerKey:c(),revision:o().int(),nextDueAt:o(),schedule:s()}))})},"xopc.scenes.read_notes":{input:G,output:f({notes:f({content:c(),revision:o().int().nonnegative(),validUntil:o().nullable()})})},"xopc.scenes.list_runs":{input:K.extend({id:c().min(1).max(512)}),output:f({runs:l(t({id:c(),activationId:c(),status:c(),attempt:o().int(),reason:c().nullable(),createdAt:o()})),nextCursor:c().nullable()})},"xopc.scenes.list_schedules":{input:G,output:f({schedules:l(t({triggerKey:c(),revision:o().int(),nextDueAt:o(),schedule:s()}))})},"xopc.scenes.list_work_items":{input:K.extend({id:c().min(1).max(512)}),output:f({workItems:l(t({id:c(),subjectId:c(),accountId:c(),dueAt:o(),status:c(),revision:o().int(),lastCheckReason:c().nullable()})),nextCursor:c().nullable()})},"xopc.settings.open":{input:r({section:c().trim().regex(/^[a-z0-9][a-z0-9/_-]*$/i).max(512).default(`overview`),title:c().trim().min(1).max(512).default(`Settings`),summary:c().trim().max(4096).optional()}),output:f({ok:u(!0),settings:f({section:c(),title:c(),summary:c().optional()})})},"xopc.local_apps.list":{input:r({}),output:f({apps:l(se)})},"xopc.local_apps.get":{input:G,output:f({app:ce})},"xopc.local_apps.validate":{input:G,output:f({validation:v})},"xopc.projects.get":{input:G,output:f({ok:u(!0),project:Y})},"xopc.projects.list":{input:Ve,output:t({ok:u(!0),items:l(Y),total:o().int().nonnegative()})},"xopc.projects.list_milestones":{input:G,output:f({ok:u(!0),projectId:c(),items:l(Z)})},"xopc.projects.list_updates":{input:G.extend({limit:o().int().min(1).max(500).default(20)}),output:f({ok:u(!0),projectId:c(),items:l(Q)})},"xopc.task_runs.get":{input:G,output:f({ok:u(!0),run:h,receipt:g.optional(),events:l(ie),activeWaits:l(_)})},"xopc.task_runs.list":{input:r({taskId:c().trim().min(1),limit:o().int().min(1).max(200).default(20)}),output:f({ok:u(!0),taskId:c(),items:l(h),receipts:l(g),activeWaits:l(_)})},"xopc.notes.project_summaries":{input:r({}),output:f({items:l(f({id:c(),name:c(),description:c().optional(),noteCount:o().int().nonnegative(),updatedAt:o().optional()}))})},"xopc.notes.history":{input:G,output:f({entries:l(f({timestamp:o().int().nonnegative(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]),snippet:c().optional()}))})},"xopc.notes.snapshot":{input:G.extend({timestamp:o().int().nonnegative()}),output:f({snapshot:f({noteId:c(),timestamp:o().int().nonnegative(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]),title:c().optional(),markdown:c(),tags:l(c()).optional(),kind:J.shape.kind,status:J.shape.status})})},"xopc.notes.get":{input:G,output:Ie},"xopc.notes.list":{input:Fe,output:Re},"xopc.tasks.metrics":{input:r({}),output:f({ok:u(!0),metrics:ye})},"xopc.tasks.get":{input:G,output:m},"xopc.tasks.list":{input:ze,output:re.extend({total:o().int().nonnegative()})}};export{ge as a,_e as i,He as n,be as o,Pe as r,Me as t};
|
|
1
|
+
import{a as e,c as t,d as n,f as r,g as i,h as ee,i as a,l as o,n as te,o as s,p as c,r as l,s as u,t as d,u as f,v as ne}from"./schemas-CObaziC7.js";import{c as re,f as ie,g as ae,l as oe,n as p,o as m,p as h,u as g,v as _}from"./tasks-DwKXgZ-I.js";import{i as v,n as se,t as ce}from"./local-apps-yys1VChX.js";import{g as y,h as b}from"./local-session-drafts-CrD74S6k.js";var x=f({id:c(),kind:d([`task`,`connector_approval`]),title:c(),detail:c().optional(),reason:d([`needs_input`,`blocked`,`user_input`,`user_approval`,`dependency`,`external`,`scheduled`,`retry`,`paused`,`overdue`,`due_soon`,`decision_needed`,`approval_required`]),urgency:d([`now`,`soon`]),href:c(),projectId:c().optional(),projectName:c().optional(),dueAt:o().int().nonnegative().optional(),updatedAt:o(),response:e(`kind`,[f({kind:u(`connector_approval`),approvalId:c()}),f({kind:u(`task`),taskId:c(),canRetry:a()})]).optional()});f({id:c(),kind:d([`automation_run`,`workflow_run`]),runId:c(),title:c(),detail:c(),reason:d([`run_failed`,`run_timeout`]),href:c(),updatedAt:o(),conversationId:c().optional()});var S=e(`type`,[f({type:u(`task_review`),label:c(),taskId:c()}),f({type:u(`retry_task`),label:c(),taskId:c()}),f({type:u(`open`),label:c(),href:c()}),f({type:u(`connector_decision`),label:c(),approvalId:c(),decision:d([`approve`,`deny`])}),f({type:u(`retry_run`),label:c(),subjectKind:d([`automation_run`,`workflow_run`]),runId:c()}),f({type:u(`acknowledge_run`),label:c(),subjectKind:d([`automation_run`,`workflow_run`]),runId:c()})]),C=f({id:c(),kind:d([`decision`,`failure`,`running`,`scheduled`]),title:c(),summary:c(),recommendation:c().optional(),dueAt:o().int().nonnegative().optional(),statusLabel:c().optional(),updatedAt:o(),openAction:S.optional(),primaryAction:S.optional(),secondaryActions:l(S).max(2).default([])}),le=f({conversationId:c(),runId:c(),title:c().optional(),agentId:c().optional(),updatedAt:o()}),ue=r({id:c().trim().min(1).max(300),sourceType:d([`project`,`task`,`conversation`,`scene`,`calendar`,`mail`,`communication`,`file`,`user_model`]),sourceRef:c().trim().min(1).max(1e3),revision:c().trim().min(1).max(300),observation:c().trim().min(1).max(1e3),observedAt:o().int().nonnegative(),freshUntil:o().int().nonnegative(),href:c().trim().min(1).max(2e3).optional()}),de=r({kind:d([`connector`,`skill`,`agent`]),capability:c().trim().min(1).max(200),resolvedId:c().trim().min(1).max(300).optional(),readiness:d([`ready`,`needs_setup`,`unavailable`]),required:a(),recoveryPath:c().trim().min(1).max(2e3).optional(),reason:c().trim().min(1).max(500).optional()}),fe=r({kind:d([`connector`,`skill`,`agent`]),capability:c().trim().min(1).max(200),code:d([`not_installed`,`disabled`,`agent_not_allowed`,`scope_too_narrow`,`connection_missing`,`account_selection_required`,`reauthorization_required`,`requirements_unmet`,`model_invocation_disabled`,`tool_gated`,`agent_unavailable`]),message:c().trim().min(1).max(500),recoveryPath:c().trim().min(1).max(2e3)}),pe=e(`state`,[r({state:u(`ready`)}),r({state:u(`needs_setup`),blockers:l(fe).min(1).max(12),recoveryActions:l(r({capability:c().trim().min(1).max(200),href:c().trim().min(1).max(2e3)})).min(1).max(12),degradedAction:r({mode:u(`degraded_start`)}).optional()})]),w=r({id:c().trim().min(1).max(200),revision:o().int().positive(),kind:d([`project_next_step`,`delivery_risk`,`meeting_prep`,`commitment_follow_up`,`automation_candidate`]),projectId:c().trim().min(1).max(200).optional(),title:c().trim().min(1).max(160),outcome:c().trim().min(1).max(1e3),rationale:c().trim().min(1).max(1500),evidence:l(ue).min(1).max(8),confidence:d([`high`,`medium`,`low`]),urgency:d([`now`,`today`,`this_week`]),estimatedMinutes:o().int().min(1).max(480).optional(),risk:d([`analysis`,`external_read`,`file_write`,`external_write`]),proposedSteps:l(c().trim().min(1).max(500)).min(1).max(6),capabilities:l(de).max(12),verification:l(c().trim().min(1).max(500)).max(8),actionPrompt:c().trim().min(1).max(4e3),degradedActionPrompt:c().trim().min(1).max(4e3).optional(),continuation:e(`kind`,[r({kind:u(`scene`),reason:u(`prior_success`),href:c().trim().min(1).max(2e3)}),r({kind:u(`automation`),reason:u(`repeated_success`),href:c().trim().min(1).max(4e3),successCount:o().int().min(2)})]).optional(),actions:r({canStart:a(),canDiscuss:a(),degradedStartAvailable:a()}),generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative()}),me=r({id:c().trim().min(1).max(200),revision:o().int().positive(),question:c().trim().min(1).max(500),options:l(r({id:c().trim().min(1).max(100),label:c().trim().min(1).max(200)})).min(2).max(3),evidenceIds:l(c().trim().min(1).max(300)).min(1).max(8)}),he=e(`state`,[r({state:u(`disabled`)}),r({state:u(`quiet`),reason:d([`no_change`,`insufficient_value`,`model_unavailable`,`generation_failed`,`budget_exhausted`])}),r({state:u(`refreshing`),previous:w.optional(),requestedAt:o().int().nonnegative()}),r({state:u(`clarification`),question:me,generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative()}),r({state:u(`ready`),primary:w,alternatives:l(w).max(2),placement:d([`primary`,`compact`]),generatedAt:o().int().nonnegative(),expiresAt:o().int().nonnegative(),stale:a()})]);r({idempotencyKey:c().trim().min(1).max(200),locale:c().trim().max(30).optional()}),r({idempotencyKey:c().trim().min(1).max(200),expectedRevision:o().int().positive(),kind:d([`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]),reasonCode:c().trim().min(1).max(100).optional(),note:c().trim().min(1).max(1e3).optional(),snoozedUntil:o().int().nonnegative().optional()}),r({idempotencyKey:c().trim().min(1).max(200)});var ge=r({items:l(r({opportunity:w,status:d([`available`,`started`,`discussing`,`completed`,`snoozed`,`dismissed`,`expired`,`superseded`]),feedbackKind:d([`started`,`discussed`,`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]).optional(),updatedAt:o().int().nonnegative(),snoozedUntil:o().int().nonnegative().optional(),href:c().trim().min(1).max(2e3).optional()})).max(100)});r({idempotencyKey:c().trim().min(1).max(200),expectedRevision:o().int().positive(),mode:d([`start`,`degraded_start`,`discuss`])});var _e=e(`outcome`,[r({outcome:u(`task`),taskId:c(),href:c()}),r({outcome:u(`chat_draft`),href:c()}),r({outcome:u(`needs_setup`),preflight:pe})]),ve=f({runningConversations:l(le).default([]),needsUser:l(C),background:l(C),backgroundCount:o().int().nonnegative(),decisions:l(x),advisor:he,attentionPolicy:f({visibleDecisionCount:o().int().nonnegative(),suppressedDecisionCount:o().int().nonnegative(),visibleAttentionCount:o().int().nonnegative(),suppressedAttentionCount:o().int().nonnegative()}).default({visibleDecisionCount:0,suppressedDecisionCount:0,visibleAttentionCount:0,suppressedAttentionCount:0})});r({window:r({since:o().int().nonnegative(),until:o().int().nonnegative()}),currentStrategyVersion:c().trim().min(1).max(100),generations:r({total:o().int().nonnegative(),succeeded:o().int().nonnegative(),quiet:o().int().nonnegative(),failed:o().int().nonnegative(),estimatedCostUsd:o().nonnegative()}),outcomes:r({opportunities:o().int().nonnegative(),started:o().int().nonnegative(),discussed:o().int().nonnegative(),completed:o().int().nonnegative(),corrected:o().int().nonnegative(),expired:o().int().nonnegative()}),rates:r({start:o().min(0).max(1),completionFromStarted:o().min(0).max(1),correction:o().min(0).max(1)}),feedback:r({alreadyDone:o().int().nonnegative(),irrelevant:o().int().nonnegative(),tooEarly:o().int().nonnegative(),sourceIncorrect:o().int().nonnegative(),lessLikeThis:o().int().nonnegative()}),strategies:l(r({version:c().trim().min(1).max(100),generations:o().int().nonnegative(),opportunities:o().int().nonnegative(),started:o().int().nonnegative(),completed:o().int().nonnegative()}))});var ye=f({northStar:f({weeklyTrustedProgress:o(),weeklyActiveUsers:o(),trustedProgressPerWeeklyActiveUser:o()}),tasks:f({total:o(),achieved:o(),partial:o(),notAchieved:o(),userCorrected:o(),achievementRate:o(),correctionRate:o(),trusted:o(),trustedRate:o()})});function be(e){return ve.parse(e)}var xe=e(`kind`,[f({kind:u(`once`),at:c()}),f({kind:u(`interval`),everyMs:o().positive(),anchorMs:o().optional()}),f({kind:u(`cron`),expr:c(),tz:c().optional()})]),T=e(`kind`,[f({kind:u(`manual`)}),f({kind:u(`schedule`),schedule:xe}),f({kind:u(`webhook`),secretId:c().optional()}),f({kind:u(`event`),eventType:c(),source:c().optional(),payloadMatch:n(c(),ee([c(),o(),a(),te()])).optional()})]),E=e(`kind`,[f({kind:u(`agent`),agentId:c().optional(),instruction:c(),workingDirectory:c().optional(),model:c().optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`workflow`),workflowId:c(),agentId:c().optional(),input:i().optional(),inputEnvelope:i().optional(),goal:c().optional(),concurrency:o().int().positive().optional(),maxSubagents:o().int().nonnegative().optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`browser_automation`),automationId:c(),inputs:n(c(),i()).optional(),timeoutSeconds:o().positive().optional()}),f({kind:u(`task_command`),taskId:c(),command:p}),f({kind:u(`system`),capability:d([`home.advisor.refresh`,`personal.proactivity.tick`,`memory.temporal_sweep`,`memory.daily_reconciliation`,`memory.weekly_knowledge`])})]),D=d([`queued`,`running`,`cancelling`,`succeeded`,`failed`,`cancelled`,`timeout`]),O=e(`kind`,[f({key:c(),kind:u(`gateway_event`)}),f({key:c(),kind:u(`webhook`),endpoint:c().url().startsWith(`https://`),secretId:c()}),f({key:c(),kind:u(`file`),targetId:c(),pathTemplate:c()}),f({key:c(),kind:u(`card`),channelId:c(),templateId:c()})]),k=f({id:c(),name:c(),description:c().optional(),projectId:c().optional(),enabled:a(),trigger:T,action:E,safety:f({mode:d([`suggest_only`,`ask_before_apply`,`auto_apply`])}).optional(),conversationMode:d([`new_session`,`continuous`]).optional(),delivery:f({notificationPolicy:d([`attention`,`all`,`none`]),destinations:l(O)}),reliability:f({executionTimeoutSeconds:o().positive().optional(),retryCount:o().int().nonnegative().optional(),maxConcurrentRuns:o().int().positive().optional(),disableAfterConsecutiveFailures:o().int().positive().optional()}).optional(),management:f({owner:c(),editable:l(d([`enabled`,`trigger`])),runnable:a(),deletable:a()}).optional(),state:f({nextRunAtMs:o().optional(),runningRunId:c().optional(),lastRunAtMs:o().optional(),lastRunStatus:D.optional(),lastError:c().optional(),consecutiveFailures:o().int().nonnegative().optional()}),createdAtMs:o(),updatedAtMs:o()}),A=f({id:c(),automationId:c(),automationName:c(),status:D,triggerSnapshot:T,actionSnapshot:E,manual:a(),createdAtMs:o(),startedAtMs:o().optional(),endedAtMs:o().optional(),durationMs:o().optional(),summary:c().optional(),error:c().optional(),conversationId:c().optional(),workflowRunId:c().optional(),model:c().optional(),deadlineAtMs:o().optional(),currentPhase:d([`queued`,`action`,`cancelling`,`completed`]).optional(),cancelRequestedAtMs:o().optional(),cancelConfirmedAtMs:o().optional(),termination:f({reason:d([`completed`,`failed`,`user_cancelled`,`deadline_exceeded`]),component:d([`automation`,`agent_turn`,`tool`,`mcp`,`process`]).optional(),componentName:c().optional(),cancellationConfirmed:a()}).optional(),heartbeatAtMs:o().optional(),leaseOwner:c().optional(),leaseExpiresAtMs:o().optional(),attemptNumber:o().int().positive().optional(),rootRunId:c().optional()}),j=f({id:c(),runId:c(),automationId:c(),type:d([`run.queued`,`run.started`,`run.deadline_resolved`,`run.cancel_requested`,`run.cancel_confirmed`,`run.cancellation_unconfirmed`,`run.recovered`,`action.started`,`action.retry_scheduled`,`action.completed`,`action.failed`,`run.completed`]),message:c(),data:i().optional(),createdAtMs:o()}),M=f({totalAutomations:o().int().nonnegative(),enabledAutomations:o().int().nonnegative(),runningRuns:o().int().nonnegative(),failedLastHour:o().int().nonnegative(),nextRun:f({automationId:c(),name:c(),runAtMs:o()}).optional(),pendingEvents:o().int().nonnegative(),oldestPendingEventAgeMs:o().int().nonnegative(),projectionDeadLetters:o().int().nonnegative(),pendingRunDeliveries:o().int().nonnegative(),runDeliveryDeadLetters:o().int().nonnegative(),pendingResultDeliveries:o().int().nonnegative(),resultDeliveryDeadLetters:o().int().nonnegative(),activeExecutions:o().int().nonnegative(),activeDeliveryLeases:o().int().nonnegative()}),N=c().trim().min(1).max(200),P=l(N).max(100).refine(e=>new Set(e).size===e.length,`Duplicate identifiers`),Se=[`no_change`,`observation`,`artifact`,`decision`,`state_change`,`effect_proposal`,`receipt`],F=[`needs_setup`,`active`,`paused`,`completed`,`archived`],Ce=e(`kind`,[r({kind:u(`personal`)}),r({kind:u(`project`),id:N}),r({kind:u(`conversation`),id:N}),r({kind:u(`objects`),ids:P.refine(e=>e.length>0)})]),we=r({timeoutSeconds:o().int().min(1).max(600),maxIterations:o().int().min(1).max(30),maxToolCalls:o().int().min(0).max(100),maxOutputTokens:o().int().min(1).max(32768)}),I=r({kind:c().regex(/^[a-z][a-z0-9_-]{0,63}$/),instruction:c().trim().min(1).max(32e3),limits:we}),L=r({schemaVersion:u(1),key:c().regex(/^[a-z][a-z0-9-]{0,79}$/),version:c().regex(/^\d+\.\d+\.\d+$/),title:c().trim().min(1).max(120),description:c().trim().min(1).max(2e3),goalMode:d([`finite`,`ongoing`]),contextProviders:P,triggers:l(e(`type`,[r({id:N,type:u(`manual`)}),r({id:N,type:u(`event`),eventType:N}),r({id:N,type:u(`schedule`)})])).min(1).max(20).refine(e=>new Set(e.map(e=>e.id)).size===e.length,`Duplicate trigger IDs`),execution:I,allowedOutcomeKinds:l(d(Se)).min(1),allowedEffectHandlers:P}),Te=r({accountIds:P,contextProviders:P,effectHandlers:P}),Ee=r({expectedRevision:o().int().nonnegative(),content:c().trim().max(32e3),validUntil:o().int().nonnegative().nullable().default(null)}),R=r({templateKey:N,templateVersion:N,goal:c().trim().min(1).max(12e3),scope:Ce,permissions:Te}),z=R.extend({id:N,ownerId:N,workspaceId:c().min(1),status:d(F),setupMissing:l(c()).optional(),revision:o().int().positive()}),De=R.pick({goal:!0,scope:!0,permissions:!0}).extend({expectedRevision:o().int().positive()}),Oe=r({expectedRevision:o().int().positive(),status:d(F)}),B=r({subjectId:N,accountId:N,dueAt:o().int().nonnegative()}),ke=r({expectedRevision:o().int().positive(),dueAt:o().int().nonnegative().optional(),status:d([`watching`,`paused`,`completed`]).optional()}).refine(e=>e.dueAt!==void 0||e.status!==void 0,`Work item update is empty`),V=B.extend({id:N,activationId:N,revision:o().int().positive(),status:d([`watching`,`paused`,`completed`])}),H=o().int().min(0).max(23),U=r({level:d([`quiet`,`balanced`,`active`]).default(`balanced`),timezone:c().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}}).default(`Asia/Shanghai`),quietStartHour:H.default(22),quietEndHour:H.default(8),dailyNotificationLimit:o().int().min(0).max(30).default(3),digestEnabled:a().default(!1),digestHour:H.default(18),digestMinute:o().int().min(0).max(59).default(0),preferredChannel:d([`in_app`,`browser`]).default(`browser`),suppressWhileViewing:a().default(!0),checksPaused:a().default(!1),checksPausedUntil:c().datetime({offset:!0}).nullable().default(null),notificationsMuted:a().default(!1)}),W=U.shape;r({expectedRevision:o().int().nonnegative(),level:W.level.removeDefault().optional(),timezone:W.timezone.removeDefault().optional(),quietStartHour:W.quietStartHour.removeDefault().optional(),quietEndHour:W.quietEndHour.removeDefault().optional(),dailyNotificationLimit:W.dailyNotificationLimit.removeDefault().optional(),digestEnabled:W.digestEnabled.removeDefault().optional(),digestHour:W.digestHour.removeDefault().optional(),digestMinute:W.digestMinute.removeDefault().optional(),preferredChannel:W.preferredChannel.removeDefault().optional(),suppressWhileViewing:W.suppressWhileViewing.removeDefault().optional(),checksPaused:W.checksPaused.removeDefault().optional(),checksPausedUntil:W.checksPausedUntil.removeDefault().optional(),notificationsMuted:W.notificationsMuted.removeDefault().optional()});var Ae=r({expectedRevision:o().int().nonnegative(),rating:d([`useful`,`not_useful`]),note:c().trim().max(2e3).optional()}),je=r({weekdays:l(o().int().min(0).max(6)).min(1).max(7).refine(e=>new Set(e).size===e.length,`Duplicate weekdays`),hour:o().int().min(0).max(23),minute:o().int().min(0).max(59),timeZone:c().trim().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid time zone`)});d([`http`,`agent`,`cli`,`automation`,`mcp`,`extension`]),d([`INVALID_INPUT`,`FORBIDDEN`,`NOT_FOUND`,`REVISION_CONFLICT`,`CONTRACT_CHANGED`,`APPROVAL_REQUIRED`,`IN_PROGRESS`,`UNAVAILABLE`,`OUTCOME_UNKNOWN`,`CANCELLED`,`INTERNAL`]);var Me=r({majorVersion:o().int().positive(),descriptorDigest:c().regex(/^[a-f0-9]{64}$/),input:s(),idempotencyKey:c().min(1).max(200).optional()}),Ne=f({triggerSummary:c(),actionSummary:c(),safetyNotes:l(c()),requiredConfirmations:l(c()),canRunNow:a(),runNowBlockedReason:c().optional()});r({agentId:c().trim().min(1).max(64).optional(),language:d([`en`,`zh`]).default(`en`)}),f({draftId:c(),explanation:c(),assumptions:l(c()),risks:l(c()),automation:t({name:c(),trigger:s(),action:s()}),simulation:Ne,repairAttempts:o().int().nonnegative()}),f({draftId:c(),patch:n(c(),s()),explanation:c(),expectedEffect:c(),risks:l(c()),requiresApproval:a(),repairAttempts:o().int().nonnegative()});var Pe=r({eventId:c().min(1),kind:d([`note`,`task`,`project`,`automation`,`scene`,`local_app`]),id:c().min(1),revision:o().int().nonnegative(),operation:d([`created`,`updated`,`deleted`]),operationId:c().optional()}),G=r({id:c().trim().min(1).max(512)}),K=r({limit:o().int().min(1).max(100).default(50),afterId:c().max(200).default(``)});f({activation:z}),Oe.extend({id:c().min(1).max(512)}),f({activation:z}),U.extend({revision:o().int().positive()}),Ae.extend({id:c().min(1).max(512)}),f({revision:o().int().positive()}),G.extend({read:a()}),f({ok:u(!0),presentationId:c(),read:a()}),G.extend({triggerKey:c().min(1).max(200),expectedRevision:o().int().nonnegative(),schedule:je}),f({revision:o().int().positive()}),De.extend({id:c().min(1).max(512)}),f({activation:z}),f({intentId:c()}),Ee.extend({id:c().min(1).max(512)}),f({revision:o().int().positive()}),B.extend({id:c().min(1).max(512)}),f({workItem:V}),ke.safeExtend({id:c().min(1).max(512)}),f({workItem:V});var q=t({id:c(),activationId:c(),outcomeId:c(),status:c(),content:s(),readOnly:a(),createdAt:o(),sources:l(f({kind:c(),title:c(),sender:c(),href:c()})),sourceHealth:n(c(),s()).nullable()});G.extend({expectedVersion:o().int().positive(),reason:c().trim().min(1).max(4096).default(`TaskRun cancelled`)}),G.extend({rating:d([`helpful`,`not_helpful`]),reason:c().trim().max(4096).optional()}),f({ok:u(!0),feedback:f({id:c(),runId:c(),rating:d([`helpful`,`not_helpful`]),reason:c().optional(),createdAt:o()})}),f({ok:u(!0),run:h,receipt:g,model:m.pick({task:!0,operationalState:!0,attention:!0,allowedCommands:!0}),executionStopConfirmed:u(!1)}),G.extend({enabled:a(),expectedRevision:o().int().nonnegative()}),f({ok:u(!0),automation:k.loose()}).extend({run:A.loose()}),f({ok:u(!0),cancelled:a(),confirmed:a()}),f({ok:u(!0),marked:u(!0)}),r({projectId:c().trim().min(1).max(512).optional()}),f({ok:u(!0),count:o().int().nonnegative()}),G.extend({reason:c().trim().min(1).max(2e3)}),r({runId:c().trim().min(1).max(200),destinationKey:c().trim().min(1).max(100),reason:c().trim().min(1).max(2e3)}),f({ok:u(!0),accepted:u(!0)}),G.extend({expectedRevision:o().int().nonnegative().nullable()}),f({ok:u(!0),removed:a(),automation:k.loose().optional(),cancelRunId:c().optional()});var Fe=r({status:d([`inbox`,`processed`,`archived`,`trashed`]).optional(),kind:d([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]).optional(),tag:c().max(512).optional(),projectId:c().min(1).max(512).optional(),unassigned:a().optional(),agentEdited:a().optional(),search:c().max(4096).optional(),pinned:a().optional(),limit:o().int().min(1).max(100).default(20),offset:o().int().min(0).default(0),sortBy:d([`createdAt`,`updatedAt`,`lastOpenedAt`]).optional(),sortOrder:d([`asc`,`desc`]).optional()}),J=t({id:c().min(1),markdown:c(),kind:d([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]),status:d([`inbox`,`processed`,`archived`,`trashed`]),createdAt:o(),updatedAt:o(),title:c().optional(),localVersion:o().optional()}),Ie=f({note:J});G.extend({expectedRevision:o().int().positive(),revokeShares:a().default(!0)}),f({deleted:u(!0),revokedShares:o().int().nonnegative()});var Le=r({title:c().max(1e3).optional(),markdown:c().max(2e6).default(``),kind:J.shape.kind.optional(),tags:l(c().max(512)).max(100).optional(),capturedVia:r({channel:d([`app`,`web`,`electron`,`tui`,`telegram`,`wechat`,`feishu`]),platform:d([`ios`,`android`,`harmonyos`]).optional()}).default({channel:`web`}),pinned:a().default(!1),projectId:c().min(1).optional()});r({id:c().min(1),expectedRevision:o().int().positive(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]).optional(),patch:r({title:c().max(1e3).optional(),markdown:c().max(2e6).optional(),tags:l(c().max(512)).max(100).optional(),pinned:a().optional(),kind:J.shape.kind.optional(),status:J.shape.status.optional(),localVersion:o().int().positive().optional(),ai:n(c(),s()).optional(),aiDeep:t({processedAt:o()}).optional()})}),r({text:c().trim().min(1).max(2e6),capturedVia:Le.shape.capturedVia}),r({id:c().min(1),expectedRevision:o().int().positive().optional(),content:c().trim().min(1).max(2e6),heading:c().trim().min(1).max(1e3).default(`AI 讨论沉淀`)}),r({id:c().min(1),timestamp:o().int().positive(),expectedRevision:o().int().positive()});var Re=t({items:l(t({id:c().min(1)})),total:o().int().nonnegative()}),ze=r({phase:ae.optional(),priority:oe.optional(),projectId:c().min(1).max(512).optional(),search:c().max(4096).optional(),limit:o().int().min(1).max(200).default(50),offset:o().int().nonnegative().default(0)}),Y=t({id:c().min(1),name:c(),slug:c(),status:d([`planned`,`active`,`paused`,`completed`,`cancelled`,`archived`]),executionMode:d([`local_checkout`,`managed_worktree`]),successCriteria:l(c()),scope:n(c(),i()),nonGoals:l(c()),health:d([`unknown`,`on_track`,`at_risk`,`off_track`]),version:o().int().positive(),createdAt:o(),updatedAt:o(),workspaceRoot:c().optional(),defaultAgentId:c().optional()}),Be=r({id:c().trim().min(1),expectedVersion:o().int().positive(),pinned:a()});f({ok:u(!0),project:Y}),r({workspacePath:c().trim().min(1).max(4096),agentId:c().trim().min(1).max(512).optional(),defaultAgentId:c().trim().max(512).optional(),projectKind:d([`auto`,`coding`,`general`,`unknown`]).optional(),autoCreate:a().default(!1),conversationId:ne().optional()}),f({ok:u(!0),project:Y.nullable(),reason:d([`exact`,`contained`,`auto_created`]).optional(),created:a().optional()}),Be.omit({pinned:!0}),f({ok:u(!0),deleted:u(!0),executionStopConfirmed:u(!1)});var X={name:c().trim().min(1).max(1e3).optional(),description:c().max(2e4).optional(),defaultAgentId:c().trim().max(512).optional(),workspaceRoot:c().trim().min(1).max(4096).optional(),createWorkspaceRoot:a().optional(),executionMode:Y.shape.executionMode.optional(),brief:c().max(2e4).optional(),instructions:c().max(1e5).optional(),outcome:c().max(2e4).optional(),successCriteria:l(c().max(4096)).max(100).optional(),scope:n(c(),s()).optional(),nonGoals:l(c().max(4096)).max(100).optional(),health:Y.shape.health.optional(),ownerId:c().max(512).optional(),targetAt:o().finite().optional()};r({...X,projectKind:d([`auto`,`coding`,`general`,`unknown`]).optional(),autoUnderstand:a().default(!1)}).refine(e=>!!(e.name||e.workspaceRoot),`name or workspaceRoot is required`),r({id:c().trim().min(1),expectedVersion:o().int().positive(),patch:r({...X,status:Y.shape.status.optional(),description:X.description.unwrap().nullable().optional(),defaultAgentId:X.defaultAgentId.unwrap().nullable().optional(),workspaceRoot:c().trim().max(4096).nullable().optional(),brief:X.brief.unwrap().nullable().optional(),instructions:X.instructions.unwrap().nullable().optional(),outcome:X.outcome.unwrap().nullable().optional(),ownerId:X.ownerId.unwrap().nullable().optional(),targetAt:X.targetAt.unwrap().nullable().optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),`Empty project patch`)});var Ve=r({status:Y.shape.status.optional(),search:c().max(4096).optional(),sortBy:d([`updatedAt`,`createdAt`,`name`]).optional(),sortOrder:d([`asc`,`desc`]).optional(),limit:o().int().min(1).max(500).default(50),offset:o().int().nonnegative().default(0)}),Z=t({id:c(),projectId:c(),title:c(),status:d([`planned`,`active`,`completed`,`cancelled`]),sortOrder:o(),createdAt:o(),updatedAt:o()}),Q=t({id:c(),projectId:c(),summary:c(),health:Y.shape.health,createdAt:o()}),$={title:c().trim().min(1).max(1e3),description:c().max(2e4).optional(),status:Z.shape.status.optional(),targetAt:o().int().nonnegative().optional(),sortOrder:o().int().optional()};r({projectId:c().trim().min(1),...$}),r({projectId:c().trim().min(1),id:c().trim().min(1),expectedRevision:o().int().nonnegative(),patch:r({...$,description:c().max(2e4).nullable().optional(),targetAt:o().int().nonnegative().nullable().optional()}).partial().refine(e=>Object.values(e).some(e=>e!==void 0),`Empty milestone patch`)}).omit({patch:!0}),f({ok:u(!0),milestone:Z,project:Y}),f({ok:u(!0),deleted:u(!0)}),r({projectId:c().trim().min(1),expectedVersion:o().int().positive(),health:Y.shape.health,summary:c().trim().min(1).max(2e4),progress:l(c().max(1e4)).max(100).default([]),risks:l(c().max(1e4)).max(100).default([]),nextSteps:l(c().max(1e4)).max(100).default([])}),f({ok:u(!0),update:Q,project:Y});var He={"xopc.context.resolve":{input:b,output:y},"xopc.notes.preview_edit":{input:G.extend({instruction:c().trim().min(1).max(16e3),markdown:c().max(2e6).optional(),context:t({type:d([`selection`,`section`,`block`,`note`]),range:r({start:o().int().nonnegative(),end:o().int().nonnegative()})}).optional()}),output:f({message:c(),patch:f({id:c(),summary:c(),operations:l(f({type:u(`replaceRange`),from:o().int().nonnegative(),to:o().int().nonnegative(),markdown:c()}))})})},"xopc.automations.get_run":{input:G,output:f({ok:u(!0),run:A.loose()})},"xopc.automations.run_events":{input:G,output:f({ok:u(!0),events:l(j.loose())})},"xopc.automations.metrics":{input:r({}),output:f({ok:u(!0),metrics:M})},"xopc.automations.events":{input:r({type:c().trim().min(1).max(512).optional(),source:c().trim().min(1).max(512).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(f({event:f({id:c(),type:c(),schemaVersion:o().int(),source:c(),subject:f({kind:c(),id:c()}).optional(),payload:n(c(),i()),occurredAtMs:o(),ingestedAtMs:o(),correlationId:c(),causationId:c().optional(),rootEventId:c(),chainDepth:o().int(),dedupeKey:c().optional(),trust:d([`system`,`user`,`connector`,`untrusted_webhook`])}),projectionStatus:d([`pending`,`projecting`,`retrying`,`projected`,`dead_letter`]),projectionAttempts:o().int(),projectionError:c().optional(),deliveries:l(f({automationId:c(),status:d([`pending`,`retrying`,`queued`,`completed`,`failed`,`cancelled`,`skipped`,`dead_letter`]),runId:c().optional(),attempts:o().int(),lastError:c().optional()}))}))})},"xopc.automations.deliveries":{input:r({runId:c().trim().min(1).max(200).optional(),status:d([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(f({runId:c(),destinationKey:c(),kind:c(),status:d([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]),attempts:o().int(),nextAttemptAtMs:o(),lastError:c().optional(),createdAtMs:o(),updatedAtMs:o()}))})},"xopc.automations.product_events":{input:r({eventType:c().trim().min(1).max(512),source:c().trim().min(1).max(512).optional(),payloadKey:c().trim().min(1).max(512).optional(),payloadValue:c().max(4096).optional(),limit:o().int().min(1).max(100).default(10)}).refine(e=>e.payloadKey===void 0==(e.payloadValue===void 0),`payloadKey and payloadValue must be supplied together`),output:f({ok:u(!0),items:l(f({run:A.loose(),triggerEvent:j.loose()}))})},"xopc.automations.list":{input:r({projectId:c().trim().min(1).optional()}),output:f({ok:u(!0),items:l(k.loose()),projectId:c().optional()})},"xopc.automations.get":{input:G,output:f({ok:u(!0),automation:k.loose()})},"xopc.automations.history":{input:r({automationId:c().trim().min(1).optional(),projectId:c().trim().min(1).optional(),limit:o().int().min(1).max(200).default(50)}),output:f({ok:u(!0),items:l(A.loose()),projectId:c().optional()})},"xopc.scenes.templates":{input:r({}),output:f({templates:l(L)})},"xopc.scenes.mail_accounts":{input:r({}),output:f({accounts:l(f({id:c(),label:c()}))})},"xopc.scenes.mail_sources":{input:K,output:f({sources:l(f({id:c(),accountId:c(),subject:c(),sender:c()})),nextCursor:c().nullable()})},"xopc.scenes.results":{input:K.extend({activationId:c().min(1).max(200).optional()}),output:f({outcomes:l(q),nextCursor:c().nullable()})},"xopc.scenes.get_presentation":{input:G,output:f({outcome:q})},"xopc.scenes.get_feedback":{input:G,output:f({feedback:f({rating:d([`useful`,`not_useful`]),note:c(),revision:o().int().nonnegative()}).nullable()})},"xopc.scenes.digest_results":{input:K.extend({id:c().min(1).max(512)}),output:f({outcomes:l(q),nextCursor:c().nullable()})},"xopc.scenes.metrics":{input:r({days:o().int().min(1).max(90).default(7)}),output:f({window:f({since:o(),until:o(),days:o().int()}),ratedOutcomes:o().int().nonnegative(),usefulOutcomes:o().int().nonnegative(),unhelpfulOutcomes:o().int().nonnegative(),scenesWithUsefulOutcomes:o().int().nonnegative(),checks:o().int().nonnegative(),failedChecks:o().int().nonnegative(),skippedChecks:o().int().nonnegative()})},"xopc.scenes.diagnostics":{input:r({}),output:f({checksPaused:a(),currentModel:c().nullable(),pendingChecks:o().int().nonnegative(),oldestDueWaitMs:o().nonnegative(),notifications:l(f({status:c(),count:o().int().nonnegative()})),activations:l(n(c(),s()))})},"xopc.scenes.get_preferences":{input:r({}),output:U.extend({revision:o().int().nonnegative()})},"xopc.scenes.preflight":{input:R,output:f({ready:a(),missing:l(c())})},"xopc.scenes.get_template":{input:r({key:c().min(1).max(200),version:c().min(1).max(200)}),output:f({template:L})},"xopc.scenes.list":{input:K,output:f({activations:l(z),nextCursor:c().nullable()})},"xopc.scenes.get":{input:G,output:f({activation:z,runs:l(t({id:c(),status:c(),attempt:o().int(),reason:c().nullable(),createdAt:o()})),schedules:l(t({triggerKey:c(),revision:o().int(),nextDueAt:o(),schedule:s()}))})},"xopc.scenes.read_notes":{input:G,output:f({notes:f({content:c(),revision:o().int().nonnegative(),validUntil:o().nullable()})})},"xopc.scenes.list_runs":{input:K.extend({id:c().min(1).max(512)}),output:f({runs:l(t({id:c(),activationId:c(),status:c(),attempt:o().int(),reason:c().nullable(),createdAt:o()})),nextCursor:c().nullable()})},"xopc.scenes.list_schedules":{input:G,output:f({schedules:l(t({triggerKey:c(),revision:o().int(),nextDueAt:o(),schedule:s()}))})},"xopc.scenes.list_work_items":{input:K.extend({id:c().min(1).max(512)}),output:f({workItems:l(t({id:c(),subjectId:c(),accountId:c(),dueAt:o(),status:c(),revision:o().int(),lastCheckReason:c().nullable()})),nextCursor:c().nullable()})},"xopc.settings.open":{input:r({section:c().trim().regex(/^[a-z0-9][a-z0-9/_-]*$/i).max(512).default(`overview`),title:c().trim().min(1).max(512).default(`Settings`),summary:c().trim().max(4096).optional()}),output:f({ok:u(!0),settings:f({section:c(),title:c(),summary:c().optional()})})},"xopc.local_apps.list":{input:r({}),output:f({apps:l(se)})},"xopc.local_apps.get":{input:G,output:f({app:ce})},"xopc.local_apps.validate":{input:G,output:f({validation:v})},"xopc.projects.get":{input:G,output:f({ok:u(!0),project:Y})},"xopc.projects.list":{input:Ve,output:t({ok:u(!0),items:l(Y),total:o().int().nonnegative()})},"xopc.projects.list_milestones":{input:G,output:f({ok:u(!0),projectId:c(),items:l(Z)})},"xopc.projects.list_updates":{input:G.extend({limit:o().int().min(1).max(500).default(20)}),output:f({ok:u(!0),projectId:c(),items:l(Q)})},"xopc.task_runs.get":{input:G,output:f({ok:u(!0),run:h,receipt:g.optional(),events:l(ie),activeWaits:l(_)})},"xopc.task_runs.list":{input:r({taskId:c().trim().min(1),limit:o().int().min(1).max(200).default(20)}),output:f({ok:u(!0),taskId:c(),items:l(h),receipts:l(g),activeWaits:l(_)})},"xopc.notes.project_summaries":{input:r({}),output:f({items:l(f({id:c(),name:c(),description:c().optional(),noteCount:o().int().nonnegative(),updatedAt:o().optional()}))})},"xopc.notes.history":{input:G,output:f({entries:l(f({timestamp:o().int().nonnegative(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]),snippet:c().optional()}))})},"xopc.notes.snapshot":{input:G.extend({timestamp:o().int().nonnegative()}),output:f({snapshot:f({noteId:c(),timestamp:o().int().nonnegative(),trigger:d([`edit`,`ai_edit`,`sync`,`restore`]),title:c().optional(),markdown:c(),tags:l(c()).optional(),kind:J.shape.kind,status:J.shape.status})})},"xopc.notes.get":{input:G,output:Ie},"xopc.notes.list":{input:Fe,output:Re},"xopc.tasks.metrics":{input:r({}),output:f({ok:u(!0),metrics:ye})},"xopc.tasks.get":{input:G,output:m},"xopc.tasks.list":{input:ze,output:re.extend({total:o().int().nonnegative()})}};export{ge as a,_e as i,He as n,be as o,Pe as r,Me as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-CJIhQfG2.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DxydK_AA.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-pmT2B_By.js","assets/messages-Ib6DaUTo.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-CZlvyzow.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-4gpFbdsr.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-ByJbFign.css","assets/copy-text-row-C7egVuKr.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/button-aIC072nz.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/chevron-left-DqFhpbvK.js","assets/chevron-right-BweFrslA.js","assets/popover-select-DHC7J4lG.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-BxWHx6J6.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-hTgxke6e.js","assets/use-file-preview-expanded-tMUDUWVH.js","assets/folder-open-CyzJ19I9.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-D2J6VacQ.js","assets/gateway-startup-retry-90pvxKox.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-C01xjDt2.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-D2oKh5ik.js","assets/mic-CuUb7zc-.js","assets/share-link-dialog-BnqkFFBZ.js","assets/globe-DSSGFWFn.js","assets/capabilities-Bf6NYuvT.js","assets/local-session-drafts-CrD74S6k.js","assets/tasks-DwKXgZ-I.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-cGtd3rjc.js","assets/capabilities-BOJYAeEJ.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-D-VLGhjV.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/session-manager-64DD1cxN.js","assets/gateway-realtime-BGhPOSfz.js","assets/gateway-realtime-store-BYe-jWB1.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-Bi4muyaZ.js","assets/agents-admin-api-D-DNV0ms.js","assets/gateway-config-swr-f-4qw3AG.js","assets/extension-provider-Dnz8j6Q_.js","assets/send-session-input-BtF5UWGp.js","assets/theme-store-D7m5Eng5.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-3slk24cw.js","assets/skill-api-utils-C7V4JVXM.js","assets/date-formatters-CUZAyDEg.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-_xgO2IDa.css","assets/page-tabs-BLGO2VIm.js","assets/capability-header-actions-DG-feQV0.js","assets/capability-icon-DVoZxEgW.js","assets/skill-api-C9AYuE_b.js","assets/skill-reload-api-VT8F0enn.js","assets/connectors-page-DXhBTvqp.js","assets/number-input-DDeqHK-G.js","assets/connector-service-page-P6yEnQ6H.js","assets/agent-plugin-dialog-C7z3r3Z3.js","assets/apps-page-CwWCU5Ib.js","assets/agents-BstMN5nH.js","assets/directory-picker-path-field-Dm7jp0Y9.js","assets/fallback-models-DirZnl7x.js","assets/image-generation-api-CtDjTXwX.js","assets/settings-page-layout-Dx5S-Msc.js","assets/channels-Bl6g4Dg9.js","assets/browser-BLJWD7WI.js","assets/schema-form-BND8Hs4C.js","assets/settings-loading-skeleton-BTqvr_Fw.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
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"./preload-helper-zJ_50EbN.js";import{m as a,r as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./messages-Ib6DaUTo.js";import{n as c}from"./locale-store-pmT2B_By.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{lo as u,ta as d}from"./index-DxydK_AA.js";import{t as f}from"./capability-header-actions-DG-feQV0.js";var p=n(),m=e(t(),1),h=r(),g=(0,m.lazy)(()=>i(()=>import(`./skills-page-CJIhQfG2.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114]))),_=(0,m.lazy)(()=>i(()=>import(`./connectors-page-DXhBTvqp.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([115,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,116,110,111,117,118]))),v=(0,m.lazy)(()=>i(()=>import(`./apps-page-CwWCU5Ib.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([119,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,118]))),y=(0,m.lazy)(()=>i(()=>import(`./agents-BstMN5nH.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([120,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,116,121,122,123,124]))),b=(0,m.lazy)(()=>i(()=>import(`./channels-Bl6g4Dg9.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([125,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,126,127,116,128,124])));function x(e){return u.includes(e)?e:null}function S(e){let t=(0,p.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},C),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,h.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function C(e,t){return(0,h.jsx)(l,{className:`h-40 rounded-xl`},t)}function w(){let e=(0,p.c)(41),t=c(D),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:u}=a(),C;e[2]===l?C=e[3]:(C=x(l),e[2]=l,e[3]=C);let w=C,O=w??`skills`,k=r.productNavigation.sections[`capabilities-${O}`],A=d(E),j=d(T),M;e[4]===O?M=e[5]:(M={section:O,value:null},e[4]=O,e[5]=M);let[N,P]=(0,m.useState)(M),F=N.section===O?N.value:null,I;e[6]===O?I=e[7]:(I=e=>{P({section:O,value:e})},e[6]=O,e[7]=I);let L=I,R,z;if(e[8]!==j||e[9]!==F||e[10]!==k||e[11]!==A?(R=()=>(A({startExtra:null,main:(0,h.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k}),end:(0,h.jsx)(f,{contribution:F})}),()=>j()),z=[j,F,k,A],e[8]=j,e[9]=F,e[10]=k,e[11]=A,e[12]=R,e[13]=z):(R=e[12],z=e[13]),(0,m.useLayoutEffect)(R,z),!w){let t;return e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsx)(o,{to:`/capabilities/skills`,replace:!0}),e[14]=t):t=e[14],t}let B;e[15]===i.discoverLoading?B=e[16]:(B=(0,h.jsx)(S,{label:i.discoverLoading}),e[15]=i.discoverLoading,e[16]=B);let V;e[17]!==u||e[18]!==L||e[19]!==O?(V=O===`agents`?(0,h.jsx)(y,{agentId:u,onHeaderActionChange:L}):null,e[17]=u,e[18]=L,e[19]=O,e[20]=V):V=e[20];let H;e[21]!==L||e[22]!==O?(H=O===`skills`?(0,h.jsx)(g,{embedded:!0,onHeaderActionChange:L}):null,e[21]=L,e[22]=O,e[23]=H):H=e[23];let U;e[24]!==L||e[25]!==O?(U=O===`connectors`?(0,h.jsx)(_,{embedded:!0,onHeaderActionChange:L}):null,e[24]=L,e[25]=O,e[26]=U):U=e[26];let W;e[27]!==u||e[28]!==L||e[29]!==O?(W=O===`channels`?(0,h.jsx)(b,{channelId:u,onHeaderActionChange:L}):null,e[27]=u,e[28]=L,e[29]=O,e[30]=W):W=e[30];let G;e[31]!==L||e[32]!==O?(G=O===`extensions`?(0,h.jsx)(v,{embedded:!0,onHeaderActionChange:L}):null,e[31]=L,e[32]=O,e[33]=G):G=e[33];let K;return e[34]!==W||e[35]!==G||e[36]!==B||e[37]!==V||e[38]!==H||e[39]!==U?(K=(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,h.jsxs)(m.Suspense,{fallback:B,children:[V,H,U,W,G]})}),e[34]=W,e[35]=G,e[36]=B,e[37]=V,e[38]=H,e[39]=U,e[40]=K):K=e[40],K}function T(e){return e.clearPageHeader}function E(e){return e.setPageHeader}function D(e){return e.language}export{w as CapabilitiesPage};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
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"./preload-helper-zJ_50EbN.js";import{f as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as u}from"./chevron-right-BweFrslA.js";import{n as d,r as f,t as p}from"./popover-select-DHC7J4lG.js";import{t as m}from"./circle-check-C23XjkUj.js";import{t as h}from"./circle-dashed-8qMD7gHf.js";import{t as g}from"./cloud-C4-yfnnk.js";import{t as _}from"./external-link-DjqjBmc3.js";import{t as v}from"./secret-input-BxWHx6J6.js";import{t as y}from"./eye-CABVeTq0.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./mic-CuUb7zc-.js";import{t as S}from"./pencil-DmIY3Oa-.js";import{t as C}from"./play-kxZvpBg8.js";import{t as w}from"./plus-Q2yW6OE7.js";import{t as T}from"./settings-2-D-csvaET.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./messages-Ib6DaUTo.js";import{t as O}from"./cn-0WouolD0.js";import{a as k,c as A,i as j,n as M,r as N}from"./locale-store-pmT2B_By.js";import{a as P,i as F,n as I,o as L,r as R,s as ee,t as z}from"./dist-BGTk37IG.js";import{i as B}from"./vendor-swr-BIWyz7Rc.js";import{t as V}from"./button-aIC072nz.js";import{n as H,t as te}from"./interaction-BdhHBbYa.js";import{n as U,r as W}from"./gateway-config-swr-f-4qw3AG.js";import{a as G,o as K,s as ne}from"./form-field-width-DJw_jULe.js";import{n as re}from"./is-masked-secret-DOkL5b_X.js";import{t as q}from"./skeleton-BI5TyibZ.js";import{i as ie,o as J}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as Y}from"./electron-env-Dit0bHgy.js";import{n as ae,t as oe}from"./settings-form-draft-Dy10ldo8.js";import{i as X,r as Z,t as se}from"./models-hub-cache-3slk24cw.js";import{At as ce,Bs as le,Bt as ue,Cs as de,Ct as fe,Dt as pe,Et as me,Ft as he,Gc as ge,Ht as _e,It as ve,Lt as ye,Mt as be,No as xe,On as Se,Ot as Ce,Pt as we,Ro as Te,Rt as Ee,So as De,St as Oe,Tt as ke,Ut as Ae,Vo as je,W as Me,Wc as Ne,Ws as Pe,Wt as Fe,Yo as Ie,Zr as Le,_a as Re,_t as ze,ba as Be,bt as Ve,ca as He,da as Ue,do as We,ga as Ge,gt as Ke,ha as qe,ia as Je,jt as Ye,kt as Xe,ma as Ze,na as Qe,ns as $e,po as et,ra as tt,sa as nt,ui as rt,va as it,vt as at,wt as ot,xa as st,xo as ct,xt as lt,ya as ut,yt as dt,zt as ft}from"./index-DxydK_AA.js";import{t as pt}from"./page-tabs-BLGO2VIm.js";import{t as mt}from"./number-input-DDeqHK-G.js";import{n as ht,r as gt}from"./settings-page-layout-Dx5S-Msc.js";import{n as _t,t as vt}from"./settings-form-section-num14vSv.js";import{t as yt}from"./settings-loading-skeleton-BTqvr_Fw.js";import{n as bt,t as xt}from"./use-autosave-jrZBPSWn.js";import{c as St,d as Ct,i as wt,l as Tt,n as Et,o as Dt,r as Ot,s as kt,t as At}from"./voice-config-api-415pyWx8.js";import{t as jt}from"./voice-api-key-field-Bp8brswu.js";import{a as Mt,i as Nt,n as Pt,o as Ft,r as It,t as Lt}from"./image-generation-api-CtDjTXwX.js";import{t as Rt}from"./xopc-cloud-account-card-Cspd770Z.js";var zt=n(),Q=e(t(),1),$=r(),Bt={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},Vt=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function Ht(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function Ut(e){let t=e.split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`:`);if(t<=0||!e.slice(t+1).trim())throw Error(`invalid_headers`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]});return Object.fromEntries(n)}function Wt({open:e,onOpenChange:t,provider:n,configured:r,language:i,onSaved:a}){let o=Bt[i],[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`bearer`),[g,_]=(0,Q.useState)(`x-api-key`),[x,S]=(0,Q.useState)(``),[C,T]=(0,Q.useState)(``),[D,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(`/images/generations`),[M,N]=(0,Q.useState)(`/images/edits`),[B,H]=(0,Q.useState)(``),[te,U]=(0,Q.useState)(``),[W,G]=(0,Q.useState)([Ht()]),[K,ne]=(0,Q.useState)(``),[q,Y]=(0,Q.useState)(),[ae,oe]=(0,Q.useState)(!1),[X,Z]=(0,Q.useState)(),[se,ce]=(0,Q.useState)(),[le,ue]=(0,Q.useState)();(0,Q.useEffect)(()=>{if(!e)return;let t=n?.imageGeneration;c(n?.providerId??``),u(t?.name??``),f(n?.baseUrl??``),h(t?.auth.type??`bearer`),_(t?.auth.type===`header`?t.auth.headerName:`x-api-key`),S(r?`••••••••••••`:``),T(t?.apiKeyUrl??``),k(t?.documentationUrl??``),j(t?.paths?.generations??`/images/generations`),N(t?.paths?.edits??`/images/edits`),H(t?.network?.allowedHosts.join(`
|
|
4
|
+
`)??``),U(Object.entries(n?.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
|
|
5
|
+
`)),G(t?.models.map(Ht)??[Ht()]),ne(t?.defaultModel??``),ce(void 0),Y(void 0),oe(!1),Z(void 0),ue(void 0)},[r,e,n]);let de=(0,Q.useMemo)(()=>W.filter(e=>e.id.trim()).map(e=>({value:e.id.trim(),label:e.name.trim()||e.id.trim()})),[W]),fe=(e,t)=>{G(n=>n.map((n,r)=>r===e?{...n,...t}:n))},pe=()=>{let e=s.trim(),t=W.map(e=>({...e,id:e.id.trim(),name:e.name.trim()}));if(!e||!l.trim()||!d.trim()||t.some(e=>!e.id))throw Error(o.required);if(new Set(t.map(e=>e.id)).size!==t.length)throw Error(o.duplicateModels);let n=K||t[0]?.id;if(!n||!t.some(e=>e.id===n))throw Error(o.required);let r;try{r=Ut(te)}catch{throw Error(o.invalidHeaders)}return{providerId:e,input:{baseUrl:d.trim(),...r?{headers:r}:{},imageGeneration:{api:`openai-images`,name:l.trim(),...D.trim()?{documentationUrl:D.trim()}:{},...C.trim()?{apiKeyUrl:C.trim()}:{},defaultModel:n,auth:m===`header`?{type:`header`,headerName:g.trim()}:{type:m},paths:{...A.trim()?{generations:A.trim()}:{},...M.trim()?{edits:M.trim()}:{}},...B.trim()?{network:{allowedHosts:B.split(`
|
|
6
|
+
`).map(e=>e.trim()).filter(Boolean)}}:{},models:t.map(e=>({...e.original,id:e.id,...e.name?{name:e.name}:{name:void 0},capabilities:{...e.original.capabilities,generate:{...e.original.capabilities.generate,maxCount:Math.max(1,Number.parseInt(e.maxCount,10)||1),supportsSize:e.supportsSize},edit:{...e.original.capabilities.edit,enabled:e.editEnabled}},defaults:{...e.original.defaults,...e.defaultCount?{count:Math.max(1,Number.parseInt(e.defaultCount,10)||1)}:{count:void 0},...e.defaultSize.trim()?{size:e.defaultSize.trim()}:{size:void 0},...e.outputFormat?{outputFormat:e.outputFormat}:{outputFormat:void 0}}}))}}}},me=async()=>{let e=pe();return await Nt(e.providerId,e.input),m!==`none`&&x.trim()&&!re(x)&&await Mt(e.providerId,x.trim()),await a(e.providerId),e},he=async()=>{Y(`save`),Z(void 0),ce(void 0);try{await me(),S(m===`none`?``:`••••••••••••`),ce(o.saved)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(void 0)}},ge=async()=>{Y(`test`),Z(void 0),ce(void 0),ue(void 0);try{let e=await me();ue((await Ft(e.providerId,e.input.imageGeneration.defaultModel)).images[0]?.dataUrl),ce(o.testReady)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(void 0)}},_e=async()=>{if(n){if(!ae){oe(!0);return}Y(`delete`),Z(void 0);try{await Lt(n.providerId),await a(),t(!1)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(void 0)}}};return(0,$.jsx)(z,{open:e,onOpenChange:t,children:(0,$.jsxs)(L,{children:[(0,$.jsx)(P,{className:O(`xopc-dialog-overlay fixed inset-0 bg-scrim`,J)}),(0,$.jsxs)(R,{className:O(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(88vh,760px)] w-[min(calc(100%-2rem),52rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,ie),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(ee,{className:`font-semibold text-fg`,children:n?o.editTitle:o.addTitle}),(0,$.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:o.intro})]}),(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-muted hover:bg-surface-inset hover:text-fg`,"aria-label":o.cancel,children:(0,$.jsx)(E,{className:`size-5`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`section`,{className:`space-y-4`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:o.connection}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.providerId,(0,$.jsx)(`input`,{value:s,disabled:!!n,onChange:e=>c(e.target.value),placeholder:`my-image-service`,className:Vt}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:o.providerIdHint})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.name,(0,$.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`My Image Service`,className:Vt})]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[o.baseUrl,(0,$.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`https://api.example.com/v1`,className:Vt})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.auth,(0,$.jsx)(p,{value:m,options:[{value:`bearer`,label:o.bearer},{value:`header`,label:o.header},{value:`none`,label:o.none}],placeholder:o.auth,allowEmpty:!1,onChange:e=>h(e),triggerClassName:`mt-1.5`})]}),m===`header`?(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.headerName,(0,$.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:Vt})]}):null]}),m===`none`?null:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,$.jsx)(`label`,{htmlFor:`custom-image-api-key`,className:`text-xs font-medium text-fg-muted`,children:o.apiKey}),C.trim()?(0,$.jsxs)(`a`,{href:C.trim(),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[o.openKeyPage,(0,$.jsx)(Ne,{className:`size-3.5`})]}):null]}),(0,$.jsx)(v,{id:`custom-image-api-key`,value:x,onChange:e=>S(re(x)?e.replace(/^•+/,``):e),labels:{show:o.show,hide:o.hide,copy:o.copy,copied:o.copied},reveal:()=>Fe(s).then(e=>e.apiKey),loadFailedLabel:o.revealFailed,notInConfigFile:o.notRevealable}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:o.apiKeyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.apiKeyUrl,(0,$.jsx)(`input`,{value:C,onChange:e=>T(e.target.value),placeholder:`https://…`,className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.docsUrl,(0,$.jsx)(`input`,{value:D,onChange:e=>k(e.target.value),placeholder:`https://…`,className:Vt})]})]}),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:o.paths}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.generationsPath,(0,$.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.editsPath,(0,$.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),className:Vt})]})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[o.allowedHosts,(0,$.jsx)(`textarea`,{value:B,onChange:e=>H(e.target.value),rows:2,placeholder:`127.0.0.1
|
|
7
|
+
image-server.lan`,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:o.allowedHostsHint})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[o.staticHeaders,(0,$.jsx)(`textarea`,{value:te,onChange:e=>U(e.target.value),rows:3,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:o.staticHeadersHint})]})]})]}),(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:o.models}),(0,$.jsxs)(V,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:()=>G(e=>[...e,Ht()]),children:[(0,$.jsx)(w,{className:`size-4`}),o.addModel]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[o.defaultModel,(0,$.jsx)(p,{value:K||de[0]?.value||``,options:de,placeholder:o.defaultModel,allowEmpty:!1,onChange:ne,triggerClassName:`mt-1.5 max-w-sm`})]}),W.map((e,t)=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.modelId,(0,$.jsx)(`input`,{value:e.id,onChange:e=>fe(t,{id:e.target.value}),placeholder:`image-1`,className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.modelName,(0,$.jsx)(`input`,{value:e.name,onChange:e=>fe(t,{name:e.target.value}),className:Vt})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.maxCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.maxCount,onChange:e=>fe(t,{maxCount:e.target.value}),className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.defaultCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.defaultCount,onChange:e=>fe(t,{defaultCount:e.target.value}),className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.defaultSize,(0,$.jsx)(`input`,{value:e.defaultSize,onChange:e=>fe(t,{defaultSize:e.target.value}),placeholder:`1024x1024`,className:Vt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[o.format,(0,$.jsx)(p,{value:e.outputFormat,options:[{value:`png`,label:`PNG`},{value:`jpeg`,label:`JPEG`},{value:`webp`,label:`WebP`}],placeholder:o.format,allowEmpty:!0,onChange:e=>fe(t,{outputFormat:e}),triggerClassName:`mt-1.5`})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.supportsSize,onChange:e=>fe(t,{supportsSize:e.target.checked})}),o.supportsSize]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.editEnabled,onChange:e=>fe(t,{editEnabled:e.target.checked})}),o.edit]}),(0,$.jsxs)(`button`,{type:`button`,disabled:W.length===1,onClick:()=>G(e=>e.filter((e,n)=>n!==t)),className:`ml-auto inline-flex items-center gap-1 text-xs text-red-600 disabled:opacity-40 dark:text-red-400`,children:[(0,$.jsx)(De,{className:`size-3.5`}),o.remove]})]})]},t))]}),le?(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(y,{className:`size-4`}),o.testReady]}),(0,$.jsx)(`img`,{src:le,alt:`Generated provider test`,className:`max-h-72 rounded-lg object-contain`})]}):null,se?(0,$.jsx)(`p`,{className:`rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:se}):null,X?(0,$.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:X}):null]}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-edge px-5 py-3`,children:[n?(0,$.jsxs)(V,{variant:`secondary`,className:`border-red-500/30 text-red-600 hover:bg-red-500/10 dark:text-red-400`,disabled:!!q,onClick:()=>void _e(),children:[q===`delete`?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(De,{className:`size-4`}),ae?o.confirmDelete:o.delete]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(V,{variant:`secondary`,children:o.cancel})}),(0,$.jsxs)(V,{variant:`secondary`,disabled:!!q,onClick:()=>void ge(),children:[q===`test`?(0,$.jsx)(b,{className:`size-4 animate-spin`}):null,q===`test`?o.testing:o.test]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!!q,onClick:()=>void he(),children:[q===`save`?(0,$.jsx)(b,{className:`size-4 animate-spin`}):null,q===`save`?o.saving:o.save]})]})]})]})]})})}var Gt=`••••••••••••`,Kt={en:{title:`Image generation`,intro:`Configure the default image model and service. Agents inherit this setting unless overridden in Agent settings.`,provider:`Provider`,model:`Model`,apiKey:`API key`,getApiKey:`Get API key`,apiKeyHint:`Stored in the local credential store, never in xopc.json.`,existingKey:`A credential or environment variable is already available. Leave this blank to reuse it.`,savedKey:`A credential is saved. Use the eye button to view it, or type a new key to replace it.`,revealFailed:`Unable to load the saved API key.`,keyNotRevealable:`This credential comes from an environment variable or another non-revealable source.`,advanced:`Provider settings`,enable:`Enable image generation`,enabling:`Verifying and enabling…`,enabled:`Image generation is ready.`,addService:`Add image service`,manageService:`Manage service`,custom:`Custom`,current:`Current`,configured:`Credential ready`,needsKey:`API key required`,connect:`Connect to a gateway to continue.`,loadError:`Unable to load image generation settings.`,selectModel:`Select a model`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`},zh:{title:`图片生成`,intro:`配置全局图片生成模型和服务。各智能体默认继承此设置,也可在智能体详情中单独覆盖。`,provider:`Provider`,model:`模型`,apiKey:`API Key`,getApiKey:`获取 API Key`,apiKeyHint:`密钥只保存在本机凭据存储中,不会写入 xopc.json。`,existingKey:`已有凭据或环境变量;留空即可继续使用。`,savedKey:`凭据已保存。点击眼睛可查看,直接输入新密钥可替换。`,revealFailed:`无法读取已保存的 API Key。`,keyNotRevealable:`当前凭据来自环境变量或其他不可查看的来源。`,advanced:`服务商设置`,enable:`启用图片生成`,enabling:`正在验证并启用…`,enabled:`图片生成已可用。`,addService:`添加图片服务`,manageService:`管理服务`,custom:`自定义`,current:`当前使用`,configured:`凭据已就绪`,needsKey:`需要 API Key`,connect:`请先连接网关。`,loadError:`无法加载图片生成设置。`,selectModel:`选择模型`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`}};async function qt(){let e=await k(N(`/api/image-generation/default`));if(!e.payload)throw Error(`Invalid default image generation response`);return e.payload}function Jt(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(0,t):void 0}function Yt(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(t+1):void 0}function Xt(e){return Object.fromEntries(e.configFields.map(t=>[t.key,e.config[t.key]??(t.required?t.options?.[0]?.value??``:``)]))}function Zt(e){let t=(0,zt.c)(11),{field:n,value:r,onChange:i}=e,a;t[0]!==n.label||t[1]!==n.options||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==n.type||t[5]!==i||t[6]!==r?(a=n.type===`select`?(0,$.jsx)(p,{value:r,options:(n.options??[]).map(Qt),placeholder:n.placeholder??n.label,allowEmpty:!n.required,onChange:i,triggerClassName:`mt-1.5`}):(0,$.jsx)(`input`,{type:`url`,value:r,required:n.required,onChange:e=>i(e.target.value),placeholder:n.placeholder,className:`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),t[0]=n.label,t[1]=n.options,t[2]=n.placeholder,t[3]=n.required,t[4]=n.type,t[5]=i,t[6]=r,t[7]=a):a=t[7];let o;return t[8]!==n.label||t[9]!==a?(o=(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.label,a]}),t[8]=n.label,t[9]=a,t[10]=o):o=t[10],o}function Qt(e){return{value:e.value,label:e.label}}function $t(){let e=(0,zt.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(q,{className:`h-24 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:5}).map(en)}),(0,$.jsx)(q,{className:`h-64 rounded-xl`})]}),e[1]=n):n=e[1],n}function en(e,t){return(0,$.jsx)(q,{className:`h-24 rounded-xl`},t)}function tn(){let e=M(e=>e.language),t=Kt[e],n=!!A(e=>e.conversationId),[r,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)({}),[f,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(),[y,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(),{data:O,isLoading:j,error:P,mutate:F}=B(n?N(`/api/image-generation/catalog`):null,It,{revalidateOnFocus:!1}),{data:I,isLoading:L,error:R,mutate:ee}=B(n?N(`/api/image-generation/custom-providers`):null,Pt,{revalidateOnFocus:!1}),{data:z,isLoading:H,error:te,mutate:W}=B(n?`default-image-generation`:null,qt,{revalidateOnFocus:!1});(0,Q.useEffect)(()=>{if(!O||!z)return;let e=Jt(z.model?.primary),t=O.find(t=>t.id===e)??O.find(e=>e.configured)??O[0];t&&(a(t.id),s(t.id===e&&Yt(z.model?.primary)||t.defaultModel),l(t.configured?Gt:``),d(Xt(t)))},[z,O]);let G=O?.find(e=>e.id===r),K=G?G.apiKeyUrl??Ce(G.id,e)[0]?.href:void 0,ne=(0,Q.useMemo)(()=>(G?.models??[]).map(e=>({value:e,label:e})),[G?.models]),q=z?.model?.primary,ie=!!(G&&o&&(G.credentialMode!==`api-key`||G.configured||c.trim())&&G.configFields.every(e=>!e.required||u[e.key]?.trim()));if(!n)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connect});if(j||L||H)return(0,$.jsx)($t,{});if(P||R||te||!O||!I)return(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:t.loadError});let J=e=>{a(e.id),s(e.defaultModel),l(e.configured?Gt:``),d(Xt(e)),_(void 0)},Y=()=>{D(void 0),C(!0)},ae=()=>{let e=I.find(e=>e.providerId===G?.id);e&&(D(e),C(!0))},oe=async e=>{let[t,n]=await Promise.all([ee(),F()]);if(e&&n?.some(t=>t.id===e)){let r=n.find(t=>t.id===e);a(r.id),s(r.defaultModel),l(r.configured?Gt:``),d(Xt(r)),D(t?.find(t=>t.providerId===e))}},X=async()=>{if(!(!G||!ie)){h(!0),_(void 0),x(!1);try{let e=await k(N(`/api/image-generation/default/setup`),{method:`POST`,body:JSON.stringify({providerId:G.id,modelId:o,...c.trim()&&!re(c)?{apiKey:c.trim()}:{},providerConfig:Object.fromEntries(Object.entries(u).filter(([,e])=>e.trim()))})});if(!e.payload)throw Error(`Invalid setup response`);await Promise.all([W(e.payload.default,{revalidate:!1}),F(e.payload.providers,{revalidate:!1}),i(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2])).then(({mutate:e})=>Promise.all([e(`settings-agent-defaults`),e(`settings-gateway-agents`)])),U()]),l(Gt),x(!0)}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,$.jsx)(Pe,{className:`size-5`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:t.intro})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:t.provider}),(0,$.jsxs)(V,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:Y,children:[(0,$.jsx)(w,{className:`size-4`}),t.addService]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:O.map(e=>{let n=e.id===r,i=e.id===Jt(q);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>J(e),className:`min-h-24 rounded-xl p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${n?`bg-accent-soft shadow-surface`:`bg-surface-base/55 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),e.source===`custom`?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:t.custom}):null]}),(0,$.jsx)(`span`,{"aria-hidden":!i,className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent ${i?``:`invisible`}`,children:t.current})]}),(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-xs ${e.configured?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`}`,children:[e.configured||e.credentialMode!==`api-key`?(0,$.jsx)(m,{className:`size-3.5`}):(0,$.jsx)(le,{className:`size-3.5`}),e.configured||e.credentialMode!==`api-key`?t.configured:t.needsKey]})]},e.id)})})]}),G?(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[t.model,(0,$.jsx)(p,{value:o,options:ne,placeholder:t.selectModel,allowEmpty:!1,onChange:s,triggerClassName:`mt-1.5`})]}),G.configFields.filter(e=>e.required).map(e=>(0,$.jsx)(Zt,{field:e,value:u[e.key]??``,onChange:t=>d(n=>({...n,[e.key]:t}))},e.key))]}),G.source===`custom`?(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(V,{variant:`secondary`,onClick:ae,children:[(0,$.jsx)(T,{className:`size-4`}),t.manageService]})}):null,G.credentialMode===`api-key`?(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`label`,{htmlFor:`image-generation-api-key`,className:`text-xs font-medium text-fg-muted`,children:t.apiKey}),K?(0,$.jsxs)(`a`,{href:K,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,children:[t.getApiKey,(0,$.jsx)(Ne,{className:`size-3.5`,"aria-hidden":`true`})]}):null]}),(0,$.jsx)(v,{id:`image-generation-api-key`,value:c,onChange:e=>l(re(c)?e.replace(/^•+/,``):e),placeholder:G.configured?t.existingKey:t.needsKey,labels:{show:t.show,hide:t.hide,copy:t.copy,copied:t.copied},reveal:()=>Fe(G.id).then(e=>e.apiKey),loadFailedLabel:t.revealFailed,notInConfigFile:t.keyNotRevealable,className:`mt-1.5`,autoComplete:`new-password`},G.id),(0,$.jsx)(`span`,{className:`mt-1.5 block font-normal leading-relaxed text-fg-subtle`,children:G.configured?t.savedKey:t.apiKeyHint})]}):null,G.configFields.some(e=>!e.required)?(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 text-sm font-medium text-fg-muted`,children:[(0,$.jsx)(Te,{className:`size-4`}),t.advanced]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:G.configFields.filter(e=>!e.required).map(e=>(0,$.jsx)(Zt,{field:e,value:u[e.key]??``,onChange:t=>d(n=>({...n,[e.key]:t}))},e.key))})]}):null,y?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:t.enabled}):null,g?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:g}):null,(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(V,{variant:`primary`,disabled:!ie||f,onClick:()=>void X(),children:[f?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(m,{className:`size-4`}),(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:t.enable}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:t.enabling}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:f?t.enabling:t.enable})]})]})})]}):null,(0,$.jsx)(Wt,{open:S,onOpenChange:C,provider:E,configured:!!(E&&O.find(e=>e.id===E.providerId)?.configured),language:e,onSaved:oe})]})}function nn({disabled:e=!1,engine:t=`agent`}){let n=M(e=>e.language),r=n===`zh`,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),{data:c,mutate:l,error:u}=B(N(`/api/voice/catalog`),async e=>{let t=await k(e);return it.parse(t.payload)}),p=r?{transcription:`录音转文字`,"transcription.stream":`实时听写 / 语音助手输入`,speech:`消息朗读`,"speech.stream":`语音助手输出`,conversation:`自然语音对话`}:{transcription:`Recorded transcription`,"transcription.stream":`Live dictation / assistant input`,speech:`Message readout`,"speech.stream":`Assistant speech`,conversation:`Natural conversation`},m=async e=>{if(c){a(!0),s(``);try{let t=await k(N(e?`/api/voice/selection`:`/api/voice/catalog/refresh`),{method:e?`PUT`:`POST`,...e?{body:JSON.stringify({revision:c.revision,selection:e})}:{}});await l(it.parse(t.payload),!1),await U()}catch(e){s(e instanceof Error?e.message:String(e)),await l()}finally{a(!1)}}},h=t=>{let a=c.selections.find(e=>e.mode===t),o=c.models.filter(e=>e.voice.modes.includes(t)),s=o.find(e=>e.id===a?.model),l=s?.voice.voices.filter(e=>ut(e,t))??[],u=a?.voice??l.find(e=>e.id===s?.voice.defaultVoice)?.id??l[0]?.id??``;return(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:p[t]}),(0,$.jsxs)(d,{className:`w-full`,value:a?.model??``,disabled:i||e||!o.length,onChange:e=>void m({mode:t,model:e.target.value}),children:[(0,$.jsx)(f,{value:``,disabled:!0,children:r?`选择模型`:`Choose model`}),a&&!s?(0,$.jsxs)(f,{value:a.model,disabled:!0,children:[a.model,` · `,r?`不可用`:`Unavailable`]}):null,o.map(e=>(0,$.jsx)(f,{value:e.id,children:Le(e,n)},e.id))]}),o.length?null:(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:r?`暂无可用模型`:`No available model`})]}),s&&l.length>0?(0,$.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:r?`音色`:`Voice`}),(0,$.jsxs)(d,{className:`w-full`,value:u,disabled:i||e,onChange:e=>void m({mode:t,model:s.id,voice:e.target.value}),children:[a?.voice&&!l.some(e=>e.id===a.voice)?(0,$.jsxs)(f,{value:a.voice,disabled:!0,children:[a.voice,` · `,r?`当前场景不可用`:`Unavailable for this mode`]}):null,l.map(e=>(0,$.jsxs)(f,{value:e.id,children:[Le(e,n),e.gender?` · ${r?e.gender===`female`?`女声`:`男声`:e.gender}`:``,e.style?` · ${e.style}`:``]},e.id))]}),l.find(e=>e.id===u)?.description?(0,$.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:l.find(e=>e.id===u)?.description}):null]}):null]},t)},g=t===`omni`?[`conversation`]:[`transcription.stream`,`speech.stream`];return(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r?`XOPC 托管语音模型`:`XOPC managed voice models`}),(0,$.jsx)(V,{variant:`secondary`,disabled:i||e||!c,onClick:()=>void m(),children:r?`刷新目录`:`Refresh catalog`})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r?`修改在下次调用生效。各设备共用此 Gateway 的配置。`:`Changes apply to the next call and are shared across devices.`}),o||u?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:o||String(u)}):null,c?(0,$.jsxs)($.Fragment,{children:[g.map(h),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:r?`其他语音场景`:`Other voice features`}),(0,$.jsx)(`div`,{className:`mt-4 space-y-4`,children:Object.keys(p).filter(e=>!g.includes(e)).map(h)})]})]}):(0,$.jsx)(q,{className:`h-48 w-full`})]})}function rn({v:e}){let t=Be(e=>e.microphoneId),n=Be(e=>e.setMicrophoneId),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{l.current=!0;let e=()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{l.current&&i(e.filter(e=>e.kind===`audioinput`))}).catch(()=>{})};return e(),navigator.mediaDevices?.addEventListener(`devicechange`,e),()=>{l.current=!1,navigator.mediaDevices?.removeEventListener(`devicechange`,e)}},[]);let u=async()=>{c(!0),o(``);try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop());let e=await navigator.mediaDevices.enumerateDevices();l.current&&i(e.filter(e=>e.kind===`audioinput`))}catch(e){l.current&&o(e instanceof Error?e.message:String(e))}finally{l.current&&c(!1)}};return(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:e.experience.microphone}),(0,$.jsxs)(d,{value:t,onChange:e=>n(e.target.value),children:[(0,$.jsx)(f,{value:``,children:e.experience.systemDevice}),t&&!r.some(e=>e.deviceId===t)?(0,$.jsx)(f,{value:t,children:e.experience.unavailable}):null,r.filter(e=>e.deviceId&&e.deviceId!=="default").map((t,n)=>(0,$.jsx)(f,{value:t.deviceId,children:t.label||`${e.experience.microphone} ${n+1}`},t.deviceId))]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.experience.deviceHint}),(0,$.jsx)(V,{variant:`secondary`,disabled:s,onClick:()=>void u(),children:e.experience.refreshDevices}),a?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:a}):null]})}function an({v:e,canListen:t,canSpeak:n,disabled:r,onVerified:i}){let a=e.setup,o=(0,Q.useContext)(Ue)?.active??!1,[s,c]=(0,Q.useState)(`idle`),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),p=(0,Q.useRef)(`idle`),m=(0,Q.useRef)(null),h=(0,Q.useRef)(!1),g=e=>{p.current=e,c(e)},_=()=>{m.current?.(),m.current=null};(0,Q.useEffect)(()=>()=>m.current?.(),[]);async function v(e){_(),i?.({input:!1,output:!1}),h.current=!1,u(``),f(``),g(e?`connecting`:`playing`);let t=new AbortController,r,o,s,c,l=()=>{o?.cancel(),r?.getTracks().forEach(e=>e.stop()),s?.stop(`surface_closed`)},d=window.setTimeout(()=>v(a.timeout),6e4);m.current=()=>{t.abort(),window.clearTimeout(d),l(),c?.close()};function v(e){t.signal.aborted||(g(`error`),f(e),_())}async function y(){g(`playing`),l();try{let e=await Tt(t.signal);if(t.signal.aborted)return;c?.enqueue(e,()=>{t.signal.aborted||(window.clearTimeout(d),g(`confirm`))})}catch(e){v(e instanceof Error?e.message:a.testFailed)}}try{if(n&&(c=new Ge,await c.start(),t.signal.throwIfAborted()),!e){await y();return}let d=window.electronAPI?.system;if(d){let e=await d.requestMicrophone();if(t.signal.throwIfAborted(),e.status===`denied`)throw Error(a.microphoneDenied)}if(r=await navigator.mediaDevices.getUserMedia({audio:st()}),t.signal.aborted){l();return}if(s=await Re.connect({purpose:`dictation`,signal:t.signal,onEvent:e=>{t.signal.aborted||(e.type===`session.error`&&v(a.testFailed),p.current===`listening`&&(e.type===`input.transcript.delta`&&u(e.payload.text),e.type===`input.transcript.final`&&e.payload.text.trim()&&(u(e.payload.text.trim()),h.current=!0,n?y():(g(`passed`),i?.({input:!0,output:!1}),_()))))},onClose:()=>{(p.current===`listening`||p.current===`connecting`)&&v(a.testFailed)}}),t.signal.aborted){l();return}let f;if(o=await Ze.start(r,{onSamples:e=>{f&&!t.signal.aborted&&s?.sendAudio(f.push(e))}}),t.signal.aborted){l();return}f=new qe(o.sampleRate,s.session.inputFormat.sampleRate),g(`listening`)}catch(e){if(t.signal.aborted){l();return}v(e instanceof Error?e.message:a.testFailed)}}let y=s===`connecting`||s===`listening`||s===`playing`;return(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(V,{type:`button`,variant:`primary`,disabled:o||r||!t||y,onClick:()=>void v(!0),children:[y?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(x,{className:`size-4`}),n?a.test:a.testInput]}),(0,$.jsxs)(V,{type:`button`,variant:`secondary`,disabled:o||r||!n||y,onClick:()=>void v(!1),children:[(0,$.jsx)(C,{className:`size-4`}),e.tts.test.play]}),y?(0,$.jsxs)(V,{type:`button`,variant:`ghost`,onClick:()=>{_(),g(`idle`)},children:[(0,$.jsx)(xe,{className:`size-4`}),e.tts.test.stop]}):null]}),(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`space-y-2 text-xs text-fg-muted`,children:[s===`idle`?(0,$.jsx)(`p`,{children:o?e.experience.endCallBeforeTest:r?a.saveBeforeTest:a.microphoneHint}):null,s===`connecting`?(0,$.jsx)(`p`,{children:a.connecting}):null,s===`listening`?(0,$.jsx)(`p`,{children:a.speakNow}):null,l?(0,$.jsx)(`p`,{className:`rounded-lg bg-surface-base p-3 text-sm text-fg`,children:l}):null,s===`playing`?(0,$.jsx)(`p`,{children:a.playing}):null,s===`confirm`?(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{children:a.heardQuestion}),(0,$.jsx)(V,{type:`button`,variant:`secondary`,onClick:()=>{_(),i?.({input:h.current,output:!0}),g(`passed`)},children:a.heard}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>{_(),g(`error`),f(a.notHeard)},children:a.notHeardButton})]}):null,s===`passed`?(0,$.jsx)(`p`,{children:h.current?n?a.passed:a.inputPassed:a.outputPassed}):null,s===`error`?(0,$.jsx)(`p`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:d}):null]})]})}function on(e,t){return{...e,stt:{...e.stt,enabled:!0,provider:t},voice:{...e.voice,realtime:{...e.voice.realtime,enabled:!0,stt:t===`xopc-cloud`?e.voice.realtime.stt:void 0,tts:e.voice.realtime.tts?.provider===t?e.voice.realtime.tts:{provider:t,...t===`alibaba`?{voice:`Cherry`}:{}},omni:e.voice.realtime.omni?.provider===t?e.voice.realtime.omni:t===`xopc-cloud`?void 0:{provider:t,model:`qwen3-omni-flash-realtime`,voice:e.voice.realtime.omni?.voice??`Cherry`,instructions:e.voice.realtime.omni?.instructions??`Keep replies conversational and concise.`}}}}}function sn(e){let t=(0,zt.c)(105),{section:n,v:r,form:i,pending:a,onChange:o}=e,s=M(fn),c=r.setup,u;t[0]===i?u=t[1]:(u=JSON.stringify(i),t[0]=i,t[1]=u);let p=u,m;t[2]===p?m=t[3]:(m={signature:p,input:!1,output:!1},t[2]=p,t[3]=m);let[h,g]=(0,Q.useState)(m);h.signature!==p&&g({signature:p,input:!1,output:!1});let _;t[4]!==a||t[5]!==p?(_=a?null:[`voice-realtime-status`,p],t[4]=a,t[5]=p,t[6]=_):_=t[6];let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!0},t[7]=v):v=t[7];let{data:y,error:b,isLoading:x}=B(_,At,v),S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=N(`/api/voice/catalog`),t[8]=S):S=t[8];let{data:C}=B(S,dn),w=i.voice.realtime,T=i.stt.provider,E=w.tts,D=E?.provider??y?.tts?.provider,O=y?.tts?.model,k;t[9]!==O||t[10]!==D?(k=D&&O?[`realtime-voices`,D,O]:null,t[9]=O,t[10]=D,t[11]=k):k=t[11];let A;t[12]!==O||t[13]!==D?(A=()=>Et(D,O,`realtime`),t[12]=O,t[13]=D,t[14]=A):A=t[14];let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},t[15]=j):j=t[15];let{data:P}=B(k,A,j),F;t[16]===P?F=t[17]:(F=P===void 0?[]:P,t[16]=P,t[17]=F);let I=F,L=I,R;t[18]===I?R=t[19]:(R=I.filter(un),t[18]=I,t[19]=R);let ee=R,z=w.defaultEngine===`omni`,H=z?w.omni?.voice??``:E?.voice??y?.tts?.voice??``,te;t[20]!==C?.models||t[21]!==z||t[22]!==ee||t[23]!==w.omni?.model||t[24]!==w.omni?.provider||t[25]!==L?(te=z?w.omni?.provider===`xopc-cloud`?C?.models.find(e=>e.id===w.omni?.model)?.voice.voices.filter(ln)??[]:ee.length?ee:[`Cherry`,`Ethan`,`Serena`,`Chelsie`].map(cn):L,t[20]=C?.models,t[21]=z,t[22]=ee,t[23]=w.omni?.model,t[24]=w.omni?.provider,t[25]=L,t[26]=te):te=t[26];let U=te,W=!!(y?.enabled&&y.stt),G=!!(y?.enabled&&y.tts),ne;t[27]!==i||t[28]!==o||t[29]!==w?(ne=e=>o({...i,voice:{...i.voice,realtime:{...w,...e}}}),t[27]=i,t[28]=o,t[29]=w,t[30]=ne):ne=t[30];let re=ne,ie;t[31]!==i||t[32]!==o?(ie=e=>o(on(i,e)),t[31]=i,t[32]=o,t[33]=ie):ie=t[33];let J=ie,Y;t[34]!==a||t[35]!==w.enabled||t[36]!==c.disabled||t[37]!==c.needsSetup||t[38]!==c.pending||t[39]!==c.unverified||t[40]!==c.verified||t[41]!==p||t[42]!==h.signature?(Y=(e,t)=>w.enabled?a?c.pending:e?t&&h.signature===p?c.verified:c.unverified:c.needsSetup:c.disabled,t[34]=a,t[35]=w.enabled,t[36]=c.disabled,t[37]=c.needsSetup,t[38]=c.pending,t[39]=c.unverified,t[40]=c.verified,t[41]=p,t[42]=h.signature,t[43]=Y):Y=t[43];let ae=Y,oe;t[44]!==J||t[45]!==b||t[46]!==i.tts||t[47]!==a||t[48]!==T||t[49]!==c.configureConversation||t[50]!==c.customProvider||t[51]!==c.edgeHint||t[52]!==c.finishSetup||t[53]!==c.hosted||t[54]!==c.hostedAccountHint||t[55]!==c.hostedHint||t[56]!==c.manageAccount||t[57]!==c.outputHint||t[58]!==c.ownKey||t[59]!==c.ownKeyHint||t[60]!==c.service||t[61]!==c.statusError||t[62]!==n||t[63]!==E||t[64]!==y?.tts?(oe=n===`service`?(0,$.jsxs)($.Fragment,{children:[b?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:c.statusError}):null,(0,$.jsxs)(`fieldset`,{className:`space-y-3`,children:[(0,$.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:c.service}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`xopc-cloud`,`alibaba`].map(e=>(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg bg-surface-base/55 px-3 py-3 text-sm text-fg has-checked:bg-accent-soft`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`realtime-service`,value:e,checked:e===`xopc-cloud`?T===e:T!==`xopc-cloud`,onChange:()=>J(e),className:`mt-1 accent-accent`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:e===`xopc-cloud`?c.hosted:c.ownKey}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e===`xopc-cloud`?c.hostedHint:c.ownKeyHint})]})]},e))})]}),T!==`alibaba`&&T!==`xopc-cloud`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.customProvider.replace(`{provider}`,T)}):null,T===`xopc-cloud`?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[c.hostedAccountHint,` `,(0,$.jsx)(l,{className:`text-accent hover:underline`,to:`/settings/capabilities/models`,children:c.manageAccount})]}):null,!E&&!a&&!y?.tts&&(T===`alibaba`||T===`xopc-cloud`)?(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-base p-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:c.finishSetup}),(0,$.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:i.tts.provider===`edge`?c.edgeHint:c.outputHint}),(0,$.jsx)(V,{className:`mt-2`,type:`button`,variant:`secondary`,onClick:()=>J(T),children:c.configureConversation})]}):null]}):null,t[44]=J,t[45]=b,t[46]=i.tts,t[47]=a,t[48]=T,t[49]=c.configureConversation,t[50]=c.customProvider,t[51]=c.edgeHint,t[52]=c.finishSetup,t[53]=c.hosted,t[54]=c.hostedAccountHint,t[55]=c.hostedHint,t[56]=c.manageAccount,t[57]=c.outputHint,t[58]=c.ownKey,t[59]=c.ownKeyHint,t[60]=c.service,t[61]=c.statusError,t[62]=n,t[63]=E,t[64]=y?.tts,t[65]=oe):oe=t[65];let X;t[66]!==H||t[67]!==s||t[68]!==z||t[69]!==D||t[70]!==w.bargeIn||t[71]!==w.defaultEngine||t[72]!==w.enabled||t[73]!==w.omni||t[74]!==w.tts||t[75]!==c.bargeIn||t[76]!==c.defaultVoice||t[77]!==c.enable||t[78]!==c.voice||t[79]!==n||t[80]!==E||t[81]!==y?.tts||t[82]!==re||t[83]!==r.experience||t[84]!==r.realtime||t[85]!==U?(X=n===`listening`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:c.enable}),(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":w.enabled,className:`ui-checkbox`,checked:w.enabled,onChange:e=>re({enabled:e.target.checked})})]}),(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:r.experience.defaultMode}),(0,$.jsxs)(d,{value:w.defaultEngine,className:K,onChange:e=>re({defaultEngine:e.target.value}),children:[(0,$.jsx)(f,{value:`agent`,children:r.experience.assistant}),(0,$.jsx)(f,{value:`omni`,children:r.experience.natural})]})]}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[w.defaultEngine===`agent`?r.experience.assistantHint:r.experience.naturalHint,` `,r.experience.nextCall]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`label`,{htmlFor:`realtime-voice`,className:`text-sm font-medium text-fg`,children:c.voice}),(0,$.jsxs)(d,{id:`realtime-voice`,className:`${K} w-full sm:w-56`,value:H,disabled:z?!w.omni:!E&&!y?.tts,onChange:e=>{if(z&&w.omni){re({omni:{...w.omni,voice:e.target.value}});return}(D===`alibaba`||D===`xopc-cloud`)&&re({tts:{...w.tts,provider:D,...e.target.value?{voice:e.target.value}:{}},...w.omni&&[`Cherry`,`Ethan`,`Serena`,`Chelsie`].includes(e.target.value)?{omni:{...w.omni,voice:e.target.value}}:{}})},children:[z?null:(0,$.jsx)(f,{value:``,children:c.defaultVoice}),H&&!U.some(e=>e.id===H)?(0,$.jsx)(f,{value:H,children:H}):null,U.map(e=>(0,$.jsxs)(f,{value:e.id,children:[Le(e,s),`gender`in e&&e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,`style`in e&&e.style?` · ${e.style}`:``]},e.id))]}),(()=>{let e=U.find(e=>e.id===H);return e&&`description`in e&&typeof e.description==`string`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.description}):null})()]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-4 text-sm text-fg`,children:[(0,$.jsxs)(`span`,{children:[c.bargeIn,(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:r.realtime.bargeInDescription})]}),(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":w.bargeIn,checked:w.bargeIn,className:`size-4 accent-accent`,onChange:e=>re({bargeIn:e.target.checked})})]})]}):null,t[66]=H,t[67]=s,t[68]=z,t[69]=D,t[70]=w.bargeIn,t[71]=w.defaultEngine,t[72]=w.enabled,t[73]=w.omni,t[74]=w.tts,t[75]=c.bargeIn,t[76]=c.defaultVoice,t[77]=c.enable,t[78]=c.voice,t[79]=n,t[80]=E,t[81]=y?.tts,t[82]=re,t[83]=r.experience,t[84]=r.realtime,t[85]=U,t[86]=X):X=t[86];let Z;t[87]!==W||t[88]!==G||t[89]!==b||t[90]!==x||t[91]!==a||t[92]!==n||t[93]!==p||t[94]!==y||t[95]!==ae||t[96]!==r||t[97]!==h.input||t[98]!==h.output?(Z=n===`diagnostics`?(0,$.jsxs)($.Fragment,{children:[x?(0,$.jsx)(q,{className:`h-16 w-full`}):(0,$.jsxs)(`div`,{className:`space-y-2 text-sm`,role:`status`,children:[(0,$.jsxs)(`p`,{children:[r.experience.dictationReady,` · `,ae(W,h.input)]}),(0,$.jsxs)(`p`,{children:[r.experience.agentReady,` · `,ae(W&&G,h.input&&h.output)]}),(0,$.jsxs)(`p`,{children:[r.experience.omniReady,` · `,ae(!!(y?.enabled&&y.omni),!1)]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.experience.configurationOnly}),(0,$.jsx)(an,{v:r,canListen:W,canSpeak:G,disabled:a||x||!!b,onVerified:e=>g({signature:p,...e})},`${p}:${JSON.stringify(y)}`)]}):null,t[87]=W,t[88]=G,t[89]=b,t[90]=x,t[91]=a,t[92]=n,t[93]=p,t[94]=y,t[95]=ae,t[96]=r,t[97]=h.input,t[98]=h.output,t[99]=Z):Z=t[99];let se;return t[100]!==c.service||t[101]!==oe||t[102]!==X||t[103]!==Z?(se=(0,$.jsxs)(`section`,{className:`space-y-5 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":c.service,children:[oe,X,Z]}),t[100]=c.service,t[101]=oe,t[102]=X,t[103]=Z,t[104]=se):se=t[104],se}function cn(e){return{id:e,name:e}}function ln(e){return ut(e,`conversation`)}function un(e){return[`Cherry`,`Ethan`,`Serena`,`Chelsie`].includes(e.id)}async function dn(e){return it.parse((await k(e)).payload)}function fn(e){return e.language}function pn(e){let t=(0,zt.c)(22),{value:n,onChange:r}=e,i=M(mn)===`zh`,a;t[0]===i?a=t[1]:(a=(e,t)=>i?t:e,t[0]=i,t[1]=a);let o=a,s;t[2]!==r||t[3]!==n?(s=e=>{n&&r({...n,...e})},t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===o?l=t[6]:(l=o(`Natural conversation overrides`,`自然对话独立配置`),t[5]=o,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:l}),t[7]=l,t[8]=u);let d;t[9]===o?d=t[10]:(d=o(`Calls continue the same session using recent history. Service and credentials are shared with voice setup; override them here only when needed.`,`通话会接续同一会话的近期历史。默认共用语音服务与凭据,仅在需要独立配置时修改。`),t[9]=o,t[10]=d);let f;t[11]===d?f=t[12]:(f=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d}),t[11]=d,t[12]=f);let p;t[13]!==o||t[14]!==r||t[15]!==c||t[16]!==n?(p=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.provider===`xopc-cloud`?o(`Uses your XOPC sign-in and the platform’s published Omni route and credits.`,`使用 XOPC 登录授权、平台发布的 Omni 路由和额度。`):o(`Leave empty to use the shared voice service credential.`,`留空使用语音服务中已配置的凭据。`)}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.model}),n.provider===`alibaba`?(0,$.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:o(`Separate API key (optional)`,`独立 API Key(可选)`)}),(0,$.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,type:`password`,autoComplete:`new-password`,value:n.apiKey??``,onChange:e=>c({apiKey:e.target.value})})]}):null,(0,$.jsx)(Me,{title:o(`Custom endpoint`,`自定义服务地址`),summary:n.baseUrl||o(`Use the default endpoint`,`使用默认服务地址`),children:(0,$.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:o(`Endpoint override (optional)`,`自定义服务地址(可选)`)}),(0,$.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:n.baseUrl??``,placeholder:n.provider===`alibaba`?`wss://dashscope.aliyuncs.com/api-ws/v1/realtime`:`https://router.xopc.ai/v1`,onChange:e=>c({baseUrl:e.target.value.trim()||void 0})})]})}),(0,$.jsx)(Me,{title:o(`Conversation instructions`,`聊天指令`),summary:o(`Current instructions remain active`,`当前聊天指令继续生效`),children:(0,$.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:o(`Conversation instructions`,`聊天指令`)}),(0,$.jsx)(`textarea`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,rows:3,maxLength:8e3,value:n.instructions,onChange:e=>c({instructions:e.target.value})})]})})]}):(0,$.jsx)(V,{variant:`secondary`,onClick:()=>r({provider:`alibaba`,model:`qwen3-omni-flash-realtime`,voice:`Cherry`,instructions:`You are a friendly voice companion. You cannot execute tools.`}),children:o(`Configure natural conversation`,`配置自然聊天`)}),t[13]=o,t[14]=r,t[15]=c,t[16]=n,t[17]=p):p=t[17];let m;return t[18]!==u||t[19]!==f||t[20]!==p?(m=(0,$.jsxs)(`details`,{className:`space-y-3 rounded-xl bg-surface-hover/20 p-4`,children:[u,f,p]}),t[18]=u,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function mn(e){return e.language}var hn=G;function gn(){return O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,ne,`dark:border-edge`)}function _n(){return O(K,G)}function vn(e){return!e||e<=0?``:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function yn(e,t){let n=window.atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t}))}function bn(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.stt.openai;case`alibaba`:return t.stt.alibaba;case`groq`:return`Groq`;default:return e}}function xn(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.tts.providerOpenai;case`alibaba`:return t.stt.alibaba;case`edge`:return t.tts.providerEdge;case`minimax`:return`MiniMax`;default:return e}}function Sn(e,t){switch(e){case`edge`:return t.tts.providerHints.edge;case`openai`:return t.tts.providerHints.openai;case`alibaba`:return t.tts.providerHints.alibaba;case`minimax`:return t.tts.providerHints.minimax;default:return t.tts.providerHints.generic}}function Cn(e){return{maskedHelp:e.apiKeyMaskedHelp,copy:e.apiKeyCopy,copied:e.apiKeyCopied,show:e.apiKeyShow,hide:e.apiKeyHide,notInConfigFile:e.apiKeyNotInConfigFile,loadFailed:e.apiKeyRevealFailed}}function wn(e,t){let n=e[t.key];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?n:t.defaultValue===void 0?t.type===`boolean`?!1:``:t.defaultValue}function Tn(e,t){if(e.type===`boolean`)return!!t;if(e.type!==`number`)return t;let n=String(t).trim();if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function En(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`update`:return{...e,form:t.updater(e.form)};case`saved`:{let n=structuredClone(t.value);return{form:e.form!==null&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function Dn(){let e=M(e=>e.language),t=D(e).voiceSettings,[n,r]=o(),i=n.get(`voiceTab`),a=i===`service`||i===`devices`?i:`listening`,s=e=>r(t=>{let n=new URLSearchParams(t);return n.set(`voiceTab`,e),n}),c=Be(e=>e.captions),l=Be(e=>e.setCaptions),u=!!A(e=>e.conversationId),[p,m]=(0,Q.useReducer)(En,{form:null,baseline:null}),h=p.form,g=p.baseline,[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),S=(0,Q.useRef)(h);S.current=h;let C=(0,Q.useRef)({parsed:null,models:void 0}),{data:w,error:T,isLoading:E,mutate:O}=W(u),{data:k,error:j,isLoading:P,mutate:F}=B(u?N(`/api/voice/models`):null,Ot,{revalidateOnFocus:!1}),{data:I,error:L,isLoading:R}=B(u?N(`/api/voice/providers`):null,wt,{revalidateOnFocus:!1}),{data:ee,error:z,isLoading:H}=B(u?N(`/api/voice/stt-providers`):null,Dt,{revalidateOnFocus:!1}),te=(0,Q.useMemo)(()=>I?.providers??[],[I]),U=(0,Q.useMemo)(()=>ee?.providers??[],[ee]),G=(0,Q.useMemo)(()=>w?.payload?.config===void 0?null:kt(w.payload.config),[w]),K=(0,Q.useMemo)(()=>!h||!g?!1:JSON.stringify(h)!==JSON.stringify(g),[h,g]);u?G!==null&&k!==void 0&&!x.current&&(C.current.parsed!==G||C.current.models!==k)&&(C.current={parsed:G,models:k},m({type:`sync`,value:G}),v(k)):(C.current.parsed!==null||C.current.models!==void 0)&&(C.current={parsed:null,models:void 0},m({type:`reset`}),v(null),x.current=!1);let ne=!!(u&&(G===null||k===void 0||I===void 0||ee===void 0)&&(E||P||R||H)),re=T instanceof Error?T.message:T?String(T):j instanceof Error?j.message:j?String(j):L instanceof Error?L.message:L?String(L):z instanceof Error?z.message:z?String(z):null,q=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:t=>t?{...t,stt:{...t.stt,...e},...e.provider&&e.provider!==`xopc-cloud`?{voice:{...t.voice,realtime:{...t.voice.realtime,stt:void 0}}}:{}}:null})},[]),ie=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:t=>{if(!t)return null;let n=t.stt.fallback??{enabled:!1,order:[]};return{...t,stt:{...t.stt,fallback:{...n,...e}}}}})},[]),J=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:t=>t?{...t,voice:{...t.voice,input:{...t.voice.input,refinement:{...t.voice.input.refinement,...e}}}}:null})},[]),Y=(0,Q.useCallback)(t=>{x.current=!0,m({type:`update`,updater:n=>n?{...n,voice:{...n.voice,languageMode:t,...t===`auto`?{language:e}:{}}}:null})},[e]),ae=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:t=>t?{...t,voice:{...t.voice,realtime:{...t.voice.realtime,...e}}}:null})},[]),oe=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:t=>t?{...t,tts:{...t.tts,...e}}:null})},[]),X=xt({value:h,dirty:K,onSave:(0,Q.useCallback)(async e=>{try{await St(e),m({type:`saved`,value:e}),x.current=!!(S.current&&JSON.stringify(S.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])}),Z=(0,Q.useCallback)(e=>{x.current=!0,m({type:`update`,updater:()=>e})},[]);if(!u)return(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})});if(ne)return(0,$.jsx)(yt,{rows:4});if(!h||_===null)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:re??t.loadError}),(0,$.jsx)(V,{type:`button`,variant:`secondary`,onClick:()=>{O(),F()},children:t.retry})]});let se=h.stt,ce=h.tts,le=h.voice.input.refinement,ue=Cn(t);return(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,onBlurCapture:X.onBlurCapture,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,$.jsx)(bt,{status:X.status,error:X.error})}),X.error?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:X.error}):null,(0,$.jsx)(`nav`,{"aria-label":t.experience.tabsLabel,className:`flex flex-wrap gap-2`,children:[`listening`,`service`,`devices`].map(e=>(0,$.jsx)(V,{variant:a===e?`secondary`:`ghost`,"aria-pressed":a===e,onClick:()=>s(e),children:t.experience[e]},e))}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.experience[`${a}Hint`]}),a===`devices`?null:(0,$.jsx)(sn,{section:a,v:t,form:h,pending:K||X.status===`saving`||!!X.error,onChange:Z}),a===`listening`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kn,{v:t,voice:h.voice,updateLanguageMode:Y}),(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.experience.pace}),(0,$.jsxs)(d,{className:_n(),value:String(h.voice.realtime.silenceDurationMs),onChange:e=>ae({silenceDurationMs:Number(e.target.value)}),children:[(0,$.jsx)(f,{value:`800`,children:t.experience.fast}),(0,$.jsx)(f,{value:`1200`,children:t.experience.standard}),(0,$.jsx)(f,{value:`2000`,children:t.experience.relaxed}),[800,1200,2e3].includes(h.voice.realtime.silenceDurationMs)?null:(0,$.jsxs)(f,{value:String(h.voice.realtime.silenceDurationMs),children:[h.voice.realtime.silenceDurationMs,` ms`]})]})]})}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between text-sm`,children:[t.experience.captions,(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":c,className:`ui-checkbox`,checked:c,onChange:e=>l(e.target.checked)})]}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[t.experience.inputProcessing,` · `,le.mode===`off`?t.stt.refinementOff:le.mode===`punctuation`?t.stt.refinementPunctuation:le.mode===`light`?t.stt.refinementLight:t.setup.advanced]}),(0,$.jsxs)(`label`,{className:`mt-4 block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:t.stt.refinement}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.stt.refinementDesc}),(0,$.jsxs)(d,{className:_n(),value:le.mode,onChange:e=>J({mode:e.target.value}),children:[(0,$.jsx)(f,{value:`off`,children:t.stt.refinementOff}),(0,$.jsx)(f,{value:`punctuation`,children:t.stt.refinementPunctuation}),(0,$.jsx)(f,{value:`light`,children:t.stt.refinementLight}),le.mode===`custom`?(0,$.jsx)(f,{value:`custom`,children:t.setup.advanced}):null]})]})]}),(0,$.jsx)(On,{v:t,tts:ce,updateTts:oe})]}):null,a===`devices`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(rn,{v:t}),(0,$.jsx)(sn,{section:`diagnostics`,v:t,form:h,pending:K||X.status===`saving`||!!X.error,onChange:Z})]}):null,a===`service`?(0,$.jsxs)($.Fragment,{children:[se.provider===`xopc-cloud`?(0,$.jsx)(nn,{engine:h.voice.realtime.defaultEngine,disabled:K||X.status===`saving`}):(0,$.jsx)($.Fragment,{children:(0,$.jsx)(An,{v:t,apiKeyLabels:ue,stt:se,models:_,sttProviders:U,updateStt:q,updateSttFallback:ie})}),h.voice.realtime.enabled&&h.voice.realtime.omni?.provider===`alibaba`?(0,$.jsx)(pn,{value:h.voice.realtime.omni,onChange:e=>ae({omni:e})}):null,(0,$.jsxs)(`details`,{open:y,className:`rounded-xl bg-surface-hover/20 p-4`,"data-voice-section":`readout-service`,children:[(0,$.jsxs)(`summary`,{onClick:e=>{e.preventDefault(),b(!y)},className:`cursor-pointer text-sm font-medium text-fg`,children:[t.experience.readoutService,(0,$.jsx)(`span`,{className:`ml-2 font-normal text-fg-muted`,children:xn(ce.provider,t)})]}),y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.setup.readoutHint}),(0,$.jsx)(Mn,{v:t,apiKeyLabels:ue,tts:ce,models:_,ttsProviders:te,updateTts:oe})]}):null]}),se.provider===`xopc-cloud`?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-hover/20 p-4`,"data-voice-section":`advanced`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:t.experience.technical}),(0,$.jsx)(An,{v:t,apiKeyLabels:ue,stt:se,models:_,sttProviders:U,updateStt:q,updateSttFallback:ie}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.notes.envVars})]}):null]}):null]})}function On(e){let t=(0,zt.c)(29),{v:n,tts:r,updateTts:i}=e,a;t[0]===n.setup.readout?a=t[1]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:n.setup.readout}),t[0]=n.setup.readout,t[1]=a);let o=n.setup.readout,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=_n(),t[2]=s):s=t[2];let c=r.enabled?r.trigger:`off`,l;t[3]===i?l=t[4]:(l=e=>i({enabled:e.target.value!==`off`,trigger:e.target.value}),t[3]=i,t[4]=l);let u;t[5]===n.tts.triggerOff?u=t[6]:(u=(0,$.jsx)(f,{value:`off`,children:n.tts.triggerOff}),t[5]=n.tts.triggerOff,t[6]=u);let p;t[7]===n.tts.triggerInbound?p=t[8]:(p=(0,$.jsx)(f,{value:`inbound`,children:n.tts.triggerInbound}),t[7]=n.tts.triggerInbound,t[8]=p);let m;t[9]===n.tts.triggerAlways?m=t[10]:(m=(0,$.jsx)(f,{value:`always`,children:n.tts.triggerAlways}),t[9]=n.tts.triggerAlways,t[10]=m);let h;t[11]===n.tts.triggerTagged?h=t[12]:(h=(0,$.jsx)(f,{value:`tagged`,children:n.tts.triggerTagged}),t[11]=n.tts.triggerTagged,t[12]=h);let g;t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==p||t[17]!==m||t[18]!==h||t[19]!==n.setup.readout?(g=(0,$.jsxs)(d,{"aria-label":o,className:s,value:c,onChange:l,children:[u,p,m,h]}),t[13]=c,t[14]=l,t[15]=u,t[16]=p,t[17]=m,t[18]=h,t[19]=n.setup.readout,t[20]=g):g=t[20];let _;t[21]!==a||t[22]!==g?(_=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[a,g]}),t[21]=a,t[22]=g,t[23]=_):_=t[23];let v;t[24]===n.setup.readoutHint?v=t[25]:(v=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.readoutHint}),t[24]=n.setup.readoutHint,t[25]=v);let y;return t[26]!==_||t[27]!==v?(y=(0,$.jsxs)(`section`,{className:`space-y-2 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,children:[_,v]}),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function kn(e){let t=(0,zt.c)(22),{v:n,voice:r,updateLanguageMode:i}=e,a;t[0]===n.language.title?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.language.title}),t[0]=n.language.title,t[1]=a);let o=r.languageMode===`auto`?n.language.autoDescription:n.language.manualDescription,s;t[2]===o?s=t[3]:(s=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o}),t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,$.jsxs)(`div`,{children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=_n(),t[7]=l):l=t[7];let u;t[8]===i?u=t[9]:(u=e=>i(e.target.value),t[8]=i,t[9]=u);let p;t[10]===n.language.auto?p=t[11]:(p=(0,$.jsx)(f,{value:`auto`,children:n.language.auto}),t[10]=n.language.auto,t[11]=p);let m;t[12]===n.language.manual?m=t[13]:(m=(0,$.jsx)(f,{value:`manual`,children:n.language.manual}),t[12]=n.language.manual,t[13]=m);let h;t[14]!==u||t[15]!==p||t[16]!==m||t[17]!==r.languageMode?(h=(0,$.jsxs)(d,{className:l,value:r.languageMode,onChange:u,children:[p,m]}),t[14]=u,t[15]=p,t[16]=m,t[17]=r.languageMode,t[18]=h):h=t[18];let g;return t[19]!==c||t[20]!==h?(g=(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[c,h]})}),t[19]=c,t[20]=h,t[21]=g):g=t[21],g}function An(e){let t=(0,zt.c)(63),{v:n,apiKeyLabels:r,stt:i,models:a,sttProviders:o,updateStt:s,updateSttFallback:c}=e,l;if(t[0]!==o){let e=new Set;l=[];for(let t of o)e.has(t.id)||(e.add(t.id),l.push(t));t[0]=o,t[1]=l}else l=t[1];let u=l,p,m,h,g;if(t[2]!==a||t[3]!==u||t[4]!==i.provider||t[5]!==i.providers){p=u.find(e=>e.id===i.provider);let e;t[10]!==i.provider||t[11]!==i.providers?(e=i.providers?.[i.provider]??{},t[10]=i.provider,t[11]=i.providers,t[12]=e):e=t[12],h=e,m=a?.stt?.[i.provider]?.length?a.stt[i.provider]:p?.models??[],g=p?.fields.find(jn),t[2]=a,t[3]=u,t[4]=i.provider,t[5]=i.providers,t[6]=p,t[7]=m,t[8]=h,t[9]=g}else p=t[6],m=t[7],h=t[8],g=t[9];let _=g,v=typeof h.model==`string`?h.model:void 0,y=v??(typeof _?.defaultValue==`string`?_.defaultValue:m[0]?.id),b;t[13]!==i.provider||t[14]!==i.providers||t[15]!==s?(b=e=>{s({providers:{...i.providers??{},[i.provider]:{...i.providers?.[i.provider]??{},...e}}})},t[13]=i.provider,t[14]=i.providers,t[15]=s,t[16]=b):b=t[16];let S=b,C,w;t[17]!==v||t[18]!==y||t[19]!==_||t[20]!==S?(C=()=>{_&&y&&v!==y&&S({model:y})},w=[v,y,_,S],t[17]=v,t[18]=y,t[19]=_,t[20]=S,t[21]=C,t[22]=w):(C=t[21],w=t[22]),(0,Q.useEffect)(C,w);let T;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(x,{"aria-hidden":`true`,className:`size-4 text-accent`,strokeWidth:1.75}),t[23]=T):T=t[23];let E;t[24]===n.stt.title?E=t[25]:(E=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[T,n.stt.title]}),t[24]=n.stt.title,t[25]=E);let D;t[26]===n.stt.enable?D=t[27]:(D=(0,$.jsx)(`span`,{children:n.stt.enable}),t[26]=n.stt.enable,t[27]=D);let k;t[28]===s?k=t[29]:(k=e=>s({enabled:e.target.checked}),t[28]=s,t[29]=k);let A;t[30]!==i.enabled||t[31]!==k?(A=(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i.enabled,className:`ui-checkbox`,checked:i.enabled,onChange:k}),t[30]=i.enabled,t[31]=k,t[32]=A):A=t[32];let j;t[33]!==D||t[34]!==A?(j=(0,$.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-xs text-fg-muted`,children:[D,A]}),t[33]=D,t[34]=A,t[35]=j):j=t[35];let M;t[36]!==j||t[37]!==E?(M=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[E,j]}),t[36]=j,t[37]=E,t[38]=M):M=t[38];let N;t[39]===n.stt.description?N=t[40]:(N=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.stt.description}),t[39]=n.stt.description,t[40]=N);let P;t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(`div`,{className:`mb-4`,children:[M,N]}),t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==p?.fields||t[45]!==r||t[46]!==y||t[47]!==m||t[48]!==u||t[49]!==h||t[50]!==i.enabled||t[51]!==i.fallback?.enabled||t[52]!==i.provider||t[53]!==S||t[54]!==s||t[55]!==c||t[56]!==n?(F=i.enabled?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:O(`flex flex-col gap-1.5`,hn),children:[(0,$.jsx)(zn,{children:n.stt.provider}),(0,$.jsx)(d,{"aria-label":n.stt.provider,className:_n(),value:i.provider,onChange:e=>s({provider:e.target.value}),children:u.map(e=>(0,$.jsxs)(f,{value:e.id,children:[bn(e.id,n),e.configured?``:` *`]},e.id))})]}),(0,$.jsx)(Nn,{kind:`stt`,providerId:i.provider,fields:p?.fields??[],providerSlice:h,models:m,currentModel:y,apiKeyLabels:r,onPatch:S})]}),i.provider===`alibaba`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.keyHint}):null,(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:n.stt.fallback}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.stt.fallback}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.stt.fallbackDesc})]}),(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.fallback?.enabled??!1,onChange:e=>c({enabled:e.target.checked})})]})]})]}):null,t[44]=p?.fields,t[45]=r,t[46]=y,t[47]=m,t[48]=u,t[49]=h,t[50]=i.enabled,t[51]=i.fallback?.enabled,t[52]=i.provider,t[53]=S,t[54]=s,t[55]=c,t[56]=n,t[57]=F):F=t[57];let I;t[58]===F?I=t[59]:(I=(0,$.jsx)(`div`,{className:`space-y-4`,children:F}),t[58]=F,t[59]=I);let L;return t[60]!==P||t[61]!==I?(L=(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[P,I]}),t[60]=P,t[61]=I,t[62]=L):L=t[62],L}function jn(e){return e.key===`model`}function Mn({v:e,apiKeyLabels:t,tts:n,models:r,ttsProviders:i,updateTts:a}){let[o,s]=(0,Q.useState)(e.tts.test.sampleText),[c,l]=(0,Q.useState)({status:`idle`}),u=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useCallback)(()=>{m.current?.abort(),m.current=null,u.current?.pause(),u.current=null,p.current&&=(URL.revokeObjectURL(p.current),null)},[]),g=(0,Q.useMemo)(()=>{let e=new Set,t=[];for(let n of i)e.has(n.id)||(e.add(n.id),t.push(n));return t},[i]),_=g.find(e=>e.id===n.provider),v=n.providers?.[n.provider]??{},y=r?.tts?.[n.provider]?.length?r.tts[n.provider]:_?.models??[],x=_?.fields.find(e=>e.key===`model`),S=_?.fields.find(e=>e.key===`voice`),w=typeof v.model==`string`?v.model:void 0,T=w??(typeof x?.defaultValue==`string`?x.defaultValue:y[0]?.id),E=y.find(e=>e.id===T),D=r?.ttsVoices?.[n.provider]?.length?r.ttsVoices[n.provider]:_?.voices??[],{data:k=[]}=B(T?`voice:tts:${n.provider}:${T}`:null,()=>Et(n.provider,T??``),{revalidateOnFocus:!1}),A=k.length>0?k:D,j=typeof v.voice==`string`?v.voice:void 0,M=j??A.find(e=>e.id===E?.tts?.defaultVoice)?.id??(typeof S?.defaultValue==`string`?S.defaultValue:A[0]?.id),N=(_?.fields??[]).filter(e=>(e.key!==`speed`||E?.tts?.speed!==!1)&&(e.key!==`instructions`||E?.tts?.instructions!==!1)),P=(0,Q.useCallback)(e=>{a({providers:{...n.providers??{},[n.provider]:{...n.providers?.[n.provider]??{},...e}}})},[n.provider,n.providers,a]);(0,Q.useEffect)(()=>{let e={};x&&T&&w!==T&&(e.model=T),S&&M&&j!==M&&(e.voice=M),Object.keys(e).length>0&&P(e)},[w,j,T,M,x,P,S]),(0,Q.useEffect)(()=>()=>h(),[h]);let F=(0,Q.useCallback)(e=>{a({provider:e}),l({status:`idle`})},[a]),I=(0,Q.useCallback)(async()=>{let t=o.trim();if(!t){l({status:`error`,message:e.tts.test.emptyText});return}h();let r=new AbortController;m.current=r,l({status:`loading`});try{let i=await Ct({text:t,provider:n.provider,providerConfig:v,...T?{model:T}:{},...M?{voice:M}:{}},r.signal);if(r.signal.aborted)return;let a=yn(i.audio,i.mimeType);p.current=a;let o=new Audio(a);u.current=o;let s=[i.provider,i.format,i.latencyMs===void 0?void 0:`${i.latencyMs}ms`,vn(i.audioSize)].filter(Boolean).join(` · `);o.addEventListener(`ended`,()=>l({status:`done`,summary:s}),{once:!0}),o.addEventListener(`error`,()=>l({status:`error`,message:e.tts.test.playFailed}),{once:!0}),await o.play(),l({status:`playing`,summary:s})}catch(e){if(r.signal.aborted)return;h(),l({status:`error`,message:e instanceof Error?e.message:String(e)})}},[T,M,v,h,o,n.provider,e.tts.test.emptyText,e.tts.test.playFailed]);return(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(et,{className:`size-4 text-accent`,strokeWidth:1.75}),e.tts.title]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.description})]}),(0,$.jsx)(`div`,{className:`space-y-4`,children:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:(0,$.jsxs)(`div`,{className:O(`flex flex-col gap-1.5`,hn),children:[(0,$.jsx)(zn,{children:e.tts.provider}),(0,$.jsx)(d,{"aria-label":e.tts.provider,className:_n(),value:n.provider,onChange:e=>F(e.target.value),children:g.map(t=>(0,$.jsx)(f,{value:t.id,children:xn(t.id,e)},t.id))}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[_?.configured?e.tts.configured:_?.diagnostics.requiresApiKey?`${e.tts.needsKey} · ${_.diagnostics.envKeys?.join(`, `)??e.stt.apiKey}`:e.tts.noKeyNeeded,` · `,_?.description??Sn(n.provider,e)]})]})}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:(0,$.jsx)(Nn,{kind:`tts`,providerId:n.provider,fields:N,providerSlice:v,models:y,voices:A,currentModel:T,currentVoice:M,apiKeyLabels:t,onPatch:P,resetVoiceOnModelChange:!0})}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-panel/80 p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e.tts.test.title}),(0,$.jsxs)(`div`,{className:`mt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsx)(`div`,{children:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.test.description})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsxs)(V,{type:`button`,variant:`primary`,onClick:()=>void I(),disabled:c.status===`loading`,className:`h-9`,children:[c.status===`loading`?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(C,{className:`size-4`}),c.status===`loading`?e.tts.test.generating:e.tts.test.play]}),(0,$.jsxs)(V,{type:`button`,variant:`secondary`,onClick:()=>{h(),l(e=>e.status===`playing`?{status:`done`,summary:e.summary}:{status:`idle`})},disabled:c.status!==`playing`,className:`h-9`,children:[(0,$.jsx)(xe,{className:`size-4`}),e.tts.test.stop]})]})]}),(0,$.jsxs)(`details`,{className:`mt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:e.setup.sampleText}),(0,$.jsx)(`textarea`,{className:O(gn(),`mt-3 min-h-20 resize-y`),value:o,onChange:e=>s(e.target.value),maxLength:1e3})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[o.length,`/1000`]}),c.status===`playing`||c.status===`done`?(0,$.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-200`,children:[c.status===`playing`?e.tts.test.playing:e.tts.test.ready,` · `,c.summary]}):null,c.status===`error`?(0,$.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:c.message}):null]})]})]})]})})]})}function Nn(e){let t=(0,zt.c)(39),{kind:n,providerId:r,fields:i,providerSlice:a,models:o,voices:s,currentModel:c,currentVoice:l,apiKeyLabels:u,onPatch:p,resetVoiceOnModelChange:m}=e,h;t[0]===s?h=t[1]:(h=s===void 0?[]:s,t[0]=s,t[1]=h);let g=h,_=m===void 0?!1:m,v=M(In),y;t[2]===v?y=t[3]:(y=D(v),t[2]=v,t[3]=y);let b=y.voiceSettings,x=Fn,S,C;if(t[4]!==u||t[5]!==c||t[6]!==l||t[7]!==i||t[8]!==n||t[9]!==v||t[10]!==o||t[11]!==p||t[12]!==r||t[13]!==a||t[14]!==_||t[15]!==b||t[16]!==g){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>!x(e),t[19]=e):e=t[19];let s=i.filter(e),m;t[20]!==u||t[21]!==c||t[22]!==l||t[23]!==n||t[24]!==v||t[25]!==o||t[26]!==p||t[27]!==r||t[28]!==a||t[29]!==_||t[30]!==b||t[31]!==g?(m=e=>e.map(e=>e.key===`apiKey`?(0,$.jsxs)(`div`,{className:O(`flex flex-col gap-1.5`,hn),children:[(0,$.jsx)(zn,{htmlFor:`voice-${n}-${r}-api-key`,children:b.stt.apiKey}),(0,$.jsx)(jt,{kind:n,providerId:r,fieldId:`voice-${n}-${r}-api-key`,value:typeof a.apiKey==`string`?a.apiKey:``,onChange:e=>p({apiKey:e}),labels:u,placeholder:e.placeholder}),e.description?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:e.description}):null]},e.key):e.key===`model`&&o.length>0?(0,$.jsxs)(`div`,{className:O(`flex flex-col gap-1.5`,hn),children:[(0,$.jsx)(zn,{htmlFor:`voice-${n}-${r}-model`,children:b.stt.model}),(0,$.jsx)(d,{id:`voice-${n}-${r}-model`,className:_n(),value:c??``,onChange:e=>p({model:e.target.value,..._?{voice:void 0}:{}}),children:o.map(Pn)})]},e.key):e.key===`voice`&&g.length>0?(0,$.jsxs)(`div`,{className:O(`flex flex-col gap-1.5`,hn),children:[(0,$.jsx)(zn,{htmlFor:`voice-${n}-${r}-voice`,children:b.tts.voice}),(0,$.jsxs)(d,{id:`voice-${n}-${r}-voice`,className:_n(),value:l??``,onChange:e=>p({voice:e.target.value}),children:[l&&!g.some(e=>e.id===l)?(0,$.jsxs)(f,{value:l,children:[l,` · unavailable`]}):null,g.map(e=>(0,$.jsxs)(f,{value:e.id,children:[Le(e,v),e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,e.style?` · ${e.style}`:``]},e.id))]}),g.find(e=>e.id===l)?.description?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:g.find(e=>e.id===l)?.description}):null]},e.key):(0,$.jsx)(Ln,{fieldId:`voice-${n}-${r}-${e.key}`,field:e,value:wn(a,e),onChange:t=>p({[e.key]:t}),className:e.type===`textarea`?`sm:col-span-2`:hn},e.key)),t[20]=u,t[21]=c,t[22]=l,t[23]=n,t[24]=v,t[25]=o,t[26]=p,t[27]=r,t[28]=a,t[29]=_,t[30]=b,t[31]=g,t[32]=m):m=t[32];let h=m;t[33]!==i||t[34]!==h?(S=h(i.filter(x)),t[33]=i,t[34]=h,t[35]=S):S=t[35],C=s.length?(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3 sm:col-span-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:b.experience.providerOptions}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:h(s)})]}):null,t[4]=u,t[5]=c,t[6]=l,t[7]=i,t[8]=n,t[9]=v,t[10]=o,t[11]=p,t[12]=r,t[13]=a,t[14]=_,t[15]=b,t[16]=g,t[17]=S,t[18]=C}else S=t[17],C=t[18];let w;return t[36]!==S||t[37]!==C?(w=(0,$.jsxs)($.Fragment,{children:[S,C]}),t[36]=S,t[37]=C,t[38]=w):w=t[38],w}function Pn(e){return(0,$.jsx)(f,{value:e.id,children:e.name},e.id)}function Fn(e){return e.required||[`apiKey`,`model`,`voice`].includes(e.key)}function In(e){return e.language}function Ln(e){let t=(0,zt.c)(37),{fieldId:n,field:r,value:i,onChange:a,className:o}=e,s=n??`voice-schema-field-${r.key}`,c=r.description;if(r.type===`boolean`){let e;t[0]===o?e=t[1]:(e=O(`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,o),t[0]=o,t[1]=e);let n;t[2]===r.label?n=t[3]:(n=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.label}),t[2]=r.label,t[3]=n);let s;t[4]===c?s=t[5]:(s=c?(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:c}):null,t[4]=c,t[5]=s);let l;t[6]!==n||t[7]!==s?(l=(0,$.jsxs)(`span`,{children:[n,s]}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u=!!i,d;t[9]!==r||t[10]!==a?(d=e=>a(Tn(r,e.target.checked)),t[9]=r,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==e||t[16]!==l||t[17]!==f?(p=(0,$.jsxs)(`label`,{className:e,children:[l,f]}),t[15]=e,t[16]=l,t[17]=f,t[18]=p):p=t[18],p}let l=typeof i==`boolean`?``:String(i),u;t[19]===o?u=t[20]:(u=O(`flex flex-col gap-1.5`,o),t[19]=o,t[20]=u);let f;t[21]!==r.label||t[22]!==s?(f=(0,$.jsx)(zn,{htmlFor:s,children:r.label}),t[21]=r.label,t[22]=s,t[23]=f):f=t[23];let p;t[24]!==o||t[25]!==r||t[26]!==l||t[27]!==s||t[28]!==a?(p=r.type===`select`?(0,$.jsx)(d,{id:s,className:_n(),value:l,required:r.required,onChange:e=>a(Tn(r,e.target.value)),children:(r.options??[]).map(Rn)}):r.type===`textarea`?(0,$.jsx)(`textarea`,{id:s,className:O(gn(),`min-h-24 resize-y`),value:l,required:r.required,placeholder:r.placeholder,onChange:e=>a(Tn(r,e.target.value))}):r.type===`password`?(0,$.jsx)(v,{id:s,className:o,value:l,onChange:e=>a(Tn(r,e)),placeholder:r.placeholder,labels:nt}):r.type===`number`?(0,$.jsx)(mt,{id:s,className:gn(),autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,allowEmpty:!r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a(Tn(r,e.target.value))}):(0,$.jsx)(`input`,{id:s,className:gn(),type:`text`,autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a(Tn(r,e.target.value))}),t[24]=o,t[25]=r,t[26]=l,t[27]=s,t[28]=a,t[29]=p):p=t[29];let m;t[30]===c?m=t[31]:(m=c?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:c}):null,t[30]=c,t[31]=m);let h;return t[32]!==u||t[33]!==f||t[34]!==p||t[35]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[f,p,m]}),t[32]=u,t[33]=f,t[34]=p,t[35]=m,t[36]=h):h=t[36],h}function Rn(e){return(0,$.jsx)(f,{value:e.id,children:e.name},e.id)}function zn(e){let t=(0,zt.c)(3),{children:n,htmlFor:r}=e,i;return t[0]!==n||t[1]!==r?(i=r?(0,$.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:n}):(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Bn(e){return e.some(e=>e.disabled?!1:e.type===`searxng`?e.url.trim().length>0:e.apiKey.trim().length>0)}function Vn(e){let t=e&&typeof e==`object`&&`tools`in e?e.tools:void 0,n=t&&typeof t==`object`&&`web`in t?t.web:void 0,r=n&&typeof n==`object`&&`region`in n?n.region:void 0,i=r===`cn`||r===`global`?r:`auto`,a=n&&typeof n==`object`&&`search`in n?n.search:void 0,o=a&&typeof a==`object`?a:{},s=typeof o.maxResults==`number`&&Number.isFinite(o.maxResults)?Math.floor(o.maxResults):5,c=n&&typeof n==`object`&&`blocklist`in n?n.blocklist:void 0,l=c&&typeof c==`object`?c:{},u=Array.isArray(l.domains)?l.domains.filter(e=>typeof e==`string`&&e.trim().length>0):[],d=o.providers;return{regionMode:i,maxResults:s,providers:Array.isArray(d)?d.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=n.type,i=r===`brave`||r===`tavily`||r===`bing`||r===`searxng`?r:`brave`;return{clientKey:`search-provider-${t}`,type:i,apiKey:typeof n.apiKey==`string`?n.apiKey:``,url:typeof n.url==`string`?n.url:``,disabled:n.disabled===!0}}):[],blocklistEnabled:l.enabled===!0,blocklistDomains:u}}async function Hn(e){let t=e.regionMode===`auto`?`auto`:e.regionMode===`cn`?`cn`:`global`,n={maxResults:e.maxResults,providers:e.providers.map(e=>{let t={type:e.type,apiKey:e.apiKey};return e.type===`searxng`&&e.url.trim()&&(t.url=e.url.trim().replace(/\/+$/,``)),e.disabled&&(t.disabled=!0),t})};await k(N(`/api/config`),{method:`PATCH`,body:JSON.stringify({tools:{web:{region:t,search:n,blocklist:{enabled:e.blocklistEnabled,domains:e.blocklistDomains}}}})}),U()}async function Un(e){let t=await k(N(`/api/tools/web/reveal-search-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({index:e})});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function Wn(e){let t=(0,zt.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Gn(){return O(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,ne,`dark:border-edge`)}function Kn(){return O(K,G)}var qn=[`brave`,`tavily`,`bing`,`searxng`];function Jn(){return{clientKey:crypto.randomUUID(),type:`brave`,apiKey:``,url:``,disabled:!1}}var Yn=oe();function Xn(){let e=D(M(e=>e.language)),t=e.webSearchSettings,n=e.logs,r=!!A(e=>e.conversationId),[i,a]=(0,Q.useReducer)(Yn,{form:null,baseline:null}),o=i.form,s=i.baseline,c=(0,Q.useRef)(!1),l=(0,Q.useRef)(o);l.current=o;let u=(0,Q.useRef)(null),{data:p,error:m,isLoading:h,mutate:_}=W(r);ae({enabled:r,parsed:(0,Q.useMemo)(()=>p?.payload?.config===void 0?null:Vn(p.payload.config),[p]),dirty:c.current,trackedParsedRef:u,dispatch:a,onResetDirty:()=>{c.current=!1}});let v=!!(r&&h&&p===void 0&&!m),y=m instanceof Error?m.message:m?String(m):null,b=(0,Q.useMemo)(()=>!o||!s?!1:JSON.stringify(o)!==JSON.stringify(s),[o,s]),x=(0,Q.useCallback)(e=>{c.current=!0,a({type:`patch`,patch:e})},[]),S=xt({value:o,dirty:b,onSave:(0,Q.useCallback)(async e=>{try{await Hn(e),a({type:`saved`,value:e}),c.current=!!(l.current&&JSON.stringify(l.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});if(!r)return(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})});if(v)return(0,$.jsx)(yt,{rows:3});if(!o)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y??t.loadError}),(0,$.jsx)(V,{type:`button`,variant:`secondary`,onClick:()=>void _(),children:n.refresh})]});let C=Bn(o.providers);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,onBlurCapture:S.onBlurCapture,children:[S.error?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S.error}):null,(0,$.jsxs)(vt,{children:[(0,$.jsx)(_t,{icon:$e,title:t.sectionSearch,subtitle:t.sectionSearchHint,trailing:(0,$.jsx)(bt,{status:S.status,error:S.error})}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-edge bg-surface-base/55 px-4 py-3`,children:[(0,$.jsx)(g,{className:`mt-0.5 size-5 shrink-0 text-accent`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.cloudProvider}),(0,$.jsx)(`span`,{className:O(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C?`bg-surface-panel text-fg-muted`:`bg-accent-soft text-accent`),children:C?t.cloudOverridden:t.cloudAutomatic})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-subtle`,children:C?t.cloudOverriddenHint:t.cloudAutomaticHint})]})]}),(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.providersTitle}),o.providers.map((n,r)=>(0,$.jsx)(Zn,{row:n,providerIndex:r,labels:t,secretLabels:He(e.providersSettings),onChange:e=>{let t=[...o.providers];t[r]=e,x({providers:t})},onRemove:()=>{x({providers:o.providers.filter((e,t)=>t!==r)})}},n.clientKey??r)),(0,$.jsxs)(V,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5 text-sm`,onClick:()=>x({providers:[...o.providers,Jn()]}),children:[(0,$.jsx)(w,{className:`size-4`}),t.addProvider]})]})]}),(0,$.jsxs)(vt,{children:[(0,$.jsx)(_t,{icon:Te,title:t.sectionPreferences}),(0,$.jsxs)(`div`,{className:`grid max-w-2xl gap-4 sm:grid-cols-2`,children:[(0,$.jsx)(Wn,{label:t.regionLabel,description:t.regionDesc,children:(0,$.jsxs)(d,{className:Kn(),value:o.regionMode,onChange:e=>x({regionMode:e.target.value}),children:[(0,$.jsx)(f,{value:`auto`,children:t.regionAuto}),(0,$.jsx)(f,{value:`cn`,children:t.regionCn}),(0,$.jsx)(f,{value:`global`,children:t.regionGlobal})]})}),(0,$.jsx)(Me,{title:t.maxResultsLabel,summary:o.maxResults,children:(0,$.jsx)(Wn,{label:t.maxResultsLabel,description:t.maxResultsDesc,children:(0,$.jsx)(mt,{type:`number`,min:1,max:50,className:Gn(),value:o.maxResults,onChange:e=>x({maxResults:Math.max(1,Math.min(50,Number(e.target.value)||5))})})})})]})]}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[t.sectionBlocklist,` · `,o.blocklistEnabled?o.blocklistDomains.length:0]}),(0,$.jsxs)(vt,{children:[(0,$.jsx)(_t,{icon:je,title:t.sectionBlocklist,subtitle:t.sectionBlocklistHint}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:o.blocklistEnabled,onChange:e=>x({blocklistEnabled:e.target.checked})}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.blocklistEnabled}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:t.blocklistEnabledDesc})]})]}),o.blocklistEnabled?(0,$.jsx)(Wn,{label:t.blocklistDomains,description:t.blocklistDomainsDesc,children:(0,$.jsx)(`textarea`,{className:O(Gn(),`min-h-[6rem] font-mono text-xs`),value:o.blocklistDomains.join(`
|
|
8
|
+
`),placeholder:t.blocklistDomainsPlaceholder,onChange:e=>{x({blocklistDomains:e.target.value.split(/\r?\n/).flatMap(e=>{let t=e.trim().toLowerCase();return t?[t]:[]})})}})}):null]})]})]})]})}function Zn(e){let t=(0,zt.c)(54),{row:n,providerIndex:r,labels:i,secretLabels:a,onChange:o,onRemove:s}=e,c;t[0]===r?c=t[1]:(c=()=>Un(r).then(Qn),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(Kn(),`min-w-[8rem]`),t[2]=u):u=t[2];let p=n.type,m;t[3]!==o||t[4]!==n?(m=e=>o({...n,type:e.target.value,url:e.target.value===`searxng`?n.url:``}),t[3]=o,t[4]=n,t[5]=m):m=t[5];let h;t[6]===i.providerTypes?h=t[7]:(h=qn.map(e=>(0,$.jsx)(f,{value:e,children:i.providerTypes[e]},e)),t[6]=i.providerTypes,t[7]=h);let g;t[8]!==n.type||t[9]!==m||t[10]!==h?(g=(0,$.jsx)(d,{className:u,value:p,onChange:m,children:h}),t[8]=n.type,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;t[12]!==o||t[13]!==n?(_=e=>o({...n,disabled:e.target.checked}),t[12]=o,t[13]=n,t[14]=_):_=t[14];let y;t[15]!==n.disabled||t[16]!==_?(y=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:n.disabled,onChange:_}),t[15]=n.disabled,t[16]=_,t[17]=y):y=t[17];let b;t[18]!==i.disabled||t[19]!==y?(b=(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-fg-muted`,children:[y,i.disabled]}),t[18]=i.disabled,t[19]=y,t[20]=b):b=t[20];let x;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(De,{className:`size-4`}),t[21]=x):x=t[21];let S;t[22]===s?S=t[23]:(S=(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-fg-muted`,onClick:s,children:x}),t[22]=s,t[23]=S);let C;t[24]!==S||t[25]!==b?(C=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,S]}),t[24]=S,t[25]=b,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==g?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[g,C]}),t[27]=C,t[28]=g,t[29]=w):w=t[29];let T;t[30]!==i.urlDesc||t[31]!==i.urlLabel||t[32]!==o||t[33]!==n?(T=n.type===`searxng`?(0,$.jsx)(Wn,{label:i.urlLabel,description:i.urlDesc,children:(0,$.jsx)(`input`,{type:`url`,className:Gn(),value:n.url,placeholder:`http://localhost:8080`,onChange:e=>o({...n,url:e.target.value})})}):null,t[30]=i.urlDesc,t[31]=i.urlLabel,t[32]=o,t[33]=n,t[34]=T):T=t[34];let E;t[35]!==o||t[36]!==n?(E=e=>o({...n,apiKey:e}),t[35]=o,t[36]=n,t[37]=E):E=t[37];let D;t[38]!==i.keyPlaceholder||t[39]!==i.keyPlaceholderMasked||t[40]!==i.saveError||t[41]!==l||t[42]!==n.apiKey||t[43]!==a||t[44]!==E?(D=(0,$.jsx)(v,{value:n.apiKey,onChange:E,placeholder:i.keyPlaceholder,labels:a,reveal:l,loadFailedLabel:i.saveError,notInConfigFile:i.keyPlaceholderMasked}),t[38]=i.keyPlaceholder,t[39]=i.keyPlaceholderMasked,t[40]=i.saveError,t[41]=l,t[42]=n.apiKey,t[43]=a,t[44]=E,t[45]=D):D=t[45];let k;t[46]!==i.apiKeyDesc||t[47]!==i.apiKeyLabel||t[48]!==D?(k=(0,$.jsx)(Wn,{label:i.apiKeyLabel,description:i.apiKeyDesc,children:D}),t[46]=i.apiKeyDesc,t[47]=i.apiKeyLabel,t[48]=D,t[49]=k):k=t[49];let A;return t[50]!==w||t[51]!==T||t[52]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-panel/60 p-4`,children:[w,T,k]}),t[50]=w,t[51]=T,t[52]=k,t[53]=A):A=t[53],A}function Qn(e){return e.apiKey??null}function $n(e){let t=(0,zt.c)(185),{model:n,isNew:r,providerId:i,onSave:a,onClose:o,m:s}=e,c=M(tr)===`zh`,l;t[0]===n?l=t[1]:(l=()=>n?{...n}:ke(``),t[0]=n,t[1]=l);let[u,p]=(0,Q.useState)(l),[m,h]=(0,Q.useState)(er),g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(e,t)=>{p(n=>({...n,[e]:t})),h(t=>{let n=new Map(t);return n.delete(e),n})},t[2]=g):g=t[2];let _=g,v;t[3]!==u.computerUse||t[4]!==u.contextWindow||t[5]!==u.id||t[6]!==u.input||t[7]!==u.maxTokens||t[8]!==s.modelIdRequired||t[9]!==s.mustBePositive||t[10]!==c?(v=()=>{let e=new Map;return(u.id||``).trim()||e.set(`id`,s.modelIdRequired),u.contextWindow!==void 0&&u.contextWindow<=0&&e.set(`contextWindow`,s.mustBePositive),u.maxTokens!==void 0&&u.maxTokens<=0&&e.set(`maxTokens`,s.mustBePositive),u.computerUse&&!u.input?.includes(`image`)&&e.set(`computerUse`,c?`电脑控制模型必须支持图片输入`:`Computer Use requires image input`),h(e),e.size===0},t[3]=u.computerUse,t[4]=u.contextWindow,t[5]=u.id,t[6]=u.input,t[7]=u.maxTokens,t[8]=s.modelIdRequired,t[9]=s.mustBePositive,t[10]=c,t[11]=v):v=t[11];let y=v,b;t[12]!==u||t[13]!==o||t[14]!==a||t[15]!==y?(b=()=>{if(!y())return;let e=(u.id||``).trim();a({...u,id:e,name:u.name?.trim()||e,reasoning:u.reasoning||!1,input:u.input||[`text`],contextWindow:u.contextWindow??128e3,maxTokens:u.maxTokens??16384,cost:{input:u.cost?.input??0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}}),o()},t[12]=u,t[13]=o,t[14]=a,t[15]=y,t[16]=b):b=t[16];let x=b,S=u,C;t[17]===S?C=t[18]:(C=fe(S),t[17]=S,t[18]=C);let w=C,T=r?s.addModelTitle:s.editModelTitle,D;t[19]===T?D=t[20]:(D=(0,$.jsx)(ee,{className:`text-base font-semibold text-fg`,children:T}),t[19]=T,t[20]=D);let k;t[21]!==s.modelProviderLabel||t[22]!==i?(k=i?(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[s.modelProviderLabel,`: `,i]}):null,t[21]=s.modelProviderLabel,t[22]=i,t[23]=k):k=t[23];let A;t[24]!==D||t[25]!==k?(A=(0,$.jsxs)(`div`,{children:[D,k]}),t[24]=D,t[25]=k,t[26]=A):A=t[26];let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=O(te,`p-1.5 hover:bg-surface-base`),t[27]=j):j=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(E,{className:`size-4`}),t[28]=N):N=t[28];let P;t[29]===s.close?P=t[30]:(P=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:j,"aria-label":s.close,children:N})}),t[29]=s.close,t[30]=P);let F;t[31]!==A||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-2`,children:[A,P]}),t[31]=A,t[32]=P,t[33]=F):F=t[33];let L;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`}),t[34]=L):L=t[34];let R;t[35]===s.modelId?R=t[36]:(R=(0,$.jsxs)(`label`,{className:`mb-1 block text-xs font-medium text-fg`,children:[s.modelId,L]}),t[35]=s.modelId,t[36]=R);let z;t[37]===m?z=t[38]:(z=O(lt(),m.has(`id`)&&`border-red-500`),t[37]=m,t[38]=z);let B=u.id||``,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>_(`id`,e.target.value),t[39]=H):H=t[39];let U=!r,W;t[40]!==z||t[41]!==B||t[42]!==U?(W=(0,$.jsx)(`input`,{className:z,value:B,onChange:H,placeholder:`e.g. llama3.1:8b`,disabled:U}),t[40]=z,t[41]=B,t[42]=U,t[43]=W):W=t[43];let G;t[44]===m?G=t[45]:(G=m.has(`id`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:m.get(`id`)}):null,t[44]=m,t[45]=G);let K;t[46]!==R||t[47]!==W||t[48]!==G?(K=(0,$.jsxs)(`div`,{children:[R,W,G]}),t[46]=R,t[47]=W,t[48]=G,t[49]=K):K=t[49];let ne;t[50]===s.displayName?ne=t[51]:(ne=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.displayName}),t[50]=s.displayName,t[51]=ne);let re;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=lt(),t[52]=re):re=t[52];let q=u.name||``,ie;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>_(`name`,e.target.value),t[53]=ie):ie=t[53];let J;t[54]===q?J=t[55]:(J=(0,$.jsx)(`input`,{className:re,value:q,onChange:ie}),t[54]=q,t[55]=J);let Y;t[56]!==ne||t[57]!==J?(Y=(0,$.jsxs)(`div`,{children:[ne,J]}),t[56]=ne,t[57]=J,t[58]=Y):Y=t[58];let ae;t[59]===s.inputTypes?ae=t[60]:(ae=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.inputTypes}),t[59]=s.inputTypes,t[60]=ae);let oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(oe=ot(),t[61]=oe):oe=t[61];let X;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(X=e=>_(`input`,Oe(e.target.value)),t[62]=X):X=t[62];let Z;t[63]===s?Z=t[64]:(Z=Ve.map(e=>(0,$.jsx)(f,{value:e.value,children:s[e.labelKey]},e.value)),t[63]=s,t[64]=Z);let se;t[65]!==w||t[66]!==Z?(se=(0,$.jsx)(d,{className:oe,value:w,onChange:X,children:Z}),t[65]=w,t[66]=Z,t[67]=se):se=t[67];let ce;t[68]!==ae||t[69]!==se?(ce=(0,$.jsxs)(`div`,{children:[ae,se]}),t[68]=ae,t[69]=se,t[70]=ce):ce=t[70];let le=u.reasoning||!1,ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>_(`reasoning`,e.target.checked),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:le,onChange:ue}),t[72]=le,t[73]=de);let pe;t[74]!==s.reasoning||t[75]!==de?(pe=(0,$.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[de,s.reasoning]}),t[74]=s.reasoning,t[75]=de,t[76]=pe):pe=t[76];let me;t[77]!==ce||t[78]!==pe?(me=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ce,pe]}),t[77]=ce,t[78]=pe,t[79]=me):me=t[79];let he;t[80]===s.contextWindow?he=t[81]:(he=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.contextWindow}),t[80]=s.contextWindow,t[81]=he);let ge;t[82]===m?ge=t[83]:(ge=O(lt(),m.has(`contextWindow`)&&`border-red-500`),t[82]=m,t[83]=ge);let _e=u.contextWindow??128e3,ve;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>_(`contextWindow`,parseInt(e.target.value,10)||0),t[84]=ve):ve=t[84];let ye;t[85]!==ge||t[86]!==_e?(ye=(0,$.jsx)(mt,{type:`number`,min:1,className:ge,value:_e,onChange:ve}),t[85]=ge,t[86]=_e,t[87]=ye):ye=t[87];let be;t[88]===m?be=t[89]:(be=m.has(`contextWindow`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:m.get(`contextWindow`)}):null,t[88]=m,t[89]=be);let xe;t[90]!==he||t[91]!==ye||t[92]!==be?(xe=(0,$.jsxs)(`div`,{children:[he,ye,be]}),t[90]=he,t[91]=ye,t[92]=be,t[93]=xe):xe=t[93];let Se;t[94]===s.maxOutputTokens?Se=t[95]:(Se=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.maxOutputTokens}),t[94]=s.maxOutputTokens,t[95]=Se);let Ce;t[96]===m?Ce=t[97]:(Ce=O(lt(),m.has(`maxTokens`)&&`border-red-500`),t[96]=m,t[97]=Ce);let we=u.maxTokens??16384,Te;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>_(`maxTokens`,parseInt(e.target.value,10)||0),t[98]=Te):Te=t[98];let Ee;t[99]!==Ce||t[100]!==we?(Ee=(0,$.jsx)(mt,{type:`number`,min:1,className:Ce,value:we,onChange:Te}),t[99]=Ce,t[100]=we,t[101]=Ee):Ee=t[101];let De;t[102]===m?De=t[103]:(De=m.has(`maxTokens`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:m.get(`maxTokens`)}):null,t[102]=m,t[103]=De);let Ae;t[104]!==Se||t[105]!==Ee||t[106]!==De?(Ae=(0,$.jsxs)(`div`,{children:[Se,Ee,De]}),t[104]=Se,t[105]=Ee,t[106]=De,t[107]=Ae):Ae=t[107];let je;t[108]!==xe||t[109]!==Ae?(je=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[xe,Ae]}),t[108]=xe,t[109]=Ae,t[110]=je):je=t[110];let Me;t[111]===s.costSection?Me=t[112]:(Me=(0,$.jsx)(`p`,{className:`mb-2 text-xs font-semibold text-fg`,children:s.costSection}),t[111]=s.costSection,t[112]=Me);let Ne;t[113]===s.costInput?Ne=t[114]:(Ne=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costInput}),t[113]=s.costInput,t[114]=Ne);let Pe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=lt(),t[115]=Pe):Pe=t[115];let Fe=u.cost?.input??0,Ie;t[116]===u.cost?Ie=t[117]:(Ie=e=>_(`cost`,{...u.cost,input:parseFloat(e.target.value)||0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[116]=u.cost,t[117]=Ie);let Le;t[118]!==Fe||t[119]!==Ie?(Le=(0,$.jsx)(mt,{type:`number`,step:`any`,min:0,className:Pe,value:Fe,onChange:Ie}),t[118]=Fe,t[119]=Ie,t[120]=Le):Le=t[120];let Re;t[121]!==Ne||t[122]!==Le?(Re=(0,$.jsxs)(`div`,{children:[Ne,Le]}),t[121]=Ne,t[122]=Le,t[123]=Re):Re=t[123];let ze;t[124]===s.costOutput?ze=t[125]:(ze=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costOutput}),t[124]=s.costOutput,t[125]=ze);let Be;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Be=lt(),t[126]=Be):Be=t[126];let He=u.cost?.output??0,Ue;t[127]===u.cost?Ue=t[128]:(Ue=e=>_(`cost`,{...u.cost,input:u.cost?.input??0,output:parseFloat(e.target.value)||0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[127]=u.cost,t[128]=Ue);let We;t[129]!==He||t[130]!==Ue?(We=(0,$.jsx)(mt,{type:`number`,step:`any`,min:0,className:Be,value:He,onChange:Ue}),t[129]=He,t[130]=Ue,t[131]=We):We=t[131];let Ge;t[132]!==ze||t[133]!==We?(Ge=(0,$.jsxs)(`div`,{children:[ze,We]}),t[132]=ze,t[133]=We,t[134]=Ge):Ge=t[134];let Ke;t[135]!==Re||t[136]!==Ge?(Ke=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[Re,Ge]}),t[135]=Re,t[136]=Ge,t[137]=Ke):Ke=t[137];let qe;t[138]!==Me||t[139]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2 dark:border-edge`,children:[Me,Ke]}),t[138]=Me,t[139]=Ke,t[140]=qe):qe=t[140];let Je;t[141]!==K||t[142]!==Y||t[143]!==me||t[144]!==je||t[145]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[K,Y,me,je,qe]}),t[141]=K,t[142]=Y,t[143]=me,t[144]=je,t[145]=qe,t[146]=Je):Je=t[146];let Ye=c?`高级:电脑控制协议`:`Advanced: Computer Use protocol`,Xe;t[147]===Ye?Xe=t[148]:(Xe=(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:Ye}),t[147]=Ye,t[148]=Xe);let Ze=c?`电脑控制协议`:`Computer Use protocol`,Qe=u.computerUse?.profile??``,$e;t[149]===Symbol.for(`react.memo_cache_sentinel`)?($e=e=>_(`computerUse`,e.target.value?{profile:e.target.value}:void 0),t[149]=$e):$e=t[149];let et=c?`未声明`:`Not declared`,tt;t[150]===et?tt=t[151]:(tt=(0,$.jsx)(f,{value:``,children:et}),t[150]=et,t[151]=tt);let nt,rt,it;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,$.jsx)(f,{value:`gui-plus-2026-02-26`,children:`GUI-Plus (2026-02-26)`}),rt=(0,$.jsx)(f,{value:`structured-tools-v1`,children:`structured-tools-v1`}),it=(0,$.jsx)(f,{value:`openai-responses-computer-v1`,children:`OpenAI Responses Computer`}),t[152]=nt,t[153]=rt,t[154]=it):(nt=t[152],rt=t[153],it=t[154]);let at;t[155]!==Ze||t[156]!==Qe||t[157]!==tt?(at=(0,$.jsxs)(d,{"aria-label":Ze,value:Qe,onChange:$e,children:[tt,nt,rt,it]}),t[155]=Ze,t[156]=Qe,t[157]=tt,t[158]=at):at=t[158];let st=c?`协议必须与模型 API 匹配。声明协议不代表模型已通过效果验证。`:`The protocol must match the model API. Declaring a protocol does not certify model quality.`,ct;t[159]===st?ct=t[160]:(ct=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:st}),t[159]=st,t[160]=ct);let ut;t[161]===m?ut=t[162]:(ut=m.has(`computerUse`)&&(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:m.get(`computerUse`)}),t[161]=m,t[162]=ut);let dt;t[163]!==at||t[164]!==ct||t[165]!==ut?(dt=(0,$.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[at,ct,ut]}),t[163]=at,t[164]=ct,t[165]=ut,t[166]=dt):dt=t[166];let ft;t[167]!==Xe||t[168]!==dt?(ft=(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge p-3 text-sm text-fg`,children:[Xe,dt]}),t[167]=Xe,t[168]=dt,t[169]=ft):ft=t[169];let pt;t[170]!==Je||t[171]!==ft?(pt=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[Je,ft]}),t[170]=Je,t[171]=ft,t[172]=pt):pt=t[172];let ht;t[173]===s.cancel?ht=t[174]:(ht=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(V,{type:`button`,variant:`secondary`,children:s.cancel})}),t[173]=s.cancel,t[174]=ht);let gt=r?s.addModelConfirm:s.saveModelConfirm,_t;t[175]!==x||t[176]!==gt?(_t=(0,$.jsx)(V,{type:`button`,variant:`primary`,className:`hover:bg-accent/90`,onClick:x,children:gt}),t[175]=x,t[176]=gt,t[177]=_t):_t=t[177];let vt;t[178]!==ht||t[179]!==_t?(vt=(0,$.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[ht,_t]}),t[178]=ht,t[179]=_t,t[180]=vt):vt=t[180];let yt;return t[181]!==F||t[182]!==pt||t[183]!==vt?(yt=(0,$.jsxs)($.Fragment,{children:[F,pt,vt]}),t[181]=F,t[182]=pt,t[183]=vt,t[184]=yt):yt=t[184],yt}function er(){return new Map}function tr(e){return e.language}function nr(e){let t=(0,zt.c)(16),{open:n,onOpenChange:r,providerId:i,model:a,isNew:o,onSave:s,m:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(P,{className:O(`xopc-dialog-overlay fixed inset-0 bg-scrim`,J)}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,720px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,ie,`overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`),t[1]=u):u=t[1];let d;t[2]!==o||t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n||t[8]!==i?(d=n?(0,$.jsx)($n,{model:a,isNew:o,providerId:i,onSave:s,onClose:()=>r(!1),m:c},`${i??`none`}-${a?.id??`new`}`):null,t[2]=o,t[3]=c,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=i,t[9]=d):d=t[9];let f;t[10]===d?f=t[11]:(f=(0,$.jsxs)(L,{children:[l,(0,$.jsx)(R,{className:u,onOpenAutoFocus:rr,children:d})]}),t[10]=d,t[11]=f);let p;return t[12]!==r||t[13]!==n||t[14]!==f?(p=(0,$.jsx)(z,{open:n,onOpenChange:r,children:f}),t[12]=r,t[13]=n,t[14]=f,t[15]=p):p=t[15],p}function rr(e){return e.preventDefault()}function ir(e){let t=(0,zt.c)(14),{providerId:n,inputId:r,value:i,onChange:a,labels:o}=e,s;t[0]===n?s=t[1]:(s=()=>Fe(n).then(ar),t[0]=n,t[1]=s);let c=s,l;t[2]!==r||t[3]!==o.apiKeyLabel?(l=(0,$.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:o.apiKeyLabel}),t[2]=r,t[3]=o.apiKeyLabel,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==o||t[7]!==a||t[8]!==c||t[9]!==i?(u=(0,$.jsx)(v,{id:r,value:i,onChange:a,placeholder:o.apiKeyPlaceholder,labels:o,reveal:c,loadFailedLabel:o.loadFailed,maskedHelp:o.maskedHelp,notInConfigFile:o.notInConfigFile}),t[5]=r,t[6]=o,t[7]=a,t[8]=c,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function ar(e){return e.apiKey??null}function or(e){let t=(0,zt.c)(20),{open:n,onOpenChange:r,providerId:i,isCustom:a,builtinRows:o,customConfig:s,allModels:c,labels:l,language:u,onSaved:d}=e,[f,p]=(0,Q.useState)(null),m;t[0]===r?m=t[1]:(m=e=>{e||p(null),r(e)},t[0]=r,t[1]=m);let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(P,{className:O(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,J)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=O(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(85vh,720px)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,ie),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==o||t[6]!==s||t[7]!==h||t[8]!==a||t[9]!==l||t[10]!==u||t[11]!==r||t[12]!==d||t[13]!==i||t[14]!==f?(v=(0,$.jsxs)(L,{children:[g,(0,$.jsx)(R,{className:_,children:f?(0,$.jsx)(dt,{target:f,zh:u===`zh`,onDone:()=>h(!1)}):a?(0,$.jsx)(cr,{providerId:i,customConfig:s,labels:l,language:u,onClose:()=>r(!1),onSaved:d,onModelAdded:e=>p({providerId:i,modelIds:[e]})}):(0,$.jsx)(sr,{providerId:i,builtinRows:o,allModels:c,labels:l,language:u,onClose:()=>r(!1),onSaved:d})})]}),t[4]=c,t[5]=o,t[6]=s,t[7]=h,t[8]=a,t[9]=l,t[10]=u,t[11]=r,t[12]=d,t[13]=i,t[14]=f,t[15]=v):v=t[15];let y;return t[16]!==h||t[17]!==n||t[18]!==v?(y=(0,$.jsx)(z,{open:n,onOpenChange:h,children:v}),t[16]=h,t[17]=n,t[18]=v,t[19]=y):y=t[19],y}function sr({providerId:e,builtinRows:t,allModels:n,labels:r,language:i,onClose:a,onSaved:o}){let s=t.find(t=>t.id===e),c=pe[e],u=n.filter(t=>t.provider===e),[d,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(s?.apiKey??``),[g,v]=(0,Q.useState)(!1),[y,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),k=D(i).providersSettings,A=s?.supportsApiKey!==!1,j=s?.supportsOAuth===!0,M=s?.authMode===`oauth`&&s.authStatus===`connected`,N=s?.configured===!0&&s.activeKeySource!==`env`&&s.activeKeySource!==`extension`&&s.activeKeySource!==`models_json`,[P,F]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(`idle`),[te,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,re]=(0,Q.useState)(null),[q,ie]=(0,Q.useState)(``),J=(0,Q.useRef)(null),Y=(0,Q.useRef)(null),ae=z===`waiting`||z===`waiting_code`,oe=(0,Q.useMemo)(()=>Ce(e,i),[e,i]),X=p!==(s?.apiKey??``),Z=async()=>{let t=p.trim();if(!(!t||!A||_e(t))){v(!0),C(null);try{await Ae({[e]:t}),x(!0),window.setTimeout(()=>{o(),a()},600)}catch(e){C(e instanceof Error?e.message:r.saveError)}finally{v(!1)}}};(0,Q.useEffect)(()=>{if(!P||!ae)return;let e=window.setInterval(()=>{(async()=>{try{let t=await ve(P);t.status===`waiting_auth`||t.status===`waiting_code`?(B(t.status===`waiting_code`?`waiting_code`:`waiting`),R(t.message??null),U(t.authUrl??null),G(t.instructions??null),re(t.deviceCode??null),t.authUrl&&t.authUrl!==Y.current&&(Y.current=t.authUrl,Ye(t.authUrl,J.current).catch(()=>{}))):t.status===`completed`?(window.clearInterval(e),ce(J.current),J.current=null,B(`success`),R(t.message??k.saved),window.setTimeout(()=>{o(),a()},600)):(t.status===`failed`||t.status===`cancelled`)&&(window.clearInterval(e),ce(J.current),J.current=null,B(`error`),R(t.error??t.message??k.revokeFailed))}catch{}})()},1e3);return()=>window.clearInterval(e)},[P,ae,a,o,k.revokeFailed,k.saved]),(0,Q.useEffect)(()=>()=>{P&&he(P).catch(()=>{})},[P]),(0,Q.useEffect)(()=>()=>{ce(J.current),J.current=null},[]);let se=async()=>{try{await ue(e),o(),a()}catch{}},le=async()=>{ce(J.current),J.current=be(),Y.current=null,B(`waiting`),R(k.oauthStarting),U(null),G(null),re(null),C(null);try{F((await Ee(e)).sessionId)}catch(e){ce(J.current),J.current=null,B(`error`),R(e instanceof Error?e.message:k.revokeFailed)}},fe=async()=>{if(P){try{await we(P)}catch{}ce(J.current),J.current=null,Y.current=null,B(`idle`),R(null),F(null),U(null),G(null),re(null)}},me=async()=>{if(!(!P||!q.trim()))try{await ft(P,q.trim()),ie(``),R(k.oauthProcessingCode)}catch(e){B(`error`),R(e instanceof Error?e.message:k.revokeFailed)}},ge=async()=>{try{await ye(e),o(),a()}catch(e){C(e instanceof Error?e.message:k.revokeFailed)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsx)(ee,{className:`text-base font-semibold text-fg`,children:s?.name??e}),(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:O(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.press),children:(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[c?.description?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.description}):null,s?.baseUrl?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.apiUrlLabel}),(0,$.jsx)(`code`,{className:`break-all rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 font-mono text-xs text-fg-muted`,children:s.baseUrl})]}):s?.category===`extension`?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.apiUrlExtensionHint}):null,A?(0,$.jsx)(ir,{providerId:e,inputId:`manage-api-key`,value:p,onChange:e=>{h(e),x(!1)},labels:{apiKeyLabel:r.apiKeyLabel,apiKeyPlaceholder:r.apiKeyPlaceholder,maskedHelp:r.maskedHelp,copy:r.copy,copied:r.copied,show:r.showKey,hide:r.hideKey,notInConfigFile:r.notInConfigFile,loadFailed:r.loadFailed}}):s?.category===`extension`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:r.extensionKeyHint}),s?.extensionId?(0,$.jsxs)(l,{to:`/settings/ext/${encodeURIComponent(s.extensionId)}`,className:`inline-flex w-fit items-center gap-1 font-medium text-accent hover:underline`,title:r.extensionSettingsLinkTitle,onClick:a,children:[r.openExtensionSettings,(0,$.jsx)(_,{className:`size-3`,"aria-hidden":!0})]}):null]}):null,j?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:k.oauth}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:M?k.sourceOauth:k.oauthHint})]}),M?(0,$.jsx)(V,{type:`button`,variant:`secondary`,className:`gap-1.5 text-red-600 dark:text-red-400`,onClick:()=>void ge(),children:k.revoke}):(0,$.jsxs)(V,{type:`button`,variant:`primary`,className:`gap-1.5`,disabled:ae,onClick:()=>void le(),children:[ae?(0,$.jsx)(b,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(de,{className:`size-3.5`,"aria-hidden":!0}),k.oauth]})]}),L?(0,$.jsx)(`p`,{className:O(`text-xs`,z===`error`?`text-red-600 dark:text-red-400`:`text-fg-muted`),children:L}):null,z===`waiting`||z===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[te?(0,$.jsxs)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 rounded-md bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),k.openAuthPage]}):null,(0,$.jsx)(V,{type:`button`,variant:`secondary`,onClick:()=>void fe(),children:k.cancelOAuth})]}):null,W?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:W}):null,K?(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:k.deviceCodeLabel}),(0,$.jsx)(`code`,{className:`mt-1 block select-all font-mono text-lg font-semibold tracking-widest text-fg`,children:K}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:k.deviceCodeHint})]}):null,z===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`input`,{type:`text`,value:q,onChange:e=>ie(e.target.value),onKeyDown:e=>e.key===`Enter`&&void me(),placeholder:k.pasteRedirectUrl,className:O(`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,ne)}),(0,$.jsx)(V,{type:`button`,variant:`primary`,onClick:()=>void me(),children:k.submitCode})]}):null]}):null,oe.length>0&&A?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:oe.map(({kind:e,href:t})=>(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[Xe(e,r),(0,$.jsx)(_,{className:`size-3`,"aria-hidden":!0})]},e))}):null,u.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium text-fg`,children:[r.modelsLabel,` (`,u.length,`)`]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:d,onChange:e=>f(e.target.checked)}),i===`zh`?`仅电脑控制模型`:`Computer Use only`]}),(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-lg border border-edge-subtle bg-surface-panel/40 p-2`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.filter(e=>!d||e.computerUse).map(e=>(0,$.jsxs)(`span`,{className:`inline-block rounded-md bg-surface-hover px-2 py-1 text-xs text-fg-muted`,children:[Le(e,i),e.computerUse?` · Computer Use`:``]},e.id))})})]}):(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.noModels}),S?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[N?(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>T(!0),children:[(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),r.remove]}):(0,$.jsx)(`span`,{}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:A&&X&&!_e(p.trim())?(0,$.jsx)(V,{type:`button`,variant:`primary`,disabled:!p.trim()||g||y,onClick:()=>void Z(),children:y?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),r.saved]}):g?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(b,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.saving]}):r.save}):null})]}),(0,$.jsx)(rt,{open:w,title:r.removeConfirmTitle,description:r.removeConfirmDescription.replace(`{{provider}}`,s?.name??e),confirmLabel:r.removeConfirmAction,cancelLabel:r.cancel,destructive:!0,onConfirm:()=>void se(),onCancel:()=>T(!1)})]})}function cr({providerId:e,customConfig:t,labels:n,language:r,onClose:i,onSaved:a,onModelAdded:o}){let s=D(r).modelsSettings,c=t?.providers[e],[l,u]=(0,Q.useState)(c?.baseUrl??``),[d,f]=(0,Q.useState)(c?.apiKey??``),[p,m]=(0,Q.useState)(c?.models??[]),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(c?.modelDiscovery?.enabled===!0),[y,x]=(0,Q.useState)(!1),[C,T]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,L]=(0,Q.useState)(null),R=n=>{if(!t)return null;let r=d.trim(),i={...c,baseUrl:l.trim()||void 0,apiKey:_e(r)?c?.apiKey:r||void 0,...n};return{providers:{...t.providers,[e]:i}}},z=async()=>{let e=R({models:p,modelDiscovery:{enabled:_}});if(e){x(!0),T(null);try{await me(e),a(),i()}catch(e){T(e instanceof Error?e.message:n.saveError)}finally{x(!1)}}},B=async()=>{if(t)try{let{[e]:n,...r}=t.providers;await me({providers:r}),a(),i()}catch{}},te=(e,t)=>{L({model:e,isNew:t}),P(!0)},U=async e=>{if(!F)return;let t=F.isNew&&!p.some(t=>t.id===e.id),r=F.isNew?[...p,e]:p.map(t=>t.id===e.id?e:t);m(r);let i=R({models:r});if(i)try{await me(i),a(),t&&!e.computerUse&&o(e.id)}catch(e){T(e instanceof Error?e.message:n.saveError)}},W=async e=>{let t=p.filter(t=>t.id!==e);m(t),M(null);let r=R({models:t});if(r)try{await me(r),a()}catch(e){T(e instanceof Error?e.message:n.saveError)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ee,{className:`text-base font-semibold text-fg`,children:e}),(0,$.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:n.custom})]}),(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:O(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.press),children:(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`label`,{htmlFor:`manage-base-url`,className:`text-sm font-medium text-fg`,children:n.baseUrlLabel}),(0,$.jsx)(`input`,{id:`manage-base-url`,type:`url`,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),className:O(`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,ne)})]}),(0,$.jsx)(ir,{providerId:e,inputId:`manage-custom-api-key`,value:d,onChange:f,labels:{apiKeyLabel:n.apiKeyLabel,apiKeyPlaceholder:n.apiKeyPlaceholder,maskedHelp:n.maskedHelp,copy:n.copy,copied:n.copied,show:n.showKey,hide:n.hideKey,notInConfigFile:n.notInConfigFile,loadFailed:n.loadFailed}}),(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel/40 p-3`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-accent`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r===`zh`?`自动同步模型目录`:`Automatically sync model catalog`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-muted`,children:r===`zh`?`启动时及定时从此服务的 /models 接口更新模型。`:`Update models from this service’s /models endpoint at startup and on schedule.`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold text-fg`,children:[s.modelsSection,p.length>0?` (${p.length})`:``]}),(0,$.jsxs)(V,{type:`button`,variant:`primary`,className:`gap-1.5 px-2 py-1 text-xs`,onClick:()=>te(null,!0),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),s.addModel]})]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:h,onChange:e=>g(e.target.checked)}),r===`zh`?`仅电脑控制模型`:`Computer Use only`]}),p.filter(e=>!h||e.computerUse).length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s.modelsEmpty}):(0,$.jsx)(`ul`,{className:`space-y-2`,children:p.filter(e=>!h||e.computerUse).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-lg border border-edge-subtle bg-surface-panel/40 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.id}),e.computerUse&&(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Computer Use`}),e.name&&e.name!==e.id?(0,$.jsx)(`div`,{className:`truncate text-xs text-fg-muted`,children:e.name}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:O(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.press),onClick:()=>te(e,!1),"aria-label":s.editModel,children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,className:O(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-red-600 dark:hover:text-red-400`,H.press),onClick:()=>M(e.id),"aria-label":s.removeModel,children:(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0})})]})]},e.id))})]}),C?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:C}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>A(!0),children:[(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),n.remove]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(V,{type:`button`,variant:`primary`,disabled:y,onClick:()=>void z(),children:y?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(b,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),n.saving]}):n.save})})]}),(0,$.jsx)(rt,{open:k,title:n.removeConfirmTitle,description:n.removeConfirmDescription.replace(`{{provider}}`,e),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void B(),onCancel:()=>A(!1)}),(0,$.jsx)(rt,{open:j!==null,title:s.removeModel,description:s.removeModelConfirm.replace(`{{id}}`,j??``),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>{j&&W(j)},onCancel:()=>M(null)}),(0,$.jsx)(nr,{open:N,onOpenChange:e=>{P(e),e||L(null)},providerId:e,model:F?.model??null,isNew:F?.isNew??!1,onSave:e=>void U(e),m:s})]})}function lr(e){return e.status===`ready`?`ready`:e.status===`disabled`?`off`:e.status===`degraded`?`degraded`:e.rejected?.length?`misconfigured`:`not-configured`}function ur(e,t){if(e.startsWith(`agentCatalog.defaults.models`))return{label:t?`全局智能体默认模型`:`Global agent defaults`,href:`/settings/agent-defaults`};let n=e.match(/^agentCatalog\.agents\.([^.]+)\.models/);return n?.[1]?{label:t?`智能体 ${n[1]}`:`Agent ${n[1]}`,href:Se(n[1])}:e.startsWith(`sessions.`)?{label:t?`会话模型覆盖`:`Session model override`,href:`/settings/sessions`}:{label:e,href:`/settings/agent-defaults`}}function dr(e,t){switch(e){case`computer-use`:return{href:`/settings/computer-use`,guidance:t?`选择兼容的电脑控制模型;本机权限需单独授权`:`Select a compatible computer model; local access requires separate approval`,action:t?`配置电脑控制`:`Configure computer use`};case`vision`:return{href:`${tt(`models`)}?add=1`,guidance:t?`接入支持图片理解的模型服务`:`Connect a model service that supports vision`,action:t?`去接入模型`:`Connect model`};case`image-generation`:return{href:tt(`image`),guidance:t?`选择图片模型并配置所需凭据`:`Choose an image model and configure its credentials`,action:t?`去配置图片生成`:`Configure image generation`};case`stt`:return{href:tt(`voice`),guidance:t?`选择语音识别服务,或安装自管 STT 扩展`:`Choose a speech-to-text service or install a self-managed STT extension`,action:t?`去配置语音识别`:`Configure speech-to-text`};case`tts`:return{href:tt(`voice`),guidance:t?`选择语音合成服务并完成凭据配置`:`Choose a text-to-speech service and configure its credentials`,action:t?`去配置语音合成`:`Configure text-to-speech`}}}function fr(e){switch(e){case`computer-use`:return`/settings/computer-use`;case`vision`:return tt(`models`);case`image-generation`:return tt(`image`);case`stt`:case`tts`:return tt(`voice`)}}async function pr(){let e=await j(N(`/api/models/catalog`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}async function mr(){let e=await j(N(`/api/capabilities/readiness`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}function hr(){let e=M(e=>e.language)===`zh`,{data:t,error:n,isLoading:r}=B(Z,pr,{revalidateOnFocus:!0,refreshInterval:6e4}),{data:i}=B(se,mr,{revalidateOnFocus:!1}),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null);if(r)return(0,$.jsx)(q,{className:`h-24 w-full rounded-2xl`});let d=Object.values(t?.sources??{}),f=d.reduce((e,t)=>e+t.models.filter(e=>e.availability===`available`).length,0),p=(t?.references??[]).filter(e=>e.availability===`unavailable`),g=t?.sync.lastSuccessAt??Math.max(0,...d.map(e=>e.lastSuccessAt)),_=!!n,v=t?.sync.sourceErrors??{},y=[...t?.sync.lastError?[[`catalog`,t.sync.lastError]]:[],...Object.entries(v),...s?[[`refresh`,s]]:[],...n instanceof Error?[[`load`,n.message]]:[]],x=t?.sync.lastAttemptAt??g,S=Object.entries(i?.capabilities??{}).filter(([e])=>e!==`computer-use`||Y()),C=S.some(([,e])=>{let t=lr(e);return t===`degraded`||t===`misconfigured`}),w=S.filter(([,e])=>lr(e)===`ready`).length,T=async()=>{o(!0),c(null);try{let e=await j(N(`/api/models/catalog/refresh`),{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);await X()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/25 p-4 sm:p-5`,children:[(0,$.jsxs)(`details`,{className:`group`,open:C||void 0,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer list-none rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2`,children:[C?(0,$.jsx)(ct,{className:`size-4 text-amber-500`,"aria-hidden":!0}):w===S.length&&S.length>0?(0,$.jsx)(m,{className:`size-4 text-emerald-500`,"aria-hidden":!0}):(0,$.jsx)(h,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:e?`可选能力`:`Optional capabilities`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-fg-muted`,children:e?`${w}/${S.length} 项已配置,不影响基础聊天功能`:`${w} of ${S.length} configured · Not required for chat`})]}),(0,$.jsx)(u,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-open:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]})}),i?(0,$.jsx)(`div`,{className:`mt-3 grid gap-1 sm:grid-cols-2`,children:Object.entries(i.capabilities).map(([t,n])=>{if(t===`computer-use`&&!Y())return null;let r=t===`vision`?e?`图片理解`:`Vision`:t===`image-generation`?e?`图片生成`:`Image generation`:t===`computer-use`?e?`电脑控制模型`:`Computer use model`:t.toUpperCase(),i=n.selectionSource!==`explicit-config`,a=lr(n),o=a===`degraded`||a===`misconfigured`,s=dr(t,e),c=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 text-xs font-medium text-fg`,children:r}),(0,$.jsx)(`span`,{className:a===`ready`?`shrink-0 text-xs text-emerald-600 dark:text-emerald-400`:a===`off`||a===`not-configured`?`shrink-0 text-xs text-fg-muted`:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,children:a===`ready`?t===`computer-use`?e?`已配置`:`Configured`:e?`可用`:`Ready`:a===`off`?e?`已关闭`:`Off`:a===`not-configured`?e?`未配置`:`Not configured`:a===`degraded`?e?`正在使用备用方案`:`Using fallback`:e?`需处理`:`Needs attention`})]}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,title:n.primary?`${n.primary.provider}/${n.primary.model}`:void 0,children:n.primary?`${i?e?`自动`:`Auto`:e?`显式`:`Explicit`} · ${n.primary.provider}/${n.primary.model}`:a===`not-configured`?e?`可稍后按需配置`:`Set up later if needed`:e?`已配置的模型不可用`:`The configured model is unavailable`}),o?(0,$.jsxs)(`div`,{className:`mt-2 rounded-lg bg-amber-500/10 p-2`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-amber-700 dark:text-amber-300`,children:n.status===`degraded`?e?`当前配置不可用,正在使用备用方案。${s.guidance}`:`The current configuration is unavailable, so a fallback is in use. ${s.guidance}.`:s.guidance}),(0,$.jsxs)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs font-medium text-accent`,children:[s.action,(0,$.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0})]})]}):null]});return(0,$.jsx)(l,{to:o?s.href:fr(t),"aria-label":o?`${r}:${s.action}`:`${e?`配置`:`Configure`} ${r}`,className:O(`rounded-lg bg-surface-base/45 px-3 py-3 transition-colors`,o?`bg-amber-500/5 hover:bg-amber-500/10`:`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:c},t)})}):null]}),p.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-live":`polite`,children:p.map(t=>(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 p-3`,children:(()=>{let n=!!v[t.ref.split(`/`)[0]??``],r=ur(t.locations[0]??``,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(ct,{className:`mt-0.5 size-4 shrink-0 text-amber-500`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`p`,{className:`break-words text-sm font-medium text-fg`,children:[t.ref,(0,$.jsx)(`span`,{className:`ml-2 font-normal text-amber-700 dark:text-amber-300`,children:n?e?`暂时无法验证`:`Temporarily unverified`:e?`不可用`:`Unavailable`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[n?e?`模型目录同步暂时失败,当前状态可能已过期;不会影响其他可用模型。`:`Catalog sync temporarily failed, so this status may be stale. Other available models are unaffected.`:e?`此模型已无法从当前配置中解析,使用它的功能可能失败。`:`This model no longer resolves from the current configuration. Features using it may fail.`,x?` · ${e?`最近检测`:`Last checked`} ${new Date(x).toLocaleString()}`:``]}),t.suggestedRef?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e?`可替换为`:`Suggested replacement`,`:`,(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t.suggestedRef})]}):null]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:[(0,$.jsxs)(V,{className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,disabled:a,onClick:()=>void T(),children:[a?(0,$.jsx)(b,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),a?e?`检测中…`:`Checking…`:e?`重新检测`:`Check again`]}),(0,$.jsx)(V,{asChild:!0,className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,children:(0,$.jsxs)(l,{to:r.href,children:[(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),t.suggestedRef?e?`更换模型`:`Replace model`:e?`调整配置`:`Adjust configuration`]})}),(0,$.jsxs)(`details`,{className:`group/references`,children:[(0,$.jsxs)(`summary`,{className:`touch-target inline-flex cursor-pointer list-none items-center gap-1 rounded-xl px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e?`查看 ${t.locations.length} 处引用`:`View ${t.locations.length} ${t.locations.length===1?`reference`:`references`}`,(0,$.jsx)(u,{className:`size-3.5 transition-transform group-open/references:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 pl-2 text-xs text-fg-muted`,children:t.locations.map(t=>{let n=ur(t,e);return(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{className:`inline-flex rounded px-1.5 py-1 text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:n.href,title:t,children:n.label})},t)})})]})]})]})})()},t.ref))}):null,_||s?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:_?e?`暂时无法读取模型状态,请重新检测;详细信息可在高级诊断中查看。`:`Model status is temporarily unavailable. Check again; details are available in Advanced diagnostics.`:e?`重新检测失败,请稍后重试;详细信息可在高级诊断中查看。`:`The check failed. Try again later; details are available in Advanced diagnostics.`}):null,(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`summary`,{className:`min-h-8 cursor-pointer rounded-md py-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e?`高级诊断`:`Advanced diagnostics`}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{children:e?`${d.length} 个来源,${f} 个可用模型${g?` · 最近同步 ${new Date(g).toLocaleString()}`:``}`:`${d.length} sources, ${f} available models${g?` · Last synced ${new Date(g).toLocaleString()}`:``}`}),y.length>0?(0,$.jsx)(`div`,{className:`mt-2 space-y-1 rounded-lg bg-surface-base/45 p-2 font-mono text-[11px] leading-5`,"aria-label":e?`同步错误详情`:`Sync error details`,children:y.map(([e,t],n)=>(0,$.jsxs)(`p`,{className:`break-words`,children:[e,`: `,t]},`${e}-${n}`))}):null]}),(0,$.jsxs)(V,{className:`shrink-0`,type:`button`,variant:`secondary`,disabled:a,onClick:()=>void T(),children:[a?(0,$.jsx)(b,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),a?e?`刷新中…`:`Refreshing…`:e?`刷新目录`:`Refresh catalog`]})]})]})]})}function gr(e){return Qe.includes(e)}function _r(){let e=(0,zt.c)(69),t=M(br),n;e[0]===t?n=e[1]:(n=D(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesSettings,u=a(),[d,f]=o(),p;if(e[2]!==d){let t=d.get(`returnTo`);p=t?.startsWith(`/chat/`)?t:null,e[2]=d,e[3]=p}else p=e[3];let m=p,{capability:h}=s(),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b=ze(),x;e[4]===b.cards?x=e[5]:(x=b.cards.some(yr),e[4]=b.cards,e[5]=x);let S=x,C,w;e[6]!==h||e[7]!==d||e[8]!==f?(C=()=>{if(h!==`models`||d.get(`add`)!==`1`)return;_(!0);let e=new URLSearchParams(d);e.delete(`add`),f(e,{replace:!0})},w=[h,d,f],e[6]=h,e[7]=d,e[8]=f,e[9]=C,e[10]=w):(C=e[9],w=e[10]),(0,Q.useEffect)(C,w);let T;e[11]===i.tabs.models?T=e[12]:(T={id:`models`,icon:$e,label:i.tabs.models},e[11]=i.tabs.models,e[12]=T);let E;e[13]===i.tabs.image?E=e[14]:(E={id:`image`,icon:Pe,label:i.tabs.image},e[13]=i.tabs.image,e[14]=E);let O;e[15]!==T||e[16]!==E?(O=[T,E],e[15]=T,e[16]=E,e[17]=O):O=e[17];let k=O,A;e[18]===u?A=e[19]:(A=e=>u(tt(e)),e[18]=u,e[19]=A);let j=A,N=vr;if(!gr(h)){let t;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(c,{to:tt(`models`),replace:!0}),e[20]=t):t=e[20],t}let P=h===`models`||h===`image`,F=h===`voice`?r.nav.settingsVoice:h===`search`?r.nav.settingsSearch:r.nav.settingsModels,I;e[21]===t?I=e[22]:(I=Je(t,`configuration`),e[21]=t,e[22]=I);let L;e[23]!==i.docsLink||e[24]!==F||e[25]!==I?(L=(0,$.jsx)(ht,{title:F,docsLink:I,docsLabel:i.docsLink}),e[23]=i.docsLink,e[24]=F,e[25]=I,e[26]=L):L=e[26];let R;e[27]!==h||e[28]!==m||e[29]!==t?(R=h===`voice`&&m?(0,$.jsx)(l,{to:m,className:`text-sm text-accent-fg hover:underline`,children:t===`zh`?`返回对话`:`Return to conversation`}):null,e[27]=h,e[28]=m,e[29]=t,e[30]=R):R=e[30];let ee;e[31]!==i.tabsAria||e[32]!==h||e[33]!==P||e[34]!==k||e[35]!==j?(ee=P?(0,$.jsx)(pt,{items:k,activeTab:h,onChange:j,ariaLabel:i.tabsAria,tabIdPrefix:`capability-tab`,panelIdPrefix:`capability-panel`}):null,e[31]=i.tabsAria,e[32]=h,e[33]=P,e[34]=k,e[35]=j,e[36]=ee):ee=e[36];let z=P?`tabpanel`:void 0,B=`capability-panel-${h}`,V=P?`capability-tab-${h}`:void 0,H;e[37]!==i.connectedProviders||e[38]!==i.xopcCloudAccount||e[39]!==h||e[40]!==b||e[41]!==S?(H=h===`models`?(0,$.jsxs)($.Fragment,{children:[S?(0,$.jsx)(Rt,{labels:i.xopcCloudAccount}):null,(0,$.jsx)(Ke,{labels:i.connectedProviders,data:b,onAdd:()=>_(!0),onManage:(e,t)=>y({providerId:e,isCustom:t})}),b.cards.length>0?(0,$.jsx)(hr,{}):null]}):(0,$.jsx)(xr,{section:h}),e[37]=i.connectedProviders,e[38]=i.xopcCloudAccount,e[39]=h,e[40]=b,e[41]=S,e[42]=H):H=e[42];let te;e[43]!==z||e[44]!==B||e[45]!==V||e[46]!==H?(te=(0,$.jsx)(`div`,{role:z,id:B,"aria-labelledby":V,className:`flex min-w-0 flex-col gap-4`,children:H}),e[43]=z,e[44]=B,e[45]=V,e[46]=H,e[47]=te):te=e[47];let U;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>N(),e[48]=U):U=e[48];let W;e[49]!==g||e[50]!==i.addProviderDialog||e[51]!==t||e[52]!==b.builtinRows||e[53]!==b.customConfig?(W=(0,$.jsx)(at,{open:g,onOpenChange:_,builtinRows:b.builtinRows,customConfig:b.customConfig,labels:i.addProviderDialog,language:t,onSaved:U}),e[49]=g,e[50]=i.addProviderDialog,e[51]=t,e[52]=b.builtinRows,e[53]=b.customConfig,e[54]=W):W=e[54];let G;e[55]!==i.manageProviderDialog||e[56]!==t||e[57]!==v||e[58]!==b.allModels||e[59]!==b.builtinRows||e[60]!==b.customConfig?(G=v?(0,$.jsx)(or,{open:!0,onOpenChange:e=>{e||y(null)},providerId:v.providerId,isCustom:v.isCustom,builtinRows:b.builtinRows,customConfig:b.customConfig,allModels:b.allModels,labels:i.manageProviderDialog,language:t,onSaved:N}):null,e[55]=i.manageProviderDialog,e[56]=t,e[57]=v,e[58]=b.allModels,e[59]=b.builtinRows,e[60]=b.customConfig,e[61]=G):G=e[61];let K;return e[62]!==L||e[63]!==R||e[64]!==ee||e[65]!==te||e[66]!==W||e[67]!==G?(K=(0,$.jsxs)(gt,{children:[L,R,ee,te,W,G]}),e[62]=L,e[63]=R,e[64]=ee,e[65]=te,e[66]=W,e[67]=G,e[68]=K):K=e[68],K}function vr(){X()}function yr(e){return e.id===`xopc-cloud`&&!e.isCustom}function br(e){return e.language}function xr(e){let t=(0,zt.c)(3),{section:n}=e;switch(n){case`models`:return null;case`image`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(tn,{}),t[0]=e):e=t[0],e}case`voice`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Dn,{}),t[1]=e):e=t[1],e}case`search`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xn,{}),t[2]=e):e=t[2],e}}}export{_r as CapabilitiesSettingsPanel};
|
|
@@ -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"./search-DA7gz22f.js";import{t as a}from"./button-
|
|
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"./search-DA7gz22f.js";import{t as a}from"./button-aIC072nz.js";import{a as o,i as s,o as c,s as l}from"./dist-C3DSFZCi.js";import{U as u}from"./index-DxydK_AA.js";var d=n(),f=e(t(),1),p=r(),m=(0,f.memo)(function(e){let t=(0,d.c)(8),{value:n,onChange:r,placeholder:a,ariaLabel:o}=e,s=o===void 0?a:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(i,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===r?l=t[2]:(l=e=>r(e.currentTarget.value),t[1]=r,t[2]=l);let u;return t[3]!==s||t[4]!==a||t[5]!==l||t[6]!==n?(u=(0,p.jsxs)(`label`,{className:`relative flex h-11 min-w-0 w-full cursor-text items-center rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-fg shadow-none focus-within:border-accent/60 focus-within:ring-2 focus-within:ring-accent/30 md:h-9`,children:[c,(0,p.jsx)(`input`,{type:`search`,"aria-label":s,enterKeyHint:`search`,value:n,onChange:l,placeholder:a,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent text-base leading-normal text-fg caret-current placeholder:text-fg-muted focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 md:text-sm`})]}),t[3]=s,t[4]=a,t[5]=l,t[6]=n,t[7]=u):u=t[7],u});function h(e){let t=(0,d.c)(8),{contribution:n}=e,r=u(`(min-width: 768px)`),f;t[0]!==n||t[1]!==r?(f=n?.search?r?(0,p.jsx)(`div`,{className:`min-w-0 max-w-60 flex-1`,children:n.search}):(0,p.jsxs)(c,{children:[(0,p.jsx)(l,{asChild:!0,children:(0,p.jsx)(a,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":n.searchLabel,title:n.searchLabel,children:(0,p.jsx)(i,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(o,{children:(0,p.jsx)(s,{align:`end`,sideOffset:8,className:`z-50 w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-panel p-2 shadow-popover`,children:n.search})})]}):null,t[0]=n,t[1]=r,t[2]=f):f=t[2];let m=n?.secondary,h=n?.primary,g=n?.overflow,_;return t[3]!==f||t[4]!==m||t[5]!==h||t[6]!==g?(_=(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 xl:w-[27rem] 2xl:w-[31rem]`,children:[f,m,h,g]}),t[3]=f,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7],_}export{m as n,h as t};
|
package/dist/gateway/static/root/assets/{capability-icon-BYm2-nS-.js → capability-icon-DVoZxEgW.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"./cn-
|
|
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"./cn-0WouolD0.js";var a=n(),o=e(t(),1),s=r();function c(e){let t=(0,a.c)(12),{iconUrl:n,fallback:r,className:c}=e,[l,u]=(0,o.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>u(!1),t[0]=d):d=t[0];let f;t[1]===n?f=t[2]:(f=[n],t[1]=n,t[2]=f),(0,o.useEffect)(d,f);let p;t[3]===c?p=t[4]:(p=i(`flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-edge bg-white`,c),t[3]=c,t[4]=p);let m;t[5]!==r||t[6]!==l||t[7]!==n?(m=n&&!l?(0,s.jsx)(`img`,{src:n,alt:``,loading:`lazy`,draggable:!1,className:`size-8 object-contain`,onError:()=>u(!0)}):(0,s.jsx)(r,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),t[5]=r,t[6]=l,t[7]=n,t[8]=m):m=t[8];let h;return t[9]!==p||t[10]!==m?(h=(0,s.jsx)(`span`,{className:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11],h}export{c as t};
|