@xopcai/xopc 0.0.414 → 0.0.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/_locales/en/messages.json +4 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +4 -1
- package/dist/browser-ext/dist/assets/{page-context-MuzjMBlJ.js → page-context-CVvmTWZb.js} +33 -9
- package/dist/browser-ext/dist/background.js +39 -10
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +22 -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-ClobpdW3.js → agent-avatar-dicebear-CufU7cqe.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHDAcss8.js +1 -0
- package/dist/gateway/static/root/assets/agents-BV3dAoa0.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-CeBkHnl8.js → agents-admin-api-B1p-ghg9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CLunLNGp.js → app-management-settings-panel-D4-n1uBg.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DBEgoE9g.js → appearance-settings-Cgn4eNsX.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BOYzD7Zz.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-JElK4Goq.js → archive-plugin-B4btCsiV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CZ0UqwyU.js → automations-page-yb1EL_3N.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-J7LJ4RuV.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CXFawow6.js → binary-plugins-DQT9e258.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BoduwSYI.js → block-editor-B50rU9tL.js} +30 -30
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D1pDgMJu.js → browser-automation-inputs-D6AccXaA.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BiQz6lJA.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-W9kuxBbE.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-Bpeh6E22.js → capabilities-BlxF36t-.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-iXe87MdG.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CRLSXe7Z.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BasrAWA0.js → capability-header-actions-BMnbzHms.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CrRJkOKX.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CwQbzcZ_.js → chat-terminal-dock-Bd3af4gL.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-DNWeJKfF.js → computer-settings-page-DXfqy7xh.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CxHgC5RM.js → connector-service-page-B-cw0CPU.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DbFxc0Fd.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CXxLbLJb.js → date-picker-CqzXevH6.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DVuWMrSj.js → dependency-picker-pgT4Gyaf.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BDlg9g4s.js → desktop-pet-settings-Dy_-i2L8.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-KbVLtAlO.js → desktop-pet-zICeqw9c.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-ByGbxqkg.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-a7xEodzo.js → directory-picker-path-field-C-aQ7qoM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CHelH5u_.js → extension-debug-page-2NwpYkS5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CrVHmS9-.js → extension-page-y9J0z7_Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CiMybi0r.js → extension-settings-page-BtowusUh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DF_HV6NP.js → gateway-config-swr-fQKBHBi1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-C52ghnBK.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-Bx9KCID-.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BYSKzUMR.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B91CBTzO.js → gateway-startup-retry-Cfwxof4k.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-Cz6eeDH5.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-8ACAVktj.js → highlighted-body-KQOG7T2V-BiAa8HKC.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cd1BjYHj.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CVBaWmrV.js → image-generation-api-gBFro48x.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C5IP3e6d.js → imports-page-BZQpXgjj.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cy16gQST.css +1 -0
- package/dist/gateway/static/root/assets/index-DRyGCING.js +710 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BhU6VYvd.js → keyboard-shortcuts-settings-CYunR34k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B_Ac1lly.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DcP1Bdlk.js → local-apps-page-w-J5bY02.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DvmwiLUx.js → local-session-drafts-iGX_6O0O.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-JogcXC4J.js → locale-store-B7s2Hb35.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Dnjvvx2i.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-w1EDwgLW.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BnPpcJ2J.js → media-plugins-CIx1koXw.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DISkHmEC.js +1 -0
- package/dist/gateway/static/root/assets/{messages-RzwPiQNL.js → messages-BYq0cPbn.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-CNkxMTFU.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D5GH2wuC.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-DZgKqFBG.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DusR2Itk.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-CR5JFkQ9.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-B7undvlr.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-fWDltRUJ.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-CsOirAiy.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-BOBVIB3j.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-FGqN-mQx.js → preview-open-alternatives-CMxjsKSw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CwnHLfdL.js → product-open-page-CrlyJx5M.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-BD6k5hF9.js → product-preview-content-B-Jhzi7W.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DoYUbtcI.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-xGQd9oAZ.js +1 -0
- package/dist/gateway/static/root/assets/refresh-cw-BRlGaq2w.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BGqSwITi.js → registry-api-BcfoLEna.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Gs0Xkws9.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-CSm5SpnR.js → runtime-tools-api-DesqGCnE.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bwg7U7TR.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DoVn5jJK.js → schema-form-ByzTNR_C.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DTxZyMta.js → session-api-DdQnMwkl.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-B2HDomj4.js → session-manager-B_h0jlLb.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-XzK1ftbR.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D_8Mvnog.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Ce8vVv-9.js → settings-form-section-Brgd8IOV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DP2w3ejC.js → settings-page-B6Mv02eg.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-header-BWyxJKOG.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-B20AfmFG.js → settings-page-layout-DLHcS-0T.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DSCj5yis.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DV4dKrmG.js → share-preview-page-DF8Of0aZ.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DXNPe4Tl.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-DTdejInH.js → skill-api-CKCDCHLq.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BH0WF6Br.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DFWMVRW4.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DB-ttubV.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BJY7c8wb.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-DIGSC4qF.js → task-result-evidence-B-vt1BgK.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-BaU8frtc.js → tracing-settings-page-Dt51Z_ws.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BCcOUsqu.js → tunnel-api-Dok3t7Qe.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-lJym5G7F.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-C1X47WVb.js → use-autosave-D4EMIB-V.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BXdNkITp.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bk4DQMTw.js → voice-api-key-field-CO3KuanA.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D7xsWrdh.js → voice-config-api-BkUlN7GH.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B7_NmTB5.js → work-discovery-overlay-BJRtgQM3.js} +1 -1
- package/dist/gateway/static/root/assets/wrench-DFb4r8bH.js +1 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CS-_GxHV.js +1 -0
- package/dist/gateway/static/root/browser-setup-test.html +5 -0
- package/dist/gateway/static/root/browser-setup-test.js +7 -0
- package/dist/gateway/static/root/index.html +17 -14
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/browser-setup.js +6 -0
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/phone-setup.js +6 -0
- package/dist/packages/realtime-client/src/index.js +1 -0
- package/dist/packages/realtime-protocol/src/index.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +4 -0
- package/dist/src/agent/agent-manager.js +12 -1
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/embedded/tool-search-extension.js +14 -1
- package/dist/src/agent/memory/context-recovery.d.ts +1 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/skills/installer.js +3 -3
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +4 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -0
- package/dist/src/agent/tool-manuals/xopc-configuration.js +25 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +2 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +6 -2
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +11 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +23 -21
- package/dist/src/agent/tools/phone-use-tool.d.ts +1 -0
- package/dist/src/agent/tools/phone-use-tool.js +29 -1
- package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
- package/dist/src/agent/tools/tool-manual-tool.js +3 -1
- package/dist/src/agent/tools/toolExposure.js +3 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +40 -2
- package/dist/src/backup/archive.js +2 -1
- package/dist/src/browser/drivers/browser-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.js +6 -3
- package/dist/src/browser/providers/browser-ext-install.js +3 -2
- package/dist/src/browser/runtime/browser-runtime.d.ts +4 -1
- package/dist/src/browser/runtime/browser-runtime.js +29 -17
- package/dist/src/browser/setup/repository.d.ts +5 -0
- package/dist/src/browser/setup/repository.js +42 -0
- package/dist/src/browser/setup/service.d.ts +152 -0
- package/dist/src/browser/setup/service.js +404 -0
- package/dist/src/browser/setup/types.d.ts +38 -0
- package/dist/src/browser/setup/types.js +1 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +3 -3
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/browser-setup.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-setup.js +114 -0
- package/dist/src/gateway/hono/routes/browser.d.ts +2 -1
- package/dist/src/gateway/hono/routes/browser.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/phone-setup.d.ts +7 -0
- package/dist/src/gateway/hono/routes/phone-setup.js +162 -0
- package/dist/src/gateway/hono/routes/phone.js +11 -7
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -0
- package/dist/src/gateway/provider-model-setup.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -0
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +52 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +7 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/unhandled-rejections.js +2 -2
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +8 -2
- package/dist/src/phone/adb-driver.js +124 -54
- package/dist/src/phone/cloud-adb.js +8 -0
- package/dist/src/phone/cloud-scrcpy.d.ts +3 -1
- package/dist/src/phone/cloud-scrcpy.js +17 -3
- package/dist/src/phone/contracts.d.ts +85 -0
- package/dist/src/phone/contracts.js +31 -5
- package/dist/src/phone/model-adapter.d.ts +141 -2
- package/dist/src/phone/model-adapter.js +176 -24
- package/dist/src/phone/numeric-entry.d.ts +31 -0
- package/dist/src/phone/numeric-entry.js +126 -0
- package/dist/src/phone/planning.d.ts +27 -0
- package/dist/src/phone/planning.js +79 -0
- package/dist/src/phone/recovery.d.ts +37 -0
- package/dist/src/phone/recovery.js +81 -0
- package/dist/src/phone/reliability.d.ts +7 -0
- package/dist/src/phone/reliability.js +66 -0
- package/dist/src/phone/repository.d.ts +1 -0
- package/dist/src/phone/repository.js +3 -0
- package/dist/src/phone/runtime.d.ts +8 -0
- package/dist/src/phone/runtime.js +387 -41
- package/dist/src/phone/scrcpy-text.d.ts +11 -0
- package/dist/src/phone/scrcpy-text.js +72 -0
- package/dist/src/phone/scrcpy.d.ts +5 -1
- package/dist/src/phone/scrcpy.js +48 -3
- package/dist/src/phone/semantic-controls.d.ts +13 -0
- package/dist/src/phone/semantic-controls.js +76 -0
- package/dist/src/phone/setup/service.d.ts +148 -0
- package/dist/src/phone/setup/service.js +251 -0
- package/dist/src/providers/presentation.js +2 -2
- package/dist/src/providers/xopc-cloud-model-source.js +6 -2
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/storage/sqlite/connection.js +2 -2
- package/dist/src/storage/sqlite/offline-access.js +13 -7
- package/dist/src/storage/sqlite/schema-errors.d.ts +12 -0
- package/dist/src/storage/sqlite/schema-errors.js +21 -3
- package/dist/src/storage/sqlite/schema-upgrade.d.ts +4 -0
- package/dist/src/storage/sqlite/schema-upgrade.js +78 -0
- package/dist/src/storage/sqlite/schema.d.ts +4 -3
- package/dist/src/storage/sqlite/schema.js +14 -8
- package/dist/src/storage/sqlite/schema.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/203_remove_retired_proactive_contracts.sql +70 -0
- package/dist/src/storage/sqlite/upgrades/204_home_intelligence.sql +78 -0
- package/dist/src/storage/sqlite/upgrades/205_agent_catalog.sql +66 -0
- package/dist/src/storage/sqlite/upgrades/206_home_advice_strategy_version.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/207_user_model_policy_contract.sql +121 -0
- package/dist/src/storage/sqlite/upgrades/208_automation_management.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/upgrades/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/upgrades/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/upgrades/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/upgrades/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/upgrades/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/upgrades/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/upgrades/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/upgrades/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/upgrades/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/upgrades/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/upgrades/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/222_session_config_authority.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/223_session_creation_receipts.sql +59 -0
- package/dist/src/storage/sqlite/upgrades/224_task_origin_links.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/225_task_collaboration.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/226_task_main_updates.sql +9 -0
- package/dist/src/storage/sqlite/upgrades/227_task_main_update_decisions.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/228_task_main_agent_links.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/229_task_criterion_reviews.sql +12 -0
- package/dist/src/storage/sqlite/upgrades/230_personal_agent_onboarding.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/231_task_result_deliveries.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/232_personal_requests.sql +28 -0
- package/dist/src/storage/sqlite/upgrades/233_observability_usage_links.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/234_task_result_reply.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/235_personal_conversation_priority.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/236_personal_proactivity.sql +53 -0
- package/dist/src/storage/sqlite/upgrades/237_personal_strategy_versions.sql +18 -0
- package/dist/src/storage/sqlite/upgrades/238_browser_record_replay.sql +45 -0
- package/dist/src/storage/sqlite/upgrades/239_clarification_notifications.sql +26 -0
- package/dist/src/storage/sqlite/upgrades/240_device_settings.sql +5 -0
- package/dist/src/storage/sqlite/upgrades/241_device_grant_audit.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/242_cloud_usage_receipts.sql +5 -0
- package/dist/src/storage/sqlite/upgrades/243_voice_opening_greetings.sql +12 -0
- package/dist/src/storage/sqlite/upgrades/244_device_request_proofs.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/245_memory_learning.sql +125 -0
- package/dist/src/storage/sqlite/upgrades/246_personal_session_thinking.sql +22 -0
- package/dist/src/storage/sqlite/upgrades/247_agent_selection_records.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/248_next_turn_suggestions.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/249_task_allocations.sql +17 -0
- package/dist/src/storage/sqlite/upgrades/250_research_checkpoints.sql +15 -0
- package/dist/src/storage/sqlite/upgrades/251_personal_result_reads.sql +40 -0
- package/dist/src/storage/sqlite/upgrades/252_task_work_revisions.sql +15 -0
- package/dist/src/storage/sqlite/upgrades/253_discussion_processing_recovery.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/254_discussion_annotations.sql +17 -0
- package/dist/src/storage/sqlite/upgrades/255_discussion_chapter_progress.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/256_task_main_update_retries.sql +21 -0
- package/dist/src/storage/sqlite/upgrades/257_session_composer_history.sql +11 -0
- package/dist/src/storage/sqlite/upgrades/258_task_phase_changes.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/259_personal_default_style.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/260_browser_setup.sql +9 -0
- package/dist/src/storage/sqlite/windows-database-owners.js +33 -28
- package/dist/src/tasks/capabilities/relations.d.ts +2 -2
- package/dist/src/tui/clipboard-image.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/work-discovery/probe.js +1 -1
- package/package.json +3 -3
- package/skills/tools/configure-xopc/SKILL.md +47 -0
- package/skills/tools/configure-xopc/references/browser/acceptance.md +31 -0
- package/skills/tools/configure-xopc/references/browser/chrome-extension.md +19 -0
- package/skills/tools/configure-xopc/references/browser/overview.md +22 -0
- package/skills/tools/configure-xopc/references/browser/permissions.md +25 -0
- package/skills/tools/configure-xopc/references/browser/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/phone/acceptance.md +25 -0
- package/skills/tools/configure-xopc/references/phone/aliyun.md +29 -0
- package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -0
- package/skills/tools/configure-xopc/references/phone/local.md +19 -0
- package/skills/tools/configure-xopc/references/phone/models.md +18 -0
- package/skills/tools/configure-xopc/references/phone/overview.md +30 -0
- package/skills/tools/configure-xopc/references/phone/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/scene-index.md +12 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-mf0jgEPE.js +0 -1
- package/dist/gateway/static/root/assets/agents-CKhZ4UYQ.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-BZ_MaQJf.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CHUDHNVL.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-DStDm9y1.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-6I4oetKt.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-C-EecWbS.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BQoCPk3x.js +0 -8
- package/dist/gateway/static/root/assets/channels-BKf_-Mdt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CUBg8spT.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-PmP_vGem.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DMAzNlm-.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DnrQ28E2.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-AMjU04kR.js +0 -1
- package/dist/gateway/static/root/assets/home-page-pTwVME-g.js +0 -2
- package/dist/gateway/static/root/assets/index-BLL0wKRZ.css +0 -1
- package/dist/gateway/static/root/assets/index-ygkHNYyo.js +0 -710
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cwl6EvuX.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CS3hcTOq.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DC-Y_-GP.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-vckgHpON.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-C7u4dxEk.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-jvqYtySx.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Bs7F5Hpf.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-DO_yhXS1.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BexL2-PQ.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +0 -1
- package/dist/gateway/static/root/assets/phone-dependencies-card-ChFtdFhA.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-CZoIAQ1j.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-DRyK0nHH.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-B-N61jJH.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DtKmFBml.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-CFZIz9mc.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CWEc7W0m.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-q_oswAdV.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BuPqNxpd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-QTVDCGJG.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-header-CYpuTXUW.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-ZmlE8jIE.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CtNxWqW-.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Egaf8PqZ.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C6FKxf4J.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Baxkhov7.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-C77-rpkt.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-BFeIbpbi.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-u8zY5jea.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CJ_akAvc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./cn-0WouolD0.js";import{l as s,n as c}from"./locale-store-B7s2Hb35.js";import{n as l,r as u}from"./cloud-credits-BMYMiiNn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as ee}from"./button-aIC072nz.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{t as p}from"./electron-env-Dit0bHgy.js";import{An as m,Cl as h,Du as g,El as _,Ga as te,Ln as v,Ml as ne,T as re,Vl as y,Zu as b,di as ie,jn as x}from"./index-DRyGCING.js";import{t as S}from"./number-input-DDeqHK-G.js";import{n as ae,t as C}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{n as w,t as T}from"./use-autosave-D4EMIB-V.js";var oe=n(),E=e(t(),1),D=r(),O=`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 k(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function se({draft:e,setDraft:t,zh:n}){let[r,i]=(0,E.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,E.useState)(!1);return(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,D.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${O} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:u(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,D.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function A(e){let t=(0,oe.c)(104),{draft:n,setDraft:r,zh:i}=e,a=i?`费用控制`:`Spending control`,o;t[0]===a?o=t[1]:(o=(0,D.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:a}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=(0,D.jsx)(se,{draft:n,setDraft:r,zh:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;t[6]!==o||t[7]!==s?(c=(0,D.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l=i?`执行与缓存策略`:`Execution and cache policy`,u=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,d=n.runtime.codemode?.enabled??!1,f;t[9]!==n||t[10]!==r?(f=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[9]=n,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==d||t[13]!==f?(p=(0,D.jsx)(`input`,{type:`checkbox`,checked:d,onChange:f,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m=i?`Codemode 读取试点`:`Codemode read pilot`,h;t[15]===m?h=t[16]:(h=(0,D.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:m}),t[15]=m,t[16]=h);let g=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,_;t[17]===g?_=t[18]:(_=(0,D.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:g}),t[17]=g,t[18]=_);let v;t[19]!==h||t[20]!==_?(v=(0,D.jsxs)(`span`,{children:[h,_]}),t[19]=h,t[20]=_,t[21]=v):v=t[21];let ne;t[22]!==v||t[23]!==p?(ne=(0,D.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[p,v]})}),t[22]=v,t[23]=p,t[24]=ne):ne=t[24];let y=i?`执行限制`:`Execution limits`,b;t[25]===y?b=t[26]:(b=(0,D.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:y}),t[25]=y,t[26]=b);let ie=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,x;t[27]===ie?x=t[28]:(x=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ie}),t[27]=ie,t[28]=x);let ae=i?`每次运行最多轮数`:`Maximum turns per run`,C=n.runtime.maxTurns??``,w=i?`系统默认`:`System default`,T;t[29]!==n||t[30]!==r?(T=e=>r({...n,runtime:{...n.runtime,maxTurns:k(e.target.value)}}),t[29]=n,t[30]=r,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==w||t[34]!==T?(E=(0,D.jsx)(S,{allowEmpty:!0,type:`number`,min:1,value:C,placeholder:w,onChange:T,className:`${O} mt-2`}),t[32]=C,t[33]=w,t[34]=T,t[35]=E):E=t[35];let A;t[36]!==ae||t[37]!==E?(A=(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ae,E]}),t[36]=ae,t[37]=E,t[38]=A):A=t[38];let j=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,M=n.runtime.timeoutMs??``,ce=i?`系统默认`:`System default`,N;t[39]!==n||t[40]!==r?(N=e=>r({...n,runtime:{...n.runtime,timeoutMs:k(e.target.value)}}),t[39]=n,t[40]=r,t[41]=N):N=t[41];let le;t[42]!==M||t[43]!==ce||t[44]!==N?(le=(0,D.jsx)(S,{allowEmpty:!0,type:`number`,min:1,value:M,placeholder:ce,onChange:N,className:`${O} mt-2`}),t[42]=M,t[43]=ce,t[44]=N,t[45]=le):le=t[45];let P;t[46]!==j||t[47]!==le?(P=(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,le]}),t[46]=j,t[47]=le,t[48]=P):P=t[48];let ue=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,de=n.runtime.maxToolFailuresPerTurn??``,fe=i?`系统默认`:`System default`,F;t[49]!==n||t[50]!==r?(F=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:k(e.target.value)}}),t[49]=n,t[50]=r,t[51]=F):F=t[51];let pe;t[52]!==de||t[53]!==fe||t[54]!==F?(pe=(0,D.jsx)(S,{allowEmpty:!0,type:`number`,min:1,value:de,placeholder:fe,onChange:F,className:`${O} mt-2`}),t[52]=de,t[53]=fe,t[54]=F,t[55]=pe):pe=t[55];let I;t[56]!==ue||t[57]!==pe?(I=(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ue,pe]}),t[56]=ue,t[57]=pe,t[58]=I):I=t[58];let L;t[59]!==A||t[60]!==P||t[61]!==I?(L=(0,D.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[A,P,I]}),t[59]=A,t[60]=P,t[61]=I,t[62]=L):L=t[62];let R;t[63]!==b||t[64]!==x||t[65]!==L?(R=(0,D.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[b,x,L]}),t[63]=b,t[64]=x,t[65]=L,t[66]=R):R=t[66];let z=i?`提示词缓存`:`Prompt cache`,B;t[67]===z?B=t[68]:(B=(0,D.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[67]=z,t[68]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[69]===V?H=t[70]:(H=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[69]=V,t[70]=H);let U=i?`缓存模式`:`Cache mode`,W;t[71]===U?W=t[72]:(W=(0,D.jsx)(`span`,{children:U}),t[71]=U,t[72]=W);let G=i?`缓存模式`:`Cache mode`,K;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(K=[`auto`,`off`],t[73]=K):K=t[73];let q;t[74]!==n||t[75]!==r||t[76]!==i?(q=K.map(e=>(0,D.jsx)(ee,{"aria-pressed":n.runtime.promptCache?.mode===e,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[74]=n,t[75]=r,t[76]=i,t[77]=q):q=t[77];let J;t[78]!==G||t[79]!==q?(J=(0,D.jsx)(te,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":G,children:q}),t[78]=G,t[79]=q,t[80]=J):J=t[80];let Y;t[81]!==W||t[82]!==J?(Y=(0,D.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,J]}),t[81]=W,t[82]=J,t[83]=Y):Y=t[83];let me;t[84]!==n||t[85]!==r||t[86]!==i?(me=n.runtime.promptCache?.mode===`auto`?(0,D.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,D.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,D.jsx)(te,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,D.jsx)(ee,{"aria-pressed":n.runtime.promptCache?.lifetime===e,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[84]=n,t[85]=r,t[86]=i,t[87]=me):me=t[87];let X;t[88]!==Y||t[89]!==me?(X=(0,D.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Y,me]}),t[88]=Y,t[89]=me,t[90]=X):X=t[90];let Z;t[91]!==B||t[92]!==H||t[93]!==X?(Z=(0,D.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[B,H,X]}),t[91]=B,t[92]=H,t[93]=X,t[94]=Z):Z=t[94];let Q;t[95]!==ne||t[96]!==R||t[97]!==l||t[98]!==Z||t[99]!==u?(Q=(0,D.jsxs)(re,{title:l,summary:u,children:[ne,R,Z]}),t[95]=ne,t[96]=R,t[97]=l,t[98]=Z,t[99]=u,t[100]=Q):Q=t[100];let $;return t[101]!==c||t[102]!==Q?($=(0,D.jsxs)(`div`,{className:`space-y-5`,children:[c,Q]}),t[101]=c,t[102]=Q,t[103]=$):$=t[103],$}function j(e){return[...new Set(e)].sort()}var M=[{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 ce(e){let t=(0,oe.c)(115),{draft:n,setDraft:r,zh:i}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[0]=s):s=t[0];let{data:c,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,ie,s),[ee,f]=(0,E.useState)(``),p=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let m;if(t[1]!==p||t[2]!==c?.catalog||t[3]!==ee){let e=[...c?.catalog??[]],n=new Set(e.map(de));for(let t of p)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=ee.trim().toLowerCase();m=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(ue),t[1]=p,t[2]=c?.catalog,t[3]=ee,t[4]=m}else m=t[4];let h=m,_;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 te=_,v;t[9]!==n||t[10]!==r?(v=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):j([...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):j([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=v):v=t[11];let re=v,y;t[12]===c?.catalog?y=t[13]:(y=c?.catalog??[],t[12]=c?.catalog,t[13]=y);let b;if(t[14]!==te||t[15]!==y){let e;t[17]===te?e=t[18]:(e=e=>e.enabled&&te(e.name),t[17]=te,t[18]=e),b=y.filter(e),t[14]=te,t[15]=y,t[16]=b}else b=t[16];let x=b.length,S;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(S=e=>{let t=new Set((c?.catalog??[]).filter(P).map(le));r({...n,skills:{mode:`selected`,include:j(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=S):S=t[22];let ae=S,C=i?`技能策略`:`Skill policy`,w;t[23]===C?w=t[24]:(w=(0,D.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:C}),t[23]=C,t[24]=w);let T=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,O;t[25]===T?O=t[26]:(O=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[25]=T,t[26]=O);let k;t[27]!==n||t[28]!==r?(k=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=k):k=t[29];let se=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,A;t[30]===se?A=t[31]:(A=o(`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`,se),t[30]=se,t[31]=A);let ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,D.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=ce):ce=t[32];let fe=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===fe?F=t[34]:(F=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:fe}),t[33]=fe,t[34]=F);let pe=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,I;t[35]===pe?I=t[36]:(I=(0,D.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:pe}),t[35]=pe,t[36]=I);let L;t[37]!==F||t[38]!==I?(L=(0,D.jsxs)(`span`,{children:[F,I]}),t[37]=F,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==k||t[41]!==A||t[42]!==L?(R=(0,D.jsxs)(`button`,{type:`button`,onClick:k,className:A,children:[ce,L]}),t[40]=k,t[41]=A,t[42]=L,t[43]=R):R=t[43];let z;t[44]!==n||t[45]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=z):z=t[46];let B=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,V;t[47]===B?V=t[48]:(V=o(`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`,B),t[47]=B,t[48]=V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,D.jsx)(g,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=H):H=t[49];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[50]===U?W=t[51]:(W=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[50]=U,t[51]=W);let G=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,K;t[52]===G?K=t[53]:(K=(0,D.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:G}),t[52]=G,t[53]=K);let q;t[54]!==W||t[55]!==K?(q=(0,D.jsxs)(`span`,{children:[W,K]}),t[54]=W,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==z||t[58]!==V||t[59]!==q?(J=(0,D.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,q]}),t[57]=z,t[58]=V,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==R||t[62]!==J?(Y=(0,D.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,J]}),t[61]=R,t[62]=J,t[63]=Y):Y=t[63];let me=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,X;t[64]===me?X=t[65]:(X=(0,D.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:me}),t[64]=me,t[65]=X);let Z;t[66]!==ae||t[67]!==c||t[68]!==i?(Z=M.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>ae(e.names),disabled:!c,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]=ae,t[67]=c,t[68]=i,t[69]=Z):Z=t[69];let Q;t[70]===Z?Q=t[71]:(Q=(0,D.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z}),t[70]=Z,t[71]=Q);let $;t[72]!==X||t[73]!==Q?($=(0,D.jsxs)(`div`,{className:`mt-4`,children:[X,Q]}),t[72]=X,t[73]=Q,t[74]=$):$=t[74];let he;t[75]!==O||t[76]!==Y||t[77]!==$||t[78]!==w?(he=(0,D.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,O,Y,$]}),t[75]=O,t[76]=Y,t[77]=$,t[78]=w,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,D.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ge}),t[80]=ge,t[81]=_e);let ve=i?`当前默认可用 ${x} 个技能。`:`${x} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,D.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,D.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,D.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,D.jsx)(ne,{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=>f(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==ee||t[92]!==Te?(Ee=(0,D.jsx)(`input`,{type:`search`,value:ee,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]=ee,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,D.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,D.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,D.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]!==te||t[103]!==u||t[104]!==h||t[105]!==re||t[106]!==i?(Ae=u?(0,D.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(N)}):(0,D.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[h.map(e=>{let t=te(e.name);return(0,D.jsxs)(`label`,{className:o(`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,D.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>re(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,D.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,D.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),h.length===0?(0,D.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=te,t[103]=u,t[104]=h,t[105]=re,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,D.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,D.jsxs)(`div`,{className:`space-y-5`,children:[he,je]}),t[112]=he,t[113]=je,t[114]=Me):Me=t[114],Me}function N(e){return(0,D.jsx)(f,{className:`h-14 rounded-xl`},e)}function le(e){return e.name}function P(e){return e.enabled}function ue(e,t){return e.name.localeCompare(t.name)}function de(e){return e.name}function fe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function F(e){let t=(0,oe.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,s=v(),[c,l]=(0,E.useState)(``),[u,d]=(0,E.useState)(`all`),[f,p]=(0,E.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(L)),t[0]=i,t[1]=m);let g=m,_;t[2]!==i||t[3]!==n.tools?(_=[...new Set([...i.map(I),...Object.keys(n.tools)])].filter(pe).sort(),t[2]=i,t[3]=n.tools,t[4]=_):_=t[4];let y=_,b;if(t[5]!==y||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),b=y.filter(e),t[5]=y,t[6]=n.tools,t[7]=b}else b=t[7];let ie=b.length,x;if(t[10]!==y||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),x=y.filter(e),t[10]=y,t[11]=n.tools,t[12]=x}else x=t[12];let ae=x.length,C;if(t[15]!==y||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),C=y.filter(e),t[15]=y,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==b.length||t[21]!==x.length||t[22]!==C.length?(w={allow:ie,ask:ae,deny:C.length},t[20]=b.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,O;if(t[24]!==y||t[25]!==g||t[26]!==n.tools||t[27]!==u||t[28]!==c){let e=c.trim().toLowerCase();O=y.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=g.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=y,t[25]=g,t[26]=n.tools,t[27]=u,t[28]=c,t[29]=O}else O=t[29];let k=O,se;t[30]!==n||t[31]!==r?(se=(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]=se):se=t[32];let A=se,j=a?`全部 ${y.length}`:`All ${y.length}`,M;t[33]===j?M=t[34]:(M={id:`all`,label:j},t[33]=j,t[34]=M);let ce=a?`允许 ${T.allow}`:`Allow ${T.allow}`,N;t[35]===ce?N=t[36]:(N={id:`allow`,label:ce},t[35]=ce,t[36]=N);let le=a?`询问 ${T.ask}`:`Ask ${T.ask}`,P;t[37]===le?P=t[38]:(P={id:`ask`,label:le},t[37]=le,t[38]=P);let ue=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,de;t[39]===ue?de=t[40]:(de={id:`deny`,label:ue},t[39]=ue,t[40]=de);let F;t[41]!==M||t[42]!==N||t[43]!==P||t[44]!==de?(F=[M,N,P,de],t[41]=M,t[42]=N,t[43]=P,t[44]=de,t[45]=F):F=t[45];let R=F,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,D.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,D.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W=a?`工具筛选`:`Tool filter`,G;t[53]!==u||t[54]!==R?(G=R.map(e=>(0,D.jsx)(`button`,{"aria-pressed":u===e.id,type:`button`,onClick:()=>d(e.id),className:o(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=u,t[54]=R,t[55]=G):G=t[55];let K;t[56]!==W||t[57]!==G?(K=(0,D.jsx)(te,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":W,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:G}),t[56]=W,t[57]=G,t[58]=K):K=t[58];let q=a?`搜索工具`:`Search tools`,J;t[59]===q?J=t[60]:(J=(0,D.jsx)(`span`,{className:`sr-only`,children:q}),t[59]=q,t[60]=J);let Y;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,D.jsx)(ne,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=Y):Y=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>l(e.target.value),t[62]=me):me=t[62];let X=a?`搜索工具`:`Search tools`,Z;t[63]!==c||t[64]!==X?(Z=(0,D.jsx)(`input`,{type:`search`,value:c,onChange:me,placeholder:X,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[63]=c,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==J||t[67]!==Z?(Q=(0,D.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[J,Y,Z]}),t[66]=J,t[67]=Z,t[68]=Q):Q=t[68];let $;t[69]!==K||t[70]!==Q?($=(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[K,Q]}),t[69]=K,t[70]=Q,t[71]=$):$=t[71];let he=a?`工具调用限制`:`Tool call limits`,ge=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,_e;t[72]!==he||t[73]!==ge?(_e=(0,D.jsx)(re,{title:he,summary:ge,children:null}),t[72]=he,t[73]=ge,t[74]=_e):_e=t[74];let ve;if(t[75]!==g||t[76]!==n.tools||t[77]!==f||t[78]!==s||t[79]!==A||t[80]!==k||t[81]!==a){let e;t[83]!==g||t[84]!==n.tools||t[85]!==f||t[86]!==s||t[87]!==A||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=g.get(e),i=f===e;return(0,D.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,D.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(te,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,D.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>A(e,{mode:n}),className:o(`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))}),s?(0,D.jsx)(ee,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,D.jsx)(h,{className:`size-4`})}):null]})]}),i&&s?(0,D.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,D.jsx)(S,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>A(e,{maxCallsPerTurn:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,D.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,D.jsx)(S,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>A(e,{timeoutMs:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[83]=g,t[84]=n.tools,t[85]=f,t[86]=s,t[87]=A,t[88]=a,t[89]=e):e=t[89],ve=k.map(e),t[75]=g,t[76]=n.tools,t[77]=f,t[78]=s,t[79]=A,t[80]=k,t[81]=a,t[82]=ve}else ve=t[82];let ye;t[90]!==k.length||t[91]!==a?(ye=k.length===0?(0,D.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=k.length,t[91]=a,t[92]=ye):ye=t[92];let be;t[93]!==ve||t[94]!==ye?(be=(0,D.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:[ve,ye]}),t[93]=ve,t[94]=ye,t[95]=be):be=t[95];let xe;return t[96]!==U||t[97]!==$||t[98]!==_e||t[99]!==be?(xe=(0,D.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[U,$,_e,be]}),t[96]=U,t[97]=$,t[98]=_e,t[99]=be,t[100]=xe):xe=t[100],xe}function pe(e){return e!==`computer_use`||p()}function I(e){return e.id}function L(e){return[e.id,e.description]}function R(){let e=(0,oe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsxs)(ae,{gap:`gap-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(f,{className:`h-7 w-56`}),(0,D.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,D.jsx)(f,{className:`h-9 w-28`})]}),(0,D.jsx)(f,{className:`h-20 rounded-2xl`}),(0,D.jsx)(f,{className:`h-12 rounded-xl`}),(0,D.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function z(e){let t=(0,oe.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,c]=i(),l;t[0]===s?l=t[1]:(l=s.get(`panel`),t[0]=s,t[1]=l);let u=l,d=u===`skills`||u===`tools`||u===`runtime`?u:`skills`,f;t[2]!==s||t[3]!==c?(f=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),c(t,{replace:!0})},t[2]=s,t[3]=c,t[4]=f):f=t[4];let p=f,h;t[5]===n?h=t[6]:(h=()=>structuredClone(n),t[5]=n,t[6]=h);let[g,v]=(0,E.useState)(h),ne;t[7]===n?ne=t[8]:(ne=()=>structuredClone(n),t[7]=n,t[8]=ne);let[re,ie]=(0,E.useState)(ne),S;t[9]===g?S=t[10]:(S=JSON.stringify(g),t[9]=g,t[10]=S);let O;t[11]===re?O=t[12]:(O=JSON.stringify(re),t[11]=re,t[12]=O);let k=S!==O,se=a?`技能`:`Skills`,j;t[13]===se?j=t[14]:(j={id:`skills`,label:se,icon:y},t[13]=se,t[14]=j);let M=a?`工具`:`Tools`,N;t[15]===M?N=t[16]:(N={id:`tools`,label:M,icon:_},t[15]=M,t[16]=N);let le=a?`运行`:`Runtime`,P;t[17]===le?P=t[18]:(P={id:`runtime`,label:le,icon:b},t[17]=le,t[18]=P);let ue;t[19]!==N||t[20]!==P||t[21]!==j?(ue=[j,N,P],t[19]=N,t[20]=P,t[21]=j,t[22]=ue):ue=t[22];let de=ue,fe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(fe=async e=>{let t=structuredClone(e),n=await m(),r=await x({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);v(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),ie(structuredClone(i))},t[23]=fe):fe=t[23];let pe=fe,I;t[24]!==k||t[25]!==g?(I={value:g,dirty:k,onSave:pe,delayMs:0},t[24]=k,t[25]=g,t[26]=I):I=t[26];let L=T(I),R=L.onBlurCapture,z=a?`智能体设置`:`Agent settings`,B;t[27]!==L.error||t[28]!==L.status?(B=(0,D.jsx)(w,{status:L.status,error:L.error}),t[27]=L.error,t[28]=L.status,t[29]=B):B=t[29];let V;t[30]!==z||t[31]!==B?(V=(0,D.jsx)(C,{title:z,actions:B}),t[30]=z,t[31]=B,t[32]=V):V=t[32];let H;t[33]!==L.error||t[34]!==L.retry||t[35]!==a?(H=L.error?(0,D.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,D.jsx)(`span`,{children:L.error}),(0,D.jsx)(ee,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:a?`重试`:`Retry`})]}):null,t[33]=L.error,t[34]=L.retry,t[35]=a,t[36]=H):H=t[36];let U=a?`默认配置分区`:`Default configuration sections`,W;t[37]!==d||t[38]!==p||t[39]!==de?(W=de.map(e=>{let{id:t,label:n,icon:r}=e;return(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>p(t),className:o(`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`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,D.jsx)(r,{className:o(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,D.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=p,t[39]=de,t[40]=W):W=t[40];let G;t[41]!==U||t[42]!==W?(G=(0,D.jsx)(te,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":U,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:W}),t[41]=U,t[42]=W,t[43]=G):G=t[43];let K;t[44]!==d||t[45]!==g||t[46]!==a?(K=d===`skills`?(0,D.jsx)(ce,{draft:g,setDraft:v,zh:a}):null,t[44]=d,t[45]=g,t[46]=a,t[47]=K):K=t[47];let q;t[48]!==d||t[49]!==r||t[50]!==g||t[51]!==a?(q=d===`tools`?(0,D.jsx)(F,{draft:g,setDraft:v,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=g,t[51]=a,t[52]=q):q=t[52];let J;t[53]!==d||t[54]!==g||t[55]!==a?(J=d===`runtime`?(0,D.jsx)(A,{draft:g,setDraft:v,zh:a}):null,t[53]=d,t[54]=g,t[55]=a,t[56]=J):J=t[56];let Y;return t[57]!==L.onBlurCapture||t[58]!==V||t[59]!==H||t[60]!==G||t[61]!==K||t[62]!==q||t[63]!==J?(Y=(0,D.jsxs)(ae,{gap:`gap-5`,onBlurCapture:R,children:[V,H,G,K,q,J]}),t[57]=L.onBlurCapture,t[58]=V,t[59]=H,t[60]=G,t[61]=K,t[62]=q,t[63]=J,t[64]=Y):Y=t[64],Y}function B(){let e=(0,oe.c)(17),t=s(H),n=c(V)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,m);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,D.jsx)(ae,{children:(0,D.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,D.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,D.jsx)(ee,{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,D.jsxs)(ae,{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,D.jsx)(R,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,D.jsx)(z,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function V(e){return e.language}function H(e){return e.conversationId}export{B as AgentDefaultsSettingsPanel};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-B50rU9tL.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DRyGCING.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-B7s2Hb35.js","assets/messages-BYq0cPbn.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/chunk-KS7C4IRE-BvcCCgTW.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/popover-select-DGKUpVsz.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/file-image-CDUPkZvG.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/refresh-cw-BRlGaq2w.js","assets/wrench-DFb4r8bH.js","assets/session-manager-B_h0jlLb.js","assets/schemas-CObaziC7.js","assets/gateway-realtime-C52ghnBK.js","assets/gateway-realtime-store-Bx9KCID-.js","assets/local-session-drafts-iGX_6O0O.js","assets/session-api-DdQnMwkl.js","assets/gateway-startup-retry-Cfwxof4k.js","assets/personal-proactivity-BJcZ3Yhi.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BcfoLEna.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-B1p-ghg9.js","assets/gateway-config-swr-fQKBHBi1.js","assets/capabilities-BlxF36t-.js","assets/local-apps-yys1VChX.js","assets/tasks-TVRjEggr.js","assets/specialists-4bkS5rZ4.js","assets/product-delivery-BqNm-8S5.js","assets/files-Bw4SBGdM.js","assets/button-aIC072nz.js","assets/sliding-indicator-hwz0sx3h.js","assets/runtime-tools-api-DesqGCnE.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/electron-env-Dit0bHgy.js","assets/index-Cy16gQST.css","assets/vendor-codemirror-Qdcjid65.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-D5GH2wuC.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-phTQ0mox.js","assets/languages-byq_L2Ae.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{u as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{i as o,s}from"./popover-select-DGKUpVsz.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./messages-BYq0cPbn.js";import{t as d}from"./cn-0WouolD0.js";import{l as f,n as p}from"./locale-store-B7s2Hb35.js";import{t as m}from"./specialists-4bkS5rZ4.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{t as g}from"./button-aIC072nz.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{r as v}from"./gateway-config-swr-fQKBHBi1.js";import{n as y,t as b}from"./registry-api-BcfoLEna.js";import{c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O}from"./agents-admin-api-B1p-ghg9.js";import{i as k,o as A}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Bc as j,Bd as M,Cl as N,Eo as P,Fn as F,Ga as I,Gc as L,Gu as R,Hc as z,Hn as B,Id as V,Ja as H,Ll as U,Mn as W,Nn as G,Ns as K,Ol as ee,Pn as te,So as ne,T as re,Uc as q,Vc as ie,Vn as ae,Wc as oe,Wl as J,Xa as se,Za as ce,Zc as le,Zl as ue,aa as Y,ca as de,da as fe,eo as pe,fc as me,la as he,mu as ge,ol as _e,pa as ve,rl as ye,si as be,ua as xe,vd as Se,w as Ce,zc as we}from"./index-DRyGCING.js";import{t as Te}from"./number-input-DDeqHK-G.js";import{n as Ee}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{t as De}from"./phone-model-picker-fWDltRUJ.js";import{t as Oe}from"./directory-picker-path-field-C-aQ7qoM.js";import{r as ke,s as Ae}from"./image-generation-api-gBFro48x.js";var X=e(t(),1),Z=n();function je(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Me(e,t){let{frontMatter:n}=je(e);return`${n}${t}`}var Ne=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
|
|
3
|
+
|
|
4
|
+
## Core Truths
|
|
5
|
+
|
|
6
|
+
**Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
|
|
7
|
+
|
|
8
|
+
**Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
|
|
9
|
+
|
|
10
|
+
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
|
|
11
|
+
|
|
12
|
+
**Remember you're a guest.** You have access to someone's life. Treat it with respect.
|
|
13
|
+
|
|
14
|
+
## Boundaries
|
|
15
|
+
|
|
16
|
+
- Private things stay private. Period.
|
|
17
|
+
- When in doubt, ask before acting externally.
|
|
18
|
+
- Never send half-baked replies to messaging surfaces.
|
|
19
|
+
|
|
20
|
+
## Vibe
|
|
21
|
+
|
|
22
|
+
Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
|
|
23
|
+
|
|
24
|
+
## Core Truths
|
|
25
|
+
|
|
26
|
+
**Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
|
|
27
|
+
|
|
28
|
+
**Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
|
|
29
|
+
|
|
30
|
+
**Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
|
|
31
|
+
|
|
32
|
+
**Earn trust by being reliable.** Show up, follow through, and remember what matters.
|
|
33
|
+
|
|
34
|
+
**Respect the intimacy.** You have access to someone's life. That's a privilege.
|
|
35
|
+
|
|
36
|
+
## Boundaries
|
|
37
|
+
|
|
38
|
+
- Private things stay private. Always.
|
|
39
|
+
- When in doubt, ask before acting externally.
|
|
40
|
+
- Be careful in group chats — you're not the user's voice.
|
|
41
|
+
|
|
42
|
+
## Vibe
|
|
43
|
+
|
|
44
|
+
Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑💻`,content:`# SOUL.md - Who You Are
|
|
45
|
+
|
|
46
|
+
## Core Truths
|
|
47
|
+
|
|
48
|
+
**Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
|
|
49
|
+
|
|
50
|
+
**Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
|
|
51
|
+
|
|
52
|
+
**Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
|
|
53
|
+
|
|
54
|
+
**Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
|
|
55
|
+
|
|
56
|
+
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
|
|
57
|
+
|
|
58
|
+
## Boundaries
|
|
59
|
+
|
|
60
|
+
- Private things stay private.
|
|
61
|
+
- When in doubt, ask before acting externally.
|
|
62
|
+
- Never send half-baked replies.
|
|
63
|
+
|
|
64
|
+
## Vibe
|
|
65
|
+
|
|
66
|
+
Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Pe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Fe=()=>i(()=>import(`./block-editor-B50rU9tL.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])),Ie=()=>i(()=>import(`./markdown-editor-phTQ0mox.js`),__vite__mapDeps([66,1,62,5,67,3])),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.BlockEditor}))),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.MarkdownEditor})));function ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(_,{className:`h-8 w-52`}),(0,Q.jsx)(_,{className:`h-4 w-full`}),(0,Q.jsx)(_,{className:`h-4 w-4/5`}),(0,Q.jsx)(_,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Be=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=P(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(``),[f,p]=(0,X.useState)(!0),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,O]=(0,X.useState)(null),[k,A]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return p(!0),h(!1),y(null),s(``),u(``),x(!1),O(null),(async()=>{try{let r=await S(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await E(e,t):``;if(n)return;s(i),u(i)}catch(e){if(n)return;h(!0),y(e instanceof Error?e.message:String(e))}finally{n||p(!1)}})(),()=>{n=!0}},[e,t]);let j=o!==c;(0,X.useEffect)(()=>r(j),[j,r]);let N=(0,X.useCallback)(async()=>{if(j){_(!0),y(null);try{await D(e,t,o),u(o),x(!0),O(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{_(!1)}}},[e,t,j,o]);(0,X.useImperativeHandle)(i,()=>({save:N}),[N]);let F={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[V,R,Se,ue],z=je(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:F[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:F[t].description})]}),(0,Q.jsx)(I,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,ue,n?`直接编辑`:`Visual`],[`source`,Se,`Markdown`],[`preview`,l,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>A(e),"aria-pressed":k===e,className:d(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,k===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!f?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:m,"aria-expanded":C,onClick:()=>w(!C),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),T===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(T),O(null)},children:n?`撤销模板替换`:`Undo template replacement`}),C?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Ne.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(O(o),s(t=>Me(t,e.content))),A(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??M,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:f?(0,Q.jsx)(ze,{}):m?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):k===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Le,{initialContent:z,onChange:e=>s(t=>Me(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):k===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Re,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:z.trim()?(0,Q.jsx)(me,{content:z}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:g?n?`正在保存角色配置…`:`Saving profile documents…`:j?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:b?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.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 He(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let v=h(p&&f!==`image`?b:null,y,m),x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[1]=x):x=t[1];let S=h(p&&f===`image`?`agent-defaults-image-models`:null,ke,x),C;t[2]===S.data?C=t[3]:(C=S.data??[],t[2]=S.data,t[3]=C);let w;t[4]===C?w=t[5]:(w=C.flatMap(We),t[4]=C,t[5]=w);let T=w,E;t[6]!==T||t[7]!==f||t[8]!==v?(E=f===`image`?T:v.data??[],t[6]=T,t[7]=f,t[8]=v,t[9]=E):E=t[9];let D=E,O;t[10]!==f||t[11]!==D?(O=f===`vision`?D.filter(Ue):D,t[10]=f,t[11]=D,t[12]=O):O=t[12];let k=O,A=f===`image`?S:v,j;t[13]===n?j=t[14]:(j=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=j);let M;t[15]!==i||t[16]!==a?(M=i===void 0?(0,Q.jsx)(Ve,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=M):M=t[17];let N;t[18]!==d||t[19]!==i||t[20]!==a?(N=i===null?(0,Q.jsx)(Ve,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=N):N=t[21];let P;t[22]!==j||t[23]!==M||t[24]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,M,N]}),t[22]=j,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(F=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=F):F=t[29];let I;t[30]!==P||t[31]!==F?(I=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[P,F]}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let L;t[33]!==l||t[34]!==i||t[35]!==a?(L=i===void 0?null:(0,Q.jsx)(g,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=L):L=t[36];let R;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(R=u&&i!==null?(0,Q.jsx)(g,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=R):R=t[41];let z;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(z=d&&i!==null?(0,Q.jsx)(g,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=z):z=t[46];let B;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(B=p?null:(0,Q.jsx)(g,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=B):B=t[52];let V;t[53]!==L||t[54]!==R||t[55]!==z||t[56]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[L,R,z,B]}),t[53]=L,t[54]=R,t[55]=z,t[56]=B,t[57]=V):V=t[57];let H;t[58]!==I||t[59]!==V?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[I,V]}),t[58]=I,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==k||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==D||t[66]!==l||t[67]!==A||t[68]!==i||t[69]!==a?(U=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),A.isLoading?(0,Q.jsx)(_,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(be,{value:i.primary,models:D,modelsLoading:A.isLoading,modelsError:A.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(re,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(Ae,{primary:i.primary,value:i.fallbacks,models:k,loading:A.isLoading,error:A.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=k,t[62]=p,t[63]=n,t[64]=f,t[65]=D,t[66]=l,t[67]=A,t[68]=i,t[69]=a,t[70]=U):U=t[70];let W;return t[71]!==H||t[72]!==U?(W=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[H,U]}),t[71]=H,t[72]=U,t[73]=W):W=t[73],W}function Ue(e){return e.vision}function We(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ge(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,f]=(0,X.useState)(!1),p=(0,X.useRef)(null),m=(0,X.useRef)(null),[h,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),b,x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>()=>m.current?.abort(),x=[],t[0]=b,t[1]=x):(b=t[0],x=t[1]),(0,X.useEffect)(b,x);let S=i?`自动头像`:`Automatic`,C;t[2]===S?C=t[3]:(C={value:``,label:S},t[2]=S,t[3]=C);let w=i?`Loopi · 平静`:`Loopi · Calm`,T;t[4]===w?T=t[5]:(T={value:`xopc:loopi:idle`,label:w},t[4]=w,t[5]=T);let E=i?`Loopi · 温暖`:`Loopi · Warm`,D;t[6]===E?D=t[7]:(D={value:`xopc:loopi:care`,label:E},t[6]=E,t[7]=D);let O=i?`Loopi · 好奇`:`Loopi · Curious`,k;t[8]===O?k=t[9]:(k={value:`xopc:loopi:curious`,label:O},t[8]=O,t[9]=k);let A=i?`Loopi · 倾听`:`Loopi · Listening`,j;t[10]===A?j=t[11]:(j={value:`xopc:loopi:listen`,label:A},t[10]=A,t[11]=j);let M;t[12]===n?M=t[13]:(M=ce(`bottts`,n),t[12]=n,t[13]=M);let N=i?`机器人`:`Robot`,P;t[14]!==M||t[15]!==N?(P={value:M,label:N},t[14]=M,t[15]=N,t[16]=P):P=t[16];let F;t[17]===n?F=t[18]:(F=ce(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==k||t[23]!==j||t[24]!==P||t[25]!==L||t[26]!==C||t[27]!==T||t[28]!==D?(R=[C,T,D,k,j,P,L],t[22]=k,t[23]=j,t[24]=P,t[25]=L,t[26]=C,t[27]=T,t[28]=D,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(y(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){y(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){y(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}_(!0),c(!0);let t=new FileReader;m.current=t;let n=()=>{_(!1),c(!1),m.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(se),n()},t.onerror=()=>{y(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let U=V,W;t[35]===U?W=t[36]:(W=(0,Q.jsx)(`input`,{ref:p,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{U(e.target.files?.[0]),e.target.value=``}}),t[35]=U,t[36]=W);let G=a||h,K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>p.current?.click(),t[37]=K):K=t[37];let ee=i?`上传头像`:`Upload avatar`,te=`avatar-help-${n}`,ne;t[38]!==n||t[39]!==r||t[40]!==o?(ne=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(H,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=ne):ne=t[41];let re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(ye,{className:`size-3`,"aria-hidden":!0})}),t[42]=re):re=t[42];let q;t[43]!==G||t[44]!==ee||t[45]!==te||t[46]!==ne?(q=(0,Q.jsxs)(`button`,{type:`button`,disabled:G,onClick:K,"aria-label":ee,"aria-describedby":te,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[ne,re]}),t[43]=G,t[44]=ee,t[45]=te,t[46]=ne,t[47]=q):q=t[47];let ie=i?`头像`:`Avatar`,ae;t[48]===ie?ae=t[49]:(ae=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:ie}),t[48]=ie,t[49]=ae);let oe=h?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,J;t[50]===oe?J=t[51]:(J=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:oe}),t[50]=oe,t[51]=J);let le=`avatar-help-${n}`,ue=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,Y;t[52]!==le||t[53]!==ue?(Y=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:ue}),t[52]=le,t[53]=ue,t[54]=Y):Y=t[54];let de;t[55]!==ae||t[56]!==J||t[57]!==Y?(de=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[ae,J,Y]}),t[55]=ae,t[56]=J,t[57]=Y,t[58]=de):de=t[58];let fe=a||h,pe=`avatar-options-${n}`,me;t[59]===u?me=t[60]:(me=()=>f(!u),t[59]=u,t[60]=me);let he=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,ge;t[61]!==u||t[62]!==fe||t[63]!==pe||t[64]!==me||t[65]!==he?(ge=(0,Q.jsx)(g,{variant:`ghost`,disabled:fe,"aria-expanded":u,"aria-controls":pe,onClick:me,children:he}),t[61]=u,t[62]=fe,t[63]=pe,t[64]=me,t[65]=he,t[66]=ge):ge=t[66];let _e;t[67]!==W||t[68]!==q||t[69]!==de||t[70]!==ge?(_e=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[W,q,de,ge]}),t[67]=W,t[68]=q,t[69]=de,t[70]=ge,t[71]=_e):_e=t[71];let ve;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==h||t[80]!==i?(ve=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||h,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),y(null)},className:d(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(H,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=h,t[80]=i,t[81]=ve):ve=t[81];let be;t[82]===v?be=t[83]:(be=v?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:v}):null,t[82]=v,t[83]=be);let xe;return t[84]!==_e||t[85]!==ve||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[_e,ve,be]}),t[84]=_e,t[85]=ve,t[86]=be,t[87]=xe):xe=t[87],xe}var Ke={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},qe=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Je=e=>e.split(`
|
|
67
|
+
`).map(e=>e.trim()).filter(Boolean);function Ye(e){let t=(0,Z.c)(21),{value:n,label:r,hint:i,onChange:a,max:o}=e,s;t[0]===n?s=t[1]:(s=n.join(`
|
|
68
|
+
`),t[0]=n,t[1]=s);let[c,l]=(0,X.useState)(s),u,d;t[2]!==c||t[3]!==n?(u=()=>{JSON.stringify(Je(c))!==JSON.stringify(n)&&l(n.join(`
|
|
69
|
+
`))},d=[n,c],t[2]=c,t[3]=n,t[4]=u,t[5]=d):(u=t[4],d=t[5]),(0,X.useEffect)(u,d);let f;t[6]===a?f=t[7]:(f=e=>{l(e.target.value),a(Je(e.target.value))},t[6]=a,t[7]=f);let p;t[8]!==i||t[9]!==f||t[10]!==c?(p=(0,Q.jsx)(`textarea`,{rows:3,className:qe,value:c,placeholder:i,onChange:f}),t[8]=i,t[9]=f,t[10]=c,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=Je(c),t[12]=c,t[13]=m);let h;t[14]!==o||t[15]!==m.length?(h=(0,Q.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[m.length,`/`,o]}),t[14]=o,t[15]=m.length,t[16]=h):h=t[16];let g;return t[17]!==r||t[18]!==p||t[19]!==h?(g=(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[r,p,h]}),t[17]=r,t[18]=p,t[19]=h,t[20]=g):g=t[20],g}var Xe={general:`通用`,coordination:`协调`,software:`软件开发`,writing:`写作`,research:`研究`,data:`数据`,design:`设计`,operations:`运营`,general_assistance:`日常协助`,task_planning:`任务规划`,bug_fix:`修复 Bug`,implementation:`功能开发`,code_review:`代码审查`,editing:`编辑润色`,news_research:`新闻研究`,data_analysis:`数据分析`,data_cleaning:`数据清洗`,image_generation:`生成图片`,automation:`自动化`,text:`文本`,repository:`代码仓库`,csv:`CSV`,spreadsheet:`电子表格`,web_page:`网页`,image:`图片`,answer:`回答`,plan:`计划`,code_patch:`代码修改`,document:`文档`,report:`报告`,chart:`图表`,script:`脚本`,design_brief:`设计说明`};function Ze(e){let t=(0,Z.c)(48),{field:n,value:r,label:i,zh:a,onChange:s}=e,c=m[n],l;if(t[0]!==r||t[1]!==c){let e;t[3]===c?e=t[4]:(e=e=>!c.includes(e),t[3]=c,t[4]=e),l=r.filter(e),t[0]=r,t[1]=c,t[2]=l}else l=t[2];let u=l,d;t[5]===a?d=t[6]:(d=e=>a?Xe[e]??e:e.replaceAll(`_`,` `),t[5]=a,t[6]=d);let f=d,p;t[7]!==f||t[8]!==r||t[9]!==a?(p=r.length?r.map(f).join(` · `):a?`选择适用项`:`Select applicable items`,t[7]=f,t[8]=r,t[9]=a,t[10]=p):p=t[10];let h;t[11]===p?h=t[12]:(h=(0,Q.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-fg-muted`,children:p}),t[11]=p,t[12]=h);let g;t[13]!==i||t[14]!==h?(g=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[i,h]}),t[13]=i,t[14]=h,t[15]=g):g=t[15];let _;if(t[16]!==f||t[17]!==r||t[18]!==c){let e;t[20]!==f||t[21]!==r?(e=e=>({value:e,label:f(e),disabled:r.length>=16&&!r.includes(e)}),t[20]=f,t[21]=r,t[22]=e):e=t[22],_=c.map(e),t[16]=f,t[17]=r,t[18]=c,t[19]=_}else _=t[19];let v;t[23]!==i||t[24]!==s||t[25]!==_||t[26]!==r?(v=(0,Q.jsx)(o,{options:_,values:r,multiple:!0,ariaLabel:i,onChange:s}),t[23]=i,t[24]=s,t[25]=_,t[26]=r,t[27]=v):v=t[27];let y=a?`自定义标识`:`Custom identifiers`,b;t[28]===y?b=t[29]:(b=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:y}),t[28]=y,t[29]=b);let x=a?`其他标识`:`Other identifiers`,S=a?`每行一个英文标识`:`One identifier per line`,C;t[30]!==s||t[31]!==r||t[32]!==c?(C=e=>s([...new Set([...r.filter(e=>c.includes(e)),...e])]),t[30]=s,t[31]=r,t[32]=c,t[33]=C):C=t[33];let w;t[34]!==u||t[35]!==x||t[36]!==S||t[37]!==C?(w=(0,Q.jsx)(Ye,{value:u,label:x,hint:S,max:16,onChange:C}),t[34]=u,t[35]=x,t[36]=S,t[37]=C,t[38]=w):w=t[38];let T;t[39]!==w||t[40]!==b?(T=(0,Q.jsxs)(`details`,{children:[b,w]}),t[39]=w,t[40]=b,t[41]=T):T=t[41];let E;t[42]!==T||t[43]!==v?(E=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[v,T]}),t[42]=T,t[43]=v,t[44]=E):E=t[44];let D;return t[45]!==E||t[46]!==g?(D=(0,Q.jsxs)(`details`,{className:`min-w-0 rounded-xl border border-edge p-3`,children:[g,E]}),t[45]=E,t[46]=g,t[47]=D):D=t[47],D}function Qe(e){let t=(0,Z.c)(45),{profile:n,zh:r,onChange:i}=e,a=r?`领域`:`Domains`,o;t[0]===a?o=t[1]:(o=[`domains`,a,`software
|
|
70
|
+
data
|
|
71
|
+
research`,16],t[0]=a,t[1]=o);let s=r?`任务类型`:`Task types`,c;t[2]===s?c=t[3]:(c=[`taskTypes`,s,`bug_fix
|
|
72
|
+
code_review
|
|
73
|
+
data_analysis`,16],t[2]=s,t[3]=c);let l=r?`输入类型`:`Input kinds`,u;t[4]===l?u=t[5]:(u=[`inputKinds`,l,`repository
|
|
74
|
+
csv
|
|
75
|
+
text`,16],t[4]=l,t[5]=u);let d=r?`交付类型`:`Output kinds`,f;t[6]===d?f=t[7]:(f=[`outputKinds`,d,`code_patch
|
|
76
|
+
report
|
|
77
|
+
chart`,16],t[6]=d,t[7]=f);let p=r?`具体专长`:`Specialties`,m=r?`每行一项具体专长`:`One specialty per line`,h;t[8]!==m||t[9]!==p?(h=[`specialties`,p,m,8],t[8]=m,t[9]=p,t[10]=h):h=t[10];let _=r?`适用边界`:`Limitations`,v=r?`每行一项边界或注意事项`:`One limitation per line`,y;t[11]!==_||t[12]!==v?(y=[`limitations`,_,v,8],t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==h||t[15]!==y||t[16]!==o||t[17]!==c||t[18]!==u||t[19]!==f?(b=[o,c,u,f,h,y],t[14]=h,t[15]=y,t[16]=o,t[17]=c,t[18]=u,t[19]=f,t[20]=b):b=t[20];let x=b,S=r?`擅长的任务`:`Specialties`,C;t[21]===S?C=t[22]:(C=(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:S}),t[21]=S,t[22]=C);let w=r?`声明专长,帮助系统匹配任务。实际执行还需具备相应模型、技能、工具和账号权限。`:`Describe expertise for task matching. Execution also requires the appropriate models, skills, tools, and account access.`,T;t[23]===w?T=t[24]:(T=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:w}),t[23]=w,t[24]=T);let E;t[25]!==C||t[26]!==T?(E=(0,Q.jsxs)(`div`,{children:[C,T]}),t[25]=C,t[26]=T,t[27]=E):E=t[27];let D;t[28]!==i||t[29]!==n?(D=()=>i(n?void 0:structuredClone(Ke)),t[28]=i,t[29]=n,t[30]=D):D=t[30];let O=n?r?`清除档案`:`Clear profile`:r?`添加档案`:`Add profile`,k;t[31]!==D||t[32]!==O?(k=(0,Q.jsx)(g,{variant:`ghost`,onClick:D,children:O}),t[31]=D,t[32]=O,t[33]=k):k=t[33];let A;t[34]!==E||t[35]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,k]}),t[34]=E,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==x||t[38]!==i||t[39]!==n||t[40]!==r?(j=n?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:x.slice(0,2).map(e=>{let[t,a]=e;return(0,Q.jsx)(Ze,{field:t,value:n[t],label:a,zh:r,onChange:e=>i({...n,[t]:e})},t)})}),(0,Q.jsx)(Ye,{value:n.specialties,label:r?`具体专长`:`Specialties`,hint:r?`每行一项,例如:React 应用调试`:`One specialty per line`,max:8,onChange:e=>i({...n,specialties:e})}),(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[r?`任务匹配细节`:`Task matching details`,(0,Q.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r?`${n.inputKinds.length} 项输入 · ${n.outputKinds.length} 项交付 · ${n.examples.length} 个示例`:`${n.inputKinds.length} inputs · ${n.outputKinds.length} outputs · ${n.examples.length} examples`})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:x.slice(2,4).map(e=>{let[t,a]=e;return(0,Q.jsx)(Ze,{field:t,value:n[t],label:a,zh:r,onChange:e=>i({...n,[t]:e})},t)})}),(0,Q.jsx)(Ye,{value:n.limitations,label:r?`适用边界`:`Limitations`,hint:r?`每行一项边界或注意事项`:`One limitation per line`,max:8,onChange:e=>i({...n,limitations:e})}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`h5`,{className:`text-xs font-medium text-fg-muted`,children:r?`适用示例`:`Examples`}),n.examples.map((e,t)=>(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,Q.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[r?`请求`:`Request`,(0,Q.jsx)(`textarea`,{rows:2,maxLength:200,className:qe,value:e.request,onChange:e=>i({...n,examples:n.examples.map((n,r)=>r===t?{...n,request:e.target.value}:n)})})]}),(0,Q.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[r?`交付成果`:`Deliverable`,(0,Q.jsx)(`textarea`,{rows:2,maxLength:200,className:qe,value:e.deliverable,onChange:e=>i({...n,examples:n.examples.map((n,r)=>r===t?{...n,deliverable:e.target.value}:n)})})]}),(0,Q.jsx)(g,{variant:`ghost`,onClick:()=>i({...n,examples:n.examples.filter((e,n)=>n!==t)}),children:r?`移除示例`:`Remove example`})]},t)),(0,Q.jsx)(g,{variant:`ghost`,disabled:n.examples.length>=4,onClick:()=>i({...n,examples:[...n.examples,{request:``,deliverable:``}]}),children:r?`添加示例`:`Add example`})]})]})]})]}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:r?`未设置档案时,继续按现有角色描述和执行条件匹配。`:`Without a profile, matching continues using the existing role and execution conditions.`}),t[37]=x,t[38]=i,t[39]=n,t[40]=r,t[41]=j):j=t[41];let M;return t[42]!==A||t[43]!==j?(M=(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[A,j]}),t[42]=A,t[43]=j,t[44]=M):M=t[44],M}var $e=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`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 et(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function tt(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function nt(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.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 rt(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.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,Q.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,Q.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,Q.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 it(e){let t=(0,Z.c)(11),{label:n,value:r,detail:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=c);let l;return t[6]!==a||t[7]!==o||t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,onClick:a,className:`min-w-0 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[o,s,c]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function at(e){let t=(0,Z.c)(10),{title:n,summary:r,children:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,Q.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r}):null,t[0]=r,t[1]=a);let o;t[2]!==a||t[3]!==n?(o=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n,a]}),t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,Q.jsx)(`div`,{className:`mt-4`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ot(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function st({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:c,onDelete:l}){let[f,p]=(0,X.useState)(`overview`),m=Ce(`(min-width: 640px)`),[h,_]=(0,X.useState)(`specialties`),[v,y]=(0,X.useState)(`directory`),[b,S]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),E=(0,X.useRef)(null),D=(0,X.useRef)({}),[O,k]=(0,X.useState)(()=>structuredClone(e.override)),[A,j]=(0,X.useState)(!1),[M,N]=(0,X.useState)(null),[P,F]=(0,X.useState)(!1),[L,R]=(0,X.useState)({soul:!1,agents:!1,tools:!1}),z=Object.values(L).some(Boolean),B=(0,X.useRef)(null),V=(0,X.useRef)(null),H=(0,X.useRef)(null),[K,ee]=(0,X.useState)(null),[te,re]=(0,X.useState)(!1),q=JSON.stringify(O)!==JSON.stringify(e.override)||z||K!==null,ie=[O.models?.chat,...Object.values(O.models?.intents??{}),O.models?.imageUnderstanding,O.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(q),[q,a]);let ae=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(O.tools??{}),...O.toolAllowlist??[]])].sort(),[e.effective.tools,O.toolAllowlist,O.tools,t]),oe=[O.models?n?`模型`:`Models`:null,O.skills?n?`技能`:`Skills`:null,O.tools?n?`工具权限`:`Tool access`:null,null].filter(e=>!!e),J=O.toolAllowlist,se=J?ae.filter(t=>J.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,ce=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,le=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,ue=O.profile?.name??e.name??e.id,Y=(t,n)=>{k(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},de=u(n?`zh`:`en`).chat.workingDirectory,fe={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},me={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},he=async()=>{let t=[];j(!0),N(null);try{await B.current?.save(),L.soul&&t.push(n?`个性与边界`:`Personality & boundaries`),await V.current?.save(),L.agents&&t.push(n?`工作规范`:`Working instructions`),await H.current?.save(),L.tools&&t.push(n?`工具使用约定`:`Tool guidance`),K&&(await C(e.id,K),pe(e.id),t.push(n?`头像图片`:`Avatar image`));let r=(await x(e.id,{expectedRevision:e.revision,specialistProfile:O.specialistProfile??null,workspace:O.workspace??null,profile:O.profile,models:O.models??null,skills:O.skills??null,tools:O.tools??null,toolAllowlist:O.toolAllowlist??null,runtime:O.runtime??null})).agents.find(t=>t.id===e.id);r&&k(structuredClone(r.override)),R({soul:!1,agents:!1,tools:!1}),T(!0),ee(null)}catch(e){let r=e instanceof Error?e.message:String(e);N(t.length?n?`已保存:${t.join(`、`)}。其余更改未保存,请重试。${r}`:`Saved: ${t.join(`, `)}. Remaining changes were not saved; retry. ${r}`:r)}finally{j(!1)}},ve=async()=>{j(!0),N(null);try{await x(e.id,{setDefault:!0})}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},ye=(e,t)=>{let n={...O.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},k({...O,tools:Object.keys(n).length>0?n:void 0})},be=(t,n)=>{let r=new Set(O.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...O.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),k({...O,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},xe=(e,t)=>{let n={...O.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,k({...O,models:Object.keys(n).length>0?n:void 0})},Se=(0,X.useCallback)(e=>R(t=>({...t,soul:e})),[]),we=(0,X.useCallback)(e=>R(t=>({...t,agents:e})),[]),Ee=(0,X.useCallback)(e=>R(t=>({...t,tools:e})),[]),ke=t=>t.some(t=>JSON.stringify(O[t])!==JSON.stringify(e.override[t])),Ae=JSON.stringify({...O.profile,instructions:void 0})!==JSON.stringify({...e.override.profile,instructions:void 0})||L.soul||K!==null,Z=ke([`models`,`skills`,`tools`,`toolAllowlist`,`specialistProfile`]),je=ke([`workspace`,`runtime`])||O.profile?.instructions!==e.override.profile?.instructions||L.agents||L.tools,Me=e=>e?(0,Q.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":n?`有未保存的更改`:`Unsaved changes`}):void 0,Ne=[{id:`overview`,label:n?`概览`:`Overview`},{id:`profile`,label:n?`个性`:`Personality`,suffix:Me(Ae)},{id:`capabilities`,label:n?`能力`:`Capabilities`,suffix:Me(Z)},{id:`work`,label:n?`工作设置`:`Work settings`,suffix:Me(je)}],Fe=f===`capabilities`?`${f}:${h}`:f===`work`?`${f}:${v}`:f,Ie=(e,t=h,n=v)=>{D.current[Fe]=E.current?.scrollTop??0,e===`profile`&&F(!0),e===`work`&&S(!0),p(e),_(t),y(n)};return(0,X.useEffect)(()=>{E.current&&(E.current.scrollTop=D.current[Fe]??0)},[Fe]),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 border-b border-edge px-3 py-2 sm:w-44 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:py-4`,children:(0,Q.jsx)(ne,{items:Ne,activeTab:f,onChange:Ie,ariaLabel:n?`智能体设置`:`Agent settings`,tabIdPrefix:`agent-tab`,panelIdPrefix:`agent-panel`,orientation:m?`vertical`:`horizontal`,className:`m-0 grid grid-cols-4 overflow-visible p-0 sm:flex sm:flex-col`,buttonClassName:`min-w-0 justify-center px-1 text-xs sm:justify-start sm:px-3 sm:py-3 sm:text-sm [&>span]:min-w-0 [&>span]:break-words`,selectedClassName:`bg-accent-soft text-accent-fg`})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{ref:E,role:`tabpanel`,id:`agent-panel-${f}`,"aria-labelledby":`agent-tab-${f}`,tabIndex:0,className:`min-h-0 flex-1 overflow-y-auto p-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:p-6`,children:[M||i?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:M??i}):null,f===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(rt,{title:G({id:e.id,name:ue},r),description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(g,{onClick:c,children:[(0,Q.jsx)(ge,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:W({id:e.id,description:O.profile?.description},r)||(n?`添加介绍,让这个智能体的定位更清晰。`:`Add a description to explain this agent’s role.`)}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(O.specialistProfile?.specialties??[]).map(e=>(0,Q.jsx)(`span`,{className:`rounded-lg bg-surface-hover px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,Q.jsx)(g,{variant:`ghost`,onClick:()=>Ie(`capabilities`,`specialties`),children:n?`查看专长`:`View specialties`}),(0,Q.jsx)(g,{variant:`ghost`,onClick:()=>Ie(`profile`),children:n?`编辑个性`:`Edit personality`})]})]}),(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:oe.length>0?n?`已自定义:${oe.join(`、`)}`:`Customized: ${oe.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:oe.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(g,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(it,{onClick:()=>Ie(`capabilities`,`models`),label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:O.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(it,{onClick:()=>Ie(`capabilities`,`tools`),label:n?`技能`:`Skills`,value:le,detail:O.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(it,{onClick:()=>Ie(`capabilities`,`tools`),label:n?`工具权限`:`Tool access`,value:se===null?ce>0?n?`${ce} 个禁用`:`${ce} denied`:n?`全部可用`:`All available`:n?`${se} 个已开放`:`${se} in scope`,detail:J?n?`受智能体工具范围限制`:`Limited by agent tool scope`:O.tools?n?`${Object.keys(O.tools).length} 个本地覆盖`:`${Object.keys(O.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(it,{onClick:()=>Ie(`work`,h,`directory`),label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:O.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(g,{onClick:()=>void ve(),disabled:A,children:n?`设为默认智能体`:`Make default agent`}),e.isDefault?(0,Q.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,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(g,{variant:`ghost`,className:`text-red-600`,onClick:l,children:[(0,Q.jsx)(_e,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null,P?(0,Q.jsxs)(`div`,{className:d(`space-y-6`,f!==`profile`&&`hidden`),children:[(0,Q.jsx)(rt,{title:n?`资料与个性`:`Identity and personality`,description:n?`设置它是谁,以及如何与你交流。`:`Define who this agent is and how it communicates.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`grid items-center gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(Ge,{agentId:e.id,avatar:O.profile?.avatar,zh:n,disabled:A,pending:K,onPendingChange:ee,onReadingChange:re,onChange:e=>Y(`avatar`,e)})}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:ue,onChange:e=>Y(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted sm:col-span-2`,children:[n?`介绍`:`Description`,(0,Q.jsx)(`textarea`,{rows:2,className:`${$} mt-1.5 resize-y leading-6`,value:O.profile?.description??``,onChange:e=>Y(`description`,e.target.value),placeholder:n?`例如:帮你整理想法、查找资料,把复杂任务拆成可以执行的步骤。`:`e.g. Helps organize ideas, research topics, and turn complex tasks into actionable steps.`}),(0,Q.jsx)(`span`,{className:`mt-1.5 block text-xs font-normal`,children:n?`简要说明定位;详细行为在下方「个性与边界」设置。`:`Describe the agent’s purpose and how it helps. Set detailed behavior in Personality & boundaries below.`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.profile?.style??``,onChange:e=>Y(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.profile?.language??``,onChange:e=>Y(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(at,{title:n?`更多身份设置`:`More identity settings`,summary:[O.profile?.creature,O.profile?.emoji].filter(Boolean).join(` · `),children:(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情(可选)`:`Signature emoji (optional)`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.profile?.emoji??``,onChange:e=>Y(`emoji`,e.target.value),placeholder:`✨`}),(0,Q.jsx)(`span`,{className:`mt-1.5 block text-xs font-normal`,children:n?`用于表达个性,与头像分开设置。`:`A personal touch, separate from the avatar.`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`角色定位`:`Role`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:O.profile?.creature??``,onChange:e=>Y(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Pe.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]})]})})})]}),(0,Q.jsx)(Be,{ref:B,file:`SOUL.md`,agentId:e.id,zh:n,onDirtyChange:Se})]}):null,f===`capabilities`?(0,Q.jsxs)(`div`,{className:`mb-5 space-y-3`,children:[(0,Q.jsx)(rt,{title:n?`能力`:`Capabilities`,description:n?`声明擅长的任务,并配置实际可用的模型、技能与工具。`:`Describe specialties and configure the models, skills, and tools available to this agent.`}),(0,Q.jsx)(ne,{items:[{id:`specialties`,label:n?`擅长的任务`:`Specialties`},{id:`models`,label:n?`模型`:`Models`},{id:`tools`,label:n?`技能与工具`:`Skills & tools`}],activeTab:h,onChange:e=>Ie(`capabilities`,e),ariaLabel:n?`能力设置`:`Capability settings`,tabIdPrefix:`agent-capability-tab`,panelIdPrefix:`agent-capability-panel`})]}):null,f===`capabilities`&&h===`specialties`?(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-capability-panel-specialties`,"aria-labelledby":`agent-capability-tab-specialties`,children:(0,Q.jsx)(Qe,{profile:O.specialistProfile,zh:n,onChange:e=>k(t=>({...t,specialistProfile:e}))})}):null,f===`capabilities`&&h===`models`?(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-capability-panel-models`,"aria-labelledby":`agent-capability-tab-models`,className:`space-y-6`,children:[(0,Q.jsx)(rt,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:O.models?(0,Q.jsxs)(g,{variant:`ghost`,onClick:()=>k({...O,models:void 0}),children:[(0,Q.jsx)(U,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(De,{zh:n,value:O.models?.phoneUse,inherited:e.effective.models.phoneUse,onChange:e=>{let t={...O.models??{}};e===void 0?delete t.phoneUse:t.phoneUse=e,k({...O,models:Object.keys(t).length?t:void 0})}}),(0,Q.jsx)(He,{label:r.editorChatModel,inherited:e.effective.models.chat,value:O.models?.chat,zh:n,onChange:e=>{let t={...O.models??{}};e?t.chat=e:delete t.chat,k({...O,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(at,{title:n?`任务模型路由`:`Task model routing`,summary:n?`当前任务路由继续生效;未覆盖的任务继承全局设置。`:`Task routes remain active; unspecified routes inherit global defaults.`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:$e.map(t=>(0,Q.jsx)(He,{label:fe[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:O.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>xe(t,e)},t))})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(He,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:O.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...O.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,k({...O,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(He,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:O.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...O.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:O.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:O.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},k({...O,models:Object.keys(n).length>0?n:void 0})}}),O.models?.imageGeneration?(0,Q.jsx)(at,{title:n?`图片执行策略`:`Image execution policy`,summary:n?`当前超时和回退策略继续生效。`:`Current timeout and fallback settings remain active.`,children:(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(Te,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:O.models.imageGeneration.timeoutMs??``,onChange:e=>k({...O,models:{...O.models,imageGeneration:{...O.models.imageGeneration,timeoutMs:tt(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(I,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`自动切换服务`:`Automatic provider fallback`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":O.models?.imageGeneration?.autoProviderFallback===e,type:`button`,onClick:()=>k({...O,models:{...O.models,imageGeneration:{...O.models.imageGeneration,autoProviderFallback:e}}}),className:d(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,O.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]})}):null]})]})]}):null,f===`capabilities`&&h===`tools`?(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-capability-panel-tools`,"aria-labelledby":`agent-capability-tab-tools`,className:`space-y-7`,children:[(0,Q.jsx)(rt,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),O.skills?(0,Q.jsxs)(g,{variant:`ghost`,onClick:()=>k({...O,skills:void 0}),children:[(0,Q.jsx)(U,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(I,{className:`mt-4 flex gap-2`,role:`group`,"aria-label":n?`技能策略`:`Skill policy`,indicatorClassName:`rounded-lg bg-surface-active`,children:[(0,Q.jsx)(g,{"aria-pressed":O.skills?.mode===`merge`,variant:`ghost`,onClick:()=>k({...O,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(g,{"aria-pressed":O.skills?.mode===`replace`,variant:`ghost`,onClick:()=>k({...O,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),O.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.skills.add.join(`, `),onChange:e=>k({...O,skills:{mode:`merge`,add:et(e.target.value),remove:O.skills?.mode===`merge`?O.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.skills.remove.join(`, `),onChange:e=>k({...O,skills:{mode:`merge`,add:O.skills?.mode===`merge`?O.skills.add:[],remove:et(e.target.value)}})})]})]}):null,O.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:O.skills.include.join(`, `),onChange:e=>k({...O,skills:{mode:`replace`,include:et(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),O.tools?(0,Q.jsxs)(g,{variant:`ghost`,onClick:()=>k({...O,tools:void 0}),children:[(0,Q.jsx)(U,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),J?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:ae.map(t=>{if(J&&!J.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(g,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>be(t,!0),children:n?`启用`:`Enable`})]},t);let r=O.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${me[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(I,{className:`flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":t,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":e===`inherit`?!r:r===e,type:`button`,onClick:()=>ye(t,e),className:d(`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:me[e]},e))}),J?(0,Q.jsx)(g,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>be(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,b?(0,Q.jsxs)(`div`,{className:d(`space-y-6`,f!==`work`&&`hidden`),children:[(0,Q.jsx)(rt,{title:n?`工作设置`:`Work settings`,description:n?`管理工作目录、执行规范与运行策略。`:`Manage the working directory, instructions, and execution policy.`}),(0,Q.jsx)(ne,{items:[{id:`directory`,label:n?`工作目录`:`Directory`,suffix:Me(ke([`workspace`]))},{id:`instructions`,label:n?`工作规范`:`Instructions`,suffix:Me(L.agents||O.profile?.instructions!==e.override.profile?.instructions)},{id:`tools`,label:n?`工具约定`:`Tool guidance`,suffix:Me(L.tools)},{id:`runtime`,label:n?`运行策略`:`Runtime`,suffix:Me(ke([`runtime`]))}],activeTab:v,onChange:e=>Ie(`work`,h,e),ariaLabel:n?`工作设置分区`:`Work settings sections`,tabIdPrefix:`agent-work-tab`,panelIdPrefix:`agent-work-panel`}),(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-work-panel-directory`,"aria-labelledby":`agent-work-tab-directory`,hidden:v!==`directory`,className:`space-y-6`,children:(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),O.workspace?(0,Q.jsxs)(g,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>k(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(U,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(nt,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(Oe,{value:O.workspace??``,onChange:e=>k(t=>({...t,workspace:e||void 0})),wd:de,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:A})})]})}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-work-panel-instructions`,"aria-labelledby":`agent-work-tab-instructions`,hidden:v!==`instructions`,className:`space-y-6`,children:[(0,Q.jsx)(Be,{ref:V,file:`AGENTS.md`,agentId:e.id,zh:n,onDirtyChange:we}),(0,Q.jsxs)(at,{title:n?`附加规则`:`Additional rules`,summary:O.profile?.instructions?n?`已设置`:`Configured`:void 0,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;长期工作规范请写入上方「工作规范」。`:`Add short execution rules. Keep lasting work guidance in Working instructions above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:O.profile?.instructions??``,onChange:t=>k(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}),(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-work-panel-tools`,"aria-labelledby":`agent-work-tab-tools`,hidden:v!==`tools`,className:`space-y-6`,children:(0,Q.jsx)(Be,{ref:H,file:`TOOLS.md`,agentId:e.id,zh:n,onDirtyChange:Ee})}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-work-panel-runtime`,"aria-labelledby":`agent-work-tab-runtime`,hidden:v!==`runtime`,className:`space-y-6`,children:[(0,Q.jsx)(rt,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:void 0}),(0,Q.jsx)(at,{title:n?`执行限制`:`Execution limits`,summary:n?`保留当前运行限制;未覆盖的字段继承全局设置。`:`Current limits remain active; unspecified limits inherit globally.`,children:(0,Q.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,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,O.runtime?.[t]===void 0?(0,Q.jsx)(nt,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(Te,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:O.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=ot({...O.runtime??{},[t]:tt(e.target.value)});k({...O,runtime:n})}})]},t))})}),(0,Q.jsx)(at,{title:n?`提示词缓存`:`Prompt cache`,summary:O.runtime?.promptCache?.mode??(n?`继承全局`:`Inherited globally`),children:(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),O.runtime?.promptCache?(0,Q.jsxs)(g,{variant:`ghost`,onClick:()=>{let e=ot({...O.runtime??{},promptCache:void 0});k({...O,runtime:e})},children:[(0,Q.jsx)(U,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),O.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(I,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`缓存模式`:`Cache mode`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":O.runtime?.promptCache?.mode===e,type:`button`,onClick:()=>k({...O,runtime:{...O.runtime,promptCache:{...O.runtime.promptCache,mode:e}}}),className:d(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,O.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(I,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`缓存周期`:`Cache lifetime`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":O.runtime?.promptCache?.lifetime===e,type:`button`,onClick:()=>k({...O,runtime:{...O.runtime,promptCache:{...O.runtime.promptCache,lifetime:e}}}),className:d(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,O.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(g,{className:`mt-4`,onClick:()=>k({...O,runtime:{...O.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})})]})]}):null]}),(0,Q.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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:A?n?`保存中…`:`Saving…`:ie?n?`请补全自定义模型`:`Complete the custom model reference`:q?n?`有未保存的更改`:`Unsaved changes`:w?n?`更改已保存`:`Changes saved`:n?`未修改`:`No changes`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(g,{onClick:o,children:n?`关闭`:`Close`}),(0,Q.jsx)(g,{variant:`primary`,disabled:A||te||!q||ie||O.profile!==void 0&&!O.profile.name.trim(),onClick:()=>void he(),children:A?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function ct(e){let t=(0,Z.c)(21),{agent:n,tuiDefaultAgentId:r,messages:i}=e,a;t[0]===n.id?a=t[1]:(a=te(n.id),t[0]=n.id,t[1]=a);let o=a,s=n.id===r,c;t[2]!==n.isDefault||t[3]!==i?(c=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:i.listDefaultBadge}):null,t[2]=n.isDefault,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==i?(l=s?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg`,children:i.tuiDefaultBadge}):null,t[5]=s,t[6]=i,t[7]=l):l=t[7];let u;t[8]!==o||t[9]!==i?(u=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg`,children:i.listPersonalDefaultBadge}):null,t[8]=o,t[9]=i,t[10]=u):u=t[10];let d;t[11]!==n.isDefault||t[12]!==o||t[13]!==s||t[14]!==i?(d=!n.isDefault&&!s&&!o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i.listCustomBadge}):null,t[11]=n.isDefault,t[12]=o,t[13]=s,t[14]=i,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[c,l,u,d]}),t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=f):f=t[20],f}function lt(e){let t=(0,Z.c)(37),{agent:n,tuiDefaultAgentId:r,messages:i,open:a,onOpenChange:o,children:c}=e,[l,u]=(0,X.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(q,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),t[0]=f):f=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=d(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,k,`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]=p):p=t[1];let m;t[2]!==n.avatar||t[3]!==n.id?(m=(0,Q.jsx)(H,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==i?(h=G(n,i),t[5]=n,t[6]=i,t[7]=h):h=t[7];let g;t[8]===h?g=t[9]:(g=(0,Q.jsx)(L,{className:`truncate text-base font-semibold text-fg`,children:h}),t[8]=h,t[9]=g);let _;t[10]===n.id?_=t[11]:(_=(0,Q.jsx)(z,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=_);let v;t[12]!==g||t[13]!==_?(v=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==n||t[16]!==i||t[17]!==r?(y=(0,Q.jsx)(ct,{agent:n,tuiDefaultAgentId:r,messages:i}),t[15]=n,t[16]=i,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==m||t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[m,v,y]}),t[19]=m,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(le,{className:`size-4`}),t[23]=x):x=t[23];let S;t[24]===i.closeDialogAria?S=t[25]:(S=(0,Q.jsx)(j,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.closeDialogAria,children:x})}),t[24]=i.closeDialogAria,t[25]=S);let C;t[26]!==S||t[27]!==b?(C=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,S]}),t[26]=S,t[27]=b,t[28]=C):C=t[28];let w;t[29]!==c||t[30]!==l||t[31]!==C?(w=(0,Q.jsxs)(oe,{children:[f,(0,Q.jsx)(ie,{ref:u,className:p,onOpenAutoFocus:ut,children:(0,Q.jsxs)(s,{layer:`modal`,portalContainer:l,children:[C,c]})})]}),t[29]=c,t[30]=l,t[31]=C,t[32]=w):w=t[32];let T;return t[33]!==o||t[34]!==a||t[35]!==w?(T=(0,Q.jsx)(we,{open:a,onOpenChange:o,children:w}),t[33]=o,t[34]=a,t[35]=w,t[36]=T):T=t[36],T}function ut(e){return e.preventDefault()}function dt(e){let t=(0,Z.c)(15),{agents:n,tuiDefaultAgentId:r,busy:i,messages:a,onOpen:o,onChat:s}=e,c;if(t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==s||t[4]!==o||t[5]!==r){let e;t[7]!==i||t[8]!==a||t[9]!==s||t[10]!==o||t[11]!==r?(e=e=>{let t=G(e,a),n=W(e,a);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:d(`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,Q.jsx)(`button`,{type:`button`,disabled:i,"aria-label":a.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>o(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(H,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(ct,{agent:e,tuiDefaultAgentId:r,messages:a})]}),(0,Q.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||a.listUsesGlobalSettings}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(g,{className:`w-full`,disabled:i,onClick:t=>{t.stopPropagation(),s(e.id)},children:[(0,Q.jsx)(ge,{className:`size-4`}),a.listChatWithAgent]})})]})},e.id)},t[7]=i,t[8]=a,t[9]=s,t[10]=o,t[11]=r,t[12]=e):e=t[12],c=n.map(e),t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=r,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:c}),t[13]=c,t[14]=l),l}var ft=`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 pt(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(q,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),t[0]=f):f=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,k),t[1]=p):p=t[1];let m;t[2]===a.manualCreateTitle?m=t[3]:(m=(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=m);let h;t[4]===a.manualCreateDescription?h=t[5]:(h=(0,Q.jsx)(z,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=h);let _;t[6]!==m||t[7]!==h?(_=(0,Q.jsxs)(`div`,{children:[m,h]}),t[6]=m,t[7]=h,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[9]=v):v=t[9];let y;t[10]===a.manualCreateClose?y=t[11]:(y=(0,Q.jsx)(j,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:v})}),t[10]=a.manualCreateClose,t[11]=y);let b;t[12]!==_||t[13]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[_,y]}),t[12]=_,t[13]=y,t[14]=b):b=t[14];let x;t[15]===i?x=t[16]:(x=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=x);let S;t[17]===s?S=t[18]:(S=e=>s({name:e.target.value}),t[17]=s,t[18]=S);let C;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==S?(C=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${ft} mt-1.5`,value:n.name,onChange:S,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=S,t[22]=C):C=t[22];let w;t[23]!==a.manualCreateName||t[24]!==C?(w=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,C]}),t[23]=a.manualCreateName,t[24]=C,t[25]=w):w=t[25];let T;t[26]===s?T=t[27]:(T=e=>s({instructions:e.target.value}),t[26]=s,t[27]=T);let E;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==T?(E=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${ft} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:T,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==a.manualCreateInstructions||t[33]!==E?(D=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,E]}),t[32]=a.manualCreateInstructions,t[33]=E,t[34]=D):D=t[34];let O;t[35]===a.manualCreateWorkspace?O=t[36]:(O=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=O);let M;t[37]===a.manualCreateWorkspaceHint?M=t[38]:(M=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=M);let N;t[39]===s?N=t[40]:(N=e=>s({workspace:e}),t[39]=s,t[40]=N);let P;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==N||t[46]!==o?(P=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(Oe,{value:n.workspace,onChange:N,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${ft} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=N,t[46]=o,t[47]=P):P=t[47];let F;t[48]!==O||t[49]!==M||t[50]!==P?(F=(0,Q.jsxs)(`div`,{children:[O,M,P]}),t[48]=O,t[49]=M,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==x||t[53]!==w||t[54]!==D||t[55]!==F?(I=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[x,w,D,F]}),t[52]=x,t[53]=w,t[54]=D,t[55]=F,t[56]=I):I=t[56];let R;t[57]!==r||t[58]!==a.manualCreateCancel?(R=(0,Q.jsx)(j,{asChild:!0,children:(0,Q.jsx)(g,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=R):R=t[59];let B;t[60]!==r||t[61]!==n.name?(B=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=B):B=t[62];let V=r?a.manualCreating:a.manualCreateSubmit,H;t[63]!==r||t[64]!==c||t[65]!==B||t[66]!==V?(H=(0,Q.jsx)(g,{variant:`primary`,disabled:B,"aria-busy":r,onClick:c,children:V}),t[63]=r,t[64]=c,t[65]=B,t[66]=V,t[67]=H):H=t[67];let U;t[68]!==R||t[69]!==H?(U=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[R,H]}),t[68]=R,t[69]=H,t[70]=U):U=t[70];let W;t[71]!==I||t[72]!==U||t[73]!==b?(W=(0,Q.jsxs)(oe,{children:[f,(0,Q.jsxs)(ie,{className:p,children:[b,I,U]})]}),t[71]=I,t[72]=U,t[73]=b,t[74]=W):W=t[74];let G;return t[75]!==n.open||t[76]!==l||t[77]!==W?(G=(0,Q.jsx)(we,{open:u,onOpenChange:l,children:W}),t[75]=n.open,t[76]=l,t[77]=W,t[78]=G):G=t[78],G}var mt=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,ht=`max-w-7xl`;function gt(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(_,{className:`h-7 w-28`}),(0,Q.jsx)(_,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(_,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Ee,{gap:`gap-5`,padding:mt,className:ht,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(_t)})]}),e[1]=n):n=e[1],n}function _t(e){return(0,Q.jsx)(_,{className:`h-64 rounded-2xl`},e)}function vt({agentId:e,onHeaderActionChange:t}){let n=f(e=>e.conversationId),r=p(e=>e.language),i=r===`zh`,o=u(r),s=o.agentsSettings,l=a(),{data:m,error:_,isLoading:y,mutate:b}=h(n?`settings-gateway-agents`:null,T),{data:x}=v(!!n),S=(x?.payload?.config)?.tui?.defaultAgent?.trim(),[C,E]=(0,X.useState)(!1),[D,k]=(0,X.useState)(null),[A,j]=(0,X.useState)(null),[M,P]=(0,X.useState)(null),[I,L]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),R=(0,X.useRef)(!1),z=m?.agents.find(t=>t.id===e),V=(0,X.useCallback)(()=>{m&&(k(null),F(m.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:s.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:m.defaultId}}))},[s.setupDraftPrefix,m,l]),H=(0,X.useCallback)(async()=>{if(!(C||!I.name.trim())){E(!0),j(null);try{let e=await O({profile:{name:I.name.trim(),...I.instructions.trim()?{instructions:I.instructions.trim()}:{}},...I.workspace.trim()?{workspace:I.workspace.trim()}:{}});L({open:!1,name:``,instructions:``,workspace:``}),F(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){j(e instanceof Error?e.message:String(e))}finally{E(!1)}}},[C,I,l]),U=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(ve,{asChild:!0,children:(0,Q.jsx)(g,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":o.capabilitiesHub.moreActions,title:o.capabilitiesHub.moreActions,children:(0,Q.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(xe,{children:(0,Q.jsxs)(de,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Q.jsxs)(he,{className:d(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,K.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Q.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(he,{className:d(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,K.transition),onSelect:()=>{j(null),L(e=>({...e,open:!0}))},children:[(0,Q.jsx)(N,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),s.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(g,{variant:`primary`,className:`shrink-0`,"aria-label":s.listNewAgentCard,onClick:V,children:[(0,Q.jsx)(J,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:s.listNewAgentCard})]})}),[s.listNewAgentCard,s.manualCreateMenu,o.capabilitiesHub.moreActions,l,V,i]);(0,X.useLayoutEffect)(()=>(t?.(U),()=>t?.(null)),[U,t]);let W=async e=>{E(!0),k(null);try{await w(e.id),l(ae)}catch(e){k(e instanceof Error?e.message:String(e))}finally{E(!1)}},te=e=>{F(e),l(`/chat/new`)},ne=e=>{R.current=!1,window.setTimeout(()=>l(B(e)),0)},re=()=>{if(R.current){P({kind:`discard`,destination:ae});return}R.current=!1,l(ae)},q=()=>{if(R.current){P({kind:`discard`,destination:`/settings/agent-defaults`});return}R.current=!1,l(`/settings/agent-defaults`)},ie=()=>{if(!M)return;if(P(null),M.kind===`discard`){R.current=!1,l(M.destination);return}let e=m?.agents.find(e=>e.id===M.agentId);e&&W(e)},oe=(0,X.useCallback)(e=>{R.current=e},[]);return n?_&&!m?(0,Q.jsxs)(Ee,{className:ht,padding:mt,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(_)}),(0,Q.jsx)(g,{onClick:()=>void b(),children:i?`重试`:`Retry`})]}):y||!m?(0,Q.jsx)(gt,{}):(0,Q.jsxs)(Ee,{gap:`gap-5`,className:ht,padding:mt,children:[(_||D)&&!z?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:D??String(_)}):null,(0,Q.jsx)(dt,{agents:m.agents,tuiDefaultAgentId:S,busy:C,messages:s,onOpen:ne,onChat:te}),z?(0,Q.jsx)(lt,{agent:z,tuiDefaultAgentId:S,messages:s,open:!0,onOpenChange:e=>{e||re()},children:(0,Q.jsx)(st,{agent:z,toolIds:m.builtinToolIds,zh:i,messages:s,externalError:D,onDirtyChange:oe,onClose:re,onOpenDefaults:q,onChat:()=>te(z.id),onDelete:()=>P({kind:`delete`,agentId:z.id,displayName:G(z,s)})},z.id)}):null,(0,Q.jsx)(pt,{draft:I,busy:C,error:A,messages:s,workingDirectoryMessages:o.chat.workingDirectory,onChange:e=>L(t=>({...t,...e})),onCreate:()=>void H(),onOpenChange:e=>{C||(L(t=>({...t,open:e})),e||j(null))}}),(0,Q.jsx)(Y,{open:M!==null,title:M?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:M?.kind===`delete`?i?`删除 ${M.displayName}?此操作无法撤销。`:`Delete ${M.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:M?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:ie,onCancel:()=>P(null)})]}):(0,Q.jsx)(Ee,{className:ht,padding:mt,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{vt as AgentsSettingsPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{i as t,o as n}from"./locale-store-
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{i as t,o as n}from"./locale-store-B7s2Hb35.js";import{n as r}from"./gateway-config-swr-fQKBHBi1.js";async function i(){let e=await n(t(`/api/agents`));if(!e.payload?.defaultId||!Array.isArray(e.payload.agents))throw Error(`Invalid /api/agents response`);return e.payload}async function a(e){let r=await n(t(`/api/agents/${encodeURIComponent(e)}/effective-config`));if(!r.payload?.config||!r.payload.sources)throw Error(`Invalid effective agent config response`);return r.payload}async function o(t){let{mutate:n}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await Promise.all([n(`settings-gateway-agents`,t,{revalidate:!1}),n(`setup-checklist-agents`,t,{revalidate:!1}),r()])}async function s(e){let r=await n(t(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.payload?.agentId||!r.payload.agents)throw Error(`Invalid create agent response`);return await o(r.payload.agents),{...r.payload.agents,createdAgentId:r.payload.agentId}}async function c(e,r){let i=await n(t(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.payload)throw Error(`Invalid update agent response`);return await o(i.payload),i.payload}async function l(e,r){await n(t(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:r.base64,mimeType:r.mimeType})})}async function u(e,r=!1){let i=await n(t(`/api/agents/${encodeURIComponent(e)}${r?`?purge=1`:``}`),{method:`DELETE`});if(!i.payload?.agents)throw Error(`Invalid delete agent response`);return await o(i.payload.agents),i.payload.agents}async function d(e){let r=(await n(t(`/api/agents/${encodeURIComponent(e)}/files`))).payload,i=typeof r?.profileDir==`string`?r.profileDir.trim():``;if(!r?.files||!i)throw Error(`Invalid agent profile files response`);return{agentId:r.agentId,profileDir:i,files:r.files}}async function f(e,r){let i=(await n(t(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`))).payload?.content;if(typeof i!=`string`)throw Error(`Invalid agent profile file response`);return i}async function p(e,r,i){await n(t(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:i})})}export{a,c,d as i,l,u as n,i as o,f as r,p as s,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-RzwPiQNL.js";import{t as s}from"./cn-0WouolD0.js";import{i as c,n as l,o as u}from"./locale-store-JogcXC4J.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-aIC072nz.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{i as h,o as g}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as _}from"./electron-env-Dit0bHgy.js";import{Bc as v,Fc as y,Lc as b,Rc as x,Vc as S,ks as C,ma as w,tu as T,yn as E,zc as D}from"./index-ygkHNYyo.js";import{n as O,t as k}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{r as A,t as j}from"./settings-form-section-Ce8vVv-9.js";var M=n(),N=e(t(),1),P=r();function F(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function I(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function L(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,N.useReducer)(w,R),{info:c,loadError:l,actionError:u,copiedField:f,clearDialogOpen:m,clearConfirmChecked:_,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,N.useEffect)(()=>{z()},[z]);let B=async(e,n)=>{if(await d(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},V=async()=>{if(!(!e?.clearUserData||M)){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||o({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(l)return(0,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l});if(!c)return(0,P.jsx)(E,{rows:2});let U=!c.packaged,W=M||c.pendingUpdate||U,G=!U&&c.uninstallMode!==`unsupported`,K=L(c,t),q=_&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,u?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:u}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,c.pendingUpdate?(0,P.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:c.appPath}),(0,P.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void B(c.appPath,`app`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:c.dataPath}),(0,P.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void B(c.dataPath,`data`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(c.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:s(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:s(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(y,{open:m,onOpenChange:e=>{!e&&!M&&o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(v,{children:[(0,P.jsx)(D,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,g)}),(0,P.jsxs)(b,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,h,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(S,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:_,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,type:`text`,autoComplete:`off`,spellCheck:!1,className:s(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(a,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(y,{open:k,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(v,{children:[(0,P.jsx)(D,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,g)}),(0,P.jsxs)(b,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,h,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(S,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await u(c(`/api/migrations/status`))).payload}async function V(){await u(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=f(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(m,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(m,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),h=u.filter(e=>e.safety===`auto`&&e.status===`planned`),g=d.length>0||u.some(e=>e.safety!==`auto`);return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:g?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(h.length))})]}),h.length>0&&!g?(0,P.jsx)(p,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=l(W),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!_()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(k,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,P.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,P.jsxs)(O,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,P.jsx)(k,{title:i.title}),e[18]=i.title,e[19]=s);let c;e[20]===i.migrations?c=e[21]:(c=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=c);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==c||e[26]!==u?(d=(0,P.jsxs)(O,{gap:`gap-6`,children:[s,c,u]}),e[24]=s,e[25]=c,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U as AppManagementSettingsPanel};
|
|
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"./copy-Dv6d4Dvw.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-BYq0cPbn.js";import{t as s}from"./cn-0WouolD0.js";import{i as c,n as l,o as u}from"./locale-store-B7s2Hb35.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-aIC072nz.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{i as h,o as g}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as _}from"./electron-env-Dit0bHgy.js";import{Gc as v,Hc as y,Ns as b,Sn as x,Uc as S,Vc as C,Wc as w,_a as T,ru as E,zc as D}from"./index-DRyGCING.js";import{n as O,t as k}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{r as A,t as j}from"./settings-form-section-Brgd8IOV.js";var M=n(),N=e(t(),1),P=r();function F(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function I(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function L(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,N.useReducer)(T,R),{info:c,loadError:l,actionError:u,copiedField:f,clearDialogOpen:m,clearConfirmChecked:_,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,N.useEffect)(()=>{z()},[z]);let B=async(e,n)=>{if(await d(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},V=async()=>{if(!(!e?.clearUserData||M)){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||o({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(l)return(0,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l});if(!c)return(0,P.jsx)(x,{rows:2});let U=!c.packaged,W=M||c.pendingUpdate||U,G=!U&&c.uninstallMode!==`unsupported`,K=L(c,t),q=_&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(E,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,u?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:u}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,c.pendingUpdate?(0,P.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:c.appPath}),(0,P.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,b.press),onClick:()=>void B(c.appPath,`app`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:c.dataPath}),(0,P.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,b.press),onClick:()=>void B(c.dataPath,`data`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(c.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:s(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,b.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:s(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,b.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(D,{open:m,onOpenChange:e=>{!e&&!M&&o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(w,{children:[(0,P.jsx)(S,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,g)}),(0,P.jsxs)(C,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,h,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:_,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,type:`text`,autoComplete:`off`,spellCheck:!1,className:s(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(a,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(D,{open:k,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(w,{children:[(0,P.jsx)(S,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,g)}),(0,P.jsxs)(C,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,h,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await u(c(`/api/migrations/status`))).payload}async function V(){await u(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=f(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(m,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(m,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),h=u.filter(e=>e.safety===`auto`&&e.status===`planned`),g=d.length>0||u.some(e=>e.safety!==`auto`);return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:g?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(h.length))})]}),h.length>0&&!g?(0,P.jsx)(p,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=l(W),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!_()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(k,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,P.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,P.jsxs)(O,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,P.jsx)(k,{title:i.title}),e[18]=i.title,e[19]=s);let c;e[20]===i.migrations?c=e[21]:(c=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=c);let u;e[22]===i?u=e[23]:(u=(0,P.jsx)(z,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==c||e[26]!==u?(d=(0,P.jsxs)(O,{gap:`gap-6`,children:[s,c,u]}),e[24]=s,e[25]=c,e[26]=u,e[27]=d):d=e[27],d}function W(e){return e.language}export{U as AppManagementSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-DGKUpVsz.js";import{t as o}from"./messages-RzwPiQNL.js";import{t as s}from"./cn-0WouolD0.js";import{i as c,n as l,o as u}from"./locale-store-JogcXC4J.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{n as f,r as p}from"./gateway-config-swr-DF_HV6NP.js";import{So as m,ks as h,qr as g,xo as _}from"./index-ygkHNYyo.js";import{n as v,t as y}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{t as b}from"./settings-advanced-gate-QTVDCGJG.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await u(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,h.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),f=c?.payload?.config,m;e[2]===f?m=e[3]:(m=w(f),e[2]=f,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(d,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(B),a=g(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(y,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(v,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-DGKUpVsz.js";import{t as o}from"./messages-BYq0cPbn.js";import{t as s}from"./cn-0WouolD0.js";import{i as c,n as l,o as u}from"./locale-store-B7s2Hb35.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{n as f,r as p}from"./gateway-config-swr-fQKBHBi1.js";import{Eo as m,Ns as h,To as g,Xr as _}from"./index-DRyGCING.js";import{n as v,t as y}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{t as b}from"./settings-advanced-gate-D_8Mvnog.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await u(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,h.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=d);let f;return e[10]!==c||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),f=c?.payload?.config,m;e[2]===f?m=e[3]:(m=w(f),e[2]=f,e[3]=m);let h=m,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(d,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(y,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(g,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(v,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,m as a,t as o,u as s}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./messages-BYq0cPbn.js";import{t as f}from"./cn-0WouolD0.js";import{l as p,n as m}from"./locale-store-B7s2Hb35.js";import{a as h,i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-aIC072nz.js";import{t as v}from"./skeleton-BI5TyibZ.js";import{o as y}from"./gateway-realtime-C52ghnBK.js";import{A as b,Ad as x,El as S,Gc as C,H as w,Hc as T,Ka as E,L as D,M as O,N as k,Ns as A,Ol as j,P as M,R as N,So as P,Uc as F,V as I,Vc as L,Wc as R,Wl as z,Yd as B,Zc as V,_a as H,ao as U,ca as ee,co as W,da as G,fc as te,io as K,j as ne,la as q,no as J,ol as re,pa as Y,ro as X,ru as Z,sl as ie,ua as ae,zc as oe,zd as se}from"./index-DRyGCING.js";import{n as ce,t as le}from"./capability-header-actions-BMnbzHms.js";import{n as ue,r as de,t as fe}from"./plugin-presentation-CO5BFDGW.js";var pe=n(),me=`grid auto-rows-fr grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-stretch gap-4`,he=`relative h-full min-w-0 rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover/30`,ge=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function _e(e){return e===`builtin`||e===`user`?e:`marketplace`}var $=r();function ve(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var ye={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function be({className:e,query:t}){let n=s(),r=i(),a=m(e=>e.language),o=d(a).extensionsPage,c=p(e=>!!e.conversationId),l=J(),{mutate:_}=h(),[S,C]=(0,Q.useReducer)(H,ye),{debounced:T,detailPkg:E,quickInstallPkg:D,rowBusy:k,actionError:A,restartHint:j}=S,P=c?`marketplace-${T}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>C({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:F,isLoading:L,error:R}=g(P,()=>b(T),{revalidateOnFocus:!1}),z=(0,Q.useCallback)(()=>{_(`gateway-extensions-list`),y()},[_]),B=(0,Q.useCallback)(async(e,t)=>{C({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await O({name:e,overwrite:t});z(),n.requiresGatewayRestart&&C({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw C({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceInstallFailed}}),e}finally{C({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceInstallFailed,o.marketplaceRestartHint,z]),V=(0,Q.useCallback)(async e=>{C({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await M(e);z(),t.requiresGatewayRestart&&C({type:`patch`,patch:{restartHint:o.marketplaceRestartHint}})}catch(e){throw C({type:`patch`,patch:{actionError:e instanceof Error?e.message:o.marketplaceUninstallFailed}}),e}finally{C({type:`patch`,patch:{rowBusy:null}})}},[o.marketplaceRestartHint,o.marketplaceUninstallFailed,z]),U=F??[];return(0,$.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[R?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R instanceof Error?R.message:o.marketplaceLoadFailed}):null,A?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:A}):null,j?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:j}):null,L&&!F?(0,$.jsx)(`ul`,{className:me,"aria-label":o.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(v,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(v,{className:`h-5 w-full`}),(0,$.jsx)(v,{className:`h-3 w-2/3`})]}),(0,$.jsx)(v,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(v,{className:`h-4 w-full`}),(0,$.jsx)(v,{className:`h-4 w-full`}),(0,$.jsx)(v,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:me,children:U.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:o.marketplaceEmpty}):U.map(e=>{let t=ve(l,e.id),i=k===e.id,s=l.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[a.startsWith(`zh`)?`zh-CN`:`en`],d=c?.displayName??e.name,p=c?.description??e.description;return(0,$.jsxs)(`li`,{className:he,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${d}, ${o.marketplaceDetailTitle}`,onClick:()=>s?.pluginId?n(I(s.pluginId,`installed`,!1,r.pathname+r.search)):C({type:`patch`,patch:{detailPkg:e.id}}),className:ge}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(N,{iconUrl:e.branding?.iconUrl,fallback:Z}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:d,children:d}),e.verified?(0,$.jsx)(x,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:s&&de(s)?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:s&&de(s)?a.startsWith(`zh`)?`需要授权`:`Authorization required`:o.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:o.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>s?.pluginId&&fe(s)?n(w(d,a.startsWith(`zh`))):s?.pluginId?n(I(s.pluginId,`installed`,de(s),r.pathname+r.search)):C({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:f(`inline-flex items-center justify-center 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`),children:s&&de(s)?a.startsWith(`zh`)?`去授权`:`Connect account`:s&&fe(s)?a.startsWith(`zh`)?`开始使用`:`Start using`:a.startsWith(`zh`)?`管理插件`:`Manage plugin`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(o.marketplaceUninstallConfirm)&&V(e.id).catch(()=>{})},className:f(`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,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),o.marketplaceUninstall]})}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>C({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:f(`inline-flex min-w-16 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:e.packageType===`plugin`?a.startsWith(`zh`)?`安装`:`Install`:o.marketplaceReview})})]}),p?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:p}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-edge px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),E?(0,$.jsx)(xe,{packageName:E,autoInstall:D===E,copy:o,extensions:l,onClose:()=>C({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:B,onUninstall:V}):null]})}function xe(e){let t=(0,pe.c)(98),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:s,onInstall:c,onUninstall:l}=e,[d,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(!1),y=p(Ee)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>ne(n),t[0]=n,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[2]=x):x=t[2];let{data:w,error:T,isLoading:E}=g(y,b,x),O;t[3]!==a||t[4]!==n?(O=ve(a,n),t[3]=a,t[4]=n,t[5]=O):O=t[5];let k=O,A=k===`user`,j=w?.manifest?.permissions,M,N,P,I,z,H,U,ee,W,G,K,q;if(t[6]!==r||t[7]!==i||t[8]!==w||t[9]!==T||t[10]!==a||t[11]!==k||t[12]!==E||t[13]!==s||t[14]!==n||t[15]!==j||t[16]!==h){H=Symbol.for(`react.early_return_sentinel`);bb0:{let e=j&&typeof j==`object`&&!Array.isArray(j)?Object.entries(j):[],o;t[29]!==i||t[30]!==w?(o=w?.readme?.trim()||(w?.description?.trim()?`### ${w.name}\n\n${w.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=w,t[31]=o):o=t[31];let c=o;if(w?.format===`agent-plugin`){let e;if(t[32]!==w||t[33]!==a||t[34]!==n){let r;t[36]!==w||t[37]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===w.manifest?.name,t[36]=w,t[37]=n,t[38]=r):r=t[38],e=a.find(r),t[32]=w,t[33]=a,t[34]=n,t[35]=e}else e=t[35];let i=`store:${n}`,o;t[39]!==r||t[40]!==w||t[41]!==s||t[42]!==e||t[43]!==i?(o=(0,$.jsx)(D,{extension:e,initialSource:i,marketplace:w,autoInstall:r,onClose:s}),t[39]=r,t[40]=w,t[41]=s,t[42]=e,t[43]=i,t[44]=o):o=t[44],H=o;break bb0}P=oe,I=!0,t[45]===s?z=t[46]:(z=e=>!e&&s(),t[45]=s,t[46]=z),N=R,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[47]=q):q=t[47],M=L,W=`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`,G=Te;let l;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(B,{className:`size-5`}),t[48]=l):l=t[48];let u;t[49]!==i.detailBack||t[50]!==s?(u=(0,$.jsx)(`button`,{type:`button`,onClick:s,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":i.detailBack,children:l}),t[49]=i.detailBack,t[50]=s,t[51]=u):u=t[51];let d;t[52]===i.marketplaceDetailTitle?d=t[53]:(d=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[52]=i.marketplaceDetailTitle,t[53]=d);let f;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(V,{className:`size-5`}),t[54]=f):f=t[54];let p;t[55]!==i.detailClose||t[56]!==s?(p=(0,$.jsx)(`button`,{type:`button`,onClick:s,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":i.detailClose,children:f}),t[55]=i.detailClose,t[56]=s,t[57]=p):p=t[57],t[58]!==u||t[59]!==d||t[60]!==p?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,d,p]}),t[58]=u,t[59]=d,t[60]=p,t[61]=K):K=t[61],U=`min-h-0 flex-1 overflow-y-auto p-5`,ee=E&&!w?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(v,{className:`h-6 w-48`}),(0,$.jsx)(v,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(v,{className:`h-12`}),(0,$.jsx)(v,{className:`h-12`})]}),(0,$.jsx)(v,{className:`h-28 w-full`}),(0,$.jsx)(v,{className:`h-36 w-full`})]}):T?(0,$.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,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:T instanceof Error?T.message:i.marketplaceLoadFailed})]}):w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:w.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:w.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:w.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:w.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:w.downloads})]})]}),k===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[w.installability.available?(0,$.jsx)(S,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:w.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:w.installability.available?i.marketplaceCodeRisk:w.installability.reason??i.marketplaceUnavailableBody})]})]}),w.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:w.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(we)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(w.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,w.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),w.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(te,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=w,t[9]=T,t[10]=a,t[11]=k,t[12]=E,t[13]=s,t[14]=n,t[15]=j,t[16]=h,t[17]=M,t[18]=N,t[19]=P,t[20]=I,t[21]=z,t[22]=H,t[23]=U,t[24]=ee,t[25]=W,t[26]=G,t[27]=K,t[28]=q}else M=t[17],N=t[18],P=t[19],I=t[20],z=t[21],H=t[22],U=t[23],ee=t[24],W=t[25],G=t[26],K=t[27],q=t[28];if(H!==Symbol.for(`react.early_return_sentinel`))return H;let J;t[62]!==U||t[63]!==ee?(J=(0,$.jsx)(`div`,{className:U,children:ee}),t[62]=U,t[63]=ee,t[64]=J):J=t[64];let Y;t[65]!==d||t[66]!==i.marketplaceBuiltinGoBuiltin||t[67]!==i.marketplaceBuiltinManageHint||t[68]!==i.marketplaceInstall||t[69]!==i.marketplaceReinstall||t[70]!==i.marketplaceReinstallConfirm||t[71]!==i.marketplaceUninstall||t[72]!==i.marketplaceUninstallConfirm||t[73]!==w||t[74]!==k||t[75]!==s||t[76]!==c||t[77]!==l||t[78]!==n||t[79]!==h||t[80]!==A?(Y=w?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:k===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(o,{to:`/capabilities/extensions?tab=builtin`,onClick:s,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:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!w.installability.available||!h,onClick:()=>{A&&!window.confirm(i.marketplaceReinstallConfirm)||(m(!0),c(n,A).catch(Ce).finally(()=>m(!1)))},className:f(`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:[d?(0,$.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,A?i.marketplaceReinstall:i.marketplaceInstall]}),A?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(m(!0),l(n).then(()=>s()).catch(Se).finally(()=>m(!1)))},className:f(`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,$.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[65]=d,t[66]=i.marketplaceBuiltinGoBuiltin,t[67]=i.marketplaceBuiltinManageHint,t[68]=i.marketplaceInstall,t[69]=i.marketplaceReinstall,t[70]=i.marketplaceReinstallConfirm,t[71]=i.marketplaceUninstall,t[72]=i.marketplaceUninstallConfirm,t[73]=w,t[74]=k,t[75]=s,t[76]=c,t[77]=l,t[78]=n,t[79]=h,t[80]=A,t[81]=Y):Y=t[81];let X;t[82]!==M||t[83]!==J||t[84]!==Y||t[85]!==W||t[86]!==G||t[87]!==K?(X=(0,$.jsxs)(M,{className:W,onOpenAutoFocus:G,children:[K,J,Y]}),t[82]=M,t[83]=J,t[84]=Y,t[85]=W,t[86]=G,t[87]=K,t[88]=X):X=t[88];let Z;t[89]!==N||t[90]!==X||t[91]!==q?(Z=(0,$.jsxs)(N,{children:[q,X]}),t[89]=N,t[90]=X,t[91]=q,t[92]=Z):Z=t[92];let ae;return t[93]!==P||t[94]!==I||t[95]!==z||t[96]!==Z?(ae=(0,$.jsx)(P,{defaultOpen:I,onOpenChange:z,children:Z}),t[93]=P,t[94]=I,t[95]=z,t[96]=Z,t[97]=ae):ae=t[97],ae}function Se(){}function Ce(){}function we(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Te(e){return e.preventDefault()}function Ee(e){return!!e.conversationId}function De({embedded:e=!1,onHeaderActionChange:t}){let n=s(),r=i(),l=m(e=>e.language),u=d(l),p=W(e=>e.setPageHeader),h=W(e=>e.clearPageHeader),g=J(),v=X(),[y,b]=a(),x=_e(y.get(`tab`)??(g.some(e=>e.source!==`bundled`)?`user`:null)),S=(0,Q.useRef)(!1),C=y.get(`q`)??``,[w,T]=(0,Q.useState)(x),[E,O]=(0,Q.useState)(C),[k,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(!1),F=y.toString(),L=(0,Q.useRef)(F);if(L.current!==F){L.current=F;let e=_e(y.get(`tab`)),t=y.get(`q`)??``;T(t=>t===e?t:e),O(e=>e===t?e:t)}(0,Q.useEffect)(()=>{b(e=>{let t=new URLSearchParams(e),n=E.trim();return n?t.set(`q`,n):t.delete(`q`),w===`marketplace`?t.delete(`tab`):t.set(`tab`,w),t.toString()===e.toString()?e:t},{replace:!0})},[w,E,b]);let R=(0,Q.useMemo)(()=>g.filter(e=>e.source===`bundled`),[g]),B=(0,Q.useMemo)(()=>g.filter(e=>e.source!==`bundled`),[g]);(0,Q.useEffect)(()=>{v||S.current||(S.current=!0,!y.has(`tab`)&&B.length&&T(`user`))},[v,y,B.length]);let V=w===`builtin`?R:B,H=(0,Q.useMemo)(()=>{let e=E.trim().toLowerCase(),t=V;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,l):e.hasUi?-1:1)},[V,E,l]);(0,Q.useEffect)(()=>{j(e=>{if(!e)return e;let t=g.find(t=>t.id===e.id);return t?Oe(e)===Oe(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[g]);let U=(0,Q.useMemo)(()=>({searchLabel:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder,search:(0,$.jsx)(ce,{value:E,onChange:O,placeholder:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(G,{children:[(0,$.jsx)(Y,{asChild:!0,children:(0,$.jsx)(_,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":u.capabilitiesHub.moreActions,title:u.capabilitiesHub.moreActions,children:(0,$.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ae,{children:(0,$.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(q,{className:f(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>N(!0),children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(q,{asChild:!0,children:(0,$.jsxs)(o,{to:`/local-apps`,className:f(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),children:[(0,$.jsx)(se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),u.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(_,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(o,{to:`/local-apps/new`,"aria-label":u.extensionsPage.createLocalApp,children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:u.extensionsPage.createLocalApp})]})})}),[l,u.capabilitiesHub.moreActions,u.extensionsPage,w,E]);(0,Q.useLayoutEffect)(()=>e?(t?.(U),()=>t?.(null)):(p({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u.extensionsPage.title})}),end:(0,$.jsx)(le,{contribution:U})}),()=>h()),[h,e,U,u.extensionsPage.title,t,p]);let te=[{id:`user`,label:u.extensionsPage.tabUser,count:v?void 0:B.length},{id:`marketplace`,label:u.extensionsPage.tabMarketplace},{id:`builtin`,label:u.extensionsPage.tabBuiltin,count:v?void 0:R.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:f(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(P,{items:te,activeTab:w,onChange:T,ariaLabel:u.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),w===`marketplace`?(0,$.jsx)(be,{query:E}):v?(0,$.jsx)(Fe,{}):w===`builtin`&&R.length===0?(0,$.jsx)(Le,{message:u.extensionsPage.emptyBuiltin}):w===`user`&&B.length===0?(0,$.jsx)(Le,{message:u.extensionsPage.emptyUser}):H.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:u.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:me,children:H.map(e=>(0,$.jsx)(je,{extension:e,copy:u.extensionsPage,onOpen:()=>e.pluginId?n(I(e.pluginId,`installed`,!1,r.pathname+r.search)):j(e)},e.id))})]}),k?k.format===`agent-plugin`?(0,$.jsx)(D,{extension:k,onClose:()=>j(null)},k.id):(0,$.jsx)(Ne,{extension:k,copy:u.extensionsPage,onClose:()=>j(null)},k.id):null,M?(0,$.jsx)(D,{onClose:()=>N(!1)}):null]})}function Oe(e){return e.activationEligible??e.active}function ke(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Ae(e,t){let n=Oe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function je(e){let t=(0,pe.c)(56),{extension:n,copy:r,onOpen:a}=e,o=m(Me),c,l;t[0]!==n||t[1]!==o?(l=o.startsWith(`zh`),c=ue(n,l),t[0]=n,t[1]=o,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=c,d;t[4]===n?d=t[5]:(d=de(n),t[4]=n,t[5]=d);let f=d,p=n.localizations?.[l?`zh-CN`:`en`]?.description??n.description,h=s(),g=i(),_;t[6]===n?_=t[7]:(_=!!n.pluginId&&fe(n),t[6]=n,t[7]=_);let v=_,y=f?l?`去授权`:`Connect account`:v?l?`开始使用`:`Start using`:l?`管理插件`:`Manage plugin`,b;t[8]!==v||t[9]!==n.pluginId||t[10]!==g||t[11]!==u||t[12]!==h||t[13]!==f||t[14]!==a||t[15]!==l?(b=()=>{v?h(w(u,l)):f&&n.pluginId?h(I(n.pluginId,`installed`,!0,g.pathname+g.search)):a()},t[8]=v,t[9]=n.pluginId,t[10]=g,t[11]=u,t[12]=h,t[13]=f,t[14]=a,t[15]=l,t[16]=b):b=t[16];let S=b,C=`${u}, ${r.marketplaceDetailTitle}`,T;t[17]!==a||t[18]!==C?(T=(0,$.jsx)(`button`,{type:`button`,"aria-label":C,onClick:a,className:ge}),t[17]=a,t[18]=C,t[19]=T):T=t[19];let E=n.branding?.iconUrl,D;t[20]===E?D=t[21]:(D=(0,$.jsx)(N,{iconUrl:E,fallback:se}),t[20]=E,t[21]=D);let O;t[22]===u?O=t[23]:(O=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),t[22]=u,t[23]=O);let k;t[24]===n.provenance?.publisherVerification?k=t[25]:(k=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(x,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[24]=n.provenance?.publisherVerification,t[25]=k);let A;t[26]!==O||t[27]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]===n.version?j=t[30]:(j=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[29]=n.version,t[30]=j);let M=f?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,P=f?l?`需要授权`:`Authorization required`:Oe(n)?r.statusEnabled:r.runStateOff,F;t[31]!==M||t[32]!==P?(F=(0,$.jsx)(`span`,{className:M,children:P}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let L;t[34]!==j||t[35]!==F?(L=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[j,F]}),t[34]=j,t[35]=F,t[36]=L):L=t[36];let R;t[37]!==A||t[38]!==L?(R=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,L]}),t[37]=A,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==y||t[41]!==S?(z=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(`button`,{type:`button`,onClick:S,className:`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg transition-colors hover:bg-surface-hover active:scale-[0.98] active:bg-surface-hover/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:y})}),t[40]=y,t[41]=S,t[42]=z):z=t[42];let B;t[43]!==R||t[44]!==z||t[45]!==D?(B=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[D,R,z]}),t[43]=R,t[44]=z,t[45]=D,t[46]=B):B=t[46];let V;t[47]!==r.cardNoDescription||t[48]!==p?(V=p?.trim()||r.cardNoDescription,t[47]=r.cardNoDescription,t[48]=p,t[49]=V):V=t[49];let H;t[50]===V?H=t[51]:(H=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:V}),t[50]=V,t[51]=H);let U;return t[52]!==B||t[53]!==H||t[54]!==T?(U=(0,$.jsxs)(`article`,{className:he,children:[T,B,H]}),t[52]=B,t[53]=H,t[54]=T,t[55]=U):U=t[55],U}function Me(e){return e.language}function Ne({extension:e,copy:t,onClose:n}){let{mutate:r}=h(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!1),m=e.activationEligible===!0,g=(0,Q.useCallback)(async()=>{c(null),p(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await k({extensionId:e.id,enabled:!m});await r(`gateway-extensions-list`),y(),p(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[m,t.extensionToggleFailed,e.id,r]),v=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),p(!1),a(`uninstall`);try{await M(e.id),await r(`gateway-extensions-list`),y(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),b=e.ui?.contributions?.pages??[],x=e.ui?.contributions?.settingsPanels??[],S=e.ui?.contributions?.chatWidgets??[],w=b.find(e=>e.showInNav)??b[0],D=x[0],O=w?E(e.id,w):null,A=D?`/settings/ext/${e.id}/${D.id}`:e.hasConfigSchema||K(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(oe,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(R,{children:[(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(L,{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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.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,$.jsx)(B,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(T,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.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,$.jsx)(V,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.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,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ke(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Ae(e,t)}),e.source===`bundled`?(0,$.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}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(_,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):m?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(_,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void v(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(b.length>0||x.length>0||S.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Pe,{template:t.badgePages,count:b.length,hidden:b.length===0}),(0,$.jsx)(Pe,{template:t.badgeSettings,count:x.length,hidden:x.length===0}),(0,$.jsx)(Pe,{template:t.badgeWidgets,count:S.length,hidden:S.length===0})]})]}):null,U(e)&&(O||A)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[O?(0,$.jsxs)(o,{to:O,onClick:n,className:f(`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,$.jsx)(l,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,A?(0,$.jsxs)(o,{to:A,onClick:n,className:f(`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,$.jsx)(j,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Pe(e){let t=(0,pe.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,$.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 Fe(){let e=(0,pe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:me,"aria-busy":`true`,children:Array.from({length:6},Ie)}),e[0]=t):t=e[0],t}function Ie(e,t){return(0,$.jsx)(v,{className:`h-32 rounded-xl`},t)}function Le(e){let t=(0,pe.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.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,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{De as ExtensionsPage};
|