@xopcai/xopc 0.0.364 → 0.0.367
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/sidepanel.js +16 -4
- 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-GvR2gZ0T.js → activity-store-Cuf3JFFJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-7Ct-ZlfL.js → agent-avatar-dicebear-DyATPNTe.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-gT9_j4tr.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CLXCJ6JN.js +1 -0
- package/dist/gateway/static/root/assets/agents-BAUfOMsq.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BkXb7VEZ.js → agents-admin-api-D842OcNo.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-4gpFbdsr.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CjfsIn9A.js → app-management-settings-panel-CoIFxQKH.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-qqHZ15GU.js → appearance-settings-DQr0o6Lm.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Ba2VkQk6.js → apps-page-CltMV4Xp.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CKe3qAaL.js → archive-plugin-DT8Nio-r.js} +1 -1
- package/dist/gateway/static/root/assets/automation-display-DCkjVzA0.js +2 -0
- package/dist/gateway/static/root/assets/{automations-page-Bt8Q58ut.js → automations-page-BIfWS_3Y.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BCGPjsdU.js +6 -0
- package/dist/gateway/static/root/assets/binary-plugins-7qs3qcW9.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-ClRFbHP7.js → block-editor-BFPUlxJ6.js} +28 -28
- package/dist/gateway/static/root/assets/{browser-automation-inputs-5B3qAdmb.js → browser-automation-inputs-BUAIKIX0.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BjMub7JM.js → browser-automations-page-CSwu1U1F.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-C1ReMNqX.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BzWFO_x_.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-BKu9BqPe.js → capabilities-K0Zb_lH0.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-BdTSqloI.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-gZ8auLwa.js → capabilities-settings-panel-BUblBMZC.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-L1NvoOUG.js → capability-header-actions-AMn_vTNv.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CXCf5qO6.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DsCpKPBe.js → chat-terminal-dock-C7nAROhF.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-B5SuSZ3G.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-mtH9mEBf.js → connector-service-page-CTx1B8wx.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DfnK1crf.js +2 -0
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-Cx_xIKvN.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-B_fPQBTM.js → dependency-picker-DYm96PDu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CJrO9Vd_.js → desktop-pet-D90OzgeR.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DYAfri9w.js → desktop-pet-settings-CmdCecjm.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CqRys2R8.js → device-pairing-wizard-s2ogSa4l.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D7_qSxNZ.js → directory-picker-path-field-DZpaoeNa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BGyJpRv4.js → extension-debug-page-Bv6QE8kC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D1zBmd8F.js → extension-page-CEsq71Cm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-F9JzOWZ3.js → extension-provider-CX-sK0Tw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CTR8AjCG.js → extension-settings-page-UyOHF39P.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-Chhv4Nfv.js → fallback-models-CKv_Wqg8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CoRoOG1l.js → gateway-config-swr-Cjnkle5J.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-D0ygm6bc.js → gateway-realtime-DCCLdyQD.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C_Th8kGg.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CZ73IpbP.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-FDS6S6qa.js → gateway-startup-retry-CXKmdVzN.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BQWq4kYi.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BPd76jW5.js → image-generation-api-NLHzm4Nc.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-9EnECtcl.js → imports-page-C7qvlBTQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-BQgqzhQj.js +106 -0
- package/dist/gateway/static/root/assets/index-COB4QIJp.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-MC7mG2h2.js → keyboard-shortcuts-settings-pkgFWJb-.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-dMDhZXAi.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-c3HncHZ3.js → local-apps-page-TpUAfOn2.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-Cvv7I0fw.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-DId6-v2R.js → locale-store-C8TMD2gn.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-B-Y9oZLh.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B2lzsw6X.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-Dse7rkio.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-XLewwq2q.js → media-plugins-BZrnzaBM.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dy26npMy.js +3 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-B9SKjidc.js → models-hub-cache-B1C86nRp.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DL__qP6U.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-Byt65v3r.js → notes-api-DKiVeQKG.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-DTBbg9Hs.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-BYsCbyGZ.js → oauth-api-BwpzpRwC.js} +1 -1
- package/dist/gateway/static/root/assets/open-route-MyZ2sB9C.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-RBp1QK0F.js → page-context-capture-button-Cxzd4QPB.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CzaTnHeD.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-D4hoEWiu.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-aR38El2E.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-D20QH4YB.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Bf3BIcT6.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-7F2WNEZC.js → registry-api-AdnxowbH.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CKxqncqW.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B0c120iI.js → runtime-tools-settings-panel-CBN3raz1.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-Cv_5ozfX.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-DQpQc9tH.js → schema-form-CxrMGsT9.js} +1 -1
- package/dist/gateway/static/root/assets/secret-input-D93UrW4C.js +1 -0
- package/dist/gateway/static/root/assets/{send-session-input-D1oc6BC6.js → send-session-input-CgOzhDZ0.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-N3N37MrR.js → session-api-_HIN8or3.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-CzCto5zT.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-DZcu6NLJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DazqeDQ7.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-GgBEp6O7.js → settings-page-D8Q3H3-o.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DvLMMiuS.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-TBBGJPfT.js → share-link-dialog-Dg5os066.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DyRLPsPv.js → share-preview-page-DMvohAyr.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DU0fHP2G.js → shares-api-C96IO4qJ.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DJ1ME-XM.js → shares-settings-CsDATuCw.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-1Puv6wOz.js → skill-api-C10ML0CH.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-ClyFqHk7.js → skill-reload-api-DNbJzSfB.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DObMKvA6.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel--yV67a8L.js → system-settings-panel-Bn3khdzb.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BR2L1L8l.js +2 -0
- package/dist/gateway/static/root/assets/task-expandable-content-DL2Q2gre.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-CH6KoBeY.js → tasks-DwKXgZ-I.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-OhcbFEUR.js → theme-store-DQ6KJa4l.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-Ed8_GYUT.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-COLdiP_E.js → tunnel-api-D3X8jDwo.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-CtM5IfrL.js → usage-page-BqzRyyb9.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-veoM0dHn.js → use-autosave-CRFefpzO.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-OLrvSjn5.js +2 -0
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-Bope6MW6.js → use-file-preview-expanded-CJvzfQvw.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-CG6wqIKP.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CwD6a3KQ.js → voice-api-key-field-R9zNWYR_.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Daexehmc.js → voice-config-api-DLudE9Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-C9u7tuEc.js → work-discovery-overlay-DVmQrolV.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BMOBbf33.js → workflow-run-setup-panel-DEkmuD3T.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-pqCB3sh4.js +6 -0
- package/dist/gateway/static/root/assets/workspace-api-CdVUhyPo.js +2 -0
- package/dist/gateway/static/root/index.html +33 -31
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +1 -0
- package/dist/packages/gateway-contract/src/home.js +14 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/notifications.js +2 -1
- package/dist/packages/gateway-contract/src/personal-proactivity.js +139 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +1 -0
- package/dist/packages/image-providers/src/catalog.js +373 -0
- package/dist/packages/image-providers/src/execute.js +372 -0
- package/dist/packages/image-providers/src/http.js +94 -0
- package/dist/packages/image-providers/src/index.js +5 -0
- package/dist/packages/image-providers/src/types.d.ts +95 -0
- package/dist/packages/image-providers/src/validation.js +52 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +35 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-context.js +1 -1
- package/dist/src/agent/context/project-context.js +4 -4
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/failover-error.d.ts +1 -1
- package/dist/src/agent/failover-error.js +7 -0
- package/dist/src/agent/image/generation/native-provider.d.ts +2 -0
- package/dist/src/agent/image/generation/native-provider.js +118 -0
- package/dist/src/agent/image/generation/openai-images-provider.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +48 -32
- package/dist/src/agent/image/generation/provider-registry.js +4 -13
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +5 -34
- package/dist/src/agent/image/generation/runtime-types.d.ts +2 -4
- package/dist/src/agent/image/generation/runtime.js +28 -23
- package/dist/src/agent/image/generation/types.d.ts +3 -50
- package/dist/src/agent/image/generation/validation.d.ts +6 -0
- package/dist/src/agent/image/generation/validation.js +16 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/prompt/voice-presentation.d.ts +1 -1
- package/dist/src/agent/prompt/voice-presentation.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +17 -1
- package/dist/src/agent/service.js +3 -3
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +2 -0
- package/dist/src/agent/tools/delegation-policy.js +2 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +31 -4
- package/dist/src/agent/tools/image-generate-tool.js +5 -19
- package/dist/src/agent/tools/index.d.ts +2 -2
- package/dist/src/agent/tools/index.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +60 -1
- package/dist/src/agent/tools/personal-attention-tool.d.ts +21 -0
- package/dist/src/agent/tools/personal-attention-tool.js +191 -0
- package/dist/src/agent/tools/personal-task-tool.d.ts +12 -8
- package/dist/src/agent/tools/personal-task-tool.js +35 -41
- package/dist/src/agent/tools/user-context-tool.d.ts +2 -0
- package/dist/src/agent/tools/user-context-tool.js +61 -2
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
- package/dist/src/agent-catalog/repository.d.ts +1 -0
- package/dist/src/agent-catalog/repository.js +4 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +2 -0
- package/dist/src/automations/domain/types.d.ts +1 -1
- package/dist/src/automations/domain/validation.d.ts +4 -0
- package/dist/src/automations/domain/validation.js +1 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/personal-command-policy.d.ts +2 -0
- package/dist/src/chat-commands/personal-command-policy.js +9 -0
- package/dist/src/chat-commands/registry.js +6 -0
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +4 -9
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/models-json.d.ts +170 -0
- package/dist/src/config/models-json.js +23 -8
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/files/file-service.d.ts +6 -0
- package/dist/src/files/file-service.js +38 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/custom-image-providers.d.ts +34 -0
- package/dist/src/gateway/file-path-classifier.js +12 -3
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/files.js +13 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/observability.js +8 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +41 -0
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +9 -1
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +1 -0
- package/dist/src/gateway/service/agent-runner.js +12 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +15 -0
- package/dist/src/gateway/service/session-command-service.js +5 -3
- package/dist/src/gateway/service/session-input-coordinator.d.ts +12 -0
- package/dist/src/gateway/service/session-input-coordinator.js +63 -5
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +54 -9
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/notifications/planner.js +32 -0
- package/dist/src/notifications/service.d.ts +2 -0
- package/dist/src/personal-agent/capability-service.js +3 -2
- package/dist/src/personal-agent/communication.d.ts +3 -2
- package/dist/src/personal-agent/communication.js +4 -3
- package/dist/src/personal-agent/conversation-state.d.ts +5 -0
- package/dist/src/personal-agent/conversation-state.js +17 -0
- package/dist/src/personal-agent/notifications.d.ts +4 -0
- package/dist/src/personal-agent/notifications.js +40 -0
- package/dist/src/personal-agent/persona.d.ts +6 -0
- package/dist/src/personal-agent/persona.js +16 -0
- package/dist/src/personal-agent/policy.d.ts +3 -1
- package/dist/src/personal-agent/policy.js +28 -6
- package/dist/src/personal-agent/proactivity/automation.d.ts +3 -0
- package/dist/src/personal-agent/proactivity/automation.js +41 -0
- package/dist/src/personal-agent/proactivity/follow-up-request.d.ts +5 -0
- package/dist/src/personal-agent/proactivity/follow-up-request.js +44 -0
- package/dist/src/personal-agent/proactivity/repository.d.ts +128 -0
- package/dist/src/personal-agent/proactivity/repository.js +403 -0
- package/dist/src/personal-agent/proactivity/routes.d.ts +3 -0
- package/dist/src/personal-agent/proactivity/routes.js +182 -0
- package/dist/src/personal-agent/proactivity/service.d.ts +32 -0
- package/dist/src/personal-agent/proactivity/service.js +496 -0
- package/dist/src/personal-agent/prompt-context.d.ts +10 -0
- package/dist/src/personal-agent/prompt-context.js +119 -0
- package/dist/src/personal-agent/prompts.d.ts +7 -0
- package/dist/src/personal-agent/prompts.js +135 -0
- package/dist/src/personal-agent/reply-composer.d.ts +1 -1
- package/dist/src/personal-agent/reply-composer.js +41 -13
- package/dist/src/personal-agent/repository.d.ts +1 -1
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +1 -1
- package/dist/src/personal-agent/request-service.js +2 -2
- package/dist/src/personal-agent/service.d.ts +1 -2
- package/dist/src/personal-agent/service.js +5 -93
- package/dist/src/personal-agent/specialist-capabilities.d.ts +9 -0
- package/dist/src/personal-agent/specialist-capabilities.js +37 -0
- package/dist/src/personal-agent/unread.d.ts +10 -0
- package/dist/src/personal-agent/unread.js +43 -0
- package/dist/src/providers/env-keys.js +6 -0
- package/dist/src/providers/model-catalog-persistence.js +3 -22
- package/dist/src/providers/model-catalog-store.js +1 -8
- package/dist/src/providers/model-catalog-types.d.ts +1 -9
- package/dist/src/providers/xopc-cloud-model-source.js +4 -25
- package/dist/src/session/client-history.d.ts +2 -0
- package/dist/src/session/client-history.js +26 -0
- package/dist/src/session/init-session-turn.js +10 -0
- package/dist/src/session/session-context-for-llm.js +28 -0
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/migrations/235_personal_conversation_priority.sql +3 -0
- package/dist/src/storage/sqlite/migrations/236_personal_proactivity.sql +53 -0
- package/dist/src/storage/sqlite/migrations/237_personal_strategy_versions.sql +18 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-input-repository.js +18 -5
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/execution-context.js +1 -1
- package/dist/src/tasks/home-query-service.js +27 -1
- package/dist/src/tasks/task-main-update-decision-service.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/voice/platform-catalog.d.ts +1 -9
- package/dist/src/voice/realtime/agentEngine.js +32 -7
- package/dist/src/voice/realtime/engine.d.ts +1 -0
- package/dist/src/voice/realtime/omniEngine.d.ts +1 -0
- package/dist/src/voice/realtime/omniEngine.js +10 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.d.ts +1 -0
- package/dist/src/voice/realtime/runtime.js +5 -0
- package/dist/src/voice/realtime/runtime.types.d.ts +2 -0
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-wYj-iyqv.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-C9HYMhnJ.js +0 -1
- package/dist/gateway/static/root/assets/agents-hPkFQ81z.js +0 -66
- package/dist/gateway/static/root/assets/app-link-DRL0YnPs.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch0ViAJW.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-J51oS7-D.js +0 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CYrPA-Fp.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-CT_ZW9fT.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-dW6FXtOy.js +0 -2
- package/dist/gateway/static/root/assets/channels-Dx5T2G73.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-6FWwxYLe.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DgDLaws0.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BDcwEaIx.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DBvCRclh.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BVfz4Tla.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BF_9C9yW.js +0 -1
- package/dist/gateway/static/root/assets/index-BpXej9jJ.js +0 -106
- package/dist/gateway/static/root/assets/index-CbJNcWAn.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CytNu0-_.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-gbemPamv.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-D4aXtitd.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-CRzWi_iJ.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-DQZ51j9e.js +0 -201
- package/dist/gateway/static/root/assets/messages-BHvpZNe9.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-BgbByI-4.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-R2BX5XCE.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-F0jTBWva.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-BtDK68qb.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DmQEm0yH.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CrLQvkHX.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C25_hQAd.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DM64yMnx.js +0 -2
- package/dist/gateway/static/root/assets/secret-input-DPl3VYM8.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-CMGUwtbN.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DvDO8LtA.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BNhgbmcX.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-10bMi6yL.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D52pEr5x.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-D-tcS2bS.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-DoBJ0TYY.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DB0bBGzZ.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-CSh61kZ5.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BrD9vXqO.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-Cs4sjV2A.js +0 -2
- package/dist/src/agent/image/generation/normalization.d.ts +0 -38
- package/dist/src/agent/image/generation/normalization.js +0 -181
- package/dist/src/agent/image/generation/providers/dashscope.d.ts +0 -35
- package/dist/src/agent/image/generation/providers/dashscope.js +0 -257
- package/dist/src/agent/image/generation/providers/fal.d.ts +0 -15
- package/dist/src/agent/image/generation/providers/fal.js +0 -323
- package/dist/src/agent/image/generation/providers/google.d.ts +0 -16
- package/dist/src/agent/image/generation/providers/google.js +0 -244
- package/dist/src/agent/image/generation/providers/minimax.d.ts +0 -23
- package/dist/src/agent/image/generation/providers/minimax.js +0 -215
- package/dist/src/agent/image/generation/providers/openai.d.ts +0 -5
- package/dist/src/agent/image/generation/providers/openai.js +0 -134
|
@@ -52,15 +52,7 @@ export declare function requirePlatformVoiceModel(id: string, mode: VoiceModeCap
|
|
|
52
52
|
priority?: number;
|
|
53
53
|
tier?: string;
|
|
54
54
|
bestEffort?: boolean;
|
|
55
|
-
imageGeneration?:
|
|
56
|
-
maxCount: number;
|
|
57
|
-
sizes: string[];
|
|
58
|
-
aspectRatios?: string[];
|
|
59
|
-
qualities: Array<"low" | "medium" | "high" | "auto">;
|
|
60
|
-
formats: Array<"png" | "jpeg" | "webp">;
|
|
61
|
-
backgrounds: Array<"transparent" | "opaque" | "auto">;
|
|
62
|
-
maxInputImages: number;
|
|
63
|
-
};
|
|
55
|
+
imageGeneration?: import("@xopcai/image-providers/src/types.js").ImageCapabilities;
|
|
64
56
|
stt?: {
|
|
65
57
|
inputFormats: string[];
|
|
66
58
|
maxBytes: number;
|
|
@@ -39,10 +39,13 @@ function createAgentVoiceEngine(options) {
|
|
|
39
39
|
const echoCandidates = new PlaybackEchoCandidates();
|
|
40
40
|
const finalizedUtterances = /* @__PURE__ */ new Set();
|
|
41
41
|
let pendingTurn;
|
|
42
|
+
let turnReceivedAtMs;
|
|
42
43
|
let taskUpdateQueued = false;
|
|
43
44
|
let lastUserSpeechAt = 0;
|
|
44
45
|
const turn = new TurnCoordinator(claim.silenceDurationMs, (text, decision, turnId) => {
|
|
45
46
|
if (closed || muted) return;
|
|
47
|
+
const receivedAtMs = turnReceivedAtMs ?? Date.now();
|
|
48
|
+
turnReceivedAtMs = void 0;
|
|
46
49
|
log.info({
|
|
47
50
|
sessionId: claim.sessionId,
|
|
48
51
|
turnId,
|
|
@@ -77,12 +80,14 @@ function createAgentVoiceEngine(options) {
|
|
|
77
80
|
const pending = {
|
|
78
81
|
turnId,
|
|
79
82
|
text,
|
|
80
|
-
cancelled: false
|
|
83
|
+
cancelled: false,
|
|
84
|
+
receivedAtMs,
|
|
85
|
+
committedAtMs: Date.now()
|
|
81
86
|
};
|
|
82
87
|
pendingTurn = pending;
|
|
83
88
|
conversationTail = conversationTail.then(() => {
|
|
84
89
|
if (pendingTurn === pending) pendingTurn = void 0;
|
|
85
|
-
if (generation === inputGeneration && !pending.cancelled) return runAssistantTurn(text, turnId).then(() => {});
|
|
90
|
+
if (generation === inputGeneration && !pending.cancelled) return runAssistantTurn(text, turnId, void 0, pending.receivedAtMs, pending.committedAtMs).then(() => {});
|
|
86
91
|
}).finally(() => {
|
|
87
92
|
if (generation === inputGeneration) queuedTurns -= 1;
|
|
88
93
|
});
|
|
@@ -156,7 +161,11 @@ function createAgentVoiceEngine(options) {
|
|
|
156
161
|
log.info({
|
|
157
162
|
sessionId: claim.sessionId,
|
|
158
163
|
responseId: response.id,
|
|
159
|
-
|
|
164
|
+
conversationId: claim.request.conversationId,
|
|
165
|
+
phase: "first_response_audio",
|
|
166
|
+
latencyMs: Date.now() - response.startedAt,
|
|
167
|
+
inputToAudioMs: Date.now() - response.inputReceivedAtMs,
|
|
168
|
+
textToAudioMs: response.firstTextAtMs === void 0 ? void 0 : Date.now() - response.firstTextAtMs
|
|
160
169
|
}, "Realtime voice first audio ready");
|
|
161
170
|
send("response.audio.started", {
|
|
162
171
|
responseId: response.id,
|
|
@@ -241,7 +250,7 @@ function createAgentVoiceEngine(options) {
|
|
|
241
250
|
if (response.speechWorker) prefetchNextSpeech(response);
|
|
242
251
|
else startSpeechWorker(response);
|
|
243
252
|
}
|
|
244
|
-
async function runAssistantTurn(text, turnId, updateClientMessageId) {
|
|
253
|
+
async function runAssistantTurn(text, turnId, updateClientMessageId, receivedAtMs = Date.now(), committedAtMs = receivedAtMs) {
|
|
245
254
|
if (!claim.tts || !claim.request.conversationId || !text.trim() || closed) return false;
|
|
246
255
|
cancelActiveResponse("barge_in");
|
|
247
256
|
const response = {
|
|
@@ -255,6 +264,8 @@ function createAgentVoiceEngine(options) {
|
|
|
255
264
|
speechQueue: [],
|
|
256
265
|
queuedSpeechCharacters: 0,
|
|
257
266
|
startedAt: Date.now(),
|
|
267
|
+
inputReceivedAtMs: receivedAtMs,
|
|
268
|
+
turnCommittedAtMs: committedAtMs,
|
|
258
269
|
firstTextSeen: false,
|
|
259
270
|
awaitingClarification: false,
|
|
260
271
|
taskDone: false,
|
|
@@ -289,12 +300,18 @@ function createAgentVoiceEngine(options) {
|
|
|
289
300
|
if (event.type === "assistant_delta" || event.type === "tool_end" && event.payload?.toolName !== "clarify") response.awaitingClarification = false;
|
|
290
301
|
if (event.type === "assistant_delta" && typeof event.payload?.delta === "string") {
|
|
291
302
|
if (response.text.length + event.payload.delta.length > 32e3) throw new Error("Voice response text limit reached");
|
|
292
|
-
if (!response.firstTextSeen) {
|
|
303
|
+
if (!response.firstTextSeen && event.payload.delta.trim()) {
|
|
293
304
|
response.firstTextSeen = true;
|
|
305
|
+
response.firstTextAtMs = Date.now();
|
|
294
306
|
log.info({
|
|
295
307
|
sessionId: claim.sessionId,
|
|
296
308
|
responseId: response.id,
|
|
297
|
-
|
|
309
|
+
conversationId: claim.request.conversationId,
|
|
310
|
+
phase: "first_response_text",
|
|
311
|
+
latencyMs: Date.now() - response.startedAt,
|
|
312
|
+
inputToTextMs: Date.now() - response.inputReceivedAtMs,
|
|
313
|
+
turnDecisionMs: Math.max(0, response.turnCommittedAtMs - response.inputReceivedAtMs),
|
|
314
|
+
queueMs: Math.max(0, response.startedAt - response.turnCommittedAtMs)
|
|
298
315
|
}, "Realtime voice first response text ready");
|
|
299
316
|
}
|
|
300
317
|
response.text += event.payload.delta;
|
|
@@ -422,6 +439,7 @@ function createAgentVoiceEngine(options) {
|
|
|
422
439
|
});
|
|
423
440
|
}
|
|
424
441
|
function bufferFinal(utteranceId, text) {
|
|
442
|
+
if (text && (turnReceivedAtMs === void 0 || turn.isIdle())) turnReceivedAtMs = Date.now();
|
|
425
443
|
try {
|
|
426
444
|
turn.final(utteranceId, text);
|
|
427
445
|
} catch (error) {
|
|
@@ -464,6 +482,7 @@ function createAgentVoiceEngine(options) {
|
|
|
464
482
|
if (pendingTurn) {
|
|
465
483
|
pendingTurn.cancelled = true;
|
|
466
484
|
turn.restore(pendingTurn.turnId, pendingTurn.text);
|
|
485
|
+
turnReceivedAtMs = pendingTurn.receivedAtMs;
|
|
467
486
|
pendingTurn = void 0;
|
|
468
487
|
}
|
|
469
488
|
turn.start(event.utteranceId);
|
|
@@ -512,6 +531,7 @@ function createAgentVoiceEngine(options) {
|
|
|
512
531
|
...event.language === "zh" || event.language === "en" ? { language: event.language } : {}
|
|
513
532
|
});
|
|
514
533
|
if (claim.request.purpose === "conversation") {
|
|
534
|
+
if (claim.request.conversationId) options.runtime.onConversationInput?.(claim.request.conversationId);
|
|
515
535
|
if (activeResponse?.awaitingClarification) {
|
|
516
536
|
turn.reset();
|
|
517
537
|
return;
|
|
@@ -525,6 +545,7 @@ function createAgentVoiceEngine(options) {
|
|
|
525
545
|
turn.reset();
|
|
526
546
|
echoCandidates.clear();
|
|
527
547
|
pendingTurn = void 0;
|
|
548
|
+
turnReceivedAtMs = void 0;
|
|
528
549
|
inputGeneration += 1;
|
|
529
550
|
queuedTurns = 0;
|
|
530
551
|
bufferedAudio = [];
|
|
@@ -548,10 +569,14 @@ function createAgentVoiceEngine(options) {
|
|
|
548
569
|
});
|
|
549
570
|
return inputReset;
|
|
550
571
|
}
|
|
572
|
+
function isConversationIdle() {
|
|
573
|
+
return claim.request.purpose === "conversation" && !closed && Boolean(sttSession) && !committing && !activeResponse && !pendingTurn && queuedTurns === 0 && turn.isIdle() && Date.now() - lastUserSpeechAt >= TASK_UPDATE_QUIET_MS;
|
|
574
|
+
}
|
|
551
575
|
function canOfferTaskUpdateInput() {
|
|
552
|
-
return
|
|
576
|
+
return Boolean(claim.tts) && isConversationIdle();
|
|
553
577
|
}
|
|
554
578
|
return {
|
|
579
|
+
isConversationIdle,
|
|
555
580
|
canOfferTaskUpdate() {
|
|
556
581
|
return !taskUpdateQueued && canOfferTaskUpdateInput();
|
|
557
582
|
},
|
|
@@ -10,6 +10,7 @@ export interface VoiceEngine {
|
|
|
10
10
|
cancel(responseId: string, reason: 'client_cancelled' | 'barge_in'): boolean;
|
|
11
11
|
cancelTask(taskId: string): Promise<boolean>;
|
|
12
12
|
acknowledge(responseId: string, playedDurationMs: number): void;
|
|
13
|
+
isConversationIdle?(): boolean;
|
|
13
14
|
canOfferTaskUpdate?(): boolean;
|
|
14
15
|
offerTaskUpdate?(input: {
|
|
15
16
|
clientMessageId: string;
|
|
@@ -13,6 +13,7 @@ export declare function createOmniVoiceEngine(options: {
|
|
|
13
13
|
bargeIn: boolean;
|
|
14
14
|
send: VoiceEventSink;
|
|
15
15
|
sendAudio: (responseId: string, bytes: Uint8Array) => void;
|
|
16
|
+
onUserInput?: () => void;
|
|
16
17
|
record: (entry: OmniTranscript) => Promise<void>;
|
|
17
18
|
onClose: (reason: string, notify: boolean) => Promise<void>;
|
|
18
19
|
}): VoiceEngine;
|
|
@@ -44,6 +44,7 @@ function createOmniVoiceEngine(options) {
|
|
|
44
44
|
const pendingInputs = /* @__PURE__ */ new Set();
|
|
45
45
|
let failed = false;
|
|
46
46
|
let platformRequestId;
|
|
47
|
+
let lastInputAt = 0;
|
|
47
48
|
let active;
|
|
48
49
|
const echoCandidates = new PlaybackEchoCandidates();
|
|
49
50
|
let recentPlayback;
|
|
@@ -360,6 +361,7 @@ function createOmniVoiceEngine(options) {
|
|
|
360
361
|
clearingInput = false;
|
|
361
362
|
clearTimeout(clearTimer);
|
|
362
363
|
} else if (event.type === "input_audio_buffer.speech_started") {
|
|
364
|
+
lastInputAt = Date.now();
|
|
363
365
|
if (muted || clearingInput) {
|
|
364
366
|
discardedInputs.add(String(event.item_id));
|
|
365
367
|
return;
|
|
@@ -375,6 +377,7 @@ function createOmniVoiceEngine(options) {
|
|
|
375
377
|
if (active && !active.published) cancel("barge_in");
|
|
376
378
|
options.send("input.speech_started", { utteranceId: String(event.item_id) });
|
|
377
379
|
} else if (event.type === "input_audio_buffer.speech_stopped") {
|
|
380
|
+
lastInputAt = Date.now();
|
|
378
381
|
if (muted || inputBlocked || discardedInputs.has(String(event.item_id)) || recorded.has(String(event.item_id))) return;
|
|
379
382
|
speaking.delete(String(event.item_id));
|
|
380
383
|
turn.stop(String(event.item_id));
|
|
@@ -408,6 +411,10 @@ function createOmniVoiceEngine(options) {
|
|
|
408
411
|
cancel("barge_in");
|
|
409
412
|
}
|
|
410
413
|
turn.final(event.item_id, text);
|
|
414
|
+
if (text) {
|
|
415
|
+
lastInputAt = Date.now();
|
|
416
|
+
options.onUserInput?.();
|
|
417
|
+
}
|
|
411
418
|
save({
|
|
412
419
|
itemId: event.item_id,
|
|
413
420
|
role: "user",
|
|
@@ -567,6 +574,9 @@ function createOmniVoiceEngine(options) {
|
|
|
567
574
|
}
|
|
568
575
|
pumpInput();
|
|
569
576
|
},
|
|
577
|
+
isConversationIdle() {
|
|
578
|
+
return ready && !closed && !failed && !active && !speaking.size && !pendingInputs.size && !responseCreateQueued && !waitingForCancellation && !clearingInput && !inputBlocked && Date.now() - lastInputAt >= 750;
|
|
579
|
+
},
|
|
570
580
|
async commit() {
|
|
571
581
|
throw new Error("Natural conversation uses automatic turn detection");
|
|
572
582
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
|
|
2
|
-
import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
|
|
3
2
|
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
3
|
+
import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
|
|
4
4
|
import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { statSync } from "node:fs";
|
|
@@ -27,6 +27,7 @@ export declare class VoiceRealtimeRuntime {
|
|
|
27
27
|
createSession(request: CreateVoiceSessionRequest, principalId: string, now?: number): Promise<CreateVoiceSessionResponse>;
|
|
28
28
|
handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean;
|
|
29
29
|
hasConversation(conversationId: string): boolean;
|
|
30
|
+
canPublishReply(conversationId: string): boolean;
|
|
30
31
|
canOfferTaskUpdate(conversationId: string): boolean;
|
|
31
32
|
offerTaskUpdate(input: {
|
|
32
33
|
conversationId: string;
|
|
@@ -313,6 +313,10 @@ var VoiceRealtimeRuntime = class {
|
|
|
313
313
|
this.pruneTickets(Date.now());
|
|
314
314
|
return this.conversationReservations.has(conversationId);
|
|
315
315
|
}
|
|
316
|
+
canPublishReply(conversationId) {
|
|
317
|
+
const sessionId = this.conversationReservations.get(conversationId);
|
|
318
|
+
return (sessionId ? this.activeSessions.get(sessionId) : void 0)?.engine?.isConversationIdle?.() === true;
|
|
319
|
+
}
|
|
316
320
|
canOfferTaskUpdate(conversationId) {
|
|
317
321
|
const sessionId = this.conversationReservations.get(conversationId);
|
|
318
322
|
return (sessionId ? this.activeSessions.get(sessionId) : void 0)?.engine?.canOfferTaskUpdate?.() === true;
|
|
@@ -539,6 +543,7 @@ var VoiceRealtimeRuntime = class {
|
|
|
539
543
|
bargeIn: consumed.config.voice?.realtime?.bargeIn ?? true,
|
|
540
544
|
send,
|
|
541
545
|
sendAudio,
|
|
546
|
+
onUserInput: () => this.options.onConversationInput?.(consumed.request.conversationId),
|
|
542
547
|
record: (entry) => this.options.recordOmniTranscript(consumed.request.conversationId, consumed.sessionId, entry, consumed.conversationSessionId),
|
|
543
548
|
onClose: shutdown
|
|
544
549
|
}) : createAgentVoiceEngine({
|
|
@@ -41,6 +41,8 @@ export interface ResolvedStreamingTts {
|
|
|
41
41
|
route: VoiceProviderRoute;
|
|
42
42
|
}
|
|
43
43
|
export interface VoiceRealtimeRuntimeOptions {
|
|
44
|
+
/** Confirmed non-echo speech invalidates background reply drafts before turn commit. */
|
|
45
|
+
onConversationInput?: (conversationId: string) => void;
|
|
44
46
|
isPrincipalActive?: (principalId: string) => boolean;
|
|
45
47
|
recordOmniTranscript?: (conversationId: string, callId: string, entry: OmniTranscript, expectedTranscriptId: string) => Promise<void>;
|
|
46
48
|
getConversationContext?: (conversationId: string, expectedTranscriptId: string) => Promise<VoiceConversationContext>;
|
|
@@ -12,10 +12,10 @@ import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
|
12
12
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
13
13
|
import { writeKnowledgeItem } from "../knowledge-memory/repository.js";
|
|
14
14
|
import "../knowledge-memory/index.js";
|
|
15
|
-
import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
16
15
|
import { linkAssertionEvidence, reconcileAssertion } from "../user-model/repository.js";
|
|
17
16
|
import { createPriorityWindow, createUserGoal } from "../user-model/goals.js";
|
|
18
17
|
import "../user-model/index.js";
|
|
18
|
+
import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
19
19
|
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
20
20
|
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, getUnderstandingSourceRun, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceGrantPolicies, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
21
21
|
import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
|
|
@@ -4,8 +4,8 @@ import { init_conversation_repository, resolveRoutedConversation } from "../../s
|
|
|
4
4
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
5
5
|
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
6
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
7
|
-
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
8
7
|
import { getProjectWorkspacePathForSession } from "../../projects/workspace.js";
|
|
8
|
+
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
9
9
|
import { automationEventPublisher, getAutomationEventForRun } from "../../automations/events/event-repository.js";
|
|
10
10
|
import { isTerminalWorkflowRunStatus } from "../domain/run.js";
|
|
11
11
|
import { validateWorkflowJsonSchema } from "../domain/schema-validation.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.367",
|
|
4
4
|
"description": "Local-first personal AI for the one-person company, with durable context, tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -162,11 +162,12 @@
|
|
|
162
162
|
"vitest": "4.1.5",
|
|
163
163
|
"vue": "^3.5.35",
|
|
164
164
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
165
|
+
"@xopcai/computer-control-contract": "0.1.0",
|
|
165
166
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
166
167
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
167
|
-
"@xopcai/computer-control-contract": "0.1.0",
|
|
168
|
-
"@xopcai/realtime-client": "0.0.0",
|
|
169
168
|
"@xopcai/gateway-contract": "0.0.0",
|
|
169
|
+
"@xopcai/realtime-client": "0.0.0",
|
|
170
|
+
"@xopcai/image-providers": "0.1.0",
|
|
170
171
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
171
172
|
},
|
|
172
173
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./popover-select-BgSdSbCL.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./mic-CuUb7zc-.js";import{t as c}from"./search-DA7gz22f.js";import{t as l}from"./sparkles-DHlfQFAF.js";import{t as u}from"./cn-JdwAhgNB.js";import{c as d,n as f}from"./locale-store-DId6-v2R.js";import{i as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as te}from"./button-CS04eWY9.js";import{r as p}from"./gateway-config-swr-CoRoOG1l.js";import{n as m,t as h}from"./registry-api-7F2WNEZC.js";import{t as g}from"./skeleton-BwbyijEw.js";import{t as _}from"./electron-env-Dit0bHgy.js";import{Ao as v,Do as y,Ho as b,Hs as x,Mc as S,Pc as C,Wr as w,bs as T,ln as E,qr as ne,un as D,v as re}from"./index-BpXej9jJ.js";import{n as O,r as k}from"./settings-page-layout-X1x-2Cp9.js";import{n as A,t as j}from"./use-autosave-veoM0dHn.js";import{s as M}from"./voice-config-api-Daexehmc.js";import{t as ie}from"./fallback-models-Chhv4Nfv.js";import{r as N}from"./image-generation-api-BPd76jW5.js";var P=e(t(),1),ae=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,ae.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,ee;t[9]===f?ee=t[10]:(ee=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=ee);let te;t[11]!==d||t[12]!==ee?(te=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,ee]}),t[11]=d,t[12]=ee,t[13]=te):te=t[13];let p;return t[14]!==s||t[15]!==te?(p=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4`,children:[s,te]}),t[14]=s,t[15]=te,t[16]=p):p=t[16],p}function B(e){let t=(0,ae.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),c=r?.payload?.config,l,u,d;if(t[0]!==c){d=c===void 0?void 0:M(c);let e=d?L(d.stt.providers,d.stt.provider,`model`):void 0,n=d?L(d.tts.providers,d.tts.provider,`model`):void 0,r=d?L(d.tts.providers,d.tts.provider,`voice`):void 0;l=d?[R(d.stt.provider),e].filter(Boolean).join(` · `):void 0,u=d?[R(d.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=c,t[1]=l,t[2]=u,t[3]=d}else l=t[1],u=t[2],d=t[3];let f=u,ee=n?`语音能力`:`Voice capabilities`,m;t[4]===ee?m=t[5]:(m=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ee}),t[4]=ee,t[5]=m);let h=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,_;t[6]===h?_=t[7]:(_=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:h}),t[6]=h,t[7]=_);let v;t[8]!==m||t[9]!==_?(v=(0,F.jsxs)(`div`,{children:[m,_]}),t[8]=m,t[9]=_,t[10]=v):v=t[10];let y=n?`管理语音设置`:`Manage voice settings`,b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,F.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t[11]=b):b=t[11];let x;t[12]===y?x=t[13]:(x=(0,F.jsx)(te,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[y,b]})}),t[12]=y,t[13]=x);let w;t[14]!==v||t[15]!==x?(w=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[v,x]}),t[14]=v,t[15]=x,t[16]=w):w=t[16];let T;t[17]!==a||t[18]!==o||t[19]!==l||t[20]!==f||t[21]!==d||t[22]!==n?(T=o||!d?a?(0,F.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(g,{className:`h-20 rounded-xl`}),(0,F.jsx)(g,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:s,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:d.stt.enabled,details:l,zh:n}),(0,F.jsx)(z,{icon:S,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:d.tts.enabled,details:f,zh:n})]}),t[17]=a,t[18]=o,t[19]=l,t[20]=f,t[21]=d,t[22]=n,t[23]=T):T=t[23];let E;return t[24]!==w||t[25]!==T?(E=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,T]}),t[24]=w,t[25]=T,t[26]=E):E=t[26],E}var V=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,U={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function W(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function G(e){let t=(0,ae.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=ee(h,m,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=ee(`agent-defaults-image-models`,N,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,d;t[4]===c.data?d=t[5]:(d=c.data??[],t[4]=c.data,t[5]=d);let f;t[6]===d?f=t[7]:(f=d.flatMap(K),t[6]=d,t[7]=f);let p=f,g=i?U.zh:U.en,_;t[8]!==n||t[9]!==r?(_=(e,t)=>{let i={...n.models.intents};t?i[e]=W(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=_):_=t[10];let v=_,y=i?`默认对话模型`:`Default conversation model`,b;t[11]===y?b=t[12]:(b=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:y}),t[11]=y,t[12]=b);let x=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,S;t[13]===x?S=t[14]:(S=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x}),t[13]=x,t[14]=S);let C;t[15]!==S||t[16]!==b?(C=(0,F.jsxs)(`div`,{children:[b,S]}),t[15]=S,t[16]=b,t[17]=C):C=t[17];let T=i?`主模型`:`Primary model`,E;t[18]===T?E=t[19]:(E=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:T}),t[18]=T,t[19]=E);let ne=i?`选择模型`:`Select a model`,D=i?`搜索模型或服务商`:`Search models or providers`,re=i?`没有匹配的模型`:`No matching models`,O=i?`默认对话模型`:`Default conversation model`,k;t[20]!==n||t[21]!==r?(k=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=k):k=t[22];let A;t[23]!==n.models.chat.primary||t[24]!==ne||t[25]!==D||t[26]!==re||t[27]!==O||t[28]!==k?(A=(0,F.jsx)(w,{value:n.models.chat.primary,placeholder:ne,searchPlaceholder:D,noMatches:re,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:O,onChange:k}),t[23]=n.models.chat.primary,t[24]=ne,t[25]=D,t[26]=re,t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==E||t[31]!==A?(j=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[E,A]}),t[30]=E,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==n||t[34]!==r?(M=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=M):M=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==M||t[42]!==i?(P=(0,F.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,F.jsx)(ie,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:M})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=M,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==C||t[45]!==j||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[C,j,P]}),t[44]=C,t[45]=j,t[46]=P,t[47]=I):I=t[47];let L=i?`图片能力`:`Image capabilities`,R;t[48]===L?R=t[49]:(R=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:L}),t[48]=L,t[49]=R);let z=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===z?G=t[51]:(G=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:z}),t[50]=z,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=W(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,F.jsx)(w,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,F.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==p||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,F.jsx)(w,{value:pe,models:p,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=p,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let $;t[84]!==fe||t[85]!==be?($=(0,F.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=$):$=t[86];let xe;t[87]!==ue||t[88]!==$?(xe=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,$]}),t[87]=ue,t[88]=$,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(te,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==R||t[95]!==G||t[96]!==xe||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[R,G,xe,Se]}),t[94]=R,t[95]=G,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(B,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==g||t[106]!==n.models.intents||t[107]!==v||t[108]!==i?(ke=V.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:g[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g[e][1]})]}),(0,F.jsx)(w,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${g[e][0]}模型`:`${g[e][0]} model`,onChange:t=>v(e,t)})]},e)),t[105]=g,t[106]=n.models.intents,t[107]=v,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,ae.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=ee(`agent-defaults-workflows`,re,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(X),t[3]=c,t[4]=l);let d=l,f=n.workflows.allowed===void 0,p;t[5]!==n||t[6]!==r?(p=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=p):p=t[7];let m=p,h=i?`执行限制`:`Execution limits`,g;t[8]===h?g=t[9]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[8]=h,t[9]=g);let _=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,v;t[10]===_?v=t[11]:(v=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[10]=_,t[11]=v);let y=i?`每次运行最多轮数`:`Maximum turns per run`,b=n.runtime.maxTurns??``,x=i?`系统默认`:`System default`,S;t[12]!==n||t[13]!==r?(S=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=S):S=t[14];let C;t[15]!==b||t[16]!==x||t[17]!==S?(C=(0,F.jsx)(`input`,{type:`number`,min:1,value:b,placeholder:x,onChange:S,className:`${q} mt-2`}),t[15]=b,t[16]=x,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==C||t[20]!==y?(w=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[y,C]}),t[19]=C,t[20]=y,t[21]=w):w=t[21];let T=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,E=n.runtime.timeoutMs??``,ne=i?`系统默认`:`System default`,D;t[22]!==n||t[23]!==r?(D=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=D):D=t[24];let O;t[25]!==E||t[26]!==ne||t[27]!==D?(O=(0,F.jsx)(`input`,{type:`number`,min:1,value:E,placeholder:ne,onChange:D,className:`${q} mt-2`}),t[25]=E,t[26]=ne,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==T||t[30]!==O?(k=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[T,O]}),t[29]=T,t[30]=O,t[31]=k):k=t[31];let A=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,j=n.runtime.maxToolFailuresPerTurn??``,M=i?`系统默认`:`System default`,ie;t[32]!==n||t[33]!==r?(ie=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=ie):ie=t[34];let N;t[35]!==j||t[36]!==M||t[37]!==ie?(N=(0,F.jsx)(`input`,{type:`number`,min:1,value:j,placeholder:M,onChange:ie,className:`${q} mt-2`}),t[35]=j,t[36]=M,t[37]=ie,t[38]=N):N=t[38];let P;t[39]!==A||t[40]!==N?(P=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[A,N]}),t[39]=A,t[40]=N,t[41]=P):P=t[41];let I;t[42]!==w||t[43]!==k||t[44]!==P?(I=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[w,k,P]}),t[42]=w,t[43]=k,t[44]=P,t[45]=I):I=t[45];let L;t[46]!==I||t[47]!==g||t[48]!==v?(L=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[g,v,I]}),t[46]=I,t[47]=g,t[48]=v,t[49]=L):L=t[49];let R=i?`提示词缓存`:`Prompt cache`,z;t[50]===R?z=t[51]:(z=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[50]=R,t[51]=z);let B=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,V;t[52]===B?V=t[53]:(V=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H=i?`缓存模式`:`Cache mode`,U;t[54]===H?U=t[55]:(U=(0,F.jsx)(`span`,{children:H}),t[54]=H,t[55]=U);let W;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(W=[`auto`,`off`],t[56]=W):W=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:W.map(e=>(0,F.jsx)(te,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let K;t[61]!==U||t[62]!==G?(K=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[U,G]}),t[61]=U,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(te,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==z||t[72]!==V||t[73]!==Z?(Q=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,V,Z]}),t[71]=z,t[72]=V,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==d||t[90]!==s.isLoading?(_e=(0,F.jsx)(a,{value:fe,options:d,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=d,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,$;t[97]===be?$=t[98]:($=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=$);let xe;t[99]!==n||t[100]!==r?(xe=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=xe):xe=t[101];let Se=f?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Ce;t[102]===Se?Ce=t[103]:(Ce=u(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==xe||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:xe,className:Ce,children:[Te,De]}),t[108]=xe,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=f?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,je;t[116]===Ae?je=t[117]:(je=u(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==f||t[131]!==n.workflows.allowed||t[132]!==m||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=f?null:(0,F.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>m(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=f,t[131]=n.workflows.allowed,t[132]=m,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==$||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[$,Le,Re]}),t[137]=$,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==se||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[se,le,ve,ye,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==L||t[148]!==Q||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[L,Q,Be]}),t[147]=L,t[148]=Q,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}var Q=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function oe(e){let t=(0,ae.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:l,isLoading:d}=ee(`agent-defaults-skills-catalog`,ne,a),[f,te]=(0,P.useState)(``),p=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let m;if(t[1]!==p||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(de));for(let t of p)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();m=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(ue),t[1]=p,t[2]=s?.catalog,t[3]=f,t[4]=m}else m=t[4];let h=m,g;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(g=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=g):g=t[8];let _=g,v;t[9]!==n||t[10]!==r?(v=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=v):v=t[11];let y=v,b;t[12]===s?.catalog?b=t[13]:(b=s?.catalog??[],t[12]=s?.catalog,t[13]=b);let x;if(t[14]!==_||t[15]!==b){let e;t[17]===_?e=t[18]:(e=e=>e.enabled&&_(e.name),t[17]=_,t[18]=e),x=b.filter(e),t[14]=_,t[15]=b,t[16]=x}else x=t[16];let S=x.length,C;t[19]!==s?.catalog||t[20]!==n||t[21]!==r?(C=e=>{let t=new Set((s?.catalog??[]).filter(le).map(ce));r({...n,skills:{mode:`selected`,include:Z(e.filter(e=>t.has(e)))}})},t[19]=s?.catalog,t[20]=n,t[21]=r,t[22]=C):C=t[22];let w=C,E=i?`技能策略`:`Skill policy`,D;t[23]===E?D=t[24]:(D=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:E}),t[23]=E,t[24]=D);let re=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,O;t[25]===re?O=t[26]:(O=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:re}),t[25]=re,t[26]=O);let k;t[27]!==n||t[28]!==r?(k=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=k):k=t[29];let A=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,j;t[30]===A?j=t[31]:(j=u(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,A),t[30]=A,t[31]=j);let M;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=M):M=t[32];let ie=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[33]===ie?N=t[34]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ie}),t[33]=ie,t[34]=N);let I=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,L;t[35]===I?L=t[36]:(L=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[35]=I,t[36]=L);let R;t[37]!==N||t[38]!==L?(R=(0,F.jsxs)(`span`,{children:[N,L]}),t[37]=N,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==k||t[41]!==j||t[42]!==R?(z=(0,F.jsxs)(`button`,{type:`button`,onClick:k,className:j,children:[M,R]}),t[40]=k,t[41]=j,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==n||t[45]!==r?(B=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=B):B=t[46];let V=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,H;t[47]===V?H=t[48]:(H=u(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V),t[47]=V,t[48]=H);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,F.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=U):U=t[49];let W=i?`只使用选中的技能`:`Use selected skills only`,G;t[50]===W?G=t[51]:(G=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:W}),t[50]=W,t[51]=G);let K=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,q;t[52]===K?q=t[53]:(q=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J;t[54]!==G||t[55]!==q?(J=(0,F.jsxs)(`span`,{children:[G,q]}),t[54]=G,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==B||t[58]!==H||t[59]!==J?(Y=(0,F.jsxs)(`button`,{type:`button`,onClick:B,className:H,children:[U,J]}),t[57]=B,t[58]=H,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==z||t[62]!==Y?(X=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[z,Y]}),t[61]=z,t[62]=Y,t[63]=X):X=t[63];let oe=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,fe;t[64]===oe?fe=t[65]:(fe=(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:oe}),t[64]=oe,t[65]=fe);let pe;t[66]!==w||t[67]!==s||t[68]!==i?(pe=Q.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>w(e.names),disabled:!s,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=w,t[67]=s,t[68]=i,t[69]=pe):pe=t[69];let me;t[70]===pe?me=t[71]:(me=(0,F.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:pe}),t[70]=pe,t[71]=me);let he;t[72]!==fe||t[73]!==me?(he=(0,F.jsxs)(`div`,{className:`mt-4`,children:[fe,me]}),t[72]=fe,t[73]=me,t[74]=he):he=t[74];let ge;t[75]!==O||t[76]!==X||t[77]!==he||t[78]!==D?(ge=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[D,O,X,he]}),t[75]=O,t[76]=X,t[77]=he,t[78]=D,t[79]=ge):ge=t[79];let _e=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,ve;t[80]===_e?ve=t[81]:(ve=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_e}),t[80]=_e,t[81]=ve);let ye=i?`当前默认可用 ${S} 个技能。`:`${S} skills are available by default.`,be;t[82]===ye?be=t[83]:(be=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ye}),t[82]=ye,t[83]=be);let $;t[84]!==ve||t[85]!==be?($=(0,F.jsxs)(`div`,{children:[ve,be]}),t[84]=ve,t[85]=be,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,F.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,F.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>te(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=f,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==_||t[103]!==d||t[104]!==h||t[105]!==y||t[106]!==i?(Ae=d?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(se)}):(0,F.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[h.map(e=>{let t=_(e.name);return(0,F.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>y(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),h.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=_,t[103]=d,t[104]=h,t[105]=y,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==ge||t[113]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[ge,je]}),t[112]=ge,t[113]=je,t[114]=Me):Me=t[114],Me}function se(e){return(0,F.jsx)(g,{className:`h-14 rounded-xl`},e)}function ce(e){return e.name}function le(e){return e.enabled}function ue(e,t){return e.name.localeCompare(t.name)}function de(e){return e.name}function fe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function pe(e){let t=(0,ae.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[l,d]=(0,P.useState)(`all`),[f,ee]=(0,P.useState)(),p;t[0]===i?p=t[1]:(p=new Map(i.map(ge)),t[0]=i,t[1]=p);let m=p,h;t[2]!==i||t[3]!==n.tools?(h=[...new Set([...i.map(he),...Object.keys(n.tools)])].filter(me).sort(),t[2]=i,t[3]=n.tools,t[4]=h):h=t[4];let g=h,_;if(t[5]!==g||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),_=g.filter(e),t[5]=g,t[6]=n.tools,t[7]=_}else _=t[7];let v=_.length,b;if(t[10]!==g||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),b=g.filter(e),t[10]=g,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,S;if(t[15]!==g||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),S=g.filter(e),t[15]=g,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==_.length||t[21]!==b.length||t[22]!==S.length?(C={allow:v,ask:x,deny:S.length},t[20]=_.length,t[21]=b.length,t[22]=S.length,t[23]=C):C=t[23];let w=C,T;if(t[24]!==g||t[25]!==m||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();T=g.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=m.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=g,t[25]=m,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=T}else T=t[29];let E=T,ne;t[30]!==n||t[31]!==r?(ne=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=ne):ne=t[32];let D=ne,re=a?`全部 ${g.length}`:`All ${g.length}`,O;t[33]===re?O=t[34]:(O={id:`all`,label:re},t[33]=re,t[34]=O);let k=a?`允许 ${w.allow}`:`Allow ${w.allow}`,A;t[35]===k?A=t[36]:(A={id:`allow`,label:k},t[35]=k,t[36]=A);let j=a?`询问 ${w.ask}`:`Ask ${w.ask}`,M;t[37]===j?M=t[38]:(M={id:`ask`,label:j},t[37]=j,t[38]=M);let ie=a?`禁用 ${w.deny}`:`Deny ${w.deny}`,N;t[39]===ie?N=t[40]:(N={id:`deny`,label:ie},t[39]=ie,t[40]=N);let I;t[41]!==O||t[42]!==A||t[43]!==M||t[44]!==N?(I=[O,A,M,N],t[41]=O,t[42]=A,t[43]=M,t[44]=N,t[45]=I):I=t[45];let L=I,R=a?`默认工具权限`:`Default tool permissions`,z;t[46]===R?z=t[47]:(z=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[46]=R,t[47]=z);let B=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,V;t[48]===B?V=t[49]:(V=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[48]=B,t[49]=V);let H;t[50]!==z||t[51]!==V?(H=(0,F.jsxs)(`div`,{children:[z,V]}),t[50]=z,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==l||t[54]!==L?(U=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:L.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>d(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=l,t[54]=L,t[55]=U):U=t[55];let W=a?`搜索工具`:`Search tools`,G;t[56]===W?G=t[57]:(G=(0,F.jsx)(`span`,{className:`sr-only`,children:W}),t[56]=W,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,F.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==U||t[67]!==X?(Z=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[U,X]}),t[66]=U,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==m||t[70]!==n.tools||t[71]!==f||t[72]!==D||t[73]!==E||t[74]!==a){let e;t[76]!==m||t[77]!==n.tools||t[78]!==f||t[79]!==D||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=m.get(e),i=f===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>D(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(te,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>ee(i?void 0:e),children:(0,F.jsx)(y,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>D(e,{maxCallsPerTurn:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>D(e,{timeoutMs:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=m,t[77]=n.tools,t[78]=f,t[79]=D,t[80]=a,t[81]=e):e=t[81],Q=E.map(e),t[69]=m,t[70]=n.tools,t[71]=f,t[72]=D,t[73]=E,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==E.length||t[83]!==a?(oe=E.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=E.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,F.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==H||t[89]!==Z||t[90]!==se?(ce=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[H,Z,se]}),t[88]=H,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function me(e){return e!==`computer_use`||_()}function he(e){return e.id}function ge(e){return[e.id,e.description]}function _e(){let e=(0,ae.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(k,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(g,{className:`h-7 w-56`}),(0,F.jsx)(g,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(g,{className:`h-9 w-28`})]}),(0,F.jsx)(g,{className:`h-20 rounded-2xl`}),(0,F.jsx)(g,{className:`h-12 rounded-xl`}),(0,F.jsx)(g,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ve(e){let t=(0,ae.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,P.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,d]=(0,P.useState)(s),f;t[2]===n?f=t[3]:(f=()=>structuredClone(n),t[2]=n,t[3]=f);let[ee,p]=(0,P.useState)(f),m;t[4]===c?m=t[5]:(m=JSON.stringify(c),t[4]=c,t[5]=m);let h;t[6]===ee?h=t[7]:(h=JSON.stringify(ee),t[6]=ee,t[7]=h);let g=m!==h,_=i?`模型`:`Models`,y;t[8]===_?y=t[9]:(y={id:`models`,label:_,icon:l},t[8]=_,t[9]=y);let S=i?`技能`:`Skills`,C;t[10]===S?C=t[11]:(C={id:`skills`,label:S,icon:b},t[10]=S,t[11]=C);let w=i?`工具`:`Tools`,T;t[12]===w?T=t[13]:(T={id:`tools`,label:w,icon:v},t[12]=w,t[13]=T);let E=i?`运行`:`Runtime`,ne;t[14]===E?ne=t[15]:(ne={id:`runtime`,label:E,icon:x},t[14]=E,t[15]=ne);let re;t[16]!==T||t[17]!==ne||t[18]!==y||t[19]!==C?(re=[y,C,T,ne],t[16]=T,t[17]=ne,t[18]=y,t[19]=C,t[20]=re):re=t[20];let M=re,ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=async e=>{let t=structuredClone(e),n=await D(t),r=structuredClone(n.defaults);d(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),p(structuredClone(r))},t[21]=ie):ie=t[21];let N=ie,I;t[22]!==g||t[23]!==c?(I={value:c,dirty:g,onSave:N,delayMs:0},t[22]=g,t[23]=c,t[24]=I):I=t[24];let L=j(I),R=L.onBlurCapture,z=i?`智能体设置`:`Agent settings`,B;t[25]!==L.error||t[26]!==L.status?(B=(0,F.jsx)(A,{status:L.status,error:L.error}),t[25]=L.error,t[26]=L.status,t[27]=B):B=t[27];let V;t[28]!==z||t[29]!==B?(V=(0,F.jsx)(O,{title:z,actions:B}),t[28]=z,t[29]=B,t[30]=V):V=t[30];let H;t[31]!==L.error||t[32]!==L.retry||t[33]!==i?(H=L.error?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,F.jsx)(`span`,{children:L.error}),(0,F.jsx)(te,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:i?`重试`:`Retry`})]}):null,t[31]=L.error,t[32]=L.retry,t[33]=i,t[34]=H):H=t[34];let U=i?`默认配置分区`:`Default configuration sections`,W;t[35]!==a||t[36]!==M?(W=M.map(e=>{let{id:t,label:n,icon:r}=e;return(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:u(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=M,t[37]=W):W=t[37];let K;t[38]!==U||t[39]!==W?(K=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":U,children:W}),t[38]=U,t[39]=W,t[40]=K):K=t[40];let q;t[41]!==a||t[42]!==c||t[43]!==i?(q=a===`models`?(0,F.jsx)(G,{draft:c,setDraft:d,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==c||t[47]!==i?(J=a===`skills`?(0,F.jsx)(oe,{draft:c,setDraft:d,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(X=a===`tools`?(0,F.jsx)(pe,{draft:c,setDraft:d,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==c||t[56]!==i?(Z=a===`runtime`?(0,F.jsx)(Y,{draft:c,setDraft:d,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=Z):Z=t[57];let Q;return t[58]!==L.onBlurCapture||t[59]!==V||t[60]!==H||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(Q=(0,F.jsxs)(k,{gap:`gap-5`,onBlurCapture:R,children:[V,H,K,q,J,X,Z]}),t[58]=L.onBlurCapture,t[59]=V,t[60]=H,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=Q):Q=t[66],Q}function ye(){let e=(0,ae.c)(17),t=d($),n=f(be)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=ee(t?`settings-agent-defaults`:null,E);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(k,{children:(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,F.jsx)(te,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,F.jsxs)(k,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(_e,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(ve,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function be(e){return e.language}function $(e){return e.conversationId}export{ye as AgentDefaultsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-BHvpZNe9.js";import{t as c}from"./cn-JdwAhgNB.js";import{a as l,i as u,n as ee,r as d}from"./locale-store-DId6-v2R.js";import{a as f,i as te,o as p,r as ne,s as re,t as m}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-CS04eWY9.js";import{n as g}from"./gateway-config-swr-CoRoOG1l.js";import{t as ae}from"./skeleton-BwbyijEw.js";import{$s as _,Ao as v,At as y,ai as b,bc as x,jt as oe,kt as S,so as se}from"./index-BpXej9jJ.js";var C=e(t(),1),w=/^([^:=]+)[:=](.*)$/;function T(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=w.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function E(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function D(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function O(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function k(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||O(t)&&(r[e]=t);return r}function A(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function j(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function M(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=A(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=j(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=E(e.headers);return n&&(t.headers=n),e.transport===`streamable-http`&&e.auth===`oauth`&&(t.auth={type:`oauth`,...e.oauthClientId.trim()?{clientId:e.oauthClientId.trim()}:{}}),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function ce(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0,o=t.auth&&typeof t.auth==`object`&&!Array.isArray(t.auth)?t.auth:void 0,s=o?.type===`oauth`?`oauth`:`none`;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:D(a),auth:s,oauthClientId:typeof o?.clientId==`string`?o.clientId:``,connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function N(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],auth:`none`,oauthClientId:``,connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function le(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||O(t)?[]:[ce(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function ue(e){return M(e)}async function de(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=M(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await l(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),g()}async function P(e,t,n=``){let r=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!r.payload)throw Error(r.error??`MCP OAuth request failed`);return r.payload}function F(e){return P(e,`GET`)}function I(e){return P(e,`POST`,`/start`)}function L(e){return P(e,`DELETE`)}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function fe(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function z(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function B(e,t){let n=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=R(n.payload.tools),i=fe(n.payload.resources),a=z(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function pe(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function me(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function he(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function V(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}var H=n(),U=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function ge(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function _e(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function W(e,t,n){let r=await l(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function ve({pluginId:e,server:t,enabled:n}){let{mutate:r}=ie(),i=ee(e=>e.language).startsWith(`zh`),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(null),[l,f]=(0,C.useState)(``),[te,p]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(!1),[m,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(t.type===`stdio`?`API_KEY`:`Authorization`),[b,x]=(0,C.useState)(t.type===`stdio`?``:`Bearer `),[se,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(``),D=`/api/mcp/servers/${encodeURIComponent(t.id)}`;async function O(){let e=await u(d(`${D}/test`),{method:`POST`,body:`{}`}),t=await e.json();if(r(`gateway-extensions-list`),p(t.code===`MCP_AUTHORIZATION_REQUIRED`),!e.ok||!t.ok)throw Error(t.error??`Connection failed`);f(i?`连接成功 · ${t.payload.toolCount} 个工具`:`Connected · ${t.payload.toolCount} tools`)}(0,C.useEffect)(()=>{if(!n||t.type!==`streamable-http`)return;let e=!1;return F(t.id).then(t=>{e||(c(t),w(!0))}).catch(t=>{e||(f(String(t)),w(!0))}),()=>{e=!0}},[n,t.id,t.type]),(0,C.useEffect)(()=>{if(s?.status!==`authorizing`)return;let e=!1,n=window.setInterval(()=>{F(t.id).then(t=>{e||(c(t),t.status===`connected`&&(p(!1),f(i?`已连接,可以重试原任务`:`Connected. Retry your task.`),r(`gateway-extensions-list`)),t.status===`error`&&f(t.session?.error??`Authorization failed`))}).catch(t=>{e||f(String(t))})},1500);return()=>{e=!0,window.clearInterval(n)}},[s?.status,t.id,i,r]);async function k(e){o(!0),f(``);try{await e()}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}}return(0,H.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,H.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e,` · `,t.type]})]}),n?(0,H.jsxs)(H.Fragment,{children:[t.type===`streamable-http`&&!se?(0,H.jsx)(ae,{className:`mb-2 h-4 w-24`}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(O),children:i?`测试连接`:`Test connection`}),t.type===`streamable-http`&&s?.status!==`connected`?(0,H.jsx)(h,{variant:te?`primary`:`secondary`,disabled:a,onClick:()=>{let e=oe();k(async()=>{try{let n=await I(t.id);if(c(n),n.session?.authorizationUrl){if(!await y(n.session.authorizationUrl,e))throw Error(i?`无法打开授权页面`:`Could not open authorization page`)}else if(S(e),n.session?.error)throw Error(n.session.error)}catch(t){throw S(e),t}})},children:i?`连接账号`:`Connect account`}):null,s?.status===`connected`?(0,H.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(async()=>{c(await L(t.id)),r(`gateway-extensions-list`)}),children:i?`断开连接`:`Disconnect`}):null,(0,H.jsx)(h,{variant:`ghost`,disabled:a,onClick:()=>re(!ne),children:i?`设置密钥`:`Set API key`})]}),ne?(0,H.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:n=>{n.preventDefault(),k(async()=>{await W(`/api/extensions/agent-plugins/${encodeURIComponent(e)}/mcp/${encodeURIComponent(t.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:t.type===`stdio`?`env`:`headers`,key:_,value:m,prefix:b}]}),g(``),re(!1),c(null),p(!1),await O()})},children:[(0,H.jsxs)(`label`,{className:`block`,children:[i?`字段名`:`Field name`,(0,H.jsx)(`input`,{className:U,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,H.jsxs)(`label`,{className:`block`,children:[i?`前缀(可选)`:`Prefix (optional)`,(0,H.jsx)(`input`,{className:U,value:b,onChange:e=>x(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`block`,children:[i?`密钥`:`Secret`,(0,H.jsx)(`input`,{className:U,type:`password`,autoComplete:`off`,value:m,onChange:e=>g(e.target.value),required:!0})]}),(0,H.jsx)(h,{type:`submit`,disabled:a||!m,children:i?`保存并测试`:`Save and test`})]}):null]}):(0,H.jsx)(`p`,{className:`text-fg-muted`,children:i?`启用插件后连接服务`:`Enable the plugin to connect`}),s?.status===`authorizing`?(0,H.jsxs)(`div`,{className:`mt-2 space-y-2 text-fg-muted`,children:[(0,H.jsx)(`p`,{children:i?`请在浏览器完成授权`:`Complete authorization in your browser`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:i?`使用远程 Gateway?`:`Using a remote Gateway?`}),(0,H.jsxs)(`form`,{className:`mt-2 space-y-2`,onSubmit:e=>{e.preventDefault(),k(async()=>{c(await W(`${D}/oauth/callback`,`POST`,{callbackUrl:T})),E(``)})},children:[(0,H.jsxs)(`label`,{children:[i?`如果浏览器跳转后无法连接,请粘贴地址栏中的完整回调 URL`:`If the browser cannot reach the callback, paste its full address-bar URL`,(0,H.jsx)(`input`,{type:`password`,autoComplete:`off`,className:U,value:T,onChange:e=>E(e.target.value)})]}),(0,H.jsx)(h,{type:`submit`,disabled:a||!T,children:i?`完成连接`:`Complete connection`})]})]})]}):null,l?(0,H.jsx)(`p`,{role:`status`,className:`mt-2 break-words text-fg-muted`,children:l}):null]})}function G({extension:e,onClose:t,initialSource:n=``,marketplace:l,autoInstall:u=!1}){let d=ee(e=>e.language),g=d.startsWith(`zh`),ae=l?.localizations?.[g?`zh-CN`:`en`],y=ae?.displayName??l?.name,oe=ae?.description??l?.description,S=(0,C.useId)(),{mutate:w}=ie(),[T,E]=(0,C.useState)(e),[D,O]=(0,C.useState)(n),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[ce,N]=(0,C.useState)(``),[le,ue]=(0,C.useState)(!1),[de,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(!1),[L,R]=(0,C.useState)(!1),[fe,z]=(0,C.useState)(!1),[B,pe]=(0,C.useState)(!1),[me,he]=(0,C.useState)(!1),V=(0,C.useRef)(!1),G=`/api/extensions/agent-plugins/${encodeURIComponent(T?.pluginId??``)}`,K=D.trim().startsWith(`store:`),q=()=>w(`gateway-extensions-list`);async function J(e){M(!0),N(``);try{await e()}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}function Y(e){O(e),A(null),N(``)}let X=typeof window<`u`?window.electronAPI?.file:void 0,Z=/^(?:\/|[A-Za-z]:[\\/])/.test(D.trim())?D.trim():void 0;async function ye(){if(!X?.openDirectory){z(!0);return}let e=await X.openDirectory(Z?{defaultPath:Z}:void 0);e&&Y(e)}async function be(){if(!X?.openFile){z(!0);return}let e=await X.openFile({...Z?{defaultPath:Z}:{},extensions:[`zip`]});e&&Y(e)}function Q(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!Q(e))return;e.preventDefault(),R(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){N(g?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=X?.getPathForFile?.(t[0]);e?Y(e):N(g?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&Y(n.trim().split(/\r?\n/)[0])}async function Se(e){E(await W(`${G}/activation`,`POST`,{enabled:e})),await q()}async function Ce(e){let t=!T,n=await W(t?`/api/extensions/install`:`${G}/update`,`POST`,{source:D,reviewHash:e.reviewHash});E(n),await q(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await W(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),E(n),await q()),A(null),he(t&&n.activationEligible===!0)}async function we(){let e=await W(`/api/extensions/inspect`,`POST`,{source:D});if(_e(e,l)){A(e);return}await Ce(e)}(0,C.useEffect)(()=>{e&&E(e)},[e]),(0,C.useEffect)(()=>{!u||T||!K||V.current||(V.current=!0,J(we))},[u,T,K]);let Te=u&&!T&&K&&!V.current,$=T?.components;return(0,H.jsx)(m,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,H.jsxs)(p,{children:[(0,H.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,H.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,H.jsx)(re,{className:`font-semibold`,children:T?.name??y??(g?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,H.jsx)(h,{variant:`ghost`,onClick:t,children:g?`关闭`:`Close`})]}),(0,H.jsx)(te,{className:`sr-only`,children:g?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!T&&K?(0,H.jsxs)(`section`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:y??k?.manifest.name??D.slice(6)}),oe?(0,H.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:oe}):null,(0,H.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l?.publisher?.verification===`verified`?g?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:g?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),k?null:(0,H.jsxs)(h,{className:`w-full`,disabled:j||Te,onClick:()=>void J(we),children:[j||Te?(0,H.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,j||Te?g?`正在安全检查并安装…`:`Checking and installing…`:g?`一键安装`:`Install`]})]}):null,T?(0,H.jsxs)(H.Fragment,{children:[me?(0,H.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,H.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:g?`插件已安装并启用`:`Plugin installed and enabled`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,T.activationEligible?null:(0,H.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-medium text-accent-fg`,children:g?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,H.jsx)(h,{disabled:j||T.readiness===`blocked`,onClick:()=>void J(()=>Se(!0)),children:g?`启用插件`:`Enable plugin`})]}),(0,H.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,T.version,` · `,T.readiness&&{ready:g?`已就绪`:`Ready`,setup_required:g?`待连接`:`Setup required`,degraded:g?`部分不可用`:`Partially available`,blocked:g?`已阻止`:`Blocked`}[T.readiness]]}),T.provenance?(0,H.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[T.provenance.publisherVerification===`verified`?g?`已认证发布者`:`Verified publisher`:g?`社区发布者`:`Community publisher`,` · `,T.provenance.packageName,`@`,T.provenance.version,` · SHA-256 `,T.provenance.sha256.slice(0,12),`…`,T.provenance.riskTier?` · ${T.provenance.riskTier}`:``]}):null,(0,H.jsx)(`p`,{className:`text-sm`,children:T.description}),T.activationEligible?(0,H.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void J(()=>Se(!1)),children:g?`停用`:`Disable`}):null,T.canRollback?(0,H.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void J(async()=>{E(await W(`${G}/rollback`,`POST`)),await q()}),children:g?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:g?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,H.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,H.jsx)(r,{to:`/capabilities/skills?source=plugin`,children:g?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,H.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,H.jsx)(r,{to:`/capabilities/connectors?tab=connected`,children:g?`管理连接`:`Manage connections`})}):null]})]}):null,T.components?.mcp.length?(0,H.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsx)(`span`,{children:g?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,H.jsx)(x,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:g?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,H.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.components.mcp.map(e=>(0,H.jsx)(ve,{pluginId:T.pluginId,server:e,enabled:T.active},e.id))})]}):null,T.diagnostics?.map((e,t)=>(0,H.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,K&&T?(0,H.jsxs)(h,{variant:`ghost`,className:`px-0`,"aria-expanded":B,onClick:()=>pe(e=>!e),children:[(0,H.jsx)(x,{className:c(`size-4 transition-transform motion-reduce:transition-none`,B&&`rotate-180`),"aria-hidden":!0}),g?`高级操作`:`Advanced actions`]}):null,!K||B?(0,H.jsxs)(`form`,{className:c(`space-y-3`,T&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),J(async()=>{A(await W(`/api/extensions/inspect`,`POST`,{source:D}))})},children:[(0,H.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:c(`rounded-xl border border-dashed p-3 transition-colors`,L?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{Q(e)&&(e.preventDefault(),R(!0))},onDragOver:e=>{Q(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,R(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||R(!1)},onDrop:xe,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,H.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:S,className:`block text-sm font-medium`,children:T?g?`更新包来源`:`Update package source`:g?`安装包来源`:`Package source`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,H.jsx)(`input`,{id:S,className:U,value:D,onChange:e=>Y(e.target.value),placeholder:g?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:X?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void J(ye),children:[(0,H.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择目录`:`Choose directory`]}),(0,H.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void J(be),children:[(0,H.jsx)(_,{className:`size-4`,"aria-hidden":!0}),g?`选择 ZIP`:`Choose ZIP`]})]}):(0,H.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>z(!0),children:[(0,H.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择文件或目录`:`Choose file or folder`]})})]}),(0,H.jsx)(h,{type:`submit`,variant:`secondary`,disabled:j||!D,children:g?`检查安装包`:`Inspect package`})]}):null,k?(0,H.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:g?`需要你的授权`:`Your authorization is required`}),(0,H.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:g?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,H.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:k.addedCapabilities.map(e=>(0,H.jsxs)(`li`,{className:`flex gap-2`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,H.jsx)(`span`,{children:ge(e,g)})]},e))}),k.diagnostics.map((e,t)=>(0,H.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(h,{disabled:j||!!T&&k.manifest.name!==T.pluginId,onClick:()=>void J(()=>Ce(k)),children:[j?(0,H.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?`授权并安装`:`Authorize and install`]}),(0,H.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>A(null),children:g?`取消`:`Cancel`})]})]}):null,T&&(!K||B)?(0,H.jsx)(`div`,{className:`border-t border-edge pt-4`,children:F?(0,H.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,H.jsx)(`p`,{children:g?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,H.jsxs)(`label`,{className:`flex gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:le,onChange:e=>ue(e.target.checked)}),g?`同时删除插件数据`:`Also delete plugin data`]}),(0,H.jsxs)(`label`,{className:`flex gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>P(e.target.checked)}),g?`同时删除本地凭据`:`Also delete local credentials`]}),(0,H.jsx)(h,{disabled:j,onClick:()=>void J(async()=>{await W(G,`DELETE`,{removeData:le,removeCredentials:de}),await q(),t()}),children:g?`确认卸载`:`Confirm uninstall`})]}):(0,H.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>I(!0),children:g?`卸载插件`:`Uninstall`})}):null,ce?(0,H.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:ce}):null]})]}),X?null:(0,H.jsx)(b,{open:fe,onOpenChange:z,initialAbsolutePath:Z,onConfirm:async e=>Y(e),wd:s(d).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:g?`选择插件安装包`:`Choose plugin package`,description:g?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:g?`使用此来源`:`Use this source`,nested:!0})]})})}export{L as a,F as c,V as d,de as f,T as g,B as h,pe as i,le as l,I as m,ve as n,N as o,he as p,ue as r,k as s,G as t,me as u};
|