@xopcai/xopc 0.0.387 → 0.0.389
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/_locales/en/messages.json +6 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +6 -1
- package/dist/browser-ext/dist/assets/{page-context-BeworyNB.js → page-context-A5RCibM_.js} +1 -1
- 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 +98 -53
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/plugin.js +5 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CB2X4Gmu.js → activity-store-dvik6t7Z.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bv8M5ygD.js → agent-avatar-dicebear-bWMd5TDC.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-UBy01-65.js → agent-defaults-settings-panel-Ds0Ue2FB.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-Q9guA8kU.js → agent-plugin-dialog-UunIxc1q.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-yfJFubD0.js → agents-BLRM4o-U.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-BkULgC6Q.js → agents-admin-api-BlNGyXpm.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Cdyad8c1.js → app-management-settings-panel-Dmy828Pe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DPPvnKH_.js → appearance-settings-CUAdx44v.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Bn_jwaeA.js → apps-page-D5zDB6gp.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-De0ND0oA.js → archive-plugin-Du6dJNcl.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CAB2sLJ5.js → automations-page-BO8Ig5Z4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CYRUhhH4.js → automations-workspace-UcCneEs3.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-Do535ZGW.js → binary-plugins-D7VJjwnr.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9DmMEa8.js → block-editor-CaJlWTAn.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-B9M1RYTm.js → browser-automation-inputs-iyMBJmQX.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BHAWpZE2.js → browser-automations-page-BjvQnYfO.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BG_17NcQ.js → browser-settings-page-D5ZghI28.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BX1rCiVm.js → capabilities-CEH1AnXc.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CW389yo6.js → capabilities-MCKRMZDK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-BAnBYWlY.js → capabilities-page-MC8qIrXo.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-Ca-d6lXk.js → capabilities-settings-panel-Blz3hEzp.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-B3TL8TcF.js → capability-header-actions-BIA0Lwt5.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BadpS-nq.js → channels-DSg_iCVC.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C_vntFpP.js → chat-terminal-dock-C97SJEwd.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-B-5kxk70.js → computer-settings-page-DvY3zgyY.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DTnfpLHL.js → connector-service-page-St2-Fj3y.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DXk-GAsd.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-D5zYeC8q.js → date-picker-C0-D80ny.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D72vT-tb.js → dependency-picker-CNd7mwMU.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DvoeVPf_.js → desktop-pet-C-2wDANn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Dfb392hs.js → desktop-pet-settings-DyhxLrdJ.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-B06Sqn5D.js → device-pairing-wizard-BeSuq__I.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CA3H3bc-.js → directory-picker-path-field-CNivVIPT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-B0wTBCx4.js → extension-debug-page-CGYO3JPw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeHiXhB1.js → extension-page-Dc51ALAg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-CJZ5EVpQ.js → extension-provider-BXPILdlw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Q88-LFCJ.js → extension-settings-page-jYu6qpY2.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BXoPCvzq.js → fallback-models-CoyzvDo7.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D0tBjSgj.js → gateway-config-swr-Bc2MytsF.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BnHraJ3O.js → gateway-realtime-BFK-vlME.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C3vH-Iup.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-IICLMGDI.js → gateway-settings-JlT1dlSj.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C1DQsIH3.js → gateway-startup-retry-BDPMttPx.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-D336so8z.js → highlighted-body-KQOG7T2V-DAlRGMge.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page--MvqsFhQ.js → home-page-DOVl8s-1.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-DodU6GNC.js → image-generation-api-BZBiYDmV.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-muV1SduS.js → imports-page-DgdBTp_0.js} +1 -1
- package/dist/gateway/static/root/assets/{index-D0qMv3jf.js → index-CmC8JkSM.js} +108 -108
- package/dist/gateway/static/root/assets/index-Dgzc0oBu.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-i1sDWcwl.js → keyboard-shortcuts-settings-BYYC9Qmw.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DY9tXEO6.js → local-app-workbench-page-BKZfn-MS.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BHD73STy.js → local-apps-page-BU8pUsVM.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Be4BGM4Z.js → local-session-drafts-kFc_MAA9.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-uRu_DsWm.js → locale-store-Dr43FCty.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DsPpe8Ws.js → logs-page-BSepiACn.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-Buwi2wQE.js → management-settings-dE_ykPNY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CBjl-XEc.js → markdown-view-CdKlPjJM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BombFqsX.js → media-plugins-DE9zt88i.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-65SE6j-_.js +1 -0
- package/dist/gateway/static/root/assets/messages-DlTNQI92.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-C7FAsEe_.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-D8n80Gbr.js → note-detail-panel-D9oqhdyk.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-BlGP533W.js → notes-api-BHouNL6-.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-Btf-jSS_.js → notes-page-Bd4_7ph8.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-97RL8Gc7.js → page-context-capture-button-TQr8NnSc.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-B04L8Oz5.js → personal-page-BvWzq4Wp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-9zEDvZa7.js → product-open-page-BEl6syFp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DynBrIXq.js → product-preview-content-BxSHnbqz.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BM7MsoVA.js → project-detail-page-D-qkIXVT.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-pcyeEJnz.js → projects-page-BQtw1Dfn.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CYqA7bfl.js → registry-api-BD5IgDOA.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CphyTu22.js → remote-access-hub-CYFNz0Jc.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-api-zzoxjSuR.js → runtime-tools-api-CjTRoQWT.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DPafoO0G.js → runtime-tools-settings-panel-Qq_NyYx_.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-j97FrDRW.js → scenes-page-hGr-ppYk.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CuJNwKHO.js → schema-form-ByG-R6N2.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-C293-Hbx.js → send-session-input-UAVStisp.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CzVTrG8n.js → session-api-DvgEiNRS.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BOb1tC_Z.js +16 -0
- package/dist/gateway/static/root/assets/{sessions-page-D8t_8fMl.js → sessions-page-CpX1Rluw.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D2s_MlxR.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DS9DMYUe.js → settings-page-C1e9m23j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DRDvm9yZ.js → setup-status-panel-BiHRYDHq.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BKGI8Kr0.js → share-link-dialog-kE_6v5Dp.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BF2WaO43.js → share-preview-page-BT-_yR1h.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-B0HlMAzi.js → shares-api-Dg_SqHQE.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DQTQZu6V.js → shares-settings-DfcAu08T.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DzVa7G-O.js → skill-api-BslUYMnX.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CEJx5rPd.js → skill-reload-api-BQ2rTOP1.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CfJIjRdS.js → skills-page-CvKc5nBN.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bzhqed-a.js → system-settings-panel-GpbPfWwo.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BYQFC0-U.js → task-detail-page-5B5ZVAu0.js} +1 -1
- package/dist/gateway/static/root/assets/{task-expandable-content-C9ohICpw.js → task-expandable-content-DJrrEBB4.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BUfzeDvL.js → theme-store-BKpYnggg.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-C2q5B3Kp.js → tracing-settings-page-D71w7dwV.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DrgpZ81I.js → tunnel-api-BV46CvS8.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-Drk8FWnj.js → usage-page-rMuwNpJi.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DgbCgsao.js → use-autosave-CzyqRffr.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-rgW7h4sD.js → use-composer-attachments-Dviq-1f6.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-DSKIxfz9.js → use-file-preview-expanded-D5Kk7Hon.js} +2 -2
- package/dist/gateway/static/root/assets/{user-model-page-07t2-nFE.js → user-model-page-Dhqw3v_u.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-4AIkbm9R.js → voice-api-key-field-DWtbmacd.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Kw1pYlLN.js → voice-config-api-DnIjZm_9.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-TQ5bjVot.js → work-discovery-overlay-ChEG71hz.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C9HP2uGG.js → workflow-run-setup-panel-pdiRKLxP.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DK01JRI1.js → workflows-page-D9LMxINt.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-JWHOFos6.js → workspace-api-CZDvu7uA.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-B-BhQdAf.js → xopc-cloud-account-card-CbUgg1SK.js} +1 -1
- package/dist/gateway/static/root/index.html +27 -27
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/clarifications.js +79 -2
- package/dist/packages/realtime-protocol/src/voice.js +13 -2
- package/dist/src/agent/agent-manager.js +12 -8
- package/dist/src/agent/background-review/prompts.js +4 -0
- package/dist/src/agent/background-review/run-background-review.js +43 -5
- package/dist/src/agent/embedded/run-turn.js +1 -1
- package/dist/src/agent/embedded/session-runner.d.ts +4 -3
- package/dist/src/agent/embedded/session-runner.js +6 -1
- package/dist/src/agent/external-tools/cliProvider.js +1 -1
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/mcp/connection-drafts.d.ts +50 -0
- package/dist/src/agent/mcp/connection-drafts.js +278 -0
- package/dist/src/agent/mcp/connection-setup.d.ts +5 -2
- package/dist/src/agent/mcp/connection-setup.js +7 -5
- package/dist/src/agent/mcp/credential-store.d.ts +6 -0
- package/dist/src/agent/mcp/credential-store.js +24 -0
- package/dist/src/agent/mcp/native-mcp.d.ts +6 -1
- package/dist/src/agent/mcp/native-mcp.js +6 -0
- package/dist/src/agent/mcp/tool-catalog.d.ts +7 -2
- package/dist/src/agent/mcp/tool-catalog.js +25 -15
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/clarify-tool.d.ts +2 -3
- package/dist/src/agent/tools/clarify-tool.js +15 -9
- package/dist/src/agent/tools/cli-clarify.d.ts +0 -3
- package/dist/src/agent/tools/cli-clarify.js +18 -32
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +4 -4
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +2 -2
- package/dist/src/automations/domain/validation.d.ts +6 -6
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.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/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.d.ts +1 -1
- package/dist/src/cli/commands/onboard/model.js +22 -3
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +7 -1
- package/dist/src/config/schema.js +3 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/chat-stream/mapper.js +2 -2
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -3
- package/dist/src/gateway/clarify-runtime.d.ts +2 -0
- package/dist/src/gateway/clarify-runtime.js +4 -1
- package/dist/src/gateway/ephemeral-clarification-waiter.d.ts +2 -1
- package/dist/src/gateway/ephemeral-clarification-waiter.js +19 -6
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/config-write-lock.d.ts +2 -0
- package/dist/src/gateway/hono/lib/config-write-lock.js +14 -0
- package/dist/src/gateway/hono/routes/agent-stream.js +4 -9
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/config.js +7 -5
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +73 -6
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/side-chats.js +4 -3
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +5 -4
- package/dist/src/gateway/service/agent-runner.js +32 -16
- package/dist/src/gateway/service/config-coordinator.d.ts +619 -1
- package/dist/src/gateway/service/config-coordinator.js +36 -24
- package/dist/src/gateway/service.d.ts +6 -3
- package/dist/src/gateway/service.js +5 -4
- package/dist/src/gateway/side-chat/run-service.d.ts +2 -1
- package/dist/src/gateway/side-chat/run-service.js +6 -3
- package/dist/src/gateway/side-chat/types.d.ts +3 -3
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +8 -5
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/memory-learning/service.js +3 -2
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +2 -2
- package/dist/src/scenes/taskFollowUp/service.d.ts +5 -5
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +3 -5
- package/dist/src/storage/sqlite/clarification-wait-repository.js +48 -28
- package/dist/src/tasks/capabilities/management.d.ts +2 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/relations.d.ts +6 -6
- package/dist/src/tasks/capabilities/write.d.ts +6 -6
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui-agent-events.js +1 -1
- package/dist/src/user-context/config.d.ts +2 -2
- package/dist/src/user-model/capture/semantic.d.ts +8 -1
- package/dist/src/user-model/capture/semantic.js +26 -5
- package/dist/src/voice/realtime/agentEngine.js +4 -2
- package/dist/src/voice/realtime/omniEngine.js +2 -2
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/connectors-page-CmJV7gqj.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BVriF6Zj.js +0 -1
- package/dist/gateway/static/root/assets/index-DBRwvWzm.css +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +0 -1
- package/dist/gateway/static/root/assets/messages-DTqbfje6.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-Ct6X5zmB.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-COd9RECl.js +0 -16
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClarificationPresentation } from '@xopcai/gateway-contract';
|
|
1
2
|
import type { AgentStreamToolExecutionMetadata, ToolActivity, TurnOutcome } from '@xopcai/gateway-contract';
|
|
2
3
|
import type { TaskUpdateTrigger } from '../../storage/sqlite/session-input-repository.js';
|
|
3
4
|
export type ChatStreamStatus = 'success' | 'error' | 'cancelled' | 'suspended';
|
|
@@ -207,12 +208,10 @@ export type TtsAudioEvent = ChatStreamEnvelope<'tts_audio', {
|
|
|
207
208
|
attachTo?: 'last_assistant';
|
|
208
209
|
messageId?: string;
|
|
209
210
|
}>;
|
|
210
|
-
export type ClarifyRequestEvent = ChatStreamEnvelope<'clarify_request', {
|
|
211
|
+
export type ClarifyRequestEvent = ChatStreamEnvelope<'clarify_request', ClarificationPresentation & {
|
|
211
212
|
requestId: string;
|
|
212
213
|
kind: 'input' | 'approval';
|
|
213
214
|
question: string;
|
|
214
|
-
choices?: string[];
|
|
215
|
-
suggestedAnswer?: string;
|
|
216
215
|
version: number;
|
|
217
216
|
createdAt: number;
|
|
218
217
|
expiresAt?: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type ClarificationChannelRuntime = {
|
|
2
2
|
answerChoice(requestId: string, choiceIndex: number, idempotencyKey: string): boolean;
|
|
3
|
+
answerDecision(requestId: string, decision: 'approve' | 'deny', idempotencyKey: string): boolean;
|
|
3
4
|
answerText(conversationId: string, text: string, idempotencyKey: string): boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare function registerClarificationChannelRuntime(next: ClarificationChannelRuntime | null): void;
|
|
6
7
|
export declare function answerClarificationChoiceFromChannel(requestId: string, choiceIndex: number, idempotencyKey: string): boolean;
|
|
7
8
|
export declare function answerClarificationTextFromChannel(conversationId: string, text: string, idempotencyKey: string): boolean;
|
|
9
|
+
export declare function answerClarificationDecisionFromChannel(requestId: string, decision: 'approve' | 'deny', idempotencyKey: string): boolean;
|
|
@@ -9,5 +9,8 @@ function answerClarificationChoiceFromChannel(requestId, choiceIndex, idempotenc
|
|
|
9
9
|
function answerClarificationTextFromChannel(conversationId, text, idempotencyKey) {
|
|
10
10
|
return runtime?.answerText(conversationId, text, idempotencyKey) ?? false;
|
|
11
11
|
}
|
|
12
|
+
function answerClarificationDecisionFromChannel(requestId, decision, idempotencyKey) {
|
|
13
|
+
return runtime?.answerDecision(requestId, decision, idempotencyKey) ?? false;
|
|
14
|
+
}
|
|
12
15
|
//#endregion
|
|
13
|
-
export { answerClarificationChoiceFromChannel, answerClarificationTextFromChannel, registerClarificationChannelRuntime };
|
|
16
|
+
export { answerClarificationChoiceFromChannel, answerClarificationDecisionFromChannel, answerClarificationTextFromChannel, registerClarificationChannelRuntime };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClarificationSubmission } from '@xopcai/gateway-contract';
|
|
1
2
|
import type { ClarifyRequestPayload } from '../agent/tools/clarify-tool.js';
|
|
2
3
|
export type ClarificationStreamEvent = {
|
|
3
4
|
type: string;
|
|
@@ -11,7 +12,7 @@ export declare class EphemeralClarificationWaiter {
|
|
|
11
12
|
request: ClarifyRequestPayload;
|
|
12
13
|
beforeResponse?: () => boolean;
|
|
13
14
|
}): Promise<string>;
|
|
14
|
-
answer(requestId: string, answer:
|
|
15
|
+
answer(requestId: string, answer: ClarificationSubmission): boolean;
|
|
15
16
|
cancelForRun(runId: string): void;
|
|
16
17
|
dispose(): void;
|
|
17
18
|
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { normalizeClarificationQuestion, normalizeClarificationSubmission, readClarificationPresentation } from "../../packages/gateway-contract/src/clarifications.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
1
3
|
//#region src/gateway/ephemeral-clarification-waiter.ts
|
|
4
|
+
init_src();
|
|
2
5
|
/** In-memory waiter exclusively for caller-owned ephemeral runs such as side chat. */
|
|
3
6
|
var EphemeralClarificationWaiter = class {
|
|
4
7
|
pending = /* @__PURE__ */ new Map();
|
|
5
8
|
start(input) {
|
|
9
|
+
const request = normalizeClarificationQuestion(input.request);
|
|
6
10
|
const requestId = crypto.randomUUID();
|
|
11
|
+
const expiresAt = request.kind === "approval" ? Date.now() + 10 * 6e4 : void 0;
|
|
7
12
|
return new Promise((resolve, reject) => {
|
|
8
13
|
this.pending.set(requestId, {
|
|
9
14
|
runId: input.runId,
|
|
15
|
+
request,
|
|
16
|
+
expiresAt,
|
|
10
17
|
resolve,
|
|
11
18
|
reject,
|
|
12
19
|
beforeResponse: input.beforeResponse
|
|
@@ -14,10 +21,10 @@ var EphemeralClarificationWaiter = class {
|
|
|
14
21
|
input.publish({
|
|
15
22
|
type: "clarify_request",
|
|
16
23
|
requestId,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
...readClarificationPresentation(request),
|
|
25
|
+
kind: request.kind ?? "input",
|
|
26
|
+
question: request.question,
|
|
27
|
+
expiresAt,
|
|
21
28
|
version: 1,
|
|
22
29
|
createdAt: Date.now()
|
|
23
30
|
});
|
|
@@ -25,9 +32,15 @@ var EphemeralClarificationWaiter = class {
|
|
|
25
32
|
}
|
|
26
33
|
answer(requestId, answer) {
|
|
27
34
|
const pending = this.pending.get(requestId);
|
|
28
|
-
if (!pending || pending.beforeResponse?.() === false) return false;
|
|
35
|
+
if (!pending || pending.beforeResponse?.() === false || pending.expiresAt !== void 0 && pending.expiresAt <= Date.now()) return false;
|
|
36
|
+
let normalized;
|
|
37
|
+
try {
|
|
38
|
+
normalized = normalizeClarificationSubmission(pending.request, answer);
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
29
42
|
this.pending.delete(requestId);
|
|
30
|
-
pending.resolve(answer
|
|
43
|
+
pending.resolve(normalized.answer);
|
|
31
44
|
return true;
|
|
32
45
|
}
|
|
33
46
|
cancelForRun(runId) {
|
|
@@ -221,7 +221,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
221
221
|
userModel: {
|
|
222
222
|
enabled: boolean;
|
|
223
223
|
writePolicy: "allow" | "deny";
|
|
224
|
-
sensitiveWritePolicy: "allow" | "
|
|
224
|
+
sensitiveWritePolicy: "allow" | "deny" | "confirm";
|
|
225
225
|
showMemoryReferences: boolean;
|
|
226
226
|
processingPolicy: "local_only" | "remote_allowed";
|
|
227
227
|
extraction: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
2
1
|
import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
3
2
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
4
3
|
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
4
|
+
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
5
5
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
6
6
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
7
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/gateway/hono/lib/config-write-lock.ts
|
|
2
|
+
const writes = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
/** Keep HTTP read/merge/write sequences together, including the legacy configuration endpoint. */
|
|
4
|
+
async function withGatewayConfigWriteLock(service, operation) {
|
|
5
|
+
const next = (writes.get(service) ?? Promise.resolve()).catch(() => {}).then(operation);
|
|
6
|
+
writes.set(service, next);
|
|
7
|
+
try {
|
|
8
|
+
return await next;
|
|
9
|
+
} finally {
|
|
10
|
+
if (writes.get(service) === next) writes.delete(service);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { withGatewayConfigWriteLock };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
2
|
+
import { clarificationResponseCommandSchema } from "../../../../packages/gateway-contract/src/clarifications.js";
|
|
2
3
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
4
|
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
4
5
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
@@ -165,11 +166,8 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
165
166
|
authenticated.post("/api/clarifications/:id/responses", chatRateLimitMiddleware, async (c) => {
|
|
166
167
|
const id = c.req.param("id")?.trim() ?? "";
|
|
167
168
|
const body = await c.req.json().catch(() => null);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
const expectedVersion = record.expectedVersion;
|
|
171
|
-
const idempotencyKey = typeof record.idempotencyKey === "string" ? record.idempotencyKey.trim() : "";
|
|
172
|
-
if (!id || !idempotencyKey || typeof expectedVersion !== "number" || !Number.isInteger(expectedVersion) || action !== "answer" && action !== "agent_decide" && action !== "cancel") return c.json({
|
|
169
|
+
const command = clarificationResponseCommandSchema.safeParse(body);
|
|
170
|
+
if (!id || !command.success) return c.json({
|
|
173
171
|
ok: false,
|
|
174
172
|
error: {
|
|
175
173
|
code: "BAD_REQUEST",
|
|
@@ -178,10 +176,7 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
178
176
|
}, 400);
|
|
179
177
|
const result = service.resolveClarificationResponse({
|
|
180
178
|
id,
|
|
181
|
-
|
|
182
|
-
idempotencyKey,
|
|
183
|
-
action,
|
|
184
|
-
answer: typeof record.answer === "string" ? record.answer : void 0
|
|
179
|
+
...command.data
|
|
185
180
|
});
|
|
186
181
|
if (result.ok === true) return c.json({
|
|
187
182
|
ok: true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config } from "../../../../user-context/config.js";
|
|
2
1
|
import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
|
|
2
|
+
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
3
|
+
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config } from "../../../../user-context/config.js";
|
|
3
4
|
import { ComputerConfigSchema, init_config as init_config$1 } from "../../../../computer/config.js";
|
|
4
5
|
import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
5
6
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
6
7
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
7
|
-
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
8
8
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
9
9
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
10
10
|
import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { enumerateLanGatewayCandidates, init_host } from "../../host.js";
|
|
2
2
|
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
3
3
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
4
|
+
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
4
5
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
5
6
|
import { applyGatewayPatch } from "./config-patch/gateway.js";
|
|
6
7
|
import { applyMiscPatch, validateGatewayAfterPatch } from "./config-patch/misc.js";
|
|
@@ -34,9 +35,10 @@ function registerConfigRoutes(authenticated, deps) {
|
|
|
34
35
|
payload: { candidates: enumerateLanGatewayCandidates(port) }
|
|
35
36
|
});
|
|
36
37
|
});
|
|
37
|
-
authenticated.patch("/api/config", strictRateLimitMiddleware, async (c) => {
|
|
38
|
+
authenticated.patch("/api/config", strictRateLimitMiddleware, async (c) => withGatewayConfigWriteLock(service, async () => {
|
|
38
39
|
const body = await c.req.json();
|
|
39
|
-
const
|
|
40
|
+
const expectedConfig = structuredClone(service.currentConfig);
|
|
41
|
+
const config = structuredClone(expectedConfig);
|
|
40
42
|
applyChannelsPatch(config, body);
|
|
41
43
|
const gatewayResult = applyGatewayPatch(config, body);
|
|
42
44
|
if (gatewayResult.ok === false) return c.json({
|
|
@@ -62,17 +64,17 @@ function registerConfigRoutes(authenticated, deps) {
|
|
|
62
64
|
error: `Failed to stop tunnel before clearing key: ${message}`
|
|
63
65
|
}, 500);
|
|
64
66
|
}
|
|
65
|
-
const result = await service.saveConfig(config);
|
|
67
|
+
const result = await service.saveConfig(config, expectedConfig);
|
|
66
68
|
if (!result.saved) return c.json({
|
|
67
69
|
ok: false,
|
|
68
70
|
error: result.error
|
|
69
|
-
}, 500);
|
|
71
|
+
}, result.conflict ? 409 : 500);
|
|
70
72
|
const safeConfig = await buildSafeWebConfigPayload(service, { locale: localeFromRequest(c) });
|
|
71
73
|
return c.json({
|
|
72
74
|
ok: true,
|
|
73
75
|
payload: { config: safeConfig }
|
|
74
76
|
});
|
|
75
|
-
});
|
|
77
|
+
}));
|
|
76
78
|
const revealGatewayAuthSecretHandler = async (c) => {
|
|
77
79
|
const field = await resolveRevealGatewayAuthField(c);
|
|
78
80
|
if (!field) return c.json({
|
|
@@ -6,9 +6,9 @@ import { getConnectorAccount, init_connector_account_repository, listConnectorAc
|
|
|
6
6
|
import { decideConnectorApproval, getConnectorApproval, listConnectorApprovals, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
|
|
7
7
|
import { getConnectorSyncPolicy, upsertConnectorSyncPolicy } from "../../../storage/sqlite/connector-sync-policy-repository.js";
|
|
8
8
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
9
|
-
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
10
9
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
11
10
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
11
|
+
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
12
12
|
import { activateComposioBackend, addComposioBackend, ensureComposioBackend, getComposioBackend, listComposioBackends, removeComposioBackend } from "../../../connectors/composio-backends.js";
|
|
13
13
|
import { getAuthorizationAttempt } from "../../../connectors/authorization-attempts.js";
|
|
14
14
|
import { ComposioSessionsAdapter, resolveComposioApiKey } from "../../../connectors/composio-sessions.js";
|
|
@@ -2,9 +2,9 @@ import { getSqliteDatabase, init_transaction } from "../../../storage/sqlite/tra
|
|
|
2
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import { countKnowledgeSourceItems, deleteKnowledgeSourceItems } from "../../../storage/sqlite/knowledge-repository.js";
|
|
4
4
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
5
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
6
|
import { getActiveUnderstandingConsent } from "../../../user-context/sources/consent-repository.js";
|
|
6
7
|
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies } from "../../../user-context/sources/repository.js";
|
|
7
|
-
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
8
8
|
import { listUserModelObservations } from "../../../user-model/observation-repository.js";
|
|
9
9
|
import "../../../user-model/index.js";
|
|
10
10
|
import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
|
|
@@ -449,7 +449,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
449
449
|
},
|
|
450
450
|
{
|
|
451
451
|
id: "mcp",
|
|
452
|
-
match: (path) => path === "/api/mcp/servers" || /^\/api\/mcp\/servers\/[^/]+\/(tools|probe|auth)$/.test(path) || /^\/api\/mcp\/auth\/[^/]+(?:\/redirect)?$/.test(path),
|
|
452
|
+
match: (path) => path === "/api/mcp/servers" || /^\/api\/mcp\/servers\/[^/]+$/.test(path) || path === "/api/mcp/drafts" || /^\/api\/mcp\/drafts\/[^/]+(?:\/(?:probe|commit|tools|auth(?:\/redirect)?))?$/.test(path) || /^\/api\/mcp\/servers\/[^/]+\/(tools|probe|auth)$/.test(path) || /^\/api\/mcp\/auth\/[^/]+(?:\/redirect)?$/.test(path),
|
|
453
453
|
load: async () => {
|
|
454
454
|
const { registerMcpRoutes } = await import("./mcp.js");
|
|
455
455
|
return { register: registerMcpRoutes };
|
|
@@ -4,8 +4,67 @@ import { loadMergedMcpConfig } from "../../../agent/mcp/config.js";
|
|
|
4
4
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
5
5
|
import { discoverMcpTools } from "../../../agent/mcp/tool-catalog.js";
|
|
6
6
|
import { cancelMcpAuthorization, getMcpAuthorization, probeMcpConnection, startMcpAuthorization, submitMcpRedirect } from "../../../agent/mcp/connection-setup.js";
|
|
7
|
+
import { McpConnectionDrafts, McpDraftError, mcpConfigRevision } from "../../../agent/mcp/connection-drafts.js";
|
|
8
|
+
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
7
9
|
//#region src/gateway/hono/routes/mcp.ts
|
|
8
10
|
function registerMcpRoutes(app, deps) {
|
|
11
|
+
const drafts = new McpConnectionDrafts({
|
|
12
|
+
readConfig: () => deps.service.currentConfig,
|
|
13
|
+
saveConfig: (config, expected) => deps.service.saveConfig(config, expected)
|
|
14
|
+
});
|
|
15
|
+
const owner = (c) => getGatewayPrincipal(c).principalId;
|
|
16
|
+
const draftRoute = (handler) => async (c) => {
|
|
17
|
+
try {
|
|
18
|
+
return c.json({
|
|
19
|
+
ok: true,
|
|
20
|
+
payload: await handler(c)
|
|
21
|
+
});
|
|
22
|
+
} catch (error) {
|
|
23
|
+
return c.json({
|
|
24
|
+
ok: false,
|
|
25
|
+
error: error instanceof McpDraftError ? error.message : "MCP draft operation failed."
|
|
26
|
+
}, error instanceof McpDraftError ? error.status : 500);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
app.post("/api/mcp/drafts", deps.strictRateLimitMiddleware, draftRoute(async (c) => {
|
|
30
|
+
const body = await c.req.json().catch(() => null);
|
|
31
|
+
if (!body || typeof body.serverId !== "string" || body.sourceServerId !== void 0 && typeof body.sourceServerId !== "string") throw new McpDraftError(400, "Invalid MCP draft request.");
|
|
32
|
+
return drafts.create(owner(c), body);
|
|
33
|
+
}));
|
|
34
|
+
app.post("/api/mcp/drafts/:id/probe", deps.strictRateLimitMiddleware, draftRoute((c) => drafts.probe(owner(c), c.req.param("id"))));
|
|
35
|
+
app.post("/api/mcp/drafts/:id/auth", deps.strictRateLimitMiddleware, draftRoute((c) => drafts.authorize(owner(c), c.req.param("id"))));
|
|
36
|
+
app.get("/api/mcp/drafts/:id/auth", draftRoute((c) => drafts.authorization(owner(c), c.req.param("id"))));
|
|
37
|
+
app.delete("/api/mcp/drafts/:id/auth", draftRoute((c) => drafts.cancelAuthorization(owner(c), c.req.param("id"))));
|
|
38
|
+
app.post("/api/mcp/drafts/:id/auth/redirect", deps.strictRateLimitMiddleware, draftRoute(async (c) => {
|
|
39
|
+
const body = await c.req.json().catch(() => null);
|
|
40
|
+
if (typeof body?.url !== "string" || body.url.length >= 16384) throw new McpDraftError(400, "Invalid callback address.");
|
|
41
|
+
drafts.redirect(owner(c), c.req.param("id"), body.url);
|
|
42
|
+
}));
|
|
43
|
+
app.post("/api/mcp/drafts/:id/commit", deps.strictRateLimitMiddleware, draftRoute(async (c) => {
|
|
44
|
+
const body = await c.req.json().catch(() => null);
|
|
45
|
+
if (!body || body.enable !== void 0 && typeof body.enable !== "boolean") throw new McpDraftError(400, "Invalid commit request.");
|
|
46
|
+
return withGatewayConfigWriteLock(deps.service, () => drafts.commit(owner(c), c.req.param("id"), body.enable === true));
|
|
47
|
+
}));
|
|
48
|
+
app.get("/api/mcp/drafts/:id/tools", deps.strictRateLimitMiddleware, draftRoute(async (c) => ({ tools: await drafts.tools(owner(c), c.req.param("id")) })));
|
|
49
|
+
app.delete("/api/mcp/drafts/:id", draftRoute((c) => drafts.remove(owner(c), c.req.param("id"))));
|
|
50
|
+
app.delete("/api/mcp/servers/:id", deps.strictRateLimitMiddleware, draftRoute(async (c) => {
|
|
51
|
+
const body = await c.req.json().catch(() => null);
|
|
52
|
+
if (!body?.expectedServer || typeof body.expectedServer !== "object" || Array.isArray(body.expectedServer)) throw new McpDraftError(400, "The expected server configuration is required.");
|
|
53
|
+
return withGatewayConfigWriteLock(deps.service, async () => {
|
|
54
|
+
const current = deps.service.currentConfig, id = c.req.param("id");
|
|
55
|
+
const server = Object.hasOwn(current.mcp?.servers ?? {}, id) ? current.mcp?.servers?.[id] : void 0;
|
|
56
|
+
if (!server || isManagedConnectorServer(server) || mcpConfigRevision(server) !== mcpConfigRevision(body.expectedServer)) throw new McpDraftError(409, "The custom server changed. Reload before removing it.");
|
|
57
|
+
const next = structuredClone(current);
|
|
58
|
+
delete next.mcp.servers[id];
|
|
59
|
+
const result = await deps.service.saveConfig(next, structuredClone(current));
|
|
60
|
+
if (result.conflict) throw new McpDraftError(409, "Configuration changed before removing the server.");
|
|
61
|
+
if (!result.saved && !result.persisted) throw new McpDraftError(500, "Could not remove the server.");
|
|
62
|
+
return {
|
|
63
|
+
serverId: id,
|
|
64
|
+
...!result.saved ? { reloadRequired: true } : {}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}));
|
|
9
68
|
app.post("/api/mcp/servers/:id/probe", deps.strictRateLimitMiddleware, async (c) => {
|
|
10
69
|
const config = deps.service.currentConfig;
|
|
11
70
|
const id = c.req.param("id");
|
|
@@ -101,12 +160,20 @@ function registerMcpRoutes(app, deps) {
|
|
|
101
160
|
return c.json({
|
|
102
161
|
ok: true,
|
|
103
162
|
payload: {
|
|
104
|
-
servers: Object.entries(merged.config.mcpServers).map(([id, server]) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
163
|
+
servers: Object.entries(merged.config.mcpServers).map(([id, server]) => {
|
|
164
|
+
const { xopcConnectionCheck, ...configuration } = server;
|
|
165
|
+
const check = xopcConnectionCheck;
|
|
166
|
+
return {
|
|
167
|
+
id,
|
|
168
|
+
plugin: server.xopcPlugin,
|
|
169
|
+
lastCheck: check?.revision === mcpConfigRevision(configuration) ? {
|
|
170
|
+
checkedAt: check.checkedAt,
|
|
171
|
+
toolCount: check.toolCount
|
|
172
|
+
} : void 0,
|
|
173
|
+
managed: isManagedConnectorServer(server),
|
|
174
|
+
connectorId: isManagedConnectorServer(server) ? server.xopcConnector.connectorId : void 0
|
|
175
|
+
};
|
|
176
|
+
}).sort((a, b) => a.id.localeCompare(b.id)),
|
|
110
177
|
mergedServerIds: Object.keys(merged.config.mcpServers).sort(),
|
|
111
178
|
configured: cfg.mcp?.servers ?? {}
|
|
112
179
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NoteDeleteOutputSchema, NoteGetOutputSchema, ProductReadContracts } from "../../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
4
|
-
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
5
3
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
6
4
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
5
|
+
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
6
|
+
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
7
7
|
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
8
8
|
import { getShareStore } from "../../../share/share-store.js";
|
|
9
9
|
import { resolveShareUrl } from "../../../share/share-url.js";
|
|
@@ -7,12 +7,12 @@ import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript
|
|
|
7
7
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
8
8
|
import { ActivityService } from "../../../activity/service.js";
|
|
9
9
|
import "../../../activity/index.js";
|
|
10
|
+
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
11
|
+
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
12
|
import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
|
|
11
13
|
import "../../../knowledge-memory/index.js";
|
|
12
14
|
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
13
15
|
import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
|
|
14
|
-
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
15
|
-
import "../../../capabilities/runtime/dispatcher.js";
|
|
16
16
|
import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
|
|
17
17
|
import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
|
|
18
18
|
import { ProjectDeletionBlockedError, ProjectWorkspaceInUseError } from "../../../projects/project-service.js";
|
|
@@ -5,9 +5,9 @@ import { endpointContextSchema } from "../../../../packages/gateway-contract/src
|
|
|
5
5
|
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
6
6
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
7
7
|
import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
8
|
-
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
9
8
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
10
9
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
|
+
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
11
11
|
import { getModelThinking } from "../../../providers/model-thinking.js";
|
|
12
12
|
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
13
13
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chooseModelThinking } from "../../../../packages/gateway-contract/src/model-selection.js";
|
|
2
|
+
import { clarificationSubmissionSchema } from "../../../../packages/gateway-contract/src/clarifications.js";
|
|
2
3
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
4
|
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
4
5
|
import { getModelThinking } from "../../../providers/model-thinking.js";
|
|
@@ -149,9 +150,9 @@ function registerSideChatRoutes(authenticated, deps) {
|
|
|
149
150
|
authenticated.post("/api/side-chats/:sideChatId/clarify/:requestId", deps.chatRateLimitMiddleware, async (c) => {
|
|
150
151
|
try {
|
|
151
152
|
const body = await c.req.json().catch(() => ({}));
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
if (!service.sideChatRuns.submitClarification(c.req.param("sideChatId"), readClientInstanceId(c, body.clientInstanceId), c.req.param("requestId"),
|
|
153
|
+
const submission = clarificationSubmissionSchema.safeParse(body);
|
|
154
|
+
if (!submission.success) throw new SideChatError("Invalid clarification response", "INVALID_REQUEST");
|
|
155
|
+
if (!service.sideChatRuns.submitClarification(c.req.param("sideChatId"), readClientInstanceId(c, body.clientInstanceId), c.req.param("requestId"), submission.data)) throw new SideChatError("Clarification request not found", "NOT_FOUND");
|
|
155
156
|
return c.json({ ok: true });
|
|
156
157
|
} catch (error) {
|
|
157
158
|
return respondSideChatError(c, error);
|
|
@@ -6,9 +6,9 @@ import { hasGatewayScope, init_gateway_scopes } from "../../security/gateway-sco
|
|
|
6
6
|
import { enqueueTaskChangedEvent, init_task_change_events } from "../../../tasks/task-change-events.js";
|
|
7
7
|
import { TaskRepository, init_task_repository } from "../../../tasks/task-repository.js";
|
|
8
8
|
import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task-run-repository.js";
|
|
9
|
-
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
10
9
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
11
10
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
11
|
+
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
12
12
|
import { TaskCollaborationRepository } from "../../../tasks/task-collaboration-repository.js";
|
|
13
13
|
import { TaskCriterionReviewRepository } from "../../../tasks/task-criterion-review-repository.js";
|
|
14
14
|
import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope } from "../agent/agent-scope.js";
|
|
4
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
4
5
|
import { resolveEffectiveAgentConfigForAgent } from "../config/agent-profile.js";
|
|
5
6
|
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
6
7
|
import { fetchWithTimeoutGuarded } from "../media-shared/http/provider-http.js";
|
|
7
8
|
import "../media-shared/http/index.js";
|
|
8
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
9
9
|
import { getImageGenerationProvider, listImageGenerationProvidersSummary } from "../agent/image/generation/provider-registry.js";
|
|
10
10
|
//#region src/gateway/image-generation-setup.ts
|
|
11
11
|
init_repository();
|
package/dist/src/gateway/lock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import net from "node:net";
|
|
5
4
|
import fs$1 from "node:fs/promises";
|
|
5
|
+
import net from "node:net";
|
|
6
6
|
import { homedir } from "os";
|
|
7
7
|
//#region src/gateway/lock.ts
|
|
8
8
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClarificationSubmission } from '@xopcai/gateway-contract';
|
|
1
2
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
2
3
|
import type { ClarificationResponseAction } from '@xopcai/gateway-contract';
|
|
3
4
|
import type { Config } from '../../config/schema.js';
|
|
@@ -112,18 +113,18 @@ export declare class GatewayAgentRunner {
|
|
|
112
113
|
aborted: boolean;
|
|
113
114
|
idle: boolean;
|
|
114
115
|
}>;
|
|
115
|
-
answerEphemeralClarification(requestId: string, answer:
|
|
116
|
+
answerEphemeralClarification(requestId: string, answer: ClarificationSubmission): boolean;
|
|
116
117
|
getClarificationState(conversationId: string): import("@xopcai/gateway-contract").ClarificationWaitSnapshot;
|
|
117
|
-
resolveClarificationResponse(input: {
|
|
118
|
+
resolveClarificationResponse(input: ClarificationSubmission & {
|
|
118
119
|
id: string;
|
|
119
120
|
expectedVersion: number;
|
|
120
121
|
idempotencyKey: string;
|
|
121
122
|
action: ClarificationResponseAction;
|
|
122
|
-
answer?: string;
|
|
123
123
|
}): import("../../storage/sqlite/clarification-wait-repository.js").ResolveClarificationResult;
|
|
124
124
|
getClarificationById(id: string): import("@xopcai/gateway-contract").ClarificationWait;
|
|
125
125
|
answerClarificationChoice(requestId: string, choiceIndex: number, idempotencyKey: string): boolean;
|
|
126
|
-
|
|
126
|
+
answerClarificationDecision(requestId: string, decision: 'approve' | 'deny', idempotencyKey: string): boolean;
|
|
127
|
+
answerClarificationText(conversationId: string, text: string, idempotencyKey: string): boolean;
|
|
127
128
|
/** Same execution path as scheduled continuation, but lets callers observe failures. */
|
|
128
129
|
runScheduledWebchatTurn(conversationId: string, userTurn: UserTurnInput): Promise<void>;
|
|
129
130
|
runScheduledWebchatContinuation(conversationId: string, message: string): Promise<void>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
4
|
+
import { readClarificationPresentation } from "../../../packages/gateway-contract/src/clarifications.js";
|
|
5
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
6
|
import { listActiveSessionInputExecutions, listActiveSessionInputRuns } from "../../storage/sqlite/session-input-repository.js";
|
|
5
7
|
import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
|
|
6
8
|
import { createClarificationWait, getClarification, getClarificationSnapshot, init_clarification_wait_repository, resolveClarification, supersedeActiveClarification } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
@@ -20,6 +22,7 @@ import { fitSourceContextsToBudget } from "../../agent/source-context/budget.js"
|
|
|
20
22
|
import { SessionInputCoordinator } from "./session-input-coordinator.js";
|
|
21
23
|
import crypto from "node:crypto";
|
|
22
24
|
//#region src/gateway/service/agent-runner.ts
|
|
25
|
+
init_src();
|
|
23
26
|
init_connection_wait_repository();
|
|
24
27
|
init_clarification_wait_repository();
|
|
25
28
|
init_logger();
|
|
@@ -299,25 +302,36 @@ var GatewayAgentRunner = class {
|
|
|
299
302
|
}
|
|
300
303
|
answerClarificationChoice(requestId, choiceIndex, idempotencyKey) {
|
|
301
304
|
const wait = getClarification(requestId);
|
|
302
|
-
const
|
|
303
|
-
if (!
|
|
305
|
+
const choice = wait?.status === "open" ? wait.choiceDetails?.[choiceIndex] : void 0;
|
|
306
|
+
if (!choice) return false;
|
|
304
307
|
return this.resolveClarificationResponse({
|
|
305
308
|
id: wait.id,
|
|
306
309
|
expectedVersion: wait.version,
|
|
307
310
|
idempotencyKey,
|
|
308
311
|
action: "answer",
|
|
309
|
-
|
|
312
|
+
response: { choiceId: choice.id }
|
|
313
|
+
}).ok;
|
|
314
|
+
}
|
|
315
|
+
answerClarificationDecision(requestId, decision, idempotencyKey) {
|
|
316
|
+
const wait = getClarification(requestId);
|
|
317
|
+
if (!wait || wait.kind !== "approval" || wait.status !== "open") return false;
|
|
318
|
+
return this.resolveClarificationResponse({
|
|
319
|
+
id: wait.id,
|
|
320
|
+
expectedVersion: wait.version,
|
|
321
|
+
idempotencyKey,
|
|
322
|
+
action: "answer",
|
|
323
|
+
decision
|
|
310
324
|
}).ok;
|
|
311
325
|
}
|
|
312
|
-
answerClarificationText(conversationId,
|
|
326
|
+
answerClarificationText(conversationId, text, idempotencyKey) {
|
|
313
327
|
const wait = getClarificationSnapshot(conversationId)?.clarification;
|
|
314
|
-
if (!wait || wait.status !== "open" || !
|
|
328
|
+
if (!wait || wait.kind === "approval" || wait.status !== "open" || !text.trim()) return false;
|
|
315
329
|
return this.resolveClarificationResponse({
|
|
316
330
|
id: wait.id,
|
|
317
331
|
expectedVersion: wait.version,
|
|
318
332
|
idempotencyKey,
|
|
319
333
|
action: "answer",
|
|
320
|
-
|
|
334
|
+
response: { text }
|
|
321
335
|
}).ok;
|
|
322
336
|
}
|
|
323
337
|
/** Same execution path as scheduled continuation, but lets callers observe failures. */
|
|
@@ -417,9 +431,8 @@ var GatewayAgentRunner = class {
|
|
|
417
431
|
runId: opts.runId,
|
|
418
432
|
toolCallId: opts.toolCallId,
|
|
419
433
|
kind: request.kind === "approval" ? "approval" : "input",
|
|
434
|
+
...readClarificationPresentation(request),
|
|
420
435
|
question: request.question,
|
|
421
|
-
choices: request.choices,
|
|
422
|
-
suggestedAnswer: request.suggestedAnswer,
|
|
423
436
|
approvalKey: request.approvalKey
|
|
424
437
|
});
|
|
425
438
|
this.opts.emit("clarification.created", wait);
|
|
@@ -427,9 +440,8 @@ var GatewayAgentRunner = class {
|
|
|
427
440
|
type: "clarify_request",
|
|
428
441
|
requestId: wait.id,
|
|
429
442
|
kind: wait.kind,
|
|
443
|
+
...readClarificationPresentation(wait),
|
|
430
444
|
question: wait.question,
|
|
431
|
-
choices: wait.choices,
|
|
432
|
-
suggestedAnswer: wait.suggestedAnswer,
|
|
433
445
|
expiresAt: wait.expiresAt,
|
|
434
446
|
createdAt: wait.createdAt,
|
|
435
447
|
version: wait.version
|
|
@@ -450,13 +462,17 @@ var GatewayAgentRunner = class {
|
|
|
450
462
|
const routing = (await this.opts.sessionIndex.getSessionMetadata(ctx.conversationId).catch(() => null))?.routing;
|
|
451
463
|
if (!routing || routing.source !== "telegram") return;
|
|
452
464
|
let body = ctx.request.question;
|
|
453
|
-
if (ctx.request.suggestedAnswer) body += `\n\nSuggested answer (never selected automatically): ${ctx.request.suggestedAnswer}`;
|
|
454
465
|
body += ctx.request.kind === "approval" ? "\n\nFor safety, this approval expires after 10 minutes." : "\n\nThis question remains available until you answer or cancel the task.";
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
const buttonRows = ctx.request.kind === "approval" ? [[{
|
|
467
|
+
text: "Approve once",
|
|
468
|
+
callback_data: `clarify:${ctx.requestId}:approve`
|
|
469
|
+
}, {
|
|
470
|
+
text: "Deny",
|
|
471
|
+
callback_data: `clarify:${ctx.requestId}:deny`
|
|
472
|
+
}]] : ctx.request.choiceDetails?.map((choice, index) => [{
|
|
473
|
+
text: choice.label.slice(0, 64),
|
|
474
|
+
callback_data: `clarify:${ctx.requestId}:${index}`
|
|
475
|
+
}]);
|
|
460
476
|
body += buttonRows ? "\n\nReply with your answer, or tap an option below." : "\n\nReply with your answer.";
|
|
461
477
|
await this.opts.getChannelManager().send({
|
|
462
478
|
channel: "telegram",
|