@xopcai/xopc 0.0.333 → 0.0.334
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/assets/{auth-DocRzRlS.js → auth-Cjj5SuoT.js} +49 -39
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +240 -36
- 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-DiI2O7lC.js → agent-avatar-dicebear-B73q7mlz.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CVp3J969.js → agent-defaults-settings-panel-B9L2YIXz.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-CacyndrS.js → agent-plugin-dialog-COOjsvea.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CCj1JnLu.js +70 -0
- package/dist/gateway/static/root/assets/agents-admin-api-Cuqi5xZn.js +2 -0
- package/dist/gateway/static/root/assets/{app-link-C6gA5Nck.js → app-link-DRL0YnPs.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BcszTlqr.js → app-management-settings-panel-CckioKud.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B1XPe8qz.js → appearance-settings-DDiPIr_Q.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Azqy8vfo.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-MjUsJcNb.js → archive-plugin-Dtyr0RhX.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +1 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +1 -0
- package/dist/gateway/static/root/assets/{automations-page-Dsjivdxs.js → automations-page-g3SrFkTC.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B0nW2nZD.js +7 -0
- package/dist/gateway/static/root/assets/binary-plugins-BwKQVxsU.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-Bx0uXbJP.js → block-editor-DD9d5pCt.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-1ZIPGDeq.js → browser-automation-inputs-D2gNdS3e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CCjYipHc.js → browser-automations-page-BKqqJR7P.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-BZH9bZbk.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-CHk4RZl4.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-CfWaVH-6.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C5FcWsSe.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-Bd66yEOa.js +1 -0
- package/dist/gateway/static/root/assets/channels-DIU5Gq4o.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Fnum_IEm.js → chat-terminal-dock-B0nPDJyj.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-DI1zfCTA.js → computer-settings-page-D7PxxaoG.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CiGDAubm.js → connector-service-page-BZH4SeQg.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BC81R_fz.js +2 -0
- package/dist/gateway/static/root/assets/{turn-outcome-D0SnyZ3Z.js → constants-Co2_smKQ.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-CDEVYjXI.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DpD3xaEB.js → dependency-picker-AInmpSwC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CCoDxKqh.js → desktop-pet-Sjgnlq8M.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-GxndKfCx.js → desktop-pet-settings-BWn0rrhr.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-B71w3ptm.js → device-pairing-wizard-BtW837_d.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CUzjJvjs.js → directory-picker-path-field-2CpmDx_D.js} +1 -1
- package/dist/gateway/static/root/assets/dist-CKkafhaS.js +1 -0
- package/dist/gateway/static/root/assets/dist-io9jFpN72.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BtDY8ntX.js → extension-debug-page-WWJFj9Z5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D9_XF-XC.js → extension-page-DL00dFRr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CjhUFAaC.js → extension-settings-page-CN-agjPk.js} +1 -1
- package/dist/gateway/static/root/assets/{files-BK6enEvD.js → files-Bw4SBGdM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-Ciq4c7KT.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BHeHN26R.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-4oD6fhAm.js +1 -0
- package/dist/gateway/static/root/assets/home-page-nEpyJUBY.js +1 -0
- package/dist/gateway/static/root/assets/{imports-page-BEtq5BRU.js → imports-page-BivdeiQ5.js} +1 -1
- package/dist/gateway/static/root/assets/index-BioG1pRD.js +106 -0
- package/dist/gateway/static/root/assets/index-DbLEkdNg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-JUYY_18v.js → keyboard-shortcuts-settings-B_8AJTFr.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CRtZQrmz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BlYESNqz.js → local-apps-page-DclxpoqR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-Bpja8nC6.js → local-apps-yys1VChX.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DkolHmyp.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DX8TxkRl.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-c4krhYU7.js → management-settings-5WFufZ4g.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BEeXMfDw.js → markdown-view-DYJnwlDr.js} +1 -1
- package/dist/gateway/static/root/assets/media-plugins-DlJDvwLK.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-GF5Q9Fqy.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-E8o4_Ty9.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-CiCmfRTw.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-BhYBCqls.js → page-tabs-Cwp3fGVM.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CP8agNlc.js → preview-open-alternatives-DJ5xqGeu.js} +1 -1
- package/dist/gateway/static/root/assets/{product-delivery-bv3z8Xkh.js → product-delivery-BAks11S4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CU7fRhfT.js → product-open-page-CcGwNePw.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-6hhRBkmC.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DUOzRaFI.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BWpWUXiE.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Czvzsuj_.js → runtime-tools-settings-panel-C6eDCNHz.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-pF7Lmqnk.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-B9Ni5O93.js → schema-form-D8W8q_ez.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-88fK3zzl.js → schemas-CObaziC7.js} +3 -3
- package/dist/gateway/static/root/assets/session-api-BAyUr97V.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-BAy2sR2Q.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-BDKDqqf9.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C9cJWlAq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-jquf1P7n.js → settings-form-section-B0cAj0nq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DPomsvba.js → settings-page-DZVVTFxs.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DZCPVx9c.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BkPNyV8c.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Bqlv5JBi.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-Bu7-3w-L.js → skill-api-C0dufzQC.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-3JF2OTBz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DB4lR4om.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BwFR0Uci.js → system-settings-panel-xjrlhdUz.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CB6M7wSs.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-CDR_RVbQ.js → tasks-QQJXsiER.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-PfucxMP3.js → tunnel-api--68MQEWM.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-t_zdQHcy.js → usage-page-OLZ00eqD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DLyy2wHz.js → use-autosave-DsnHYpTv.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CoePFpHD.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CQDY5EBK.js → voice-api-key-field-CvIXutQp.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJzqJ47I.js → work-discovery-overlay-By5_7MLR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-sCOk-esV.js → workflow-run-setup-panel-HSMDxDXV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DElQ47Da.js +6 -0
- package/dist/gateway/static/root/index.html +24 -18
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +14 -2
- package/dist/packages/gateway-contract/src/index.js +6 -2
- package/dist/packages/gateway-contract/src/session-command-rejection.js +19 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +109 -0
- package/dist/packages/gateway-contract/src/sessions.js +0 -6
- package/dist/src/agent/agent-manager.js +6 -6
- package/dist/src/agent/background-review/run-background-review.js +2 -2
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +4 -2
- package/dist/src/agent/service.js +4 -4
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +11 -11
- package/dist/src/automations/domain/validation.d.ts +11 -11
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/cli/authorization.d.ts +1 -1
- package/dist/src/connectors/cli/store.d.ts +1 -1
- package/dist/src/connectors/connection-candidates.js +53 -15
- package/dist/src/connectors/connection-capabilities.js +5 -1
- package/dist/src/execution-environments/local-worktree-manager.js +10 -1
- package/dist/src/execution-environments/session-environment-service.d.ts +3 -0
- package/dist/src/execution-environments/session-environment-service.js +28 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +6 -2
- package/dist/src/gateway/hono/routes/browser-session.js +4 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +9 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/files.js +3 -0
- package/dist/src/gateway/hono/routes/models.js +17 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -4
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-command-handler.d.ts +5 -0
- package/dist/src/gateway/hono/routes/session-command-handler.js +189 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +14 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +0 -168
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/tui.js +2 -1
- package/dist/src/gateway/hono/routes/voice.js +9 -0
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/resolve-webchat-session-key.d.ts +1 -1
- package/dist/src/gateway/resolve-webchat-session-key.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/session-command-service.d.ts +34 -0
- package/dist/src/gateway/service/session-command-service.js +81 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +21 -0
- package/dist/src/gateway/service/session-input-coordinator.js +41 -0
- package/dist/src/gateway/service/session-preparation-worker.d.ts +15 -0
- package/dist/src/gateway/service/session-preparation-worker.js +125 -0
- package/dist/src/gateway/service.d.ts +24 -0
- package/dist/src/gateway/service.js +27 -14
- package/dist/src/gateway/side-chat/promotion-service.js +0 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/home-intelligence/host.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/mcp/channel-bridge.js +12 -2
- package/dist/src/notes/capabilities/read.js +2 -2
- package/dist/src/notes/service.d.ts +4 -1
- package/dist/src/notes/service.js +11 -8
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/store.js +0 -1
- package/dist/src/storage/sqlite/migrations/223_session_creation_receipts.sql +59 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-creation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +166 -0
- package/dist/src/storage/sqlite/session-input-repository.d.ts +4 -2
- package/dist/src/storage/sqlite/session-input-repository.js +7 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tui/backends/embedded-backend.d.ts +5 -0
- package/dist/src/tui/backends/embedded-backend.js +266 -20
- package/dist/src/tui/backends/embedded-drafts.d.ts +22 -0
- package/dist/src/tui/backends/embedded-drafts.js +53 -0
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +10 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +214 -33
- package/dist/src/tui/tui-backend.d.ts +1 -1
- package/dist/src/tui/tui-chat-input-state.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-session-format.js +0 -1
- package/dist/src/tui/tui-startup-resources.d.ts +1 -0
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui-types.d.ts +0 -1
- package/dist/src/tui/tui.js +69 -29
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/work-discovery/service.js +3 -6
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +0 -70
- package/dist/gateway/static/root/assets/apps-page-ZqANbUZv.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-DHa-BI9a.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-DQYcuBHP.js +0 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BfvDvIY1.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-D_hbWRRF.js +0 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +0 -2
- package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-D-JhzZyW.js +0 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BWaCnwT1.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BTjGLngn.js +0 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +0 -121
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BbLQreeN.js +0 -2
- package/dist/gateway/static/root/assets/media-plugins-DEFN1I73.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-D43aVpCj.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DUOKZLt7.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-fVPQe5YS.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BvVlqpHf.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-b9DI0N1J.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D7XPEQu_.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +0 -6
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -9
- package/dist/src/tui/tui-empty-session-cleanup.js +0 -19
- /package/dist/gateway/static/root/assets/{dist-CI_fqRk-.js → dist-CI_fqRk-2.js} +0 -0
package/dist/src/tui/tui.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { version } from "../../package.js";
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
|
-
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
4
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
5
3
|
import { init_paths } from "../config/paths.js";
|
|
4
|
+
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
6
5
|
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
6
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
7
7
|
import { isTerminalWorkflowRunStatus } from "../workflows/domain/run.js";
|
|
8
8
|
import "../workflows/domain/index.js";
|
|
9
9
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
@@ -26,7 +26,6 @@ import { transcriptTreeEntryIdToRowNumber } from "./tui-transcript-tree.js";
|
|
|
26
26
|
import { formatTuiCompactionResult, formatTuiShareResult } from "./tui-command-formatters.js";
|
|
27
27
|
import { formatTuiStartupText } from "./tui-startup-text.js";
|
|
28
28
|
import { createTuiCommandHandler, getSlashCommands } from "./tui-commands.js";
|
|
29
|
-
import { GENERATED_TUI_SESSION_SHELL_PATCH, cleanupAbandonedTuiSessions, deleteGeneratedTuiSessionIfEmpty } from "./tui-empty-session-cleanup.js";
|
|
30
29
|
import { extensionCustomMessageContentToText, extensionCustomMessageToTurnText, extensionUserMessageContentToText } from "./tui-extension-user-message.js";
|
|
31
30
|
import { resolveFdPath } from "./tui-fd-path.js";
|
|
32
31
|
import { createBackspaceDeduper, drainAndStopTuiSafely, isIgnorableTuiStopError, resolveCtrlCAction, stopTuiSafely } from "./tui-lifecycle.js";
|
|
@@ -45,6 +44,7 @@ import { installTuiStdioFilter } from "./tui-stdio-filter.js";
|
|
|
45
44
|
import { createEditorSubmitHandler, createSubmitBurstCoalescer, shouldEnableWindowsGitBashPasteFallback } from "./tui-submit.js";
|
|
46
45
|
import { withTuiSuspended } from "./tui-suspend.js";
|
|
47
46
|
import { createInitialState } from "./tui-types.js";
|
|
47
|
+
import { TuiDraftFileStore } from "./backends/embedded-drafts.js";
|
|
48
48
|
import { EmbeddedBackend } from "./backends/embedded-backend.js";
|
|
49
49
|
import { GatewayRealtimeBackend } from "./backends/gateway-realtime-backend.js";
|
|
50
50
|
import { ChatLog } from "./components/chat-log.js";
|
|
@@ -196,7 +196,6 @@ async function runTui(opts) {
|
|
|
196
196
|
const generatedStartupConversationId = !opts.session?.trim() ? startup.conversationId : null;
|
|
197
197
|
const generatedStartupConversationIds = new Set(generatedStartupConversationId ? [generatedStartupConversationId] : []);
|
|
198
198
|
const isGeneratedTuiConversationId = (id) => generatedStartupConversationIds.has(id);
|
|
199
|
-
let startupSessionHadUserTurn = false;
|
|
200
199
|
const startupWorkingDirectory = resolveStartupWorkingDirectory(opts, isLocalMode);
|
|
201
200
|
const implicitTrustedWorkspace = startupWorkingDirectory ?? (isLocalMode ? process.cwd() : void 0);
|
|
202
201
|
const projectTrustStore = new ProjectTrustStore();
|
|
@@ -392,6 +391,7 @@ async function runTui(opts) {
|
|
|
392
391
|
tui.requestRender();
|
|
393
392
|
};
|
|
394
393
|
editor.onChange = (text) => {
|
|
394
|
+
scheduleComposerDraftSave();
|
|
395
395
|
const trimmed = text.trimStart();
|
|
396
396
|
const nextExclude = trimmed.startsWith("!!");
|
|
397
397
|
const nextBash = editorMode === "shell" || trimmed.startsWith("!");
|
|
@@ -401,6 +401,37 @@ async function runTui(opts) {
|
|
|
401
401
|
updateEditorBorderColor();
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
|
+
let composerDrafts;
|
|
405
|
+
let composerDraftTimer;
|
|
406
|
+
const saveComposerDraft = () => {
|
|
407
|
+
if (!composerDrafts) return;
|
|
408
|
+
try {
|
|
409
|
+
const text = editor.getText();
|
|
410
|
+
if (text || pendingImageAttachments.length) composerDrafts.save(state.currentConversationId, {
|
|
411
|
+
text,
|
|
412
|
+
attachments: pendingImageAttachments
|
|
413
|
+
});
|
|
414
|
+
else composerDrafts.remove(state.currentConversationId);
|
|
415
|
+
} catch (error) {
|
|
416
|
+
chatLog.addSystem(`Draft could not be saved: ${String(error)}`);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
const scheduleComposerDraftSave = () => {
|
|
420
|
+
clearTimeout(composerDraftTimer);
|
|
421
|
+
composerDraftTimer = setTimeout(saveComposerDraft, 300);
|
|
422
|
+
};
|
|
423
|
+
const restoreComposerDraft = () => {
|
|
424
|
+
if (!composerDrafts || editor.getText() || pendingImageAttachments.length) return;
|
|
425
|
+
try {
|
|
426
|
+
const saved = composerDrafts.read(state.currentConversationId);
|
|
427
|
+
if (saved) {
|
|
428
|
+
pendingImageAttachments = saved.attachments;
|
|
429
|
+
editor.setText(saved.text);
|
|
430
|
+
}
|
|
431
|
+
} catch (error) {
|
|
432
|
+
chatLog.addSystem(`Draft could not be restored: ${String(error)}`);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
404
435
|
const copyDefaultEditorAppHandlers = (target) => {
|
|
405
436
|
const customEditor = target;
|
|
406
437
|
if (!(customEditor.actionHandlers instanceof Map)) return;
|
|
@@ -558,7 +589,7 @@ async function runTui(opts) {
|
|
|
558
589
|
}
|
|
559
590
|
};
|
|
560
591
|
const getAvailableProviderCount = () => getAllProviders().filter((provider) => isProviderConfiguredSync(provider)).length;
|
|
561
|
-
const getExtensionSystemPrompt = () =>
|
|
592
|
+
const getExtensionSystemPrompt = () => resolveEffectiveAgentProfile(currentAgentId).customInstructions ?? "";
|
|
562
593
|
const waitForTuiIdle = async () => {
|
|
563
594
|
while (state.activeRunId != null || state.isCompacting || state.activityStatus === "sending" || state.activityStatus === "waiting" || state.activityStatus === "streaming" || state.activityStatus === "running" || state.activityStatus === "compacting") await new Promise((resolveDelay) => setTimeout(resolveDelay, 50));
|
|
564
595
|
};
|
|
@@ -952,6 +983,8 @@ async function runTui(opts) {
|
|
|
952
983
|
let exitResult = { exitReason: "exit" };
|
|
953
984
|
const requestExit = (options) => {
|
|
954
985
|
if (state.exitRequested) return;
|
|
986
|
+
clearTimeout(composerDraftTimer);
|
|
987
|
+
saveComposerDraft();
|
|
955
988
|
state.exitRequested = true;
|
|
956
989
|
if (elapsedTimerId) {
|
|
957
990
|
clearInterval(elapsedTimerId);
|
|
@@ -963,21 +996,15 @@ async function runTui(opts) {
|
|
|
963
996
|
}
|
|
964
997
|
tui.terminal.setProgress(false);
|
|
965
998
|
(async () => {
|
|
966
|
-
const removedEmptyStartupSessions = /* @__PURE__ */ new Set();
|
|
967
|
-
if (!state.activeRunId) for (const conversationId of generatedStartupConversationIds) {
|
|
968
|
-
if (conversationId === state.currentConversationId && startupSessionHadUserTurn) continue;
|
|
969
|
-
if (await deleteGeneratedTuiSessionIfEmpty(client, conversationId).catch(() => false)) removedEmptyStartupSessions.add(conversationId);
|
|
970
|
-
}
|
|
971
999
|
client.stop();
|
|
972
1000
|
await drainAndStopTuiSafely(tui);
|
|
973
1001
|
restoreStdio();
|
|
974
|
-
|
|
975
|
-
if (options?.showResumeHint !== false && !currentSessionWasRemoved) process.stdout.write(`\nTo resume this session: ${formatTuiResumeCommand(opts, state.currentConversationId)}\n`);
|
|
1002
|
+
if (options?.showResumeHint !== false) process.stdout.write(`\nTo resume this session: ${formatTuiResumeCommand(opts, state.currentConversationId)}\n`);
|
|
976
1003
|
finishTui?.();
|
|
977
1004
|
process.exit(0);
|
|
978
1005
|
})();
|
|
979
1006
|
};
|
|
980
|
-
const { refreshSessionInfo, loadHistory: loadSessionHistory, loadHistoryWindow, setSession, abortActive, resetCurrentSession, clearChatForSessionSwitch } = createSessionActions({
|
|
1007
|
+
const { refreshSessionInfo, loadHistory: loadSessionHistory, loadHistoryWindow, setSession: changeSession, abortActive, resetCurrentSession, clearChatForSessionSwitch } = createSessionActions({
|
|
981
1008
|
client,
|
|
982
1009
|
chatLog,
|
|
983
1010
|
tui,
|
|
@@ -992,6 +1019,15 @@ async function runTui(opts) {
|
|
|
992
1019
|
},
|
|
993
1020
|
onSessionInfoChange: () => persistCurrentNewSessionContext()
|
|
994
1021
|
});
|
|
1022
|
+
const setSession = async (key) => {
|
|
1023
|
+
clearTimeout(composerDraftTimer);
|
|
1024
|
+
saveComposerDraft();
|
|
1025
|
+
pendingImageAttachments = [];
|
|
1026
|
+
editor.setText("");
|
|
1027
|
+
clearTimeout(composerDraftTimer);
|
|
1028
|
+
await changeSession(key);
|
|
1029
|
+
restoreComposerDraft();
|
|
1030
|
+
};
|
|
995
1031
|
const persistCurrentNewSessionContext = () => {
|
|
996
1032
|
const current = getTuiNewSessionPreferences(tuiSettings, newSessionPreferenceKey);
|
|
997
1033
|
const normalizedProjectId = state.sessionInfo.projectId?.trim() || null;
|
|
@@ -1012,8 +1048,7 @@ async function runTui(opts) {
|
|
|
1012
1048
|
if (initialAgentConfig || projectId) {
|
|
1013
1049
|
await client.patchSession(state.currentConversationId, {
|
|
1014
1050
|
...initialAgentConfig,
|
|
1015
|
-
...projectId ? { projectId } : {}
|
|
1016
|
-
...isGeneratedTuiConversationId(state.currentConversationId) ? GENERATED_TUI_SESSION_SHELL_PATCH : {}
|
|
1051
|
+
...projectId ? { projectId } : {}
|
|
1017
1052
|
});
|
|
1018
1053
|
await refreshSessionInfo();
|
|
1019
1054
|
}
|
|
@@ -1050,10 +1085,7 @@ async function runTui(opts) {
|
|
|
1050
1085
|
const applyStartupWorkingDirectory = async () => {
|
|
1051
1086
|
if (startupWorkingDirectoryApplied || !startupWorkingDirectory) return;
|
|
1052
1087
|
startupWorkingDirectoryApplied = true;
|
|
1053
|
-
await client.patchSession(state.currentConversationId, {
|
|
1054
|
-
workingDirectory: startupWorkingDirectory,
|
|
1055
|
-
...isGeneratedTuiConversationId(state.currentConversationId) ? GENERATED_TUI_SESSION_SHELL_PATCH : {}
|
|
1056
|
-
});
|
|
1088
|
+
await client.patchSession(state.currentConversationId, { workingDirectory: startupWorkingDirectory });
|
|
1057
1089
|
state.sessionInfo.effectiveWorkspacePath = startupWorkingDirectory;
|
|
1058
1090
|
state.sessionInfo.workingDirectoryLocked = true;
|
|
1059
1091
|
};
|
|
@@ -1073,18 +1105,13 @@ async function runTui(opts) {
|
|
|
1073
1105
|
generatedStartupConversationIds.add(targetConversationId);
|
|
1074
1106
|
await setSession(targetConversationId);
|
|
1075
1107
|
currentAgentId = projectAgentId;
|
|
1076
|
-
if (isGeneratedTuiConversationId(state.currentConversationId)) await client.patchSession(state.currentConversationId, GENERATED_TUI_SESSION_SHELL_PATCH);
|
|
1077
1108
|
await client.patchSession(state.currentConversationId, {
|
|
1078
1109
|
projectId: result.project.id,
|
|
1079
|
-
workingDirectory: startupWorkingDirectory
|
|
1080
|
-
...isGeneratedTuiConversationId(state.currentConversationId) ? GENERATED_TUI_SESSION_SHELL_PATCH : {}
|
|
1110
|
+
workingDirectory: startupWorkingDirectory
|
|
1081
1111
|
});
|
|
1082
1112
|
state.sessionInfo.effectiveWorkspacePath = startupWorkingDirectory;
|
|
1083
1113
|
state.sessionInfo.workingDirectoryLocked = true;
|
|
1084
|
-
} else await client.patchSession(state.currentConversationId, {
|
|
1085
|
-
projectId: result.project.id,
|
|
1086
|
-
...isGeneratedTuiConversationId(state.currentConversationId) ? GENERATED_TUI_SESSION_SHELL_PATCH : {}
|
|
1087
|
-
});
|
|
1114
|
+
} else await client.patchSession(state.currentConversationId, { projectId: result.project.id });
|
|
1088
1115
|
const verb = result.created ? "Created project" : "Using project";
|
|
1089
1116
|
chatLog.addStatus(theme.dim(`${verb}: ${result.project.name}`));
|
|
1090
1117
|
};
|
|
@@ -1531,7 +1558,6 @@ async function runTui(opts) {
|
|
|
1531
1558
|
return;
|
|
1532
1559
|
}
|
|
1533
1560
|
chatLog.addUser(userDisplayContentForAttachments(text, attachments));
|
|
1534
|
-
startupSessionHadUserTurn = true;
|
|
1535
1561
|
sessionSnapshot.appendMessage("user", messageText);
|
|
1536
1562
|
lastRetryMessageText = messageText;
|
|
1537
1563
|
markRunSending(state);
|
|
@@ -1686,11 +1712,19 @@ async function runTui(opts) {
|
|
|
1686
1712
|
tui.requestRender();
|
|
1687
1713
|
};
|
|
1688
1714
|
const retryLastMessage = async () => {
|
|
1689
|
-
const
|
|
1715
|
+
const interrupted = state.chatInputState.inputs.find((input) => input.status === "interrupted");
|
|
1716
|
+
const message = interrupted?.content.trim() || lastRetryMessageText?.trim();
|
|
1690
1717
|
if (!message) {
|
|
1691
1718
|
chatLog.addSystem("No previous user message to retry.");
|
|
1692
1719
|
return;
|
|
1693
1720
|
}
|
|
1721
|
+
if (interrupted) {
|
|
1722
|
+
if (pendingImageAttachments.length || pendingNextTurnCustomMessages.length) {
|
|
1723
|
+
chatLog.addSystem("Send or clear the current attachments and context before retrying an interrupted input.");
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
pendingImageAttachments = interrupted.attachments ?? [];
|
|
1727
|
+
}
|
|
1694
1728
|
if (state.activeRunId) await abortActive({ clearUi: false });
|
|
1695
1729
|
sendMessage(message);
|
|
1696
1730
|
};
|
|
@@ -2112,8 +2146,10 @@ async function runTui(opts) {
|
|
|
2112
2146
|
});
|
|
2113
2147
|
defaultEditor.onAction("app.editor.external", openExternalEditor);
|
|
2114
2148
|
defaultEditor.onPasteImage = () => {
|
|
2149
|
+
const conversationId = state.currentConversationId;
|
|
2115
2150
|
(async () => {
|
|
2116
2151
|
const image = await readClipboardImage();
|
|
2152
|
+
if (conversationId !== state.currentConversationId) return;
|
|
2117
2153
|
if (!image) {
|
|
2118
2154
|
chatLog.addStatus(theme.dim("No image found on clipboard."));
|
|
2119
2155
|
tui.requestRender();
|
|
@@ -2138,6 +2174,7 @@ async function runTui(opts) {
|
|
|
2138
2174
|
name,
|
|
2139
2175
|
size: image.bytes.byteLength
|
|
2140
2176
|
});
|
|
2177
|
+
scheduleComposerDraftSave();
|
|
2141
2178
|
chatLog.addStatus(theme.dim(`Attached image: ${name} (${pendingImageAttachments.length} pending). Send a message to include it.`));
|
|
2142
2179
|
tui.requestRender();
|
|
2143
2180
|
})();
|
|
@@ -2269,6 +2306,10 @@ async function runTui(opts) {
|
|
|
2269
2306
|
setConnectionStatus(isLocalMode ? "local ready" : "gateway connected");
|
|
2270
2307
|
touchStreamingActivity();
|
|
2271
2308
|
(async () => {
|
|
2309
|
+
if (!composerDrafts) {
|
|
2310
|
+
composerDrafts = new TuiDraftFileStore(await client.getComposerDraftDirectory());
|
|
2311
|
+
restoreComposerDraft();
|
|
2312
|
+
}
|
|
2272
2313
|
if (!startupConversationCreated) {
|
|
2273
2314
|
await client.createConversation(currentAgentId, state.currentConversationId);
|
|
2274
2315
|
startupConversationCreated = true;
|
|
@@ -2314,7 +2355,6 @@ async function runTui(opts) {
|
|
|
2314
2355
|
} catch {}
|
|
2315
2356
|
await refreshModelChoices();
|
|
2316
2357
|
await loadSessionHistory({ merge: true });
|
|
2317
|
-
cleanupAbandonedTuiSessions(client, state.currentConversationId).catch(() => {});
|
|
2318
2358
|
showStartupCardOnce();
|
|
2319
2359
|
refreshStartupResources().then(() => {
|
|
2320
2360
|
updateFooter();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
|
|
2
|
-
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
3
2
|
import { DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
|
|
3
|
+
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
4
4
|
import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { statSync } from "node:fs";
|
|
@@ -8,15 +8,15 @@ import { ActivityService } from "../activity/service.js";
|
|
|
8
8
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
9
9
|
import { init_session_key, resolveConversationId } from "../routing/session-key.js";
|
|
10
10
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
11
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
12
11
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
12
|
+
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
13
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
13
14
|
import { writeKnowledgeItem } from "../knowledge-memory/repository.js";
|
|
14
15
|
import "../knowledge-memory/index.js";
|
|
15
16
|
import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
16
17
|
import { linkAssertionEvidence, reconcileAssertion } from "../user-model/repository.js";
|
|
17
18
|
import { createPriorityWindow, createUserGoal } from "../user-model/goals.js";
|
|
18
19
|
import "../user-model/index.js";
|
|
19
|
-
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
20
20
|
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, getUnderstandingSourceRun, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceGrantPolicies, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
21
21
|
import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
|
|
22
22
|
import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
|
|
@@ -237,10 +237,7 @@ function sessionMetadata(agentId, peerId) {
|
|
|
237
237
|
peerKind: "direct",
|
|
238
238
|
peerId
|
|
239
239
|
},
|
|
240
|
-
customData: {
|
|
241
|
-
workDiscovery: true,
|
|
242
|
-
genericNewChatShell: false
|
|
243
|
-
}
|
|
240
|
+
customData: { workDiscovery: true }
|
|
244
241
|
};
|
|
245
242
|
}
|
|
246
243
|
function errorCode(error) {
|
|
@@ -2,8 +2,8 @@ import { TaskRepository, init_task_repository } from "../../tasks/task-repositor
|
|
|
2
2
|
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
3
3
|
import { init_conversation_repository, resolveRoutedConversation } from "../../storage/sqlite/conversation-repository.js";
|
|
4
4
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
5
|
-
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
5
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
6
|
+
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
7
7
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
8
8
|
import { getProjectWorkspacePathForSession } from "../../projects/workspace.js";
|
|
9
9
|
import { automationEventPublisher, getAutomationEventForRun } from "../../automations/events/event-repository.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.334",
|
|
4
4
|
"description": "Local-first personal AI for the one-person company, with durable context, tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -160,9 +160,9 @@
|
|
|
160
160
|
"vue": "^3.5.35",
|
|
161
161
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
162
162
|
"@xopcai/computer-control-contract": "0.1.0",
|
|
163
|
+
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
163
164
|
"@xopcai/gateway-contract": "0.0.0",
|
|
164
165
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
165
|
-
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
166
166
|
"@xopcai/realtime-client": "0.0.0",
|
|
167
167
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
168
168
|
},
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Bx0uXbJP.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DHL16aYZ.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-BEeXMfDw.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-BY30D6tg.js","assets/messages-_6IXbP2u.js","assets/cn-JdwAhgNB.js","assets/app-link-C6gA5Nck.js","assets/product-delivery-bv3z8Xkh.js","assets/schemas-88fK3zzl.js","assets/local-apps-Bpja8nC6.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-DcsFzD_i.js","assets/dist-3h6cXXhT.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/capabilities-BnO9LV7U.js","assets/tasks-CDR_RVbQ.js","assets/conversation-identity-Cw0n9uzK.js","assets/files-BK6enEvD.js","assets/tool-activity-BtJkgjFf.js","assets/turn-outcome-D0SnyZ3Z.js","assets/button-CS04eWY9.js","assets/registry-api-BvVx0G1o.js","assets/gateway-startup-retry-i-1lTrwY.js","assets/gateway-config-swr-CgIjCxM8.js","assets/electron-env-Dit0bHgy.js","assets/index-N1e6PDwx.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./ellipsis-0k4rZLoy.js";import{t as s}from"./eye-CABVeTq0.js";import{t as c}from"./markdown-view-BEeXMfDw.js";import{t as l}from"./message-square-plus-XP0tGdlV.js";import{t as u}from"./pencil-DmIY3Oa-.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-_6IXbP2u.js";import{t as m}from"./cn-JdwAhgNB.js";import{c as h,n as g}from"./locale-store-BY30D6tg.js";import{a as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CS04eWY9.js";import{t as E}from"./skeleton-BwbyijEw.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as k}from"./settings-shell-layer-context-BTQUDoJ2.js";import{$c as A,$s as j,Cn as M,Dn as N,En as P,Fn as F,Gn as I,Hn as L,Jo as R,Lc as z,Mc as B,On as V,Pn as H,R as U,Sn as W,Su as G,Tn as ee,Un as K,Wn as q,Wu as J,bn as te,bo as ne,dd as re,fl as ie,gu as ae,hd as oe,ju as se,ol as ce,qn as le,tl as ue,wn as de,xn as fe}from"./index-DHL16aYZ.js";import{r as pe}from"./settings-page-layout-X1x-2Cp9.js";import{t as me}from"./directory-picker-path-field-CUzjJvjs.js";var Y=e(t(),1),X=n(),he={name:``,description:``,language:``,creature:``,emoji:``,avatar:``};function ge(e){let t={...he};if(!e.trim())return t;let n={name:`name`,description:`description`,language:`language`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
|
|
3
|
-
`)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function _e(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Description:** ${e.description}`,`- **Language:** ${e.language}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
|
|
4
|
-
`)}function ve(e,t){if(!e.trim())return _e(t);let n={...t},r=new Set,i={name:`name`,description:`description`,language:`language`,creature:`creature`,emoji:`emoji`,avatar:`avatar`},a=e.split(`
|
|
5
|
-
`).map(e=>{let t=e.match(/^([-*]\s+\*\*)(\w+)(:\*\*\s*)(.*)$/i);if(!t)return e;let a=i[t[2].toLowerCase()];return a?(r.add(a),`${t[1]}${t[2]}${t[3]}${n[a]}`):e}),o=Object.keys(n).filter(e=>!r.has(e));if(o.length>0){a.length>0&&a.at(-1)?.trim()&&a.push(``);for(let e of o){let t=e.charAt(0).toUpperCase()+e.slice(1);a.push(`- **${t}:** ${n[e]}`)}}return a.at(-1)!==``&&a.push(``),a.join(`
|
|
6
|
-
`)}function ye(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 be(e,t){let{frontMatter:n}=ye(e);return`${n}${t}`}var xe=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
|
|
7
|
-
|
|
8
|
-
## Core Truths
|
|
9
|
-
|
|
10
|
-
**Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
|
|
11
|
-
|
|
12
|
-
**Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
|
|
13
|
-
|
|
14
|
-
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
|
|
15
|
-
|
|
16
|
-
**Remember you're a guest.** You have access to someone's life. Treat it with respect.
|
|
17
|
-
|
|
18
|
-
## Boundaries
|
|
19
|
-
|
|
20
|
-
- Private things stay private. Period.
|
|
21
|
-
- When in doubt, ask before acting externally.
|
|
22
|
-
- Never send half-baked replies to messaging surfaces.
|
|
23
|
-
|
|
24
|
-
## Vibe
|
|
25
|
-
|
|
26
|
-
Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
|
|
27
|
-
|
|
28
|
-
## Core Truths
|
|
29
|
-
|
|
30
|
-
**Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
|
|
31
|
-
|
|
32
|
-
**Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
|
|
33
|
-
|
|
34
|
-
**Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
|
|
35
|
-
|
|
36
|
-
**Earn trust by being reliable.** Show up, follow through, and remember what matters.
|
|
37
|
-
|
|
38
|
-
**Respect the intimacy.** You have access to someone's life. That's a privilege.
|
|
39
|
-
|
|
40
|
-
## Boundaries
|
|
41
|
-
|
|
42
|
-
- Private things stay private. Always.
|
|
43
|
-
- When in doubt, ask before acting externally.
|
|
44
|
-
- Be careful in group chats — you're not the user's voice.
|
|
45
|
-
|
|
46
|
-
## Vibe
|
|
47
|
-
|
|
48
|
-
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
|
|
49
|
-
|
|
50
|
-
## Core Truths
|
|
51
|
-
|
|
52
|
-
**Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
|
|
53
|
-
|
|
54
|
-
**Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
|
|
55
|
-
|
|
56
|
-
**Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
|
|
57
|
-
|
|
58
|
-
**Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
|
|
59
|
-
|
|
60
|
-
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
|
|
61
|
-
|
|
62
|
-
## Boundaries
|
|
63
|
-
|
|
64
|
-
- Private things stay private.
|
|
65
|
-
- When in doubt, ask before acting externally.
|
|
66
|
-
- Never send half-baked replies.
|
|
67
|
-
|
|
68
|
-
## Vibe
|
|
69
|
-
|
|
70
|
-
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:``}],Se=[{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:`数字伙伴`}],Z=r(),Ce=()=>i(()=>import(`./block-editor-Bx0uXbJP.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])),we=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([64,1,60,5,65,66,3])),Te=(0,Y.lazy)(()=>Ce().then(e=>({default:e.BlockEditor}))),Ee=(0,Y.lazy)(()=>we().then(e=>({default:e.MarkdownEditor}))),De=[`SOUL.md`,`IDENTITY.md`,`TOOLS.md`,`AGENTS.md`,`HEARTBEAT.md`],Oe={"SOUL.md":``,"IDENTITY.md":``,"TOOLS.md":``,"AGENTS.md":``,"HEARTBEAT.md":``};function ke(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Z.jsx)(E,{className:`h-8 w-52`}),(0,Z.jsx)(E,{className:`h-4 w-full`}),(0,Z.jsx)(E,{className:`h-4 w-4/5`}),(0,Z.jsx)(E,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Ae=(0,Y.forwardRef)(function({agentId:e,zh:t,inputClass:n,name:r,onNameChange:i,onDirtyChange:a},o){let l=R(e=>e.resolved===`dark`),[d,f]=(0,Y.useState)(Oe),[p,h]=(0,Y.useState)(Oe),[g,_]=(0,Y.useState)(!0),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(`SOUL.md`),[D,O]=(0,Y.useState)(`direct`);(0,Y.useEffect)(()=>{let t=!1;return _(!0),y(!1),C(null),f({...Oe}),h({...Oe}),(async()=>{try{let n=await M(e),r=new Set(n.files.filter(e=>!e.missing).map(e=>e.name)),i=await Promise.all(De.map(async t=>[t,r.has(t)?await W(e,t):``]));if(t)return;let a={...Oe};for(let[e,t]of i)a[e]=t;f(a),h(a)}catch(e){if(t)return;y(!0),C(e instanceof Error?e.message:String(e))}finally{t||_(!1)}})(),()=>{t=!0}},[e]);let k=(0,Y.useMemo)(()=>De.some(e=>d[e]!==p[e]),[p,d]);(0,Y.useEffect)(()=>a(k),[k,a]);let j=(0,Y.useCallback)(async()=>{let t=De.filter(e=>d[e]!==p[e]);if(t.length!==0){x(!0),C(null);try{await Promise.all(t.map(t=>ee(e,t,d[t]))),h({...d})}catch(e){throw C(e instanceof Error?e.message:String(e)),e}finally{x(!1)}}},[e,p,d]);(0,Y.useImperativeHandle)(o,()=>({save:j}),[j]);let N=(0,Y.useMemo)(()=>ge(d[`IDENTITY.md`]),[d]),P=(0,Y.useMemo)(()=>({...N,name:N.name||r}),[N,r]),F=e=>{let t={...P,...e};f(e=>({...e,"IDENTITY.md":ve(e[`IDENTITY.md`],t)})),e.name!==void 0&&i(e.name)},I={"SOUL.md":{label:t?`个性与边界`:`Personality & boundaries`,description:t?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"IDENTITY.md":{label:t?`身份资料`:`Identity`,description:t?`智能体如何介绍自己;上方表单与此文件保持同步。`:`How the agent presents itself; synchronized with the form above.`},"TOOLS.md":{label:t?`工具说明`:`Tool guidance`,description:t?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:t?`工作规范`:`Working instructions`,description:t?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`},"HEARTBEAT.md":{label:t?`主动检查`:`Heartbeat`,description:t?`定期唤醒时需要检查和处理的事项。`:`What to inspect and handle during scheduled wake-ups.`}},L=[re,ae,J,u],z=ye(d[w]).body;return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,Z.jsx)(A,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`智能体身份`:`Agent identity`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`这些内容会写入 IDENTITY.md,并用于智能体自我介绍。`:`These fields are written to IDENTITY.md and shape how the agent introduces itself.`})]})]}),g?(0,Z.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(E,{className:`h-16`}),(0,Z.jsx)(E,{className:`h-16`}),(0,Z.jsx)(E,{className:`h-16`}),(0,Z.jsx)(E,{className:`h-16`})]}):v?(0,Z.jsx)(`p`,{className:`mt-5 text-sm text-fg-muted`,children:t?`身份资料暂时无法加载,请关闭后重试。`:`Identity details could not be loaded. Close the editor and try again.`}):(0,Z.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`名称`:`Name`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,value:P.name,onChange:e=>F({name:e.target.value}),placeholder:t?`例如:小助`:`e.g. Nova`})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`一句话介绍`:`Description`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,value:P.description,onChange:e=>F({description:e.target.value}),placeholder:t?`擅长什么、如何帮助你`:`What this agent is great at`})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`类型`:`Type`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,list:`agent-creatures-${e}`,value:P.creature,onChange:e=>F({creature:e.target.value}),placeholder:t?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Z.jsx)(`datalist`,{id:`agent-creatures-${e}`,children:Se.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:t?e.labelZh:e.labelEn},e.value))})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`主要语言`:`Primary language`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,value:P.language,onChange:e=>F({language:e.target.value}),placeholder:t?`例如:简体中文`:`e.g. English`})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`签名表情`:`Signature emoji`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,value:P.emoji,onChange:e=>F({emoji:e.target.value}),placeholder:`✨`})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[t?`头像地址`:`Avatar URL or path`,(0,Z.jsx)(`input`,{className:`${n} mt-1.5`,value:P.avatar,onChange:e=>F({avatar:e.target.value}),placeholder:t?`URL 或本地路径`:`URL or local path`})]})]})]}),(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-4 sm:px-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Z.jsx)(se,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`角色配置`:`Profile documents`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`五类角色文件均可编辑。默认使用所见即所得编辑器,熟悉 Markdown 时再切换源码。`:`All five profile documents are editable. The visual editor is the default; switch to Markdown source only when needed.`})]})]}),(0,Z.jsx)(`div`,{className:`mt-4 flex gap-1 overflow-x-auto`,role:`tablist`,"aria-label":t?`角色配置文件`:`Profile documents`,children:De.map(e=>(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":w===e,onClick:()=>{T(e),O(`direct`)},className:m(`min-h-10 shrink-0 rounded-lg px-3 py-2 font-mono text-xs font-medium transition-colors`,w===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e},e))})]}),(0,Z.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:I[w].label}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[w].description})]}),(0,Z.jsx)(`div`,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":t?`编辑模式`:`Editor mode`,children:[[`direct`,u,t?`直接编辑`:`Visual`],[`source`,J,`Markdown`],[`preview`,s,t?`预览`:`Preview`]].map(([e,t,n])=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>O(e),"aria-pressed":D===e,className:m(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,D===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),w===`SOUL.md`&&!g?(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:t?`从模板开始`:`Start from a template`}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:xe.map((e,n)=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&f(t=>({...t,"SOUL.md":be(t[`SOUL.md`],e.content)})),O(`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,Z.jsx)(L[n]??oe,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t?e.labelZh:e.labelEn]},e.id))})]}):null,S?(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:S}):null,(0,Z.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,role:`tabpanel`,children:g?(0,Z.jsx)(ke,{}):v?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:t?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):D===`direct`?(0,Z.jsx)(Y.Suspense,{fallback:(0,Z.jsx)(ke,{}),children:(0,Z.jsx)(Te,{initialContent:z,onChange:e=>f(t=>({...t,[w]:be(t[w],e)})),placeholder:t?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${w}-direct`)}):D===`source`?(0,Z.jsx)(Y.Suspense,{fallback:(0,Z.jsx)(ke,{}),children:(0,Z.jsx)(Ee,{initialContent:d[w],onChange:e=>f(t=>({...t,[w]:e})),isDark:l,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${w}-source`)}):(0,Z.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:z.trim()?(0,Z.jsx)(c,{content:z}):(0,Z.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t?`暂无内容。`:`No content yet.`})})}),(0,Z.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:b?t?`正在保存角色配置…`:`Saving profile documents…`:k?t?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:t?`角色配置已保存`:`Profile documents saved`})]})]})]})}),je=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],Q=`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 Me(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function Ne(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Pe(e){let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.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 $(e){let t=(0,X.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.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,Z.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,Z.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,Z.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 Fe(e){let t=(0,X.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Ie(e){let t=(0,X.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,Z.jsx)(Pe,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,Z.jsx)(Pe,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,Z.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,Z.jsx)(T,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let y;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(y=l&&i!==null?(0,Z.jsx)(T,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=y):y=t[28];let b;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(b=u&&i!==null?(0,Z.jsx)(T,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=b):b=t[33];let x;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(x=d?null:(0,Z.jsx)(T,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=x):x=t[39];let S;t[40]!==y||t[41]!==b||t[42]!==x||t[43]!==v?(S=(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[v,y,b,x]}),t[40]=y,t[41]=b,t[42]=x,t[43]=v,t[44]=S):S=t[44];let C;t[45]!==S||t[46]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,S]}),t[45]=S,t[46]=_,t[47]=C):C=t[47];let w;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(w=d?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:Me(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=w):w=t[52];let E;return t[53]!==C||t[54]!==w?(E=(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[C,w]}),t[53]=C,t[54]=w,t[55]=E):E=t[55],E}function Le(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Re({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:c,onDelete:u}){let[d,f]=(0,Y.useState)(`overview`),[h,g]=(0,Y.useState)(()=>structuredClone(e.override)),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),E=(0,Y.useRef)(null),D=JSON.stringify(h)!==JSON.stringify(e.override)||C,O=[h.models?.chat,...Object.values(h.models?.intents??{}),h.models?.imageUnderstanding,h.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,Y.useEffect)(()=>a(D),[D,a]);let k=(0,Y.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(h.tools??{})])].sort(),[e.effective.tools,h.tools,t]),j=[h.models?n?`模型`:`Models`:null,h.skills?n?`技能`:`Skills`:null,h.tools?n?`工具权限`:`Tool access`:null,h.runtime||h.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),M=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,N=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,F=h.profile?.name??e.name??e.id,I=p(n?`zh`:`en`).chat.workingDirectory,L={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},R={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},V=async()=>{v(!0),b(null);try{await E.current?.save();let t=(await P(e.id,{workspace:h.workspace??null,profile:h.profile,models:h.models??null,skills:h.skills??null,tools:h.tools??null,workflows:h.workflows??null,runtime:h.runtime??null})).agents.find(t=>t.id===e.id);t&&g(structuredClone(t.override)),w(!1)}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},H=async()=>{v(!0),b(null);try{await P(e.id,{setDefault:!0})}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},U=(e,t)=>{let n={...h.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},g({...h,tools:Object.keys(n).length>0?n:void 0})},W=(e,t)=>{let n={...h.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,g({...h,models:Object.keys(n).length>0?n:void 0})},ee=(0,Y.useCallback)(e=>{w(e)},[]);return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Z.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,Z.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:G},{id:`profile`,label:n?`个性`:`Profile`,icon:B},{id:`models`,label:n?`模型`:`Models`,icon:A},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:oe},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:G},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:z}].map(({id:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{f(e),e===`profile`&&S(!0)},className:m(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,d===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Z.jsx)(n,{className:`size-4`}),t]},e))})}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[y||i?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:y??i}):null,d===`overview`?(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)($,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Z.jsxs)(T,{onClick:c,children:[(0,Z.jsx)(l,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Z.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,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:j.length>0?n?`已自定义:${j.join(`、`)}`:`Customized: ${j.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:j.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Z.jsx)(T,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(Fe,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:h.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Z.jsx)(Fe,{label:n?`技能`:`Skills`,value:N,detail:h.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Z.jsx)(Fe,{label:n?`工具权限`:`Tool access`,value:M>0?n?`${M} 个禁用`:`${M} denied`:n?`全部可用`:`All available`,detail:h.tools?n?`${Object.keys(h.tools).length} 个本地覆盖`:`${Object.keys(h.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Z.jsx)(Fe,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:h.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Z.jsx)(T,{onClick:()=>void H(),disabled:_,children:n?`设为默认智能体`:`Make default agent`})]}):null,x?(0,Z.jsxs)(`div`,{className:m(`space-y-6`,d!==`profile`&&`hidden`),children:[(0,Z.jsx)($,{title:n?`身份、个性与工作区`:`Identity, behavior, and workspace`,description:n?`完整管理这个智能体的身份资料、五类角色文件和工作目录。`:`Manage this agent’s identity, all five profile documents, and working directory.`}),(0,Z.jsx)(Ae,{ref:E,agentId:e.id,zh:n,inputClass:Q,name:F,onNameChange:e=>g(t=>({...t,profile:{name:e,...t.profile?.instructions?{instructions:t.profile.instructions}:{}}})),onDirtyChange:ee}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Z.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.`})]}),h.workspace?(0,Z.jsxs)(T,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>g(e=>({...e,workspace:void 0})),children:[(0,Z.jsx)(ie,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Z.jsx)(Pe,{children:n?`自动`:`Automatic`})]}),(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(me,{value:h.workspace??``,onChange:e=>g(t=>({...t,workspace:e||void 0})),wd:I,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${Q} font-mono`,disabled:_})})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`仅用于需要高优先级补充的简短规则;完整个性与规范建议写入上方角色配置。`:`Use this for short, high-priority additions. Keep the full personality and operating guidance in the profile documents above.`}),(0,Z.jsx)(`textarea`,{rows:4,className:`${Q} mt-4 resize-y leading-6`,value:h.profile?.instructions??``,onChange:t=>g(n=>({...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`})]})]}):null,d===`models`?(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)($,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:h.models?(0,Z.jsxs)(T,{variant:`ghost`,onClick:()=>g({...h,models:void 0}),children:[(0,Z.jsx)(ie,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Z.jsx)(Ie,{label:r.editorChatModel,inherited:e.effective.models.chat,value:h.models?.chat,zh:n,onChange:e=>{let t={...h.models??{}};e?t.chat=e:delete t.chat,g({...h,models:Object.keys(t).length>0?t:void 0})}}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Z.jsx)(`div`,{className:`space-y-3`,children:je.map(t=>(0,Z.jsx)(Ie,{label:L[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:h.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>W(t,e)},t))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Ie,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:h.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...h.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,g({...h,models:Object.keys(t).length>0?t:void 0})}}),(0,Z.jsx)(Ie,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:h.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...h.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:h.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:h.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},g({...h,models:Object.keys(n).length>0?n:void 0})}}),h.models?.imageGeneration?(0,Z.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Z.jsx)(`input`,{type:`number`,min:1,className:`${Q} mt-1.5`,value:h.models.imageGeneration.timeoutMs??``,onChange:e=>g({...h,models:{...h.models,imageGeneration:{...h.models.imageGeneration,timeoutMs:Ne(e.target.value)}}})})]}),(0,Z.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Z.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>g({...h,models:{...h.models,imageGeneration:{...h.models.imageGeneration,autoProviderFallback:e}}}),className:m(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,h.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,d===`capabilities`?(0,Z.jsxs)(`div`,{className:`space-y-7`,children:[(0,Z.jsx)($,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),h.skills?(0,Z.jsxs)(T,{variant:`ghost`,onClick:()=>g({...h,skills:void 0}),children:[(0,Z.jsx)(ie,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Z.jsx)(T,{variant:h.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>g({...h,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Z.jsx)(T,{variant:h.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>g({...h,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),h.skills?.mode===`merge`?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5`,value:h.skills.add.join(`, `),onChange:e=>g({...h,skills:{mode:`merge`,add:Me(e.target.value),remove:h.skills?.mode===`merge`?h.skills.remove:[]}})})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5`,value:h.skills.remove.join(`, `),onChange:e=>g({...h,skills:{mode:`merge`,add:h.skills?.mode===`merge`?h.skills.add:[],remove:Me(e.target.value)}})})]})]}):null,h.skills?.mode===`replace`?(0,Z.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5`,value:h.skills.include.join(`, `),onChange:e=>g({...h,skills:{mode:`replace`,include:Me(e.target.value)}})})]}):null]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),h.tools?(0,Z.jsxs)(T,{variant:`ghost`,onClick:()=>g({...h,tools:void 0}),children:[(0,Z.jsx)(ie,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:k.map(t=>{let r=h.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Z.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${R[i]}`})]}),(0,Z.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>U(t,e),className:m(`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:R[e]},e))})]},t)})})]})]}):null,d===`runtime`?(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)($,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:h.runtime||h.workflows?(0,Z.jsxs)(T,{variant:`ghost`,onClick:()=>g({...h,runtime:void 0,workflows:void 0}),children:[(0,Z.jsx)(ie,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Z.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,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,h.runtime?.[t]===void 0?(0,Z.jsx)(Pe,{children:n?`继承`:`Inherited`}):null]}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:`${Q} mt-1.5`,value:h.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Le({...h.runtime??{},[t]:Ne(e.target.value)});g({...h,runtime:n})}})]},t))}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5`,value:h.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Le({...h.workflows??{},default:e.target.value||void 0});g({...h,workflows:t})}})]}),(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,Z.jsx)(`input`,{className:`${Q} mt-1.5`,value:h.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=Me(e.target.value),n=Le({...h.workflows??{},allowed:t.length>0?t:void 0});g({...h,workflows:n})}})]})]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),h.runtime?.promptCache?(0,Z.jsxs)(T,{variant:`ghost`,onClick:()=>{let e=Le({...h.runtime??{},promptCache:void 0});g({...h,runtime:e})},children:[(0,Z.jsx)(ie,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),h.runtime?.promptCache?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Z.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>g({...h,runtime:{...h.runtime,promptCache:{...h.runtime.promptCache,mode:e}}}),className:m(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,h.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Z.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Z.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>g({...h,runtime:{...h.runtime,promptCache:{...h.runtime.promptCache,lifetime:e}}}),className:m(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,h.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Z.jsx)(T,{className:`mt-4`,onClick:()=>g({...h,runtime:{...h.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,d===`danger`?(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)($,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,Z.jsx)(T,{disabled:_,onClick:()=>void H(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,Z.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,Z.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,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Z.jsxs)(T,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Z.jsx)(z,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,Z.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,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:O?n?`请补全自定义模型`:`Complete the custom model reference`:D?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(T,{onClick:o,children:n?`关闭`:`Close`}),(0,Z.jsx)(T,{variant:`primary`,disabled:_||!D||O||h.profile!==void 0&&!h.profile.name.trim(),onClick:()=>void V(),children:_?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function ze(e){let t=(0,X.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[s,c]=(0,Y.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(_,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim`,O)}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,D,`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]=u):u=t[1];let d;t[2]!==n.avatar||t[3]!==n.id?(d=(0,Z.jsx)(U,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=d):d=t[4];let p;t[5]!==n||t[6]!==r?(p=V(n,r),t[5]=n,t[6]=r,t[7]=p):p=t[7];let h;t[8]===p?h=t[9]:(h=(0,Z.jsx)(S,{className:`truncate text-base font-semibold text-fg`,children:p}),t[8]=p,t[9]=h);let g;t[10]===n.id?g=t[11]:(g=(0,Z.jsx)(v,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=g);let w;t[12]!==h||t[13]!==g?(w=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=w):w=t[14];let T;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(T=n.isDefault?(0,Z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=T):T=t[17];let E;t[18]!==d||t[19]!==w||t[20]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[d,w,T]}),t[18]=d,t[19]=w,t[20]=T,t[21]=E):E=t[21];let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(f,{className:`size-4`}),t[22]=A):A=t[22];let j;t[23]===r.closeDialogAria?j=t[24]:(j=(0,Z.jsx)(y,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:A})}),t[23]=r.closeDialogAria,t[24]=j);let M;t[25]!==j||t[26]!==E?(M=(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[E,j]}),t[25]=j,t[26]=E,t[27]=M):M=t[27];let N;t[28]!==o||t[29]!==s||t[30]!==M?(N=(0,Z.jsxs)(b,{children:[l,(0,Z.jsx)(x,{ref:c,className:u,onOpenAutoFocus:Be,children:(0,Z.jsxs)(k,{layer:`modal`,portalContainer:s,children:[M,o]})})]}),t[28]=o,t[29]=s,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==a||t[33]!==i||t[34]!==N?(P=(0,Z.jsx)(C,{open:i,onOpenChange:a,children:N}),t[32]=a,t[33]=i,t[34]=N,t[35]=P):P=t[35],P}function Be(e){return e.preventDefault()}function Ve(e){let t=(0,X.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=V(e,i),n=N(e,i);return(0,Z.jsx)(`li`,{className:`min-h-0`,children:(0,Z.jsxs)(`article`,{className:m(`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,Z.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Z.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(U,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Z.jsx)(`span`,{className:m(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,Z.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,Z.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,Z.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,Z.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,Z.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Z.jsxs)(T,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,Z.jsx)(l,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,Z.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var He=`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 Ue(e){let t=(0,X.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(_,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim`,O)}),t[0]=d):d=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=m(`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`,D),t[1]=p):p=t[1];let h;t[2]===a.manualCreateTitle?h=t[3]:(h=(0,Z.jsx)(S,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=h);let g;t[4]===a.manualCreateDescription?g=t[5]:(g=(0,Z.jsx)(v,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=g);let w;t[6]!==h||t[7]!==g?(w=(0,Z.jsxs)(`div`,{children:[h,g]}),t[6]=h,t[7]=g,t[8]=w):w=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(f,{className:`size-4`,"aria-hidden":!0}),t[9]=E):E=t[9];let k;t[10]===a.manualCreateClose?k=t[11]:(k=(0,Z.jsx)(y,{asChild:!0,children:(0,Z.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:E})}),t[10]=a.manualCreateClose,t[11]=k);let A;t[12]!==w||t[13]!==k?(A=(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[w,k]}),t[12]=w,t[13]=k,t[14]=A):A=t[14];let j;t[15]===i?j=t[16]:(j=i?(0,Z.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]=j);let M;t[17]===s?M=t[18]:(M=e=>s({name:e.target.value}),t[17]=s,t[18]=M);let N;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==M?(N=(0,Z.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${He} mt-1.5`,value:n.name,onChange:M,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=M,t[22]=N):N=t[22];let P;t[23]!==a.manualCreateName||t[24]!==N?(P=(0,Z.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,N]}),t[23]=a.manualCreateName,t[24]=N,t[25]=P):P=t[25];let F;t[26]===s?F=t[27]:(F=e=>s({instructions:e.target.value}),t[26]=s,t[27]=F);let I;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==F?(I=(0,Z.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${He} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:F,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=F,t[31]=I):I=t[31];let L;t[32]!==a.manualCreateInstructions||t[33]!==I?(L=(0,Z.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,I]}),t[32]=a.manualCreateInstructions,t[33]=I,t[34]=L):L=t[34];let R;t[35]===a.manualCreateWorkspace?R=t[36]:(R=(0,Z.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=R);let z;t[37]===a.manualCreateWorkspaceHint?z=t[38]:(z=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=z);let B;t[39]===s?B=t[40]:(B=e=>s({workspace:e}),t[39]=s,t[40]=B);let V;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==B||t[46]!==o?(V=(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(me,{value:n.workspace,onChange:B,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${He} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=B,t[46]=o,t[47]=V):V=t[47];let H;t[48]!==R||t[49]!==z||t[50]!==V?(H=(0,Z.jsxs)(`div`,{children:[R,z,V]}),t[48]=R,t[49]=z,t[50]=V,t[51]=H):H=t[51];let U;t[52]!==j||t[53]!==P||t[54]!==L||t[55]!==H?(U=(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[j,P,L,H]}),t[52]=j,t[53]=P,t[54]=L,t[55]=H,t[56]=U):U=t[56];let W;t[57]!==r||t[58]!==a.manualCreateCancel?(W=(0,Z.jsx)(y,{asChild:!0,children:(0,Z.jsx)(T,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=W):W=t[59];let G;t[60]!==r||t[61]!==n.name?(G=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=G):G=t[62];let ee=r?a.manualCreating:a.manualCreateSubmit,K;t[63]!==r||t[64]!==c||t[65]!==G||t[66]!==ee?(K=(0,Z.jsx)(T,{variant:`primary`,disabled:G,"aria-busy":r,onClick:c,children:ee}),t[63]=r,t[64]=c,t[65]=G,t[66]=ee,t[67]=K):K=t[67];let q;t[68]!==W||t[69]!==K?(q=(0,Z.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[W,K]}),t[68]=W,t[69]=K,t[70]=q):q=t[70];let J;t[71]!==U||t[72]!==q||t[73]!==A?(J=(0,Z.jsxs)(b,{children:[d,(0,Z.jsxs)(x,{className:p,children:[A,U,q]})]}),t[71]=U,t[72]=q,t[73]=A,t[74]=J):J=t[74];let te;return t[75]!==n.open||t[76]!==l||t[77]!==J?(te=(0,Z.jsx)(C,{open:u,onOpenChange:l,children:J}),t[75]=n.open,t[76]=l,t[77]=J,t[78]=te):te=t[78],te}var We=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,Ge=`max-w-7xl`;function Ke(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(E,{className:`h-7 w-28`}),(0,Z.jsx)(E,{className:`h-4 w-80 max-w-full`})]}),(0,Z.jsx)(E,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(pe,{gap:`gap-5`,padding:We,className:Ge,children:[t,(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(qe)})]}),e[1]=n):n=e[1],n}function qe(e){return(0,Z.jsx)(E,{className:`h-64 rounded-2xl`},e)}function Je({agentId:e,onHeaderActionChange:t}){let n=h(e=>e.conversationId),r=g(e=>e.language),i=r===`zh`,s=p(r),c=s.agentsSettings,l=a(),{data:u,error:f,isLoading:_,mutate:v}=w(n?`settings-gateway-agents`:null,de),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),[C,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)({open:!1,name:``,instructions:``,workspace:``}),k=(0,Y.useRef)(!1),A=u?.agents.find(t=>t.id===e),M=(0,Y.useCallback)(()=>{u&&(S(null),ne(u.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:c.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:u.defaultId}}))},[c.setupDraftPrefix,u,l]),N=(0,Y.useCallback)(async()=>{if(!(y||!D.name.trim())){b(!0),E(null);try{let e=await te({profile:{name:D.name.trim(),...D.instructions.trim()?{instructions:D.instructions.trim()}:{}},...D.workspace.trim()?{workspace:D.workspace.trim()}:{}});O({open:!1,name:``,instructions:``,workspace:``}),ne(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){E(e instanceof Error?e.message:String(e))}finally{b(!1)}}},[y,D,l]),P=(0,Y.useMemo)(()=>({overflow:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(le,{asChild:!0,children:(0,Z.jsx)(T,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":s.capabilitiesHub.moreActions,title:s.capabilitiesHub.moreActions,children:(0,Z.jsx)(o,{className:`size-4`,"aria-hidden":!0})})}),(0,Z.jsx)(q,{children:(0,Z.jsxs)(L,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(K,{className:m(`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`,j.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Z.jsx)(ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Z.jsxs)(K,{className:m(`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`,j.transition),onSelect:()=>{E(null),O(e=>({...e,open:!0}))},children:[(0,Z.jsx)(ue,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),c.manualCreateMenu]})]})})]}),primary:(0,Z.jsxs)(T,{variant:`primary`,className:`shrink-0`,"aria-label":c.listNewAgentCard,onClick:M,children:[(0,Z.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:c.listNewAgentCard})]})}),[c.listNewAgentCard,c.manualCreateMenu,s.capabilitiesHub.moreActions,l,M,i]);(0,Y.useLayoutEffect)(()=>(t?.(P),()=>t?.(null)),[P,t]);let R=async e=>{let t=V(e,c);if(window.confirm(i?`删除 ${t}?此操作无法撤销。`:`Delete ${t}? This cannot be undone.`)){b(!0),S(null);try{await fe(e.id),l(H)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}},z=e=>{ne(e),l(`/chat/new`)},B=e=>{k.current=!1,window.setTimeout(()=>l(F(e)),0)},U=()=>{k.current&&!window.confirm(i?`放弃未保存的更改?`:`Discard unsaved changes?`)||(k.current=!1,l(H))},W=()=>{k.current&&!window.confirm(i?`放弃未保存的更改?`:`Discard unsaved changes?`)||(k.current=!1,l(`/settings/agent-defaults`))},G=(0,Y.useCallback)(e=>{k.current=e},[]);return n?f&&!u?(0,Z.jsxs)(pe,{className:Ge,padding:We,children:[(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(f)}),(0,Z.jsx)(T,{onClick:()=>void v(),children:i?`重试`:`Retry`})]}):_||!u?(0,Z.jsx)(Ke,{}):(0,Z.jsxs)(pe,{gap:`gap-5`,className:Ge,padding:We,children:[(f||x)&&!A?(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(f)}):null,(0,Z.jsx)(Ve,{agents:u.agents,busy:y,messages:c,onOpen:B,onChat:z}),A?(0,Z.jsx)(ze,{agent:A,messages:c,open:!0,onOpenChange:e=>{e||U()},children:(0,Z.jsx)(Re,{agent:A,toolIds:u.builtinToolIds,zh:i,messages:c,externalError:x,onDirtyChange:G,onClose:U,onOpenDefaults:W,onChat:()=>z(A.id),onDelete:()=>void R(A)},A.id)}):null,(0,Z.jsx)(Ue,{draft:D,busy:y,error:C,messages:c,workingDirectoryMessages:s.chat.workingDirectory,onChange:e=>O(t=>({...t,...e})),onCreate:()=>void N(),onOpenChange:e=>{y||(O(t=>({...t,open:e})),e||E(null))}})]}):(0,Z.jsx)(pe,{className:Ge,padding:We,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{Je as AgentsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i,t as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-BEeXMfDw.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-_6IXbP2u.js";import{t as m}from"./cn-JdwAhgNB.js";import{c as h,i as g,n as _,r as v}from"./locale-store-BY30D6tg.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-CS04eWY9.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$s as k,Al as A,Bo as j,Fo as M,Gn as N,Hn as P,Ho as F,Io as I,Lc as ee,Lo as L,Ma as R,No as z,Po as B,Rc as te,Td as ne,Un as V,Wn as H,id as U,il as re,md as W,ol as G,qn as K}from"./index-DHL16aYZ.js";import{n as q,t as J}from"./capability-header-actions-D_hbWRRF.js";import{t as Y}from"./page-tabs-BhYBCqls.js";import{t as ie}from"./agent-plugin-dialog-CacyndrS.js";import{t as X}from"./capability-icon-BYm2-nS-.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ce(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=p(_(e=>e.language)).extensionsPage,r=h(e=>!!e.conversationId),i=B(),{mutate:a}=T(),[o,s]=(0,Z.useReducer)(R,pe),{debounced:c,detailPkg:l,rowBusy:d,actionError:f,restartHint:g}=o,v=r?`marketplace-${c}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>s({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:y,isLoading:b,error:x}=E(v,()=>oe(c),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(()=>{a(`gateway-extensions-list`),j()},[a]),C=(0,Z.useCallback)(async(e,t)=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await le({name:e,overwrite:t});S(),r.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceInstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceInstallFailed,n.marketplaceRestartHint,S]),w=(0,Z.useCallback)(async e=>{s({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);S(),t.requiresGatewayRestart&&s({type:`patch`,patch:{restartHint:n.marketplaceRestartHint}})}catch(e){throw s({type:`patch`,patch:{actionError:e instanceof Error?e.message:n.marketplaceUninstallFailed}}),e}finally{s({type:`patch`,patch:{rowBusy:null}})}},[n.marketplaceRestartHint,n.marketplaceUninstallFailed,S]),D=y??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[x?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x instanceof Error?x.message:n.marketplaceLoadFailed}):null,f?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,g?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g}):null,b&&!y?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":n.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(O,{className:`h-5 w-40`}),(0,$.jsx)(O,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(O,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(O,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:D.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:n.marketplaceEmpty}):D.map(e=>{let t=fe(i,e.id),r=d===e.id;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${n.marketplaceDetailTitle}`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s({type:`patch`,patch:{detailPkg:e.id}}))},className:m(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:A}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,$.jsx)(U,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:n.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:n.marketplaceInstalled}),(0,$.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>{window.confirm(n.marketplaceUninstallConfirm)&&w(e.id).catch(()=>{})},className:m(`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:[r?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>s({type:`patch`,patch:{detailPkg:e.id}}),className:m(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.marketplaceReview})})]})},e.id)})}),l?(0,$.jsx)(he,{packageName:l,copy:n,extensions:i,onClose:()=>s({type:`patch`,patch:{detailPkg:null}}),onInstall:C,onUninstall:w}):null]})}function he(e){let t=(0,ae.c)(93),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:c}=e,[d,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),v=h(be)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>ce(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:k,isLoading:A}=E(v,b,T),j;t[3]!==i||t[4]!==n?(j=fe(i,n),t[3]=i,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,P=D?.manifest?.permissions,F,I,L,R,z,B,V,H,U,W,G,K;if(t[6]!==r||t[7]!==D||t[8]!==k||t[9]!==i||t[10]!==M||t[11]!==A||t[12]!==o||t[13]!==n||t[14]!==P||t[15]!==g){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],a;t[28]!==r||t[29]!==D?(a=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[28]=r,t[29]=D,t[30]=a):a=t[30];let s=a;if(D?.format===`agent-plugin`){let e;if(t[31]!==D||t[32]!==i){let n;t[34]===D?n=t[35]:(n=e=>e.pluginId===D.manifest?.name,t[34]=D,t[35]=n),e=i.find(n),t[31]=D,t[32]=i,t[33]=e}else e=t[33];let r=`store:${n}`,a;t[36]!==o||t[37]!==e||t[38]!==r?(a=(0,$.jsx)(ie,{extension:e,initialSource:r,onClose:o}),t[36]=o,t[37]=e,t[38]=r,t[39]=a):a=t[39],B=a;break bb0}L=w,R=!0,t[40]===o?z=t[41]:(z=e=>!e&&o(),t[40]=o,t[41]=z),I=x,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[42]=K):K=t[42],F=S,U=`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`,W=ye;let c;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(ne,{className:`size-5`}),t[43]=c):c=t[43];let u;t[44]!==r.detailBack||t[45]!==o?(u=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:c}),t[44]=r.detailBack,t[45]=o,t[46]=u):u=t[46];let d;t[47]===r.marketplaceDetailTitle?d=t[48]:(d=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[47]=r.marketplaceDetailTitle,t[48]=d);let p;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(f,{className:`size-5`}),t[49]=p):p=t[49];let m;t[50]!==r.detailClose||t[51]!==o?(m=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:p}),t[50]=r.detailClose,t[51]=o,t[52]=m):m=t[52],t[53]!==u||t[54]!==d||t[55]!==m?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[u,d,m]}),t[53]=u,t[54]=d,t[55]=m,t[56]=G):G=t[56],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=A&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,$.jsx)(O,{className:`h-6 w-48`}),(0,$.jsx)(O,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(O,{className:`h-12`}),(0,$.jsx)(O,{className:`h-12`})]}),(0,$.jsx)(O,{className:`h-28 w-full`}),(0,$.jsx)(O,{className:`h-36 w-full`})]}):k?(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:r.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:k instanceof Error?k.message:r.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.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:D.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:r.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`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:[D.installability.available?(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(ee,{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:D.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.marketplaceUnavailableBody})]})]}),D.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:r.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,D.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:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:s})})]}):null}t[6]=r,t[7]=D,t[8]=k,t[9]=i,t[10]=M,t[11]=A,t[12]=o,t[13]=n,t[14]=P,t[15]=g,t[16]=F,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K}else F=t[16],I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let q;t[57]!==V||t[58]!==H?(q=(0,$.jsx)(`div`,{className:V,children:H}),t[57]=V,t[58]=H,t[59]=q):q=t[59];let J;t[60]!==d||t[61]!==r.marketplaceBuiltinGoBuiltin||t[62]!==r.marketplaceBuiltinManageHint||t[63]!==r.marketplaceInstall||t[64]!==r.marketplaceReinstall||t[65]!==r.marketplaceReinstallConfirm||t[66]!==r.marketplaceUninstall||t[67]!==r.marketplaceUninstallConfirm||t[68]!==D||t[69]!==M||t[70]!==o||t[71]!==s||t[72]!==c||t[73]!==n||t[74]!==g||t[75]!==N?(J=D?(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:M===`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:r.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{to:`/capabilities/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(p(!0),s(n,N).catch(_e).finally(()=>p(!1)))},className:m(`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,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(p(!0),c(n).then(()=>o()).catch(ge).finally(()=>p(!1)))},className:m(`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)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[60]=d,t[61]=r.marketplaceBuiltinGoBuiltin,t[62]=r.marketplaceBuiltinManageHint,t[63]=r.marketplaceInstall,t[64]=r.marketplaceReinstall,t[65]=r.marketplaceReinstallConfirm,t[66]=r.marketplaceUninstall,t[67]=r.marketplaceUninstallConfirm,t[68]=D,t[69]=M,t[70]=o,t[71]=s,t[72]=c,t[73]=n,t[74]=g,t[75]=N,t[76]=J):J=t[76];let Y;t[77]!==F||t[78]!==q||t[79]!==J||t[80]!==U||t[81]!==W||t[82]!==G?(Y=(0,$.jsxs)(F,{className:U,onOpenAutoFocus:W,children:[G,q,J]}),t[77]=F,t[78]=q,t[79]=J,t[80]=U,t[81]=W,t[82]=G,t[83]=Y):Y=t[83];let X;t[84]!==I||t[85]!==Y||t[86]!==K?(X=(0,$.jsxs)(I,{children:[K,Y]}),t[84]=I,t[85]=Y,t[86]=K,t[87]=X):X=t[87];let Q;return t[88]!==L||t[89]!==R||t[90]!==z||t[91]!==X?(Q=(0,$.jsx)(L,{defaultOpen:R,onOpenChange:z,children:X}),t[88]=L,t[89]=R,t[90]=z,t[91]=X,t[92]=Q):Q=t[92],Q}function ge(){}function _e(){}function ve(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 ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=_(e=>e.language),r=p(n),o=F(e=>e.setPageHeader),c=F(e=>e.clearPageHeader),l=B(),u=M(),[f,h]=i(),g=Q(f.get(`tab`)),v=f.get(`q`)??``,[y,b]=(0,Z.useState)(g),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),O=f.toString(),A=(0,Z.useRef)(O);if(A.current!==O){A.current=O;let e=Q(f.get(`tab`)),t=f.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let j=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),I=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),ee=y===`builtin`?j:I,L=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=ee;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,n):e.hasUi?-1:1)},[ee,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let R=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(q,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(N,{children:[(0,$.jsx)(K,{asChild:!0,children:(0,$.jsx)(D,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(H,{children:(0,$.jsxs)(P,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(V,{className:m(`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:()=>E(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(V,{asChild:!0,children:(0,$.jsxs)(a,{to:`/local-apps`,className:m(`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),children:[(0,$.jsx)(W,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);if((0,Z.useLayoutEffect)(()=>e?(t?.(R),()=>t?.(null)):(o({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:r.extensionsPage.title})}),end:(0,$.jsx)(J,{contribution:R})}),()=>c()),[c,e,R,r.extensionsPage.title,t,o]),u&&y!==`marketplace`)return(0,$.jsx)(ke,{});let z=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:j.length},{id:`user`,label:r.extensionsPage.tabUser,count:I.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:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(Y,{items:z,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):y===`builtin`&&j.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&I.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):L.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:L.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,T?(0,$.jsx)(ie,{onClose:()=>E(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let h;t[5]===p?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(d,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:u,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),h=e.activationEligible===!0,g=(0,Z.useCallback)(async()=>{l(null),p(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),j(),p(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[h,t.extensionToggleFailed,e.id,r]),_=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),p(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),j(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),v=e.ui?.contributions?.pages??[],E=e.ui?.contributions?.settingsPanels??[],O=e.ui?.contributions?.chatWidgets??[],k=v.find(e=>e.showInNav)??v[0],A=E[0],M=k?z(e.id,k):null,N=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||I(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{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)(ne,{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)(b,{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)(f,{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,` `,Ce(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:Te(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)(D,{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]}):h?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)(D,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void _(),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)(te,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(v.length>0||E.length>0||O.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)(Oe,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:E.length,hidden:E.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:O.length,hidden:O.length===0})]})]}):null,L(e)&&(M||N)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,$.jsxs)(a,{to:M,onClick:n,className:m(`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)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,N?(0,$.jsxs)(a,{to:N,onClick:n,className:m(`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)(G,{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 Oe(e){let t=(0,ae.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 ke(){let e=(0,ae.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,$.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,$.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,$.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(Ae)})]})}),e[4]=a):a=e[4],a}function Ae(e){return(0,$.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function je(e){let t=(0,ae.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{xe as ExtensionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ia as e,La as t}from"./index-DHL16aYZ.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if((o===`application/octet-stream`||/\.(csv|tsv)$/i.test(a))&&(o=e(a)??o),o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}return{id:f,type:`document`,name:a,mimeType:o,size:s,content:d}}export{n as loadAttachment};
|