@xopcai/xopc 0.0.324 → 0.0.329
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/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B-Gczr_A.js → agent-avatar-dicebear-Bs1qnnhD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHJyAT7t.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DLKj_iIh.js +1 -0
- package/dist/gateway/static/root/assets/agents-SXZ5O0g4.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BwWdVRlb.js → app-management-settings-panel-BrIji9B5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-EoXNDO1j.js → appearance-settings-Uts-MQ7K.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DcclVdxW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B_T0uMvL.js → archive-plugin-_EzRfBuI.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D9DDwxd2.js → attachment-load-CHg7_XFl.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-jI9vNr2r.js → automations-page-CGMErk_w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Cc4yqiF6.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Dzsxh9OL.js → binary-plugins-D3WB-tVn.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWUUgWWk.js → block-editor-Cm1W-14I.js} +53 -53
- package/dist/gateway/static/root/assets/box-DvYoGszj.js +1 -0
- package/dist/gateway/static/root/assets/braces-Cfmtagno.js +1 -0
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DSWXq9lI.js → browser-automation-inputs-VnvK-GQP.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CZYCvSSU.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-DDz9PE6m.js +3 -0
- package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-DH3aDk53.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C8jMZAJl.js +8 -0
- package/dist/gateway/static/root/assets/capability-discover-page-CgGvsf3t.js +1 -0
- package/dist/gateway/static/root/assets/capability-header-actions-C3chJDQu.js +1 -0
- package/dist/gateway/static/root/assets/capability-icon-BYm2-nS-.js +1 -0
- package/dist/gateway/static/root/assets/channels-CuVS_KsY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-WXZrEB3K.js → chat-terminal-dock-ClbmjCL2.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-BfZaf516.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-F-fYNIx8.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-B4SLpvSL.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DXQTsUJn.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-B_z3zihW.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DPVPqFlh.js → desktop-pet-C1TZzKS3.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-B5JGIfqn.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DFYK_Ywf.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-BfxaNwMB.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-cuG5Lnwf.js → extension-debug-page-Bs8_FYCm.js} +1 -1
- package/dist/gateway/static/root/assets/extension-marketplace-api-DqV4YRYs.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-BCTAXdyE.js → extension-page-DH5vFbBw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-kadW_icu.js → extension-settings-page-hGKovxxC.js} +1 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-CoQVulMd.js → gateway-config-swr-BYMrbKZE.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIsiP-JI.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B5GJ-CQV.js → gateway-startup-retry-DMqYXHAn.js} +1 -1
- package/dist/gateway/static/root/assets/gauge-C78eD2BA.js +1 -0
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CoBivEvx.js +1 -0
- package/dist/gateway/static/root/assets/image-Cwyalflz.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DvWDkbk1.js → image-generation-api-D1sQGaJz.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-rssb4rjP.js +1 -0
- package/dist/gateway/static/root/assets/inbox-DNoSz682.js +1 -0
- package/dist/gateway/static/root/assets/index-C4QN4gCi.css +1 -0
- package/dist/gateway/static/root/assets/index-Cr4SINLG.js +121 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C1fKIjz4.js → keyboard-shortcuts-settings-CMitbles.js} +1 -1
- package/dist/gateway/static/root/assets/layout-grid-CEVZdVFU.js +1 -0
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
- package/dist/gateway/static/root/assets/list-BBGUdmkF.js +1 -0
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-Di82Oacm.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-CCvA9d9L.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BPZR8x9b.js → locale-store-BSkKhYkc.js} +1 -1
- package/dist/gateway/static/root/assets/lock-keyhole-DEK5kH0u.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-BK8ol1q0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-CebXkEtB.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-Dft8ASFD.js → markdown-view-DXubGEic.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-Cjj-fidX.js → media-plugins-DLJrmU9J.js} +1 -1
- package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +1 -0
- package/dist/gateway/static/root/assets/messages-D0G_sZvA.js +3 -0
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-B0EUPwTv.js +1 -0
- package/dist/gateway/static/root/assets/network-BUQLY1BV.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-xsKDIJdK.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-1qg2v-9j.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-BFm7XnWH.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-C3JiQEKD.js +1 -0
- package/dist/gateway/static/root/assets/paperclip-f1HujQY1.js +1 -0
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +1 -0
- package/dist/gateway/static/root/assets/power-ZI-pBczI.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-buk_gdip.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DlpCi5zT.js → product-open-page-DwEEO0Ak.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CRQGCRSU.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DcqylysA.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DWWO6ajd.js → registry-api-tx8XCHOs.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cq5MaiRW.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BT_ANpaT.js → runtime-tools-settings-panel-De7HmmBu.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-GXJ-b3dO.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-BcqsqSsV.js → schema-form-DPMEuj5D.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/server-BlHCBjiE.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-C6FwYIRA.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEyQiZs0.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DM0D-BQ_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-B65vii9U.js → settings-page-CWS9yOH3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-BhGKiTPf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BS8o58NJ.js → share-preview-page-CcRi2yGy.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DNmcCBfX.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-BCAV_F1P.js +1 -0
- package/dist/gateway/static/root/assets/skill-card-icon-BrrpZ3Mw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BEV2WXGk.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C8zOGpKw.js +2 -0
- package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +1 -0
- package/dist/gateway/static/root/assets/stethoscope-DRqTAtjD.js +1 -0
- package/dist/gateway/static/root/assets/store-SzD1Jvgm.js +1 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C_lajq9u.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-Dk8Bmlhw.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-CYvKiE_f.js +1 -0
- package/dist/gateway/static/root/assets/upload-rrb46c3c.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-ZTHe1zCM.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-C_SPNZbP.js +2 -0
- package/dist/gateway/static/root/assets/user-round-C9jxPhMR.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DJV-qERt.js → voice-api-key-field-C8Kpkct-.js} +1 -1
- package/dist/gateway/static/root/assets/voice-config-api-BvzxINUk.js +1 -0
- package/dist/gateway/static/root/assets/wand-sparkles-DWuJz5ya.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DcHhy54L.js → work-discovery-overlay-ClB6T-dm.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-X0Cyh2AR.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BrL6dzf0.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +1 -0
- package/dist/gateway/static/root/connector-icons/wecom.svg +9 -0
- package/dist/gateway/static/root/index.html +26 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
- package/dist/src/agent/agent-manager.d.ts +4 -2
- package/dist/src/agent/agent-manager.js +58 -19
- package/dist/src/agent/background-review/coordinator.d.ts +2 -7
- package/dist/src/agent/background-review/coordinator.js +17 -34
- package/dist/src/agent/background-review/prompts.d.ts +13 -5
- package/dist/src/agent/background-review/prompts.js +17 -12
- package/dist/src/agent/background-review/run-background-review.d.ts +3 -3
- package/dist/src/agent/background-review/run-background-review.js +58 -43
- package/dist/src/agent/context/execution-context.js +5 -2
- package/dist/src/agent/mcp/index.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +2 -2
- package/dist/src/agent/mcp/oauth/index.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +2 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +12 -0
- package/dist/src/agent/tools/user-context-tool.js +29 -4
- package/dist/src/automations/domain/types.d.ts +7 -1
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +36 -13
- package/dist/src/automations/service/automation-service.js +2 -1
- package/dist/src/browser/automations/index.js +2 -2
- package/dist/src/browser/automations/service.d.ts +11 -2
- package/dist/src/browser/automations/service.js +19 -5
- package/dist/src/capabilities/readiness/from-config.d.ts +0 -1
- package/dist/src/capabilities/readiness/from-config.js +2 -4
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +2 -1
- package/dist/src/config/schema.js +4 -4
- package/dist/src/connectors/china-catalog.js +5 -1
- package/dist/src/connectors/connected-source-ingestion.js +6 -1
- package/dist/src/connectors/connected-source-observations.d.ts +10 -0
- package/dist/src/connectors/connected-source-observations.js +80 -0
- package/dist/src/connectors/connected-source-understanding.js +198 -8
- package/dist/src/connectors/learning-coordinator.js +63 -26
- package/dist/src/connectors/learning-recipes.js +19 -2
- package/dist/src/discussions/audio-repair.d.ts +1 -1
- package/dist/src/discussions/live-worker.js +1 -3
- package/dist/src/discussions/recording.js +2 -2
- package/dist/src/discussions/sealer.js +2 -2
- package/dist/src/extensions/agent-plugins/auth.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/auth.js +6 -35
- package/dist/src/extensions/agent-plugins/credentials.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/credentials.js +37 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +1 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +8 -0
- package/dist/src/extensions/marketplace.d.ts +4 -0
- package/dist/src/extensions/marketplace.js +4 -0
- package/dist/src/gateway/file-space-service.d.ts +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +2 -1
- package/dist/src/gateway/hono/routes/config.js +0 -3
- package/dist/src/gateway/hono/routes/connectors.js +3 -10
- package/dist/src/gateway/hono/routes/context-sources.d.ts +0 -1
- package/dist/src/gateway/hono/routes/context-sources.js +12 -15
- package/dist/src/gateway/hono/routes/status.js +0 -1
- package/dist/src/gateway/hono/routes/user-model.js +21 -3
- package/dist/src/gateway/hono/routes/voice.js +0 -67
- package/dist/src/gateway/service.js +6 -4
- package/dist/src/media-understanding/types.d.ts +1 -1
- package/dist/src/memory-maintenance/service.d.ts +1 -0
- package/dist/src/memory-maintenance/service.js +13 -0
- package/dist/src/migrations/retired-local-stt.d.ts +2 -0
- package/dist/src/migrations/retired-local-stt.js +52 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/storage/sqlite/connection.js +1 -0
- package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +121 -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/sql-assets.d.ts +1 -0
- package/dist/src/storage/sqlite/sql-assets.js +7 -4
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +4 -2
- package/dist/src/tasks/task-context-assembler.js +10 -1
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +15 -2
- package/dist/src/user-context/sources/consent-repository.d.ts +7 -0
- package/dist/src/user-context/sources/consent-repository.js +81 -0
- package/dist/src/user-context/sources/index.d.ts +1 -0
- package/dist/src/user-context/sources/index.js +2 -1
- package/dist/src/user-context/sources/repository.js +73 -1
- package/dist/src/user-context/sources/types.d.ts +16 -0
- package/dist/src/user-model/action-rule-suggestions.d.ts +11 -0
- package/dist/src/user-model/action-rule-suggestions.js +29 -0
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +83 -7
- package/dist/src/user-model/capture/semantic.d.ts +5 -2
- package/dist/src/user-model/capture/semantic.js +27 -11
- package/dist/src/user-model/domain.d.ts +26 -0
- package/dist/src/user-model/domain.js +40 -2
- package/dist/src/user-model/index.d.ts +2 -0
- package/dist/src/user-model/index.js +6 -4
- package/dist/src/user-model/maintenance-policy.d.ts +1 -0
- package/dist/src/user-model/maintenance-policy.js +13 -0
- package/dist/src/user-model/observation-repository.d.ts +48 -0
- package/dist/src/user-model/observation-repository.js +100 -0
- package/dist/src/user-model/repository.d.ts +5 -0
- package/dist/src/user-model/repository.js +121 -10
- package/dist/src/user-model/usage-policy.d.ts +5 -2
- package/dist/src/user-model/usage-policy.js +2 -2
- package/dist/src/voice/audio/normalize.d.ts +1 -1
- package/dist/src/voice/audio/normalize.js +1 -1
- package/dist/src/voice/{local → audio}/wav.js +1 -1
- package/dist/src/voice/language-profile.js +10 -16
- package/dist/src/voice/metadata/builtin.js +0 -46
- package/dist/src/voice/stt/providers/index.d.ts +0 -1
- package/dist/src/voice/stt/providers/index.js +1 -2
- package/dist/src/voice/stt/types.js +3 -4
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/speech-registry.d.ts +1 -1
- package/dist/src/voice/tts/types.d.ts +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -5
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/work-discovery/types.d.ts +1 -1
- package/dist/src/workflows/context/workflow-context.js +5 -1
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +13 -4
- package/package.json +13 -17
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxcIHW_Z.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CNuqJcHQ.js +0 -1
- package/dist/gateway/static/root/assets/agents-CPpmkx7O.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-6xEgLDv8.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-rztQnZDk.js +0 -7
- package/dist/gateway/static/root/assets/browser-automations-page-D96o3bDY.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-DUQzQ3ic.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CKWtXof8.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-C8ducWB7.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-uy9YDwxJ.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-BpF0SjB9.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-eZTfIMWI.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-Do1dl0La.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-BhS8s080.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Dv3vG9HZ.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DdvO1O6W.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLZyN-u9.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BSqg-JE9.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-_pddpuej.js +0 -1
- package/dist/gateway/static/root/assets/index-BKL5tg2f.css +0 -1
- package/dist/gateway/static/root/assets/index-CJuypaNt.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-DXFnYiA0.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-CkXKS5xe.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-C33z-ife.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-8eDZb0uS.js +0 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C95RtLuL.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-kFxknjMR.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-OUL3fEYh.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-CVbY7_N5.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CKiIby0r.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-LPAxUszX.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Cbyb4hyy.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BtDFZc6g.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-CJlc-mg1.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CUo6-iV2.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-XeSxPjP7.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-Dol9j_pF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-eqTUTW2L.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BCt__prc.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BsjSqEnw.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-evN7gs0S.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BifYwEhe.js +0 -2
- package/dist/gateway/static/root/assets/skills-page.utils-DOk-iOvN.js +0 -1
- package/dist/gateway/static/root/assets/system-settings-panel-CcSvoHfY.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-pCRG7Jb3.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DDGMf44u.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DiIkxIq7.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CvYeM0Ml.js +0 -2
- package/dist/gateway/static/root/assets/voice-config-api-BaxITrwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DbVtLh0R.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CT8ouKcB.js +0 -6
- package/dist/src/voice/local/model-files.d.ts +0 -14
- package/dist/src/voice/local/model-files.js +0 -92
- package/dist/src/voice/local/model-manager.d.ts +0 -18
- package/dist/src/voice/local/model-manager.js +0 -133
- package/dist/src/voice/local/models.d.ts +0 -28
- package/dist/src/voice/local/models.js +0 -99
- package/dist/src/voice/local/provider-switch.d.ts +0 -4
- package/dist/src/voice/local/provider-switch.js +0 -36
- package/dist/src/voice/local/runtime-client.d.ts +0 -28
- package/dist/src/voice/local/runtime-client.js +0 -183
- package/dist/src/voice/local/runtime-worker.d.ts +0 -1
- package/dist/src/voice/local/runtime-worker.js +0 -271
- package/dist/src/voice/stt/providers/local-transcription.d.ts +0 -2
- package/dist/src/voice/stt/providers/local-transcription.js +0 -53
- /package/dist/src/voice/{local → audio}/wav.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.329",
|
|
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",
|
|
@@ -112,27 +112,18 @@
|
|
|
112
112
|
"zod": "^4.4.3"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
-
"@huggingface/transformers": "3.8.1",
|
|
116
115
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
117
|
-
"playwright-core": "^1.60.0"
|
|
118
|
-
"sherpa-onnx-node": "1.13.4"
|
|
116
|
+
"playwright-core": "^1.60.0"
|
|
119
117
|
},
|
|
120
118
|
"peerDependenciesMeta": {
|
|
121
|
-
"@huggingface/transformers": {
|
|
122
|
-
"optional": true
|
|
123
|
-
},
|
|
124
119
|
"@larksuiteoapi/node-sdk": {
|
|
125
120
|
"optional": true
|
|
126
121
|
},
|
|
127
122
|
"playwright-core": {
|
|
128
123
|
"optional": true
|
|
129
|
-
},
|
|
130
|
-
"sherpa-onnx-node": {
|
|
131
|
-
"optional": true
|
|
132
124
|
}
|
|
133
125
|
},
|
|
134
126
|
"devDependencies": {
|
|
135
|
-
"@huggingface/transformers": "3.8.1",
|
|
136
127
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
137
128
|
"@resvg/resvg-js": "^2.6.2",
|
|
138
129
|
"@tailwindcss/vite": "^4.3.0",
|
|
@@ -156,9 +147,7 @@
|
|
|
156
147
|
"eslint": "^10.4.0",
|
|
157
148
|
"jsdom": "^29.1.1",
|
|
158
149
|
"node-pty": "1.1.0",
|
|
159
|
-
"onnxruntime-common": "1.21.0",
|
|
160
150
|
"playwright-core": "^1.60.0",
|
|
161
|
-
"sherpa-onnx-node": "1.13.4",
|
|
162
151
|
"svgo": "4.0.2",
|
|
163
152
|
"tailwindcss": "^4.3.0",
|
|
164
153
|
"tsdown": "0.21.10",
|
|
@@ -170,11 +159,11 @@
|
|
|
170
159
|
"vitest": "4.1.5",
|
|
171
160
|
"vue": "^3.5.35",
|
|
172
161
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
173
|
-
"@xopcai/browser-control-contract": "0.1.0",
|
|
174
|
-
"@xopcai/computer-control-contract": "0.1.0",
|
|
175
162
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
176
|
-
"@xopcai/gateway-contract": "0.0.0",
|
|
177
163
|
"@xopcai/realtime-client": "0.0.0",
|
|
164
|
+
"@xopcai/gateway-contract": "0.0.0",
|
|
165
|
+
"@xopcai/browser-control-contract": "0.1.0",
|
|
166
|
+
"@xopcai/computer-control-contract": "0.1.0",
|
|
178
167
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
179
168
|
},
|
|
180
169
|
"scripts": {
|
|
@@ -208,7 +197,14 @@
|
|
|
208
197
|
"dev:init": "sh -c 'mkdir -p \"$HOME/.xopc-dev\" && XOPC_STATE_DIR=\"$HOME/.xopc-dev\" XOPC_CONFIG_PATH=\"$HOME/.xopc-dev/xopc.json\" XOPC_CONFIG=\"$HOME/.xopc-dev/xopc.json\" XOPC_LOG_DIR=\"$HOME/.xopc-dev/logs\" XOPC_LOG_LEVEL=info tsx src/cli/bin.ts init \"$@\"' --",
|
|
209
198
|
"dev:gateway": "sh -c 'mkdir -p \"$HOME/.xopc-dev\" && XOPC_STATE_DIR=\"$HOME/.xopc-dev\" XOPC_CONFIG_PATH=\"$HOME/.xopc-dev/xopc.json\" XOPC_CONFIG=\"$HOME/.xopc-dev/xopc.json\" XOPC_LOG_DIR=\"$HOME/.xopc-dev/logs\" XOPC_LOG_LEVEL=info tsx src/cli/bin.ts gateway \"$@\"' --",
|
|
210
199
|
"start": "node dist/src/cli/bin.js",
|
|
211
|
-
"test": "vitest run
|
|
200
|
+
"test": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=unit",
|
|
201
|
+
"test:all": "cross-env XOPC_LOG_LEVEL=fatal vitest run",
|
|
202
|
+
"test:changed": "cross-env XOPC_LOG_LEVEL=fatal vitest run --changed",
|
|
203
|
+
"test:component": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=component",
|
|
204
|
+
"test:integration": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=integration",
|
|
205
|
+
"test:extensions": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=extensions",
|
|
206
|
+
"test:web": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=web",
|
|
207
|
+
"test:packages": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=packages",
|
|
212
208
|
"test:web:onboarding-visual": "node scripts/test-onboarding-visual.mjs",
|
|
213
209
|
"test:web:onboarding-visual:update": "node scripts/test-onboarding-visual.mjs --update",
|
|
214
210
|
"test:quick-understanding": "XOPC_LOG_LEVEL=fatal vitest run src/work-discovery/__tests__/evaluation.test.ts src/user-context/sources/__tests__/activity-clustering.test.ts src/knowledge/__tests__/quick-understanding.e2e.test.ts src/connectors/__tests__/content-enrichment.test.ts src/connectors/__tests__/connected-source-ingestion.test.ts",
|
|
@@ -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-DcsFzD_i.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{c as l,n as u}from"./locale-store-BPZR8x9b.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-CS04eWY9.js";import{r as p}from"./gateway-config-swr-CoQVulMd.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-DWWO6ajd.js";import{Gc as _,Ni as v,Pl as y,Sd as b,Xc as x,Xl as S,_n as C,dl as w,gn as T,ki as E,nl as D,qc as ee,wd as O,xu as k,y as te}from"./index-CJuypaNt.js";import{n as A,r as j}from"./settings-page-layout-eqTUTW2L.js";import{n as M,t as N}from"./use-autosave-DiIkxIq7.js";import{u as P}from"./voice-config-api-BaxITrwZ.js";import{r as ne}from"./image-generation-api-DvWDkbk1.js";var F=e(t(),1),re=n(),I=r(),L={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function R(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function z(e){return L[e]??e}function B(e){let t=(0,re.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,I.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,I.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,I.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,I.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,I.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`,p;t[9]===f?p=t[10]:(p=(0,I.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,I.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function V(e){let t=(0,re.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:P(s);let e=u?R(u.stt.providers,u.stt.provider,`model`):void 0,n=u?R(u.tts.providers,u.tts.provider,`model`):void 0,r=u?R(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[z(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[z(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let x;t[8]!==g||t[9]!==v?(x=(0,I.jsxs)(`div`,{children:[g,v]}),t[8]=g,t[9]=v,t[10]=x):x=t[10];let S=n?`管理语音设置`:`Manage voice settings`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,I.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[11]=C):C=t[11];let w;t[12]===S?w=t[13]:(w=(0,I.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,I.jsxs)(i,{to:`/settings/capabilities/voice`,children:[S,C]})}),t[12]=S,t[13]=w);let T;t[14]!==x||t[15]!==w?(T=(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[x,w]}),t[14]=x,t[15]=w,t[16]=T):T=t[16];let E;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(E=o||!u?a?(0,I.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,I.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(m,{className:`h-20 rounded-xl`}),(0,I.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,I.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(B,{icon:y,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,I.jsx)(B,{icon:b,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=E):E=t[23];let D;return t[24]!==T||t[25]!==E?(D=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=D):D=t[26],D}var H=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],U=`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`,W={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 G(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function ie(e){let t=(0,re.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,I.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,I.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,I.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,I.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,I.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,I.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,I.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,I.jsx)(s,{className:`size-3`})})]},e))}):(0,I.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let C;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(C=(0,I.jsx)(E,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==C||t[32]!==g||t[33]!==_?(w=(0,I.jsxs)(`div`,{children:[g,_,C]}),t[31]=C,t[32]=g,t[33]=_,t[34]=w):w=t[34],w}function K(e){let t=(0,re.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=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,ne,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(q),t[6]=p,t[7]=m);let _=m,v=i?W.zh:W.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=G(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let C=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,w;t[13]===C?w=t[14]:(w=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[13]=C,t[14]=w);let T;t[15]!==w||t[16]!==S?(T=(0,I.jsxs)(`div`,{children:[S,w]}),t[15]=w,t[16]=S,t[17]=T):T=t[17];let D=i?`主模型`:`Primary model`,ee;t[18]===D?ee=t[19]:(ee=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=ee);let O=i?`选择模型`:`Select a model`,k=i?`搜索模型或服务商`:`Search models or providers`,te=i?`没有匹配的模型`:`No matching models`,A=i?`默认对话模型`:`Default conversation model`,j;t[20]!==n||t[21]!==r?(j=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=j):j=t[22];let M;t[23]!==n.models.chat.primary||t[24]!==O||t[25]!==k||t[26]!==te||t[27]!==A||t[28]!==j?(M=(0,I.jsx)(E,{value:n.models.chat.primary,placeholder:O,searchPlaceholder:k,noMatches:te,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:A,onChange:j}),t[23]=n.models.chat.primary,t[24]=O,t[25]=k,t[26]=te,t[27]=A,t[28]=j,t[29]=M):M=t[29];let N;t[30]!==ee||t[31]!==M?(N=(0,I.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[ee,M]}),t[30]=ee,t[31]=M,t[32]=N):N=t[32];let P;t[33]!==n||t[34]!==r?(P=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=P):P=t[35];let F;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]!==P||t[42]!==i?(F=(0,I.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,I.jsx)(ie,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange: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]=P,t[42]=i,t[43]=F):F=t[43];let L;t[44]!==T||t[45]!==N||t[46]!==F?(L=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[T,N,F]}),t[44]=T,t[45]=N,t[46]=F,t[47]=L):L=t[47];let R=i?`图片能力`:`Image capabilities`,z;t[48]===R?z=t[49]:(z=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[48]=R,t[49]=z);let B=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,K;t[50]===B?K=t[51]:(K=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[50]=B,t[51]=K);let J=i?`图片理解模型`:`Image understanding model`,Y;t[52]===J?Y=t[53]:(Y=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:J}),t[52]=J,t[53]=Y);let X=n.models.imageUnderstanding?.primary??``,Z=i?`关闭图片理解`:`Image understanding off`,Q=i?`搜索视觉模型`:`Search vision models`,$=i?`没有可用的视觉模型`:`No vision models available`,ae=i?`关闭图片理解`:`Image understanding off`,oe=i?`图片理解模型`:`Image understanding model`,se;t[54]!==n||t[55]!==r?(se=e=>{let t={...n.models};e?t.imageUnderstanding=G(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=se):se=t[56];let ce;t[57]!==X||t[58]!==Z||t[59]!==Q||t[60]!==$||t[61]!==ae||t[62]!==oe||t[63]!==se?(ce=(0,I.jsx)(E,{value:X,placeholder:Z,searchPlaceholder:Q,noMatches:$,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:ae,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:oe,onChange:se}),t[57]=X,t[58]=Z,t[59]=Q,t[60]=$,t[61]=ae,t[62]=oe,t[63]=se,t[64]=ce):ce=t[64];let le;t[65]!==Y||t[66]!==ce?(le=(0,I.jsxs)(`div`,{children:[Y,ce]}),t[65]=Y,t[66]=ce,t[67]=le):le=t[67];let ue=i?`图片生成模型`:`Image generation model`,de;t[68]===ue?de=t[69]:(de=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[68]=ue,t[69]=de);let fe=n.models.imageGeneration?.primary??``,pe=i?`关闭图片生成`:`Image generation off`,me=i?`搜索图片模型或服务商`:`Search image models or providers`,he=i?`没有可用的图片生成模型`:`No image generation models available`,ge=i?`关闭图片生成`:`Image generation off`,_e=i?`图片生成模型`:`Image generation model`,ve;t[70]!==n||t[71]!==r?(ve=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]=ve):ve=t[72];let ye;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==fe||t[77]!==pe||t[78]!==me||t[79]!==he||t[80]!==ge||t[81]!==_e||t[82]!==ve?(ye=(0,I.jsx)(E,{value:fe,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:pe,searchPlaceholder:me,noMatches:he,allowEmpty:!0,emptyLabel:ge,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:_e,onChange:ve}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=fe,t[77]=pe,t[78]=me,t[79]=he,t[80]=ge,t[81]=_e,t[82]=ve,t[83]=ye):ye=t[83];let be;t[84]!==de||t[85]!==ye?(be=(0,I.jsxs)(`div`,{children:[de,ye]}),t[84]=de,t[85]=ye,t[86]=be):be=t[86];let xe;t[87]!==le||t[88]!==be?(xe=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[le,be]}),t[87]=le,t[88]=be,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,I.jsx)(`input`,{type:`number`,min:1,className:`${U} 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,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,I.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,I.jsx)(f,{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]!==z||t[95]!==K||t[96]!==xe||t[97]!==Se?(Ce=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,K,xe,Se]}),t[94]=z,t[95]=K,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,I.jsx)(V,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,I.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,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=H.map(e=>(0,I.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,I.jsxs)(`div`,{className:`mb-3`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,I.jsx)(E,{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?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,I.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,I.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]!==L||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,I.jsxs)(`div`,{className:`space-y-5`,children:[L,Ce,we,je]}),t[116]=L,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function q(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var J=`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 Y(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function X(e){let t=(0,re.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=d(`agent-defaults-workflows`,te,o),l;t[1]===s.data?l=t[2]:(l=s.data??[],t[1]=s.data,t[2]=l);let u;t[3]===l?u=t[4]:(u=l.map(Z),t[3]=l,t[4]=u);let p=u,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(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]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:Y(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,I.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${J} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,ee=n.runtime.timeoutMs??``,O=i?`系统默认`:`System default`,k;t[22]!==n||t[23]!==r?(k=e=>r({...n,runtime:{...n.runtime,timeoutMs:Y(e.target.value)}}),t[22]=n,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==ee||t[26]!==O||t[27]!==k?(A=(0,I.jsx)(`input`,{type:`number`,min:1,value:ee,placeholder:O,onChange:k,className:`${J} mt-2`}),t[25]=ee,t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==D||t[30]!==A?(j=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,A]}),t[29]=D,t[30]=A,t[31]=j):j=t[31];let M=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,N=n.runtime.maxToolFailuresPerTurn??``,P=i?`系统默认`:`System default`,ne;t[32]!==n||t[33]!==r?(ne=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:Y(e.target.value)}}),t[32]=n,t[33]=r,t[34]=ne):ne=t[34];let F;t[35]!==N||t[36]!==P||t[37]!==ne?(F=(0,I.jsx)(`input`,{type:`number`,min:1,value:N,placeholder:P,onChange:ne,className:`${J} mt-2`}),t[35]=N,t[36]=P,t[37]=ne,t[38]=F):F=t[38];let L;t[39]!==M||t[40]!==F?(L=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[M,F]}),t[39]=M,t[40]=F,t[41]=L):L=t[41];let R;t[42]!==E||t[43]!==j||t[44]!==L?(R=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,j,L]}),t[42]=E,t[43]=j,t[44]=L,t[45]=R):R=t[45];let z;t[46]!==R||t[47]!==v||t[48]!==b?(z=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,R]}),t[46]=R,t[47]=v,t[48]=b,t[49]=z):z=t[49];let B=i?`提示词缓存`:`Prompt cache`,V;t[50]===B?V=t[51]:(V=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:B}),t[50]=B,t[51]=V);let H=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,U;t[52]===H?U=t[53]:(U=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[52]=H,t[53]=U);let W=i?`缓存模式`:`Cache mode`,G;t[54]===W?G=t[55]:(G=(0,I.jsx)(`span`,{children:W}),t[54]=W,t[55]=G);let ie;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ie=[`auto`,`off`],t[56]=ie):ie=t[56];let K;t[57]!==n||t[58]!==r||t[59]!==i?(K=(0,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ie.map(e=>(0,I.jsx)(f,{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]=K):K=t[60];let q;t[61]!==G||t[62]!==K?(q=(0,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[G,K]}),t[61]=G,t[62]=K,t[63]=q):q=t[63];let X;t[64]!==n||t[65]!==r||t[66]!==i?(X=n.runtime.promptCache?.mode===`auto`?(0,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,I.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,I.jsx)(f,{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]=X):X=t[67];let Q;t[68]!==q||t[69]!==X?(Q=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[q,X]}),t[68]=q,t[69]=X,t[70]=Q):Q=t[70];let $;t[71]!==V||t[72]!==U||t[73]!==Q?($=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[V,U,Q]}),t[71]=V,t[72]=U,t[73]=Q,t[74]=$):$=t[74];let ae=i?`工作流`:`Workflows`,oe;t[75]===ae?oe=t[76]:(oe=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ae}),t[75]=ae,t[76]=oe);let se=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,ce;t[77]===se?ce=t[78]:(ce=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:se}),t[77]=se,t[78]=ce);let le=i?`默认工作流`:`Default workflow`,ue;t[79]===le?ue=t[80]:(ue=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:le}),t[79]=le,t[80]=ue);let de=n.workflows.default??``,fe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,pe=i?`不设置默认工作流`:`No default workflow`,me=i?`默认工作流`:`Default workflow`,he;t[81]!==n||t[82]!==r?(he=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=he):he=t[83];let ge;t[84]!==de||t[85]!==fe||t[86]!==pe||t[87]!==me||t[88]!==he||t[89]!==p||t[90]!==s.isLoading?(ge=(0,I.jsx)(a,{value:de,options:p,placeholder:fe,emptyLabel:pe,disabled:s.isLoading,ariaLabel:me,onChange:he,triggerClassName:`mt-2`}),t[84]=de,t[85]=fe,t[86]=pe,t[87]=me,t[88]=he,t[89]=p,t[90]=s.isLoading,t[91]=ge):ge=t[91];let _e;t[92]!==ue||t[93]!==ge?(_e=(0,I.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[ue,ge]}),t[92]=ue,t[93]=ge,t[94]=_e):_e=t[94];let ve;t[95]===s.error?ve=t[96]:(ve=s.error?(0,I.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]=ve);let ye=i?`允许调用的工作流`:`Allowed workflows`,be;t[97]===ye?be=t[98]:(be=(0,I.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ye}),t[97]=ye,t[98]=be);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=m?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Ce;t[102]===Se?Ce=t[103]:(Ce=c(`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,I.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,I.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,I.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=m?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,je;t[116]===Ae?je=t[117]:(je=c(`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,I.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,I.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,I.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,I.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]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,I.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,I.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,I.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==be||t[138]!==Le||t[139]!==Re?(ze=(0,I.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[be,Le,Re]}),t[137]=be,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==oe||t[142]!==ce||t[143]!==_e||t[144]!==ve||t[145]!==ze?(Be=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[oe,ce,_e,ve,ze]}),t[141]=oe,t[142]=ce,t[143]=_e,t[144]=ve,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==z||t[148]!==$||t[149]!==Be?(Ve=(0,I.jsxs)(`div`,{className:`space-y-5`,children:[z,$,Be]}),t[147]=z,t[148]=$,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function Z(e){return{value:e.id,label:e.title||e.name}}function Q(e){return[...new Set(e)].sort()}var $=[{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 ae(e){let t=(0,re.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:u}=d(`agent-defaults-skills-catalog`,v,a),[f,p]=(0,F.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(ue));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(le),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=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]=_):_=t[8];let y=_,b;t[9]!==n||t[10]!==r?(b=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Q([...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):Q([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,C;t[12]===s?.catalog?C=t[13]:(C=s?.catalog??[],t[12]=s?.catalog,t[13]=C);let w;if(t[14]!==y||t[15]!==C){let e;t[17]===y?e=t[18]:(e=e=>e.enabled&&y(e.name),t[17]=y,t[18]=e),w=C.filter(e),t[14]=y,t[15]=C,t[16]=w}else w=t[16];let T=w.length,E;t[19]!==s?.catalog||t[20]!==n||t[21]!==r?(E=e=>{let t=new Set((s?.catalog??[]).filter(ce).map(se));r({...n,skills:{mode:`selected`,include:Q(e.filter(e=>t.has(e)))}})},t[19]=s?.catalog,t[20]=n,t[21]=r,t[22]=E):E=t[22];let ee=E,O=i?`技能策略`:`Skill policy`,k;t[23]===O?k=t[24]:(k=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:O}),t[23]=O,t[24]=k);let te=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,A;t[25]===te?A=t[26]:(A=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:te}),t[25]=te,t[26]=A);let j;t[27]!==n||t[28]!==r?(j=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=j):j=t[29];let M=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,N;t[30]===M?N=t[31]:(N=c(`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`,M),t[30]=M,t[31]=N);let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,I.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=P):P=t[32];let ne=i?`使用所有已启用技能`:`Use every enabled skill`,L;t[33]===ne?L=t[34]:(L=(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ne}),t[33]=ne,t[34]=L);let R=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,z;t[35]===R?z=t[36]:(z=(0,I.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:R}),t[35]=R,t[36]=z);let B;t[37]!==L||t[38]!==z?(B=(0,I.jsxs)(`span`,{children:[L,z]}),t[37]=L,t[38]=z,t[39]=B):B=t[39];let V;t[40]!==j||t[41]!==N||t[42]!==B?(V=(0,I.jsxs)(`button`,{type:`button`,onClick:j,className:N,children:[P,B]}),t[40]=j,t[41]=N,t[42]=B,t[43]=V):V=t[43];let H;t[44]!==n||t[45]!==r?(H=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=H):H=t[46];let U=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,W;t[47]===U?W=t[48]:(W=c(`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`,U),t[47]=U,t[48]=W);let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,I.jsx)(S,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=G):G=t[49];let ie=i?`只使用选中的技能`:`Use selected skills only`,K;t[50]===ie?K=t[51]:(K=(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ie}),t[50]=ie,t[51]=K);let q=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,J;t[52]===q?J=t[53]:(J=(0,I.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y;t[54]!==K||t[55]!==J?(Y=(0,I.jsxs)(`span`,{children:[K,J]}),t[54]=K,t[55]=J,t[56]=Y):Y=t[56];let X;t[57]!==H||t[58]!==W||t[59]!==Y?(X=(0,I.jsxs)(`button`,{type:`button`,onClick:H,className:W,children:[G,Y]}),t[57]=H,t[58]=W,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==V||t[62]!==X?(Z=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[V,X]}),t[61]=V,t[62]=X,t[63]=Z):Z=t[63];let ae=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,de;t[64]===ae?de=t[65]:(de=(0,I.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:ae}),t[64]=ae,t[65]=de);let fe;t[66]!==ee||t[67]!==s||t[68]!==i?(fe=$.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>ee(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]=ee,t[67]=s,t[68]=i,t[69]=fe):fe=t[69];let pe;t[70]===fe?pe=t[71]:(pe=(0,I.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:fe}),t[70]=fe,t[71]=pe);let me;t[72]!==de||t[73]!==pe?(me=(0,I.jsxs)(`div`,{className:`mt-4`,children:[de,pe]}),t[72]=de,t[73]=pe,t[74]=me):me=t[74];let he;t[75]!==A||t[76]!==Z||t[77]!==me||t[78]!==k?(he=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[k,A,Z,me]}),t[75]=A,t[76]=Z,t[77]=me,t[78]=k,t[79]=he):he=t[79];let ge=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,_e;t[80]===ge?_e=t[81]:(_e=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ge}),t[80]=ge,t[81]=_e);let ve=i?`当前默认可用 ${T} 个技能。`:`${T} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ve}),t[82]=ve,t[83]=ye);let be;t[84]!==_e||t[85]!==ye?(be=(0,I.jsxs)(`div`,{children:[_e,ye]}),t[84]=_e,t[85]=ye,t[86]=be):be=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,I.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,I.jsx)(D,{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=>p(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,I.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,I.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]!==be||t[98]!==De?(Oe=(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[be,De]}),t[97]=be,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,I.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]!==y||t[103]!==u||t[104]!==g||t[105]!==x||t[106]!==i?(Ae=u?(0,I.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(oe)}):(0,I.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:[g.map(e=>{let t=y(e.name);return(0,I.jsxs)(`label`,{className:c(`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,I.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>x(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,I.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,I.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,I.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=y,t[103]=u,t[104]=g,t[105]=x,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,I.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]!==he||t[113]!==je?(Me=(0,I.jsxs)(`div`,{className:`space-y-5`,children:[he,je]}),t[112]=he,t[113]=je,t[114]=Me):Me=t[114],Me}function oe(e){return(0,I.jsx)(m,{className:`h-14 rounded-xl`},e)}function se(e){return e.name}function ce(e){return e.enabled}function le(e,t){return e.name.localeCompare(t.name)}function ue(e){return e.name}function de(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function fe(e){let t=(0,re.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,F.useState)(``),[l,u]=(0,F.useState)(`all`),[d,p]=(0,F.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(me)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(pe),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||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),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,b;if(t[10]!==_||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=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,S;if(t[15]!==_||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=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==v.length||t[21]!==b.length||t[22]!==S.length?(C={allow:y,ask:x,deny:S.length},t[20]=v.length,t[21]=b.length,t[22]=S.length,t[23]=C):C=t[23];let w=C,T;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();T=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=T}else T=t[29];let E=T,O;t[30]!==n||t[31]!==r?(O=(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]=O):O=t[32];let k=O,te=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===te?A=t[34]:(A={id:`all`,label:te},t[33]=te,t[34]=A);let j=a?`允许 ${w.allow}`:`Allow ${w.allow}`,M;t[35]===j?M=t[36]:(M={id:`allow`,label:j},t[35]=j,t[36]=M);let N=a?`询问 ${w.ask}`:`Ask ${w.ask}`,P;t[37]===N?P=t[38]:(P={id:`ask`,label:N},t[37]=N,t[38]=P);let ne=a?`禁用 ${w.deny}`:`Deny ${w.deny}`,L;t[39]===ne?L=t[40]:(L={id:`deny`,label:ne},t[39]=ne,t[40]=L);let R;t[41]!==A||t[42]!==M||t[43]!==P||t[44]!==L?(R=[A,M,P,L],t[41]=A,t[42]=M,t[43]=P,t[44]=L,t[45]=R):R=t[45];let z=R,B=a?`默认工具权限`:`Default tool permissions`,V;t[46]===B?V=t[47]:(V=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:B}),t[46]=B,t[47]=V);let H=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,U;t[48]===H?U=t[49]:(U=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[48]=H,t[49]=U);let W;t[50]!==V||t[51]!==U?(W=(0,I.jsxs)(`div`,{children:[V,U]}),t[50]=V,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==l||t[54]!==z?(G=(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:z.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>u(e.id),className:c(`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]=z,t[55]=G):G=t[55];let ie=a?`搜索工具`:`Search tools`,K;t[56]===ie?K=t[57]:(K=(0,I.jsx)(`span`,{className:`sr-only`,children:ie}),t[56]=ie,t[57]=K);let q;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,I.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=q):q=t[58];let J;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>s(e.target.value),t[59]=J):J=t[59];let Y=a?`搜索工具`:`Search tools`,X;t[60]!==o||t[61]!==Y?(X=(0,I.jsx)(`input`,{type:`search`,value:o,onChange:J,placeholder:Y,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]=Y,t[62]=X):X=t[62];let Z;t[63]!==K||t[64]!==X?(Z=(0,I.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[K,q,X]}),t[63]=K,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==G||t[67]!==Z?(Q=(0,I.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[G,Z]}),t[66]=G,t[67]=Z,t[68]=Q):Q=t[68];let $;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==k||t[73]!==E||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==k||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,I.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>k(e,{mode:n}),className:c(`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,I.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,I.jsx)(ee,{className:`size-4`})})]})]}),i?(0,I.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,I.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>k(e,{maxCallsPerTurn:de(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,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,I.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>k(e,{timeoutMs:de(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]=h,t[77]=n.tools,t[78]=d,t[79]=k,t[80]=a,t[81]=e):e=t[81],$=E.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=k,t[73]=E,t[74]=a,t[75]=$}else $=t[75];let ae;t[82]!==E.length||t[83]!==a?(ae=E.length===0?(0,I.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]=ae):ae=t[84];let oe;t[85]!==$||t[86]!==ae?(oe=(0,I.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:[$,ae]}),t[85]=$,t[86]=ae,t[87]=oe):oe=t[87];let se;return t[88]!==W||t[89]!==Q||t[90]!==oe?(se=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[W,Q,oe]}),t[88]=W,t[89]=Q,t[90]=oe,t[91]=se):se=t[91],se}function pe(e){return e.id}function me(e){return[e.id,e.description]}function he(){let e=(0,re.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsxs)(j,{gap:`gap-5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(m,{className:`h-7 w-56`}),(0,I.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,I.jsx)(m,{className:`h-9 w-28`})]}),(0,I.jsx)(m,{className:`h-20 rounded-2xl`}),(0,I.jsx)(m,{className:`h-12 rounded-xl`}),(0,I.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ge(e){let t=(0,re.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,F.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[l,u]=(0,F.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,F.useState)(d),h;t[4]===l?h=t[5]:(h=JSON.stringify(l),t[4]=l,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let v=h!==g,y=i?`模型`:`Models`,b;t[8]===y?b=t[9]:(b={id:`models`,label:y,icon:_},t[8]=y,t[9]=b);let S=i?`技能`:`Skills`,T;t[10]===S?T=t[11]:(T={id:`skills`,label:S,icon:w},t[10]=S,t[11]=T);let E=i?`工具`:`Tools`,D;t[12]===E?D=t[13]:(D={id:`tools`,label:E,icon:x},t[12]=E,t[13]=D);let ee=i?`运行`:`Runtime`,O;t[14]===ee?O=t[15]:(O={id:`runtime`,label:ee,icon:k},t[14]=ee,t[15]=O);let te;t[16]!==D||t[17]!==O||t[18]!==b||t[19]!==T?(te=[b,T,D,O],t[16]=D,t[17]=O,t[18]=b,t[19]=T,t[20]=te):te=t[20];let P=te,ne;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ne=async e=>{let t=structuredClone(e),n=await C(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=ne):ne=t[21];let L=ne,R;t[22]!==v||t[23]!==l?(R={value:l,dirty:v,onSave:L,delayMs:0},t[22]=v,t[23]=l,t[24]=R):R=t[24];let z=N(R),B=z.onBlurCapture,V=i?`智能体设置`:`Agent settings`,H;t[25]!==z.error||t[26]!==z.status?(H=(0,I.jsx)(M,{status:z.status,error:z.error}),t[25]=z.error,t[26]=z.status,t[27]=H):H=t[27];let U;t[28]!==V||t[29]!==H?(U=(0,I.jsx)(A,{title:V,actions:H}),t[28]=V,t[29]=H,t[30]=U):U=t[30];let W;t[31]!==z.error||t[32]!==z.retry||t[33]!==i?(W=z.error?(0,I.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,I.jsx)(`span`,{children:z.error}),(0,I.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:z.retry,children:i?`重试`:`Retry`})]}):null,t[31]=z.error,t[32]=z.retry,t[33]=i,t[34]=W):W=t[34];let G=i?`默认配置分区`:`Default configuration sections`,ie;t[35]!==a||t[36]!==P?(ie=P.map(e=>{let{id:t,label:n,icon:r}=e;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:c(`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,I.jsx)(r,{className:c(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=P,t[37]=ie):ie=t[37];let q;t[38]!==G||t[39]!==ie?(q=(0,I.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":G,children:ie}),t[38]=G,t[39]=ie,t[40]=q):q=t[40];let J;t[41]!==a||t[42]!==l||t[43]!==i?(J=a===`models`?(0,I.jsx)(K,{draft:l,setDraft:u,zh:i}):null,t[41]=a,t[42]=l,t[43]=i,t[44]=J):J=t[44];let Y;t[45]!==a||t[46]!==l||t[47]!==i?(Y=a===`skills`?(0,I.jsx)(ae,{draft:l,setDraft:u,zh:i}):null,t[45]=a,t[46]=l,t[47]=i,t[48]=Y):Y=t[48];let Z;t[49]!==a||t[50]!==r||t[51]!==l||t[52]!==i?(Z=a===`tools`?(0,I.jsx)(fe,{draft:l,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=l,t[52]=i,t[53]=Z):Z=t[53];let Q;t[54]!==a||t[55]!==l||t[56]!==i?(Q=a===`runtime`?(0,I.jsx)(X,{draft:l,setDraft:u,zh:i}):null,t[54]=a,t[55]=l,t[56]=i,t[57]=Q):Q=t[57];let $;return t[58]!==z.onBlurCapture||t[59]!==U||t[60]!==W||t[61]!==q||t[62]!==J||t[63]!==Y||t[64]!==Z||t[65]!==Q?($=(0,I.jsxs)(j,{gap:`gap-5`,onBlurCapture:B,children:[U,W,q,J,Y,Z,Q]}),t[58]=z.onBlurCapture,t[59]=U,t[60]=W,t[61]=q,t[62]=J,t[63]=Y,t[64]=Z,t[65]=Q,t[66]=$):$=t[66],$}function _e(){let e=(0,re.c)(17),t=l(ye),n=u(ve)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,T);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,I.jsx)(j,{children:(0,I.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,I.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,I.jsx)(f,{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,I.jsxs)(j,{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,I.jsx)(he,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,I.jsx)(ge,{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 ve(e){return e.language}function ye(e){return e.conversationId}export{_e 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{a as r,i,n as a,r as o}from"./locale-store-BPZR8x9b.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{a as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-CS04eWY9.js";import{n as h}from"./gateway-config-swr-CoQVulMd.js";import{t as g}from"./skeleton-BwbyijEw.js";import{Dt as _,Ot as v,kt as y}from"./index-CJuypaNt.js";var b=e(t(),1),x=/^([^:=]+)[:=](.*)$/;function S(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=x.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function C(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 w(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 T(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 E(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)||T(t)&&(r[e]=t);return r}function D(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function O(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 k(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=D(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=O(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=C(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 A(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:w(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 j(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 M(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)||T(t)?[]:[A(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 N(e){return k(e)}async function P(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]=k(r)}}let i={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(i.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await r(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:i})}),h()}async function F(e,t,n=``){let i=await r(o(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!i.payload)throw Error(i.error??`MCP OAuth request failed`);return i.payload}function I(e){return F(e,`GET`)}function L(e){return F(e,`POST`,`/start`)}function R(e){return F(e,`DELETE`)}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();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 B(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 V(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 H(e,t){let n=await r(o(`/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 i=z(n.payload.tools),a=B(n.payload.resources),s=V(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:i.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:a.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:s.length,tools:i,resources:a,prompts:s}}function U(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function W(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 G(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function K(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 q=n(),J=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;async function Y(e,t,n){let i=await r(o(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!i.ok)throw Error(i.error??`Request failed`);return i.payload}function X({pluginId:e,server:t,enabled:n}){let{mutate:r}=p(),s=a(e=>e.language).startsWith(`zh`),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(null),[f,h]=(0,b.useState)(``),[x,S]=(0,b.useState)(!1),[C,w]=(0,b.useState)(!1),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)(t.type===`stdio`?`API_KEY`:`Authorization`),[k,A]=(0,b.useState)(t.type===`stdio`?``:`Bearer `),[j,M]=(0,b.useState)(!1),[N,P]=(0,b.useState)(``),F=`/api/mcp/servers/${encodeURIComponent(t.id)}`;async function z(){let e=await i(o(`${F}/test`),{method:`POST`,body:`{}`}),t=await e.json();if(r(`gateway-extensions-list`),S(t.code===`MCP_AUTHORIZATION_REQUIRED`),!e.ok||!t.ok)throw Error(t.error??`Connection failed`);h(s?`连接成功 · ${t.payload.toolCount} 个工具`:`Connected · ${t.payload.toolCount} tools`)}(0,b.useEffect)(()=>{if(!n||t.type!==`streamable-http`)return;let e=!1;return I(t.id).then(t=>{e||(d(t),M(!0))}).catch(t=>{e||(h(String(t)),M(!0))}),()=>{e=!0}},[n,t.id,t.type]),(0,b.useEffect)(()=>{if(u?.status!==`authorizing`)return;let e=!1,n=window.setInterval(()=>{I(t.id).then(t=>{e||(d(t),t.status===`connected`&&(S(!1),h(s?`已连接,可以重试原任务`:`Connected. Retry your task.`),r(`gateway-extensions-list`)),t.status===`error`&&h(t.session?.error??`Authorization failed`))}).catch(t=>{e||h(String(t))})},1500);return()=>{e=!0,window.clearInterval(n)}},[u?.status,t.id,s,r]);async function B(e){l(!0),h(``);try{await e()}catch(e){h(e instanceof Error?e.message:String(e))}finally{l(!1)}}return(0,q.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e,` · `,t.type]})]}),n?(0,q.jsxs)(q.Fragment,{children:[t.type===`streamable-http`&&!j?(0,q.jsx)(g,{className:`mb-2 h-4 w-24`}):null,(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(m,{variant:`secondary`,disabled:c,onClick:()=>void B(z),children:s?`测试连接`:`Test connection`}),t.type===`streamable-http`&&u?.status!==`connected`?(0,q.jsx)(m,{variant:x?`primary`:`secondary`,disabled:c,onClick:()=>{let e=y();B(async()=>{try{let n=await L(t.id);if(d(n),n.session?.authorizationUrl){if(!await v(n.session.authorizationUrl,e))throw Error(s?`无法打开授权页面`:`Could not open authorization page`)}else if(_(e),n.session?.error)throw Error(n.session.error)}catch(t){throw _(e),t}})},children:s?`连接账号`:`Connect account`}):null,u?.status===`connected`?(0,q.jsx)(m,{variant:`secondary`,disabled:c,onClick:()=>void B(async()=>{d(await R(t.id)),r(`gateway-extensions-list`)}),children:s?`断开连接`:`Disconnect`}):null,(0,q.jsx)(m,{variant:`ghost`,disabled:c,onClick:()=>w(!C),children:s?`设置密钥`:`Set API key`})]}),C?(0,q.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:n=>{n.preventDefault(),B(async()=>{await Y(`/api/extensions/agent-plugins/${encodeURIComponent(e)}/mcp/${encodeURIComponent(t.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:t.type===`stdio`?`env`:`headers`,key:D,value:T,prefix:k}]}),E(``),w(!1),d(null),S(!1),await z()})},children:[(0,q.jsxs)(`label`,{className:`block`,children:[s?`字段名`:`Field name`,(0,q.jsx)(`input`,{className:J,value:D,onChange:e=>O(e.target.value),required:!0})]}),(0,q.jsxs)(`label`,{className:`block`,children:[s?`前缀(可选)`:`Prefix (optional)`,(0,q.jsx)(`input`,{className:J,value:k,onChange:e=>A(e.target.value)})]}),(0,q.jsxs)(`label`,{className:`block`,children:[s?`密钥`:`Secret`,(0,q.jsx)(`input`,{className:J,type:`password`,autoComplete:`off`,value:T,onChange:e=>E(e.target.value),required:!0})]}),(0,q.jsx)(m,{type:`submit`,disabled:c||!T,children:s?`保存并测试`:`Save and test`})]}):null]}):(0,q.jsx)(`p`,{className:`text-fg-muted`,children:s?`启用插件后连接服务`:`Enable the plugin to connect`}),u?.status===`authorizing`?(0,q.jsxs)(`div`,{className:`mt-2 space-y-2 text-fg-muted`,children:[(0,q.jsx)(`p`,{children:s?`请在浏览器完成授权`:`Complete authorization in your browser`}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:s?`使用远程 Gateway?`:`Using a remote Gateway?`}),(0,q.jsxs)(`form`,{className:`mt-2 space-y-2`,onSubmit:e=>{e.preventDefault(),B(async()=>{d(await Y(`${F}/oauth/callback`,`POST`,{callbackUrl:N})),P(``)})},children:[(0,q.jsxs)(`label`,{children:[s?`如果浏览器跳转后无法连接,请粘贴地址栏中的完整回调 URL`:`If the browser cannot reach the callback, paste its full address-bar URL`,(0,q.jsx)(`input`,{type:`password`,autoComplete:`off`,className:J,value:N,onChange:e=>P(e.target.value)})]}),(0,q.jsx)(m,{type:`submit`,disabled:c||!N,children:s?`完成连接`:`Complete connection`})]})]})]}):null,f?(0,q.jsx)(`p`,{role:`status`,className:`mt-2 break-words text-fg-muted`,children:f}):null]})}function Z({extension:e,onClose:t,initialSource:n=``}){let r=a(e=>e.language).startsWith(`zh`),{mutate:i}=p(),[o,h]=(0,b.useState)(e),[g,_]=(0,b.useState)(n),[v,y]=(0,b.useState)(null),[x,S]=(0,b.useState)(!1),[C,w]=(0,b.useState)(``),[T,E]=(0,b.useState)(!1),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(!1),j=`/api/extensions/agent-plugins/${encodeURIComponent(o?.pluginId??``)}`,M=()=>i(`gateway-extensions-list`);async function N(e){S(!0),w(``);try{await e()}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(!1)}}async function P(e){h(await Y(`${j}/activation`,`POST`,{enabled:e})),await M()}return(0,b.useEffect)(()=>{e&&h(e)},[e]),(0,q.jsx)(f,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,q.jsxs)(l,{children:[(0,q.jsx)(s,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,q.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(85vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,q.jsx)(d,{className:`font-semibold`,children:o?.name??(r?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,q.jsx)(m,{variant:`ghost`,onClick:t,children:r?`关闭`:`Close`})]}),(0,q.jsx)(c,{className:`sr-only`,children:r?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[o?(0,q.jsxs)(q.Fragment,{children:[o.activationEligible?null:(0,q.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium text-accent-fg`,children:r?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,q.jsx)(m,{disabled:x||o.readiness===`blocked`,onClick:()=>void N(()=>P(!0)),children:r?`启用插件`:`Enable plugin`})]}),(0,q.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,o.version,` · `,o.readiness&&{ready:r?`已就绪`:`Ready`,setup_required:r?`待连接`:`Setup required`,degraded:r?`部分不可用`:`Partially available`,blocked:r?`已阻止`:`Blocked`}[o.readiness]]}),(0,q.jsx)(`p`,{className:`text-sm`,children:o.description}),o.activationEligible?(0,q.jsx)(m,{disabled:x,variant:`secondary`,onClick:()=>void N(()=>P(!1)),children:r?`停用`:`Disable`}):null,o.canRollback?(0,q.jsx)(m,{disabled:x,variant:`secondary`,onClick:()=>void N(async()=>{h(await Y(`${j}/rollback`,`POST`)),await M()}),children:r?`回滚上一版本`:`Roll back`}):null,o.components?.skills.length?(0,q.jsxs)(`p`,{className:`text-sm`,children:[`Skills: `,o.components.skills.map(e=>e.name).join(`, `)]}):null,o.components?.mcp.map(e=>(0,q.jsx)(X,{pluginId:o.pluginId,server:e,enabled:o.active},e.id)),o.diagnostics?.map((e,t)=>(0,q.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,(0,q.jsxs)(`form`,{className:`space-y-3 border-t border-edge pt-4`,onSubmit:e=>{e.preventDefault(),N(async()=>{y(await Y(`/api/extensions/inspect`,`POST`,{source:g}))})},children:[(0,q.jsxs)(`label`,{className:`block text-sm`,children:[o?r?`更新包来源`:`Update package source`:r?`Gateway 本地路径、HTTPS ZIP 或 store:包名`:`Gateway local path, HTTPS ZIP or store:package`,(0,q.jsx)(`input`,{className:`${J} mt-1`,value:g,onChange:e=>{_(e.target.value),y(null)},required:!0})]}),(0,q.jsx)(m,{type:`submit`,variant:`secondary`,disabled:x||!g,children:r?`检查安装包`:`Inspect package`})]}),v?(0,q.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3 text-sm`,children:[(0,q.jsxs)(`p`,{className:`font-medium`,children:[v.manifest.name,` `,v.manifest.version]}),(0,q.jsx)(`p`,{className:`text-fg-muted`,children:r?`此包将提供以下能力。本地 MCP 会在你的主机上运行程序。`:`This package provides the capabilities below. Local MCP servers execute programs on your host.`}),(0,q.jsx)(`ul`,{className:`space-y-1 break-words`,children:v.capabilities.map(e=>(0,q.jsxs)(`li`,{children:[v.addedCapabilities.includes(e)?`+ `:``,e]},e))}),v.diagnostics.map((e,t)=>(0,q.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,q.jsx)(m,{disabled:x||!!o&&v.manifest.name!==o.pluginId,onClick:()=>void N(async()=>{h(await Y(o?`${j}/update`:`/api/extensions/install`,`POST`,{source:g,reviewHash:v.reviewHash})),y(null),await M()}),children:r?`确认能力并安装`:`Accept capabilities and install`})]}):null,o?(0,q.jsx)(`div`,{className:`border-t border-edge pt-4`,children:k?(0,q.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,q.jsx)(`p`,{children:r?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,q.jsxs)(`label`,{className:`flex gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked)}),r?`同时删除插件数据`:`Also delete plugin data`]}),(0,q.jsxs)(`label`,{className:`flex gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),r?`同时删除本地凭据`:`Also delete local credentials`]}),(0,q.jsx)(m,{disabled:x,onClick:()=>void N(async()=>{await Y(j,`DELETE`,{removeData:T,removeCredentials:D}),await M(),t()}),children:r?`确认卸载`:`Confirm uninstall`})]}):(0,q.jsx)(m,{variant:`ghost`,disabled:x,onClick:()=>A(!0),children:r?`卸载插件`:`Uninstall`})}):null,C?(0,q.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:C}):null]})]})]})})}export{R as a,I as c,K as d,P as f,S as g,H as h,U as i,M as l,L as m,X as n,j as o,G as p,N as r,E as s,Z as t,W as u};
|
|
@@ -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{f as i,m as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{c as l,n as u}from"./locale-store-BPZR8x9b.js";import{t as d}from"./messages-kFWhF6_t.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CS04eWY9.js";import{t as x}from"./skeleton-BwbyijEw.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as w}from"./settings-shell-layer-context-BTQUDoJ2.js";import{Ac as T,Cn as E,Gc as D,Il as O,Io as k,R as A,Sn as j,Tc as M,bn as N,fo as P,gd as F,ol as I,vn as L,xn as R,xu as z,yn as ee}from"./index-CJuypaNt.js";import{r as B}from"./settings-page-layout-eqTUTW2L.js";var V=n(),H=e(t(),1),U=r(),te=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],W=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function G(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function K(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function q(e){let t=(0,V.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function J(e){let t=(0,V.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Y(e){let t=(0,V.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,U.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function X(e){let t=(0,V.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,U.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,U.jsx)(q,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,U.jsx)(q,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let y;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(y=l&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=y):y=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,U.jsx)(b,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==y||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[v,y,x,S]}),t[40]=y,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:G(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function Z(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Q({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:l,onDelete:u}){let[d,f]=(0,H.useState)(`overview`),[p,m]=(0,H.useState)(()=>structuredClone(e.override)),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(null),y=JSON.stringify(p)!==JSON.stringify(e.override),x=[p.models?.chat,...Object.values(p.models?.intents??{}),p.models?.imageUnderstanding,p.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,H.useEffect)(()=>a(y),[y,a]);let S=(0,H.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(p.tools??{})])].sort(),[e.effective.tools,p.tools,t]),C=[p.models?n?`模型`:`Models`:null,p.skills?n?`技能`:`Skills`:null,p.tools?n?`工具权限`:`Tool access`:null,p.runtime||p.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),w=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,k=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,A=E({id:e.id,name:p.profile?.name??e.name},r),j={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},N={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},P=async()=>{g(!0),v(null);try{let t=(await R(e.id,{workspace:p.workspace??null,profile:p.profile,models:p.models??null,skills:p.skills??null,tools:p.tools??null,workflows:p.workflows??null,runtime:p.runtime??null})).agents.find(t=>t.id===e.id);t&&m(structuredClone(t.override))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}},L=async()=>{g(!0),v(null);try{await R(e.id,{setDefault:!0})}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}},ee=(e,t)=>{let n={...p.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},m({...p,tools:Object.keys(n).length>0?n:void 0})},B=(e,t)=>{let n={...p.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,m({...p,models:Object.keys(n).length>0?n:void 0})};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,U.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,U.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:z},{id:`profile`,label:n?`个性`:`Profile`,icon:M},{id:`models`,label:n?`模型`:`Models`,icon:D},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:F},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:z},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:T}].map(({id:e,label:t,icon:n})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:c(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,d===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,U.jsx)(n,{className:`size-4`}),t]},e))})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[_||i?(0,U.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:_??i}):null,d===`overview`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,U.jsxs)(b,{onClick:l,children:[(0,U.jsx)(O,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.length>0?n?`已自定义:${C.join(`、`)}`:`Customized: ${C.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,U.jsx)(b,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(Y,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:p.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`技能`:`Skills`,value:k,detail:p.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工具权限`:`Tool access`,value:w>0?n?`${w} 个禁用`:`${w} denied`:n?`全部可用`:`All available`,detail:p.tools?n?`${Object.keys(p.tools).length} 个本地覆盖`:`${Object.keys(p.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:p.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,U.jsx)(b,{onClick:()=>void L(),disabled:h,children:n?`设为默认智能体`:`Make default agent`})]}):null,d===`profile`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`只设置这个智能体独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:A,onChange:e=>m({...p,profile:{name:e.target.value,...p.profile?.instructions?{instructions:p.profile.instructions}:{}}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,p.workspace?null:(0,U.jsx)(q,{children:n?`自动`:`Automatic`})]}),(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:p.workspace??``,placeholder:e.effective.workspace,onChange:e=>m({...p,workspace:e.target.value||void 0})})]})]}),(0,U.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,U.jsx)(`textarea`,{rows:10,className:`${W} mt-1.5 resize-y leading-6`,value:p.profile?.instructions??``,onChange:t=>m({...p,profile:{name:p.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,d===`models`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:p.models?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,models:void 0}),children:[(0,U.jsx)(I,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(X,{label:r.editorChatModel,inherited:e.effective.models.chat,value:p.models?.chat,zh:n,onChange:e=>{let t={...p.models??{}};e?t.chat=e:delete t.chat,m({...p,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:te.map(t=>(0,U.jsx)(X,{label:j[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:p.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>B(t,e)},t))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(X,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:p.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...p.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,m({...p,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsx)(X,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:p.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...p.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:p.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:p.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},m({...p,models:Object.keys(n).length>0?n:void 0})}}),p.models?.imageGeneration?(0,U.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:p.models.imageGeneration.timeoutMs??``,onChange:e=>m({...p,models:{...p.models,imageGeneration:{...p.models.imageGeneration,timeoutMs:K(e.target.value)}}})})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,models:{...p.models,imageGeneration:{...p.models.imageGeneration,autoProviderFallback:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,d===`capabilities`?(0,U.jsxs)(`div`,{className:`space-y-7`,children:[(0,U.jsx)(J,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),p.skills?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,skills:void 0}),children:[(0,U.jsx)(I,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(b,{variant:p.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>m({...p,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,U.jsx)(b,{variant:p.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>m({...p,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),p.skills?.mode===`merge`?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.add.join(`, `),onChange:e=>m({...p,skills:{mode:`merge`,add:G(e.target.value),remove:p.skills?.mode===`merge`?p.skills.remove:[]}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.remove.join(`, `),onChange:e=>m({...p,skills:{mode:`merge`,add:p.skills?.mode===`merge`?p.skills.add:[],remove:G(e.target.value)}})})]})]}):null,p.skills?.mode===`replace`?(0,U.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.include.join(`, `),onChange:e=>m({...p,skills:{mode:`replace`,include:G(e.target.value)}})})]}):null]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),p.tools?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,tools:void 0}),children:[(0,U.jsx)(I,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,U.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:S.map(t=>{let r=p.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${N[i]}`})]}),(0,U.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>ee(t,e),className:c(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:N[e]},e))})]},t)})})]})]}):null,d===`runtime`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:p.runtime||p.workflows?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,runtime:void 0,workflows:void 0}),children:[(0,U.jsx)(I,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,p.runtime?.[t]===void 0?(0,U.jsx)(q,{children:n?`继承`:`Inherited`}):null]}),(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:p.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Z({...p.runtime??{},[t]:K(e.target.value)});m({...p,runtime:n})}})]},t))}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Z({...p.workflows??{},default:e.target.value||void 0});m({...p,workflows:t})}})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=G(e.target.value),n=Z({...p.workflows??{},allowed:t.length>0?t:void 0});m({...p,workflows:n})}})]})]})]}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),p.runtime?.promptCache?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>{let e=Z({...p.runtime??{},promptCache:void 0});m({...p,runtime:e})},children:[(0,U.jsx)(I,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),p.runtime?.promptCache?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...p.runtime.promptCache,mode:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...p.runtime.promptCache,lifetime:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,U.jsx)(b,{className:`mt-4`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,d===`danger`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,U.jsx)(b,{disabled:h,onClick:()=>void L(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,U.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,U.jsxs)(b,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,U.jsx)(T,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,U.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x?n?`请补全自定义模型`:`Complete the custom model reference`:y?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(b,{onClick:o,children:n?`关闭`:`Close`}),(0,U.jsx)(b,{variant:`primary`,disabled:h||!y||x||p.profile!==void 0&&!p.profile.name.trim(),onClick:()=>void P(),children:h?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function $(e){let t=(0,V.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[l,u]=(0,H.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,U.jsx)(f,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=d):d=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=c(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,S,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]!==n.avatar||t[3]!==n.id?(b=(0,U.jsx)(A,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=b):b=t[4];let x;t[5]!==n||t[6]!==r?(x=E(n,r),t[5]=n,t[6]=r,t[7]=x):x=t[7];let T;t[8]===x?T=t[9]:(T=(0,U.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:x}),t[8]=x,t[9]=T);let D;t[10]===n.id?D=t[11]:(D=(0,U.jsx)(p,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=D);let O;t[12]!==T||t[13]!==D?(O=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[T,D]}),t[12]=T,t[13]=D,t[14]=O):O=t[14];let k;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(k=n.isDefault?(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=k):k=t[17];let j;t[18]!==b||t[19]!==O||t[20]!==k?(j=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[b,O,k]}),t[18]=b,t[19]=O,t[20]=k,t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,U.jsx)(s,{className:`size-4`}),t[22]=M):M=t[22];let N;t[23]===r.closeDialogAria?N=t[24]:(N=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:M})}),t[23]=r.closeDialogAria,t[24]=N);let P;t[25]!==N||t[26]!==j?(P=(0,U.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[j,N]}),t[25]=N,t[26]=j,t[27]=P):P=t[27];let F;t[28]!==o||t[29]!==l||t[30]!==P?(F=(0,U.jsxs)(h,{children:[d,(0,U.jsx)(g,{ref:u,className:y,onOpenAutoFocus:ne,children:(0,U.jsxs)(w,{layer:`modal`,portalContainer:l,children:[P,o]})})]}),t[28]=o,t[29]=l,t[30]=P,t[31]=F):F=t[31];let I;return t[32]!==a||t[33]!==i||t[34]!==F?(I=(0,U.jsx)(v,{open:i,onOpenChange:a,children:F}),t[32]=a,t[33]=i,t[34]=F,t[35]=I):I=t[35],I}function ne(e){return e.preventDefault()}function re(e){let t=(0,V.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=E(e,i),n=j(e,i);return(0,U.jsx)(`li`,{className:`min-h-0`,children:(0,U.jsxs)(`article`,{className:c(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,U.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(A,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,U.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,U.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,U.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,U.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,U.jsxs)(b,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,U.jsx)(O,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let l;return t[11]===s?l=t[12]:(l=(0,U.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=l),l}var ie=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function ae(e){let t=(0,V.c)(59),{open:n,busy:r,error:i,name:a,instructions:o,zh:l,onNameChange:u,onInstructionsChange:d,onCreate:y,onOpenChange:x}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,U.jsx)(f,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=c(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,S),t[1]=T):T=t[1];let E=l?`新建智能体`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,U.jsx)(_,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=l?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,U.jsx)(p,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,U.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,U.jsx)(s,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,U.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=l?`名称`:`Name`,F=l?`智能体名称`:`Agent name`,I;t[14]===u?I=t[15]:(I=e=>u(e.target.value),t[14]=u,t[15]=I);let L=l?`例如:数据分析师`:`For example: Data analyst`,R;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==L?(R=(0,U.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${ie} mt-1.5`,value:a,onChange:I,placeholder:L}),t[16]=a,t[17]=F,t[18]=I,t[19]=L,t[20]=R):R=t[20];let z;t[21]!==P||t[22]!==R?(z=(0,U.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,R]}),t[21]=P,t[22]=R,t[23]=z):z=t[23];let ee=l?`个性与工作方式(可选)`:`Personality and working style (optional)`,B=l?`个性与工作方式`:`Personality and working style`,H;t[24]===d?H=t[25]:(H=e=>d(e.target.value),t[24]=d,t[25]=H);let te=l?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,W;t[26]!==o||t[27]!==B||t[28]!==H||t[29]!==te?(W=(0,U.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":B,rows:4,className:`${ie} mt-1.5 resize-none`,value:o,onChange:H,placeholder:te}),t[26]=o,t[27]=B,t[28]=H,t[29]=te,t[30]=W):W=t[30];let G;t[31]!==ee||t[32]!==W?(G=(0,U.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[ee,W]}),t[31]=ee,t[32]=W,t[33]=G):G=t[33];let K;t[34]!==N||t[35]!==z||t[36]!==G?(K=(0,U.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,z,G]}),t[34]=N,t[35]=z,t[36]=G,t[37]=K):K=t[37];let q=l?`取消`:`Cancel`,J;t[38]!==r||t[39]!==q?(J=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(b,{disabled:r,children:q})}),t[38]=r,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==r||t[42]!==a?(Y=r||!a.trim(),t[41]=r,t[42]=a,t[43]=Y):Y=t[43];let X=r?l?`创建中…`:`Creating…`:l?`创建智能体`:`Create agent`,Z;t[44]!==y||t[45]!==Y||t[46]!==X?(Z=(0,U.jsx)(b,{variant:`primary`,disabled:Y,onClick:y,children:X}),t[44]=y,t[45]=Y,t[46]=X,t[47]=Z):Z=t[47];let Q;t[48]!==J||t[49]!==Z?(Q=(0,U.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[J,Z]}),t[48]=J,t[49]=Z,t[50]=Q):Q=t[50];let $;t[51]!==K||t[52]!==Q||t[53]!==M?($=(0,U.jsxs)(h,{children:[w,(0,U.jsxs)(g,{className:T,children:[M,K,Q]})]}),t[51]=K,t[52]=Q,t[53]=M,t[54]=$):$=t[54];let ne;return t[55]!==x||t[56]!==n||t[57]!==$?(ne=(0,U.jsx)(v,{open:n,onOpenChange:x,children:$}),t[55]=x,t[56]=n,t[57]=$,t[58]=ne):ne=t[58],ne}function oe(){let e=(0,V.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(x,{className:`h-7 w-28`}),(0,U.jsx)(x,{className:`h-4 w-80 max-w-full`})]}),(0,U.jsx)(x,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsxs)(B,{gap:`gap-5`,children:[t,(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(se)})]}),e[1]=n):n=e[1],n}function se(e){return(0,U.jsx)(x,{className:`h-64 rounded-2xl`},e)}function ce(){let e=l(e=>e.conversationId),t=u(e=>e.language),n=t===`zh`,r=d(t).agentsSettings,s=i(),{agentId:c}=a(),{data:f,error:p,isLoading:m,mutate:h}=y(e?`settings-gateway-agents`:null,N),g=k(e=>e.setPageHeader),_=k(e=>e.clearPageHeader),[v,x]=(0,H.useState)({open:!1,name:``,instructions:``}),[S,C]=(0,H.useState)(!1),[w,T]=(0,H.useState)(null),D=(0,H.useRef)(!1),O=f?.agents.find(e=>e.id===c),A=(0,H.useMemo)(()=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(b,{onClick:()=>s(`/settings/agent-defaults`),children:n?`全局默认配置`:`Global defaults`}),(0,U.jsxs)(b,{variant:`primary`,onClick:()=>{T(null),x(e=>({...e,open:!0}))},children:[(0,U.jsx)(o,{className:`size-4`}),n?`新建智能体`:`New agent`]})]}),[s,n]);(0,H.useLayoutEffect)(()=>(g({startExtra:null,main:(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?`智能体`:`Agents`}),end:A}),()=>_()),[_,A,g,n]);let j=async()=>{C(!0),T(null);try{let e=await L({profile:{name:v.name.trim(),...v.instructions.trim()?{instructions:v.instructions.trim()}:{}}});x({open:!1,name:``,instructions:``}),s(`/agents/${e.createdAgentId}`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}},M=async e=>{let t=E(e,r);if(window.confirm(n?`删除 ${t}?此操作无法撤销。`:`Delete ${t}? This cannot be undone.`)){C(!0),T(null);try{await ee(e.id),s(`/agents`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},F=e=>{P(e),s(`/chat/new`)},I=e=>{D.current=!1,window.setTimeout(()=>s(`/agents/${e}`),0)},R=()=>{D.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(D.current=!1,s(`/agents`))},z=()=>{D.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(D.current=!1,s(`/settings/agent-defaults`))},V=(0,H.useCallback)(e=>{D.current=e},[]);return e?p&&!f?(0,U.jsxs)(B,{children:[(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(p)}),(0,U.jsx)(b,{onClick:()=>void h(),children:n?`重试`:`Retry`})]}):m||!f?(0,U.jsx)(oe,{}):(0,U.jsxs)(B,{gap:`gap-5`,className:`max-w-6xl`,padding:`px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(p||w)&&!O?(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:w??String(p)}):null,(0,U.jsx)(re,{agents:f.agents,busy:S,messages:r,onOpen:I,onChat:F}),O?(0,U.jsx)($,{agent:O,messages:r,open:!0,onOpenChange:e=>{e||R()},children:(0,U.jsx)(Q,{agent:O,toolIds:f.builtinToolIds,zh:n,messages:r,externalError:w,onDirtyChange:V,onClose:R,onOpenDefaults:z,onChat:()=>F(O.id),onDelete:()=>void M(O)},O.id)}):null,(0,U.jsx)(ae,{open:v.open,busy:S,error:w,name:v.name,instructions:v.instructions,zh:n,onNameChange:e=>x(t=>({...t,name:e})),onInstructionsChange:e=>x(t=>({...t,instructions:e})),onCreate:()=>void j(),onOpenChange:e=>{S||(x(t=>({...t,open:e})),e||T(null))}})]}):(0,U.jsx)(B,{children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`需要本机服务令牌。`:`Local service token required.`})})}export{ce as AgentsSettingsPanel};
|
|
@@ -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{g as i,t as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./markdown-view-Dft8ASFD.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-JdwAhgNB.js";import{a as d,c as f,i as p,n as m,r as h}from"./locale-store-BPZR8x9b.js";import{t as g}from"./messages-kFWhF6_t.js";import{a as _,i as v,o as y,r as b,s as x,t as S}from"./dist-BGTk37IG.js";import{a as C,i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CS04eWY9.js";import{t as E}from"./skeleton-BwbyijEw.js";import{Ac as D,Ao as O,Do as k,Ed as A,Eo as j,Fu as ee,Io as M,No as N,Oo as P,Qc as F,Tl as I,Ul as te,Xc as ne,ad as L,hd as R,jc as re,ko as z,nl as B,wa as V}from"./index-CJuypaNt.js";import{t as H}from"./page-tabs-CVbY7_N5.js";import{t as ie}from"./agent-plugin-dialog-CNuqJcHQ.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ae(e){let t=await p(h(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await p(h(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await p(h(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await p(h(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function oe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=g(m(e=>e.language)).extensionsPage,n=f(e=>!!e.conversationId),r=k(),{mutate:i}=C(),[a,o]=(0,U.useReducer)(V,Z),{q:s,debounced:c,detailPkg:l,rowBusy:p,actionError:_,restartHint:v}=a,y=n?`marketplace-${c}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:b,isLoading:x,error:S}=w(y,async()=>d(c.length>0?h(`/api/marketplace?q=${encodeURIComponent(c)}`):h(`/api/marketplace`)),{revalidateOnFocus:!1}),T=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),N()},[i]),D=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});T(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,T]),O=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);T(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,T]),A=b?.extensions??[];return(0,X.jsxs)(`div`,{className:u(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),S?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S instanceof Error?S.message:t.marketplaceLoadFailed}):null,_?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:_}):null,v?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v}):null,x&&!b?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(E,{className:`h-5 w-40`}),(0,X.jsx)(E,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(E,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(E,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:A.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):A.map(e=>{let n=oe(r,e.id),i=p===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:u(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(L,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(I,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&O(e.id).catch(()=>{})},className:u(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(re,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:u(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),l?(0,X.jsx)($,{packageName:l,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:D,onUninstall:O}):null]})}function $(e){let t=(0,W.c)(93),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:d}=e,[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),v=f(de)?`ext-mp-detail-${n}`:null,C;t[0]===n?C=t[1]:(C=async()=>ae(n),t[0]=n,t[1]=C);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:O,error:k,isLoading:j}=w(v,C,T),ee;t[3]!==i||t[4]!==n?(ee=oe(i,n),t[3]=i,t[4]=n,t[5]=ee):ee=t[5];let M=ee,N=M===`user`,P=O?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q,J;if(t[6]!==r||t[7]!==O||t[8]!==k||t[9]!==i||t[10]!==M||t[11]!==j||t[12]!==o||t[13]!==n||t[14]!==P||t[15]!==h){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],a;t[28]!==r||t[29]!==O?(a=O?.readme?.trim()||(O?.description?.trim()?`### ${O.name}\n\n${O.description}`:`*${r.marketplaceNoReadme}*`),t[28]=r,t[29]=O,t[30]=a):a=t[30];let c=a;if(O?.format===`agent-plugin`){let e;if(t[31]!==O||t[32]!==i){let n;t[34]===O?n=t[35]:(n=e=>e.pluginId===O.manifest?.name,t[34]=O,t[35]=n),e=i.find(n),t[31]=O,t[32]=i,t[33]=e}else e=t[33];let r=`store:${n}`,a;t[36]!==o||t[37]!==e||t[38]!==r?(a=(0,X.jsx)(ie,{extension:e,initialSource:r,onClose:o}),t[36]=o,t[37]=e,t[38]=r,t[39]=a):a=t[39],B=a;break bb0}L=S,R=!0,t[40]===o?z=t[41]:(z=e=>!e&&o(),t[40]=o,t[41]=z),I=y,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,X.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[42]=J):J=t[42],F=b,G=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,K=ue;let u;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(A,{className:`size-5`}),t[43]=u):u=t[43];let d;t[44]!==r.detailBack||t[45]!==o?(d=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:u}),t[44]=r.detailBack,t[45]=o,t[46]=d):d=t[46];let f;t[47]===r.marketplaceDetailTitle?f=t[48]:(f=(0,X.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[47]=r.marketplaceDetailTitle,t[48]=f);let p;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(l,{className:`size-5`}),t[49]=p):p=t[49];let m;t[50]!==r.detailClose||t[51]!==o?(m=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:p}),t[50]=r.detailClose,t[51]=o,t[52]=m):m=t[52],t[53]!==d||t[54]!==f||t[55]!==m?(q=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,f,m]}),t[53]=d,t[54]=f,t[55]=m,t[56]=q):q=t[56],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=j&&!O?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(E,{className:`h-6 w-48`}),(0,X.jsx)(E,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(E,{className:`h-12`}),(0,X.jsx)(E,{className:`h-12`})]}),(0,X.jsx)(E,{className:`h-28 w-full`}),(0,X.jsx)(E,{className:`h-36 w-full`})]}):k?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:k instanceof Error?k.message:r.marketplaceLoadFailed})]}):O?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:O.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:O.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:O.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:O.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:O.downloads})]})]}),M===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[O.installability.available?(0,X.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:O.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:O.installability.available?r.marketplaceCodeRisk:O.installability.reason??r.marketplaceUnavailableBody})]})]}),O.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:O.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(le)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(O.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,O.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),O.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(s,{content:c})})]}):null}t[6]=r,t[7]=O,t[8]=k,t[9]=i,t[10]=M,t[11]=j,t[12]=o,t[13]=n,t[14]=P,t[15]=h,t[16]=F,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=G,t[25]=K,t[26]=q,t[27]=J}else F=t[16],I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],G=t[24],K=t[25],q=t[26],J=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let Y;t[57]!==V||t[58]!==H?(Y=(0,X.jsx)(`div`,{className:V,children:H}),t[57]=V,t[58]=H,t[59]=Y):Y=t[59];let Z;t[60]!==p||t[61]!==r.marketplaceBuiltinGoBuiltin||t[62]!==r.marketplaceBuiltinManageHint||t[63]!==r.marketplaceInstall||t[64]!==r.marketplaceReinstall||t[65]!==r.marketplaceReinstallConfirm||t[66]!==r.marketplaceUninstall||t[67]!==r.marketplaceUninstallConfirm||t[68]!==O||t[69]!==M||t[70]!==o||t[71]!==c||t[72]!==d||t[73]!==n||t[74]!==h||t[75]!==N?(Z=O?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:p||!O.installability.available||!h,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(m(!0),c(n,N).catch(ce).finally(()=>m(!1)))},className:u(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,X.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,X.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(m(!0),d(n).then(()=>o()).catch(se).finally(()=>m(!1)))},className:u(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[60]=p,t[61]=r.marketplaceBuiltinGoBuiltin,t[62]=r.marketplaceBuiltinManageHint,t[63]=r.marketplaceInstall,t[64]=r.marketplaceReinstall,t[65]=r.marketplaceReinstallConfirm,t[66]=r.marketplaceUninstall,t[67]=r.marketplaceUninstallConfirm,t[68]=O,t[69]=M,t[70]=o,t[71]=c,t[72]=d,t[73]=n,t[74]=h,t[75]=N,t[76]=Z):Z=t[76];let Q;t[77]!==F||t[78]!==Y||t[79]!==Z||t[80]!==G||t[81]!==K||t[82]!==q?(Q=(0,X.jsxs)(F,{className:G,onOpenAutoFocus:K,children:[q,Y,Z]}),t[77]=F,t[78]=Y,t[79]=Z,t[80]=G,t[81]=K,t[82]=q,t[83]=Q):Q=t[83];let $;t[84]!==I||t[85]!==Q||t[86]!==J?($=(0,X.jsxs)(I,{children:[J,Q]}),t[84]=I,t[85]=Q,t[86]=J,t[87]=$):$=t[87];let fe;return t[88]!==L||t[89]!==R||t[90]!==z||t[91]!==$?(fe=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:$}),t[88]=L,t[89]=R,t[90]=z,t[91]=$,t[92]=fe):fe=t[92],fe}function se(){}function ce(){}function le(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ue(e){return e.preventDefault()}function de(e){return!!e.conversationId}function fe(){let e=m(e=>e.language),t=g(e),n=M(e=>e.setPageHeader),r=M(e=>e.clearPageHeader),o=k(),s=P(),[l,u]=i(),d=G(l.get(`tab`)),f=l.get(`q`)??``,[p,h]=(0,U.useState)(d),[_,v]=(0,U.useState)(f),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(!1),C=l.toString(),w=(0,U.useRef)(C);if(w.current!==C){w.current=C;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),v(e=>e===t?e:t)}(0,U.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=_.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,_,u]);let E=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),D=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),O=p===`builtin`?E:D,A=(0,U.useMemo)(()=>{let t=_.trim().toLowerCase(),n=O;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[O,_,e]);if((0,U.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?pe(e)===pe(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(T,{variant:`secondary`,onClick:()=>S(!0),children:e.startsWith(`zh`)?`安装插件`:`Install plugin`}),(0,X.jsx)(T,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(R,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(T,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(c,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,e,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&p!==`marketplace`)return(0,X.jsx)(be,{});let j=p!==`marketplace`&&O.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,X.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 border-b border-edge-subtle pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:E.length},{id:`user`,label:t.extensionsPage.tabUser,count:D.length}],activeTab:p,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),j?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,X.jsx)(Q,{}):p===`builtin`&&E.length===0?(0,X.jsx)(Se,{message:t.extensionsPage.emptyBuiltin}):p===`user`&&D.length===0?(0,X.jsx)(Se,{message:t.extensionsPage.emptyUser}):A.length===0?(0,X.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:A.map(e=>(0,X.jsx)(_e,{extension:e,copy:t.extensionsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?y.format===`agent-plugin`?(0,X.jsx)(ie,{extension:y,onClose:()=>b(null)},y.id):(0,X.jsx)(ve,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null,x?(0,X.jsx)(ie,{onClose:()=>S(!1)}):null]})}function pe(e){return e.activationEligible??e.active}function me(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function he(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ge(e,t){let n=pe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function _e(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=pe(n),t[0]=n,t[1]=s);let l=s,d=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=u(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=f):f=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==l?(y=l?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(c,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==d?(w=(0,X.jsx)(`span`,{title:d,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=d,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:me(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:he(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:f,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function ve({extension:e,copy:t,onClose:n}){let{mutate:r}=C(),[i,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),p=e.activationEligible===!0,m=(0,U.useCallback)(async()=>{if(e.source===`bundled`){c(null),f(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!p});await r(`gateway-extensions-list`),N(),f(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[p,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],E=h.find(e=>e.showInNav)??h[0],D=g[0],k=E?j(e.id,E):null,M=D?`/settings/ext/${e.id}/${D.id}`:e.hasConfigSchema||z(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(S,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(y,{children:[(0,X.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(A,{className:`size-5`})}),(0,X.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(v,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(l,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,me(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ge(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(T,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void m(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):p?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(h.length>0||g.length>0||w.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ye,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ye,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ye,{template:t.badgeWidgets,count:w.length,hidden:w.length===0})]})]}):null,O(e)&&(k||M)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[k?(0,X.jsxs)(a,{to:k,onClick:n,className:u(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(ee,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,X.jsxs)(a,{to:M,onClick:n,className:u(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(F,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ye(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function be(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(xe)})]})}),e[4]=a):a=e[4],a}function xe(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function Se(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{fe as ExtensionsPage};
|