@xopcai/xopc 0.0.388 → 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/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +7 -5
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- 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-44LqtGte.js → agent-avatar-dicebear-bWMd5TDC.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-2VA4eKPf.js → agent-defaults-settings-panel-Ds0Ue2FB.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DRhTOw_O.js → agent-plugin-dialog-UunIxc1q.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BemUH_Yf.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-CR_cc7rj.js → app-management-settings-panel-Dmy828Pe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CYofu-su.js → appearance-settings-CUAdx44v.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CHjWvDjk.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-BIF0skon.js → automations-page-BO8Ig5Z4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DOwtT4sS.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-C_RD603p.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-B-Ezk_8l.js → browser-automations-page-BjvQnYfO.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BSmmTBn4.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-xZgTYYDn.js → capabilities-page-MC8qIrXo.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-oqkuOjcR.js → capabilities-settings-panel-Blz3hEzp.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-Chuhscdb.js → capability-header-actions-BIA0Lwt5.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-Dq2C2k9M.js → channels-DSg_iCVC.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-srB_M-aQ.js → chat-terminal-dock-C97SJEwd.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-Af00Kjc0.js → computer-settings-page-DvY3zgyY.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-3W0_7-4L.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-DBgZBmik.js → date-picker-C0-D80ny.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BDJ406kH.js → dependency-picker-CNd7mwMU.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Do1XPn6U.js → desktop-pet-C-2wDANn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-LKeVh6OH.js → desktop-pet-settings-DyhxLrdJ.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CvZpnSVw.js → device-pairing-wizard-BeSuq__I.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BMLHoL6g.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-vR2r4uUB.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-1tbWe5xQ.js → extension-settings-page-jYu6qpY2.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-CW6a1-GK.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-vQWTUx2c.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-BM__yiMn.js → highlighted-body-KQOG7T2V-DAlRGMge.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-hfWuVtcG.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-CuR6RSUM.js → imports-page-DgdBTp_0.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CNH8vwcY.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-DpyqH2cP.js → keyboard-shortcuts-settings-BYYC9Qmw.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B4hIoxV8.js → local-app-workbench-page-BKZfn-MS.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-S7lUpENM.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-CSlZT1-L.js → logs-page-BSepiACn.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BYCL5CwV.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-CJ5Earr_.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-CPGk8-n1.js → notes-page-Bd4_7ph8.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-C2bSXVbz.js → page-context-capture-button-TQr8NnSc.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BjTt5R3s.js → personal-page-BvWzq4Wp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Cn16lm5l.js → product-open-page-BEl6syFp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CowgeuoG.js → product-preview-content-BxSHnbqz.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CyKx4PyN.js → project-detail-page-D-qkIXVT.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page--_hXxUMC.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-Bq_eqQYf.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-BgCATci5.js → runtime-tools-settings-panel-Qq_NyYx_.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-DxE3jRPR.js → scenes-page-hGr-ppYk.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-I6pzJJzg.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-CQkGFnJM.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-Dy5oQDbx.js → settings-page-C1e9m23j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CrAazq4r.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-BNMhs-Vd.js → shares-settings-DfcAu08T.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-RIjxQs-Y.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-XVOxILQn.js → skills-page-CvKc5nBN.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C8aLy8T_.js → system-settings-panel-GpbPfWwo.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-o1O2IDVP.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-JkDu1wiC.js → tunnel-api-BV46CvS8.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-B8K6Y4ro.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-C1QX47VR.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-BshsEDRO.js → work-discovery-overlay-ChEG71hz.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CRG3paWy.js → workflow-run-setup-panel-pdiRKLxP.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-c-AoSVzm.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-PDSIicr1.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 +25 -21
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +5 -1
- package/dist/src/agent/background-review/run-background-review.js +50 -12
- package/dist/src/agent/child-agent-factory.js +1 -1
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/context/coordinator.js +2 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -5
- package/dist/src/agent/embedded/run-turn.js +14 -14
- package/dist/src/agent/embedded/session-runner.d.ts +4 -3
- package/dist/src/agent/embedded/session-runner.js +9 -4
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
- package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +3 -3
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
- package/dist/src/agent/external-tools/gateway-tools.js +2 -2
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/index.js +3 -3
- 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/memory/context-budget.js +1 -1
- package/dist/src/agent/memory/context-recovery.js +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
- package/dist/src/agent/prompt/response-language.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +4 -4
- package/dist/src/agent/service/process-direct-streaming.js +6 -6
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +21 -21
- package/dist/src/agent/session/session-config-service.js +3 -3
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/source-context/index.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +7 -7
- 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/create-share-tool.js +3 -3
- package/dist/src/agent/tools/dataBatch.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +19 -19
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.js +6 -6
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/personal-attention-tool.js +2 -2
- package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +4 -4
- package/dist/src/agent/tools/personal-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +4 -4
- package/dist/src/agent/tools/personal-task-tool.js +6 -6
- package/dist/src/agent/tools/publish-artifacts.js +2 -2
- package/dist/src/agent/tools/read.js +2 -2
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +3 -3
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +2 -2
- package/dist/src/agent/tools/xopc-use-tool.js +4 -4
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +2 -2
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +2 -2
- package/dist/src/automations/domain/index.js +1 -1
- package/dist/src/automations/domain/validation.d.ts +6 -6
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/automations/index.js +2 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/capabilities/store-connector.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/builtins/config.js +4 -4
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/context.js +2 -2
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +7 -7
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/mcp.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/onboard/model.d.ts +1 -1
- package/dist/src/cli/commands/onboard/model.js +21 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +4 -4
- package/dist/src/cli/extension-cli-register.js +6 -6
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/cli/utils/session.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.d.ts +7 -1
- package/dist/src/config/schema.js +7 -5
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/cli/runtime.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +4 -4
- package/dist/src/connectors/connected-source-understanding.js +4 -4
- package/dist/src/connectors/connection-recovery-service.js +4 -4
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +1 -1
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/runtime.js +2 -2
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/agent-plugins/auth.js +1 -1
- package/dist/src/extensions/agent-plugins/credentials.js +1 -1
- package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
- package/dist/src/extensions/api.js +4 -4
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +3 -3
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- 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/device-routes.js +2 -2
- 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/file-path-classifier.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -3
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- 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/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
- 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 +2 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +74 -7
- package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
- package/dist/src/gateway/hono/routes/models.js +5 -5
- package/dist/src/gateway/hono/routes/notes.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +5 -5
- package/dist/src/gateway/hono/routes/sessions.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +2 -2
- package/dist/src/gateway/hono/routes/side-chats.js +5 -4
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +7 -7
- package/dist/src/gateway/hono/routes/voice.js +7 -7
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +5 -4
- package/dist/src/gateway/service/agent-runner.js +35 -19
- package/dist/src/gateway/service/config-coordinator.d.ts +619 -1
- package/dist/src/gateway/service/config-coordinator.js +38 -26
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +4 -4
- package/dist/src/gateway/service/session-command-service.js +2 -2
- package/dist/src/gateway/service.d.ts +6 -3
- package/dist/src/gateway/service.js +45 -44
- package/dist/src/gateway/session-context-summary.js +4 -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/workspace-editor-path.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +7 -4
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/imports/compatibility.js +1 -1
- package/dist/src/imports/inventory.js +3 -3
- package/dist/src/imports/productImport.js +2 -2
- package/dist/src/imports/runtime.js +1 -1
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +9 -9
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -2
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/knowledge-memory/repository.js +1 -1
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/mcp/gateway-http-client.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/memory-learning/service.js +3 -2
- package/dist/src/memory-learning/source-learning.js +4 -4
- package/dist/src/memory-learning/task-receipts.js +1 -1
- package/dist/src/notes/agent-context.js +4 -4
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/proactivity/routes.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +7 -7
- package/dist/src/personal-agent/prompt-context.js +7 -7
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +9 -9
- package/dist/src/personal-agent/request-delivery.js +2 -2
- package/dist/src/personal-agent/request-service.js +6 -6
- package/dist/src/personal-agent/result-reader.js +1 -1
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +2 -2
- package/dist/src/scenes/taskFollowUp/resources.js +2 -2
- package/dist/src/scenes/taskFollowUp/service.d.ts +5 -5
- package/dist/src/scenes/taskFollowUp/service.js +6 -6
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/hosted-session-share.js +2 -2
- package/dist/src/share/session-share-service.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- 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/storage/sqlite/connection.js +9 -9
- 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/home-query-service.js +2 -2
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tasks/task-allocation-service.js +5 -5
- package/dist/src/tasks/task-application-service.js +6 -6
- package/dist/src/tasks/task-collaboration-delivery.js +1 -1
- package/dist/src/tasks/task-context-assembler.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.js +5 -5
- package/dist/src/tasks/task-main-update-decision-service.js +3 -3
- package/dist/src/tasks/task-model-call.js +1 -1
- package/dist/src/tasks/task-research-result.js +4 -4
- package/dist/src/tasks/task-result-delivery-repository.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +2 -2
- package/dist/src/tasks/task-run-coordinator.js +4 -4
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +13 -13
- package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +2 -2
- package/dist/src/tui/tui-agent-events.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -5
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +4 -4
- package/dist/src/tui/tui.js +6 -6
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/access-policy.js +2 -2
- package/dist/src/user-context/config.d.ts +2 -2
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/capture/semantic.d.ts +8 -1
- package/dist/src/user-model/capture/semantic.js +26 -5
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/agentEngine.js +4 -2
- package/dist/src/voice/realtime/memory-context.js +7 -7
- package/dist/src/voice/realtime/omniEngine.js +2 -2
- package/dist/src/voice/realtime/runtime.js +4 -4
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/service.js +7 -7
- package/dist/src/workflows/context/workflow-context.js +1 -1
- package/dist/src/workflows/engine/workflow-engine.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +7 -7
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/connectors-page-BZk-Gou5.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-i9N5shss.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-Dtlsvsci.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
2
2
|
import { emitSessionTranscriptUpdate } from "../../session/transcript-events.js";
|
|
3
|
+
import { extractToolCallsFromAssistant, extractToolResultId } from "../transcript/tool-call-id.js";
|
|
4
|
+
import { makeMissingToolResult, sanitizeToolCallInputs } from "../transcript/session-transcript-repair.js";
|
|
3
5
|
import { boundedJsonUtf8Bytes, firstEnumerableOwnKeys, jsonUtf8BytesOrInfinity } from "../../infra/json-utf8-bytes.js";
|
|
4
6
|
import { formatContextLimitTruncationNotice } from "./tool-result-context-guard.js";
|
|
5
7
|
import { resolveLiveToolResultMaxChars, truncateToolResultMessage } from "./tool-result-truncation.js";
|
|
6
|
-
import { extractToolCallsFromAssistant, extractToolResultId } from "../transcript/tool-call-id.js";
|
|
7
|
-
import { makeMissingToolResult, sanitizeToolCallInputs } from "../transcript/session-transcript-repair.js";
|
|
8
8
|
//#region src/agent/embedded/session-tool-result-guard.ts
|
|
9
9
|
init_string_coerce();
|
|
10
10
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_string_coerce, normalizeLowercaseStringOrEmpty } from "../../utils/string-coerce.js";
|
|
2
|
-
import { formatContextLimitTruncationNotice } from "./tool-result-context-guard.js";
|
|
3
2
|
import { isDataBatchResult, renderDataBatch } from "../data-acquisition/render.js";
|
|
3
|
+
import { formatContextLimitTruncationNotice } from "./tool-result-context-guard.js";
|
|
4
4
|
//#region src/agent/embedded/tool-result-truncation.ts
|
|
5
5
|
init_string_coerce();
|
|
6
6
|
const MAX_TOOL_RESULT_CONTEXT_SHARE = .3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { recordPersonalPerformance } from "../../personal-agent/performance.js";
|
|
2
1
|
import { getXopcToolMetadata } from "./tool-metadata.js";
|
|
3
2
|
import { withDataToolPermissions } from "../tools/dataBatch.js";
|
|
3
|
+
import { recordPersonalPerformance } from "../../personal-agent/performance.js";
|
|
4
4
|
//#region src/agent/embedded/xopc-tools-bridge.ts
|
|
5
5
|
const APPLY_PATCH_BEGIN_MARKER = "*** Begin Patch";
|
|
6
6
|
const APPLY_PATCH_END_MARKER = "*** End Patch";
|
|
@@ -8,15 +8,15 @@ import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
|
8
8
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
9
9
|
import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
|
|
10
10
|
import "../../capabilities/runtime/dispatcher.js";
|
|
11
|
+
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
11
12
|
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
13
|
+
import { selectConnectorAccount } from "../../connectors/account-selection.js";
|
|
14
|
+
import { cliContextPath } from "../../connectors/cli/process.js";
|
|
12
15
|
import { validateActionInput } from "../../connectors/cli/protocol.js";
|
|
13
16
|
import { getCliAdapter } from "../../connectors/cli/adapterRegistry.js";
|
|
14
17
|
import { evaluateConnectorExecutionPolicy } from "../../connectors/policy.js";
|
|
15
18
|
import { listConnectorInstances } from "../../connectors/instances.js";
|
|
16
|
-
import { cliContextPath } from "../../connectors/cli/process.js";
|
|
17
19
|
import { cliOwnerId, recoverCliExecutions } from "../../connectors/cli/store.js";
|
|
18
|
-
import { selectConnectorAccount } from "../../connectors/account-selection.js";
|
|
19
|
-
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
20
20
|
import { describeCliAction, executeCliAction } from "../../connectors/cli/runtime.js";
|
|
21
21
|
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
22
22
|
import { join } from "node:path";
|
|
@@ -7,6 +7,7 @@ import { bindObjectiveAccount, connectionBinding, connectionBindings, connectorO
|
|
|
7
7
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
8
8
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
9
9
|
import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
|
|
10
|
+
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
10
11
|
import { canAccessConnectorAccount, currentAccountConnections } from "../../connectors/account-access.js";
|
|
11
12
|
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
12
13
|
import { connectorIdentitySummary } from "../../connectors/connector-identity.js";
|
|
@@ -15,9 +16,8 @@ import { ComposioSessionsAdapter } from "../../connectors/composio-sessions.js";
|
|
|
15
16
|
import { getComposioToolkitScope, getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "../../connectors/composio.js";
|
|
16
17
|
import { getConnectorDefinition } from "../../connectors/catalog.js";
|
|
17
18
|
import { listConnectorInstances } from "../../connectors/instances.js";
|
|
18
|
-
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
19
|
-
import { isToolInputSchema } from "../../connectors/connection-capabilities.js";
|
|
20
19
|
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
20
|
+
import { isToolInputSchema } from "../../connectors/connection-capabilities.js";
|
|
21
21
|
import { ExternalToolSearchError } from "./search-error.js";
|
|
22
22
|
//#region src/agent/external-tools/composio-provider.ts
|
|
23
23
|
init_session_input_repository();
|
|
@@ -2,14 +2,14 @@ import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../c
|
|
|
2
2
|
import { canonicalCapabilityJson } from "../../capabilities/runtime/dispatcher.js";
|
|
3
3
|
import { init_src } from "../../../packages/computer-control-contract/src/index.js";
|
|
4
4
|
import "../../../packages/browser-control-contract/src/index.js";
|
|
5
|
+
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
5
6
|
import { extractDocumentText } from "../../document-understanding/extract.js";
|
|
6
|
-
import {
|
|
7
|
+
import { prepareImageForModel } from "../image/prepare-image-for-model.js";
|
|
7
8
|
import { processLocationTask } from "../../endpoint-tools/location-task.js";
|
|
8
9
|
import { projectDeviceReading } from "../../endpoint-tools/result-projector.js";
|
|
9
|
-
import { DeviceTargetResolver } from "../../endpoint-tools/target-resolver.js";
|
|
10
10
|
import { getEndpointDeviceSettings } from "../../storage/sqlite/endpoint-device-settings-repository.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { DeviceTargetResolver } from "../../endpoint-tools/target-resolver.js";
|
|
12
|
+
import { EndpointToolExecutionError } from "../../endpoint-tools/invocation-service.js";
|
|
13
13
|
import { createHash } from "node:crypto";
|
|
14
14
|
//#region src/agent/external-tools/endpoint-provider.ts
|
|
15
15
|
init_src();
|
|
@@ -7,11 +7,11 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
|
|
|
7
7
|
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
8
8
|
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
9
9
|
import { listConnectorInstances } from "../../connectors/instances.js";
|
|
10
|
-
import { getStoreConnectorInstallPlan, parseStoreConnectorCandidateRef, searchStoreConnectorInstallCandidates } from "../../capabilities/store-connector.js";
|
|
11
|
-
import { connectionCandidates, resolveConnectionCandidate } from "../../connectors/connection-candidates.js";
|
|
12
10
|
import { parseExternalToolRef } from "./refs.js";
|
|
13
11
|
import { setXopcToolMetadata } from "../embedded/tool-metadata.js";
|
|
12
|
+
import { getStoreConnectorInstallPlan, parseStoreConnectorCandidateRef, searchStoreConnectorInstallCandidates } from "../../capabilities/store-connector.js";
|
|
14
13
|
import { assertPersonalRequestAccountAccess } from "../../personal-agent/request-access.js";
|
|
14
|
+
import { connectionCandidates, resolveConnectionCandidate } from "../../connectors/connection-candidates.js";
|
|
15
15
|
import { ExternalToolService } from "./service.js";
|
|
16
16
|
import { EXTERNAL_TOOL_SOURCES } from "./types.js";
|
|
17
17
|
import { bindExternalToolRegistry } from "./tool-registry.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
+
import { imageFileExtensionForMimeType } from "./image-assets.js";
|
|
3
4
|
import { pickTimeoutMsOrFallback } from "../../../media-shared/http/deadline.js";
|
|
4
5
|
import { privateNetworkPolicyToSsrfGuardOptions } from "../../../media-shared/http/private-network.js";
|
|
5
6
|
import { resolveProviderHttpRequestConfig } from "../../../media-shared/http/resolve-provider-http-request-config.js";
|
|
@@ -8,7 +9,6 @@ import "../../../media-shared/http/index.js";
|
|
|
8
9
|
import { ImageProviderError, validateImageRequest } from "../../../../packages/image-providers/src/validation.js";
|
|
9
10
|
import { decodeBase64, imageFromBytes } from "../../../../packages/image-providers/src/http.js";
|
|
10
11
|
import "../../../../packages/image-providers/src/index.js";
|
|
11
|
-
import { imageFileExtensionForMimeType } from "./image-assets.js";
|
|
12
12
|
//#region src/agent/image/generation/openai-images-provider.ts
|
|
13
13
|
/** Strict implementation of the OpenAI Images REST protocol. */
|
|
14
14
|
init_logger();
|
|
@@ -3,12 +3,12 @@ import { init_logger } from "../../../utils/logger.js";
|
|
|
3
3
|
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../providers/env-keys.js";
|
|
4
4
|
import { ImageProviderError } from "../../../../packages/image-providers/src/validation.js";
|
|
5
5
|
import "../../../../packages/image-providers/src/index.js";
|
|
6
|
-
import { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary as listImageGenerationProvidersSummary$1 } from "./provider-registry.js";
|
|
7
6
|
import { describeFailoverError, isFailoverError } from "../../failover-error.js";
|
|
8
7
|
import { buildNoCapabilityModelConfiguredMessage, recordCapabilityCandidateFailure, resolveCapabilityModelCandidates, throwCapabilityGenerationFailure } from "../../media-generation/runtime-shared.js";
|
|
9
8
|
import "../../media-generation/index.js";
|
|
10
9
|
import { parseImageGenerationModelRef } from "./model-ref.js";
|
|
11
10
|
import { validateImageGenerationRequest } from "./validation.js";
|
|
11
|
+
import { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary as listImageGenerationProvidersSummary$1 } from "./provider-registry.js";
|
|
12
12
|
//#region src/agent/image/generation/runtime.ts
|
|
13
13
|
init_env_keys();
|
|
14
14
|
init_logger();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getImageGenerationProvider, listImageGenerationProviders } from "./generation/provider-registry.js";
|
|
2
1
|
import { getImageUnderstandingProvider, listImageUnderstandingProviders, registerImageUnderstandingProvider } from "./understanding/provider-registry.js";
|
|
3
2
|
import { resolveImageModelConfigForTool } from "./tool-model-config.js";
|
|
4
3
|
import { describeImages, describeImagesWithFallback } from "./understanding/runtime.js";
|
|
5
4
|
import { modelSupportsVision, resolveImageHandlingStrategy } from "./vision-detection.js";
|
|
6
5
|
import { runWithImageModelFallback } from "./image-model-fallback.js";
|
|
7
6
|
import { loadImageForToolInput } from "./load-image-media.js";
|
|
7
|
+
import { getImageGenerationProvider, listImageGenerationProviders } from "./generation/provider-registry.js";
|
|
8
8
|
import { generateImage, listImageGenerationProvidersSummary } from "./generation/runtime.js";
|
|
9
9
|
export { describeImages, describeImagesWithFallback, generateImage, getImageGenerationProvider, getImageUnderstandingProvider, listImageGenerationProviders, listImageGenerationProvidersSummary, listImageUnderstandingProviders, loadImageForToolInput, modelSupportsVision, registerImageUnderstandingProvider, resolveImageHandlingStrategy, resolveImageModelConfigForTool, runWithImageModelFallback };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { stripRuntimeUserMessageEnvelope } from "../../../packages/gateway-contract/src/user-message-display.js";
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
4
|
+
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
5
|
+
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
3
6
|
import { mimeTypeFromMediaPath } from "../../media/store.js";
|
|
4
7
|
import { readMediaReference } from "../../media/media-reference.js";
|
|
5
|
-
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
6
|
-
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
7
8
|
import { MODEL_IMAGE_MAX_BYTES, MODEL_IMAGE_SOURCE_MAX_BYTES, prepareImageForModel } from "../image/prepare-image-for-model.js";
|
|
8
9
|
import { isImageInboundAttachment } from "../../channels/attachments/attachment-classifiers.js";
|
|
9
10
|
import "../../channels/attachments/inbound-persist.js";
|
|
10
11
|
import { expandAtFileMentionsInPlainText } from "../context/expand-at-file-mentions.js";
|
|
11
|
-
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
12
12
|
import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
|
|
13
13
|
import { resolveInboundImageContentParts } from "../image/inbound-image-handling.js";
|
|
14
14
|
//#region src/agent/inbound/attachment-pipeline.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { runWithLogContext, updateAsyncLogContext } from "../../utils/logger/context.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
4
|
-
import "../../infra/bus/index.js";
|
|
5
3
|
import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
|
|
6
4
|
import { initSessionTurn } from "../../session/init-session-turn.js";
|
|
5
|
+
import { MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
6
|
+
import "../../infra/bus/index.js";
|
|
7
7
|
import { runEmbeddedTurnForSession } from "../embedded/run-for-session.js";
|
|
8
8
|
import { inboundMessageLogRequestId } from "../service-inbound-utils.js";
|
|
9
9
|
//#region src/agent/inbound/inbound-loop.ts
|
package/dist/src/agent/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { extractToolCallsFromAssistant, extractToolResultId, sanitizeToolCallId, sanitizeToolCallIdsForCloudCodeAssist } from "./transcript/tool-call-id.js";
|
|
2
|
-
import { makeMissingToolResult, repairToolUseResultPairing, sanitizeToolCallInputs, sanitizeToolUseResultPairing, stripToolResultDetails } from "./transcript/session-transcript-repair.js";
|
|
3
1
|
import { resolveTranscriptPolicy } from "./transcript/transcript-policy.js";
|
|
4
2
|
import { dropThinkingBlocks } from "./transcript/thinking.js";
|
|
3
|
+
import { extractToolCallsFromAssistant, extractToolResultId, sanitizeToolCallId, sanitizeToolCallIdsForCloudCodeAssist } from "./transcript/tool-call-id.js";
|
|
4
|
+
import { makeMissingToolResult, repairToolUseResultPairing, sanitizeToolCallInputs, sanitizeToolUseResultPairing, stripToolResultDetails } from "./transcript/session-transcript-repair.js";
|
|
5
5
|
import { applySessionTranscriptHygiene, applySessionTranscriptHygieneForPersistence, applySessionTranscriptHygieneWithPolicy, resolvePolicyForModel, tryApplySessionTranscriptHygiene, tryApplySessionTranscriptHygieneForPersistence } from "./transcript/transcript-hygiene.js";
|
|
6
|
-
import { AgentService } from "./service.js";
|
|
7
6
|
import { createResponseMessage, createSignalMessage, createTaskMessage, isValidIPCMessage } from "./ipc/types.js";
|
|
8
7
|
import { AgentInbox } from "./ipc/inbox.js";
|
|
9
8
|
import { AgentBus } from "./ipc/bus.js";
|
|
10
9
|
import { AgentSocketClient, AgentSocketServer, isSocketAvailable } from "./ipc/socket.js";
|
|
11
10
|
import "./ipc/index.js";
|
|
11
|
+
import { AgentService } from "./service.js";
|
|
12
12
|
import { stripToolMessages } from "./transcript/strip-tool-messages.js";
|
|
13
13
|
import "./transcript/index.js";
|
|
14
14
|
export { AgentBus, AgentInbox, AgentService, AgentSocketClient, AgentSocketServer, applySessionTranscriptHygiene, applySessionTranscriptHygieneForPersistence, applySessionTranscriptHygieneWithPolicy, createResponseMessage, createSignalMessage, createTaskMessage, dropThinkingBlocks, extractToolCallsFromAssistant, extractToolResultId, isSocketAvailable, isValidIPCMessage, makeMissingToolResult, repairToolUseResultPairing, resolvePolicyForModel, resolveTranscriptPolicy, sanitizeToolCallId, sanitizeToolCallIdsForCloudCodeAssist, sanitizeToolCallInputs, sanitizeToolUseResultPairing, stripToolMessages, stripToolResultDetails, tryApplySessionTranscriptHygiene, tryApplySessionTranscriptHygieneForPersistence };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Config } from '../../config/schema.js';
|
|
2
|
+
import { type McpConnectionProbe } from './connection-setup.js';
|
|
3
|
+
export declare function mcpConfigRevision(value: unknown): string;
|
|
4
|
+
export declare class McpDraftError extends Error {
|
|
5
|
+
readonly status: 400 | 404 | 409 | 429 | 500;
|
|
6
|
+
constructor(status: 400 | 404 | 409 | 429 | 500, message: string);
|
|
7
|
+
}
|
|
8
|
+
export type McpDraftInput = {
|
|
9
|
+
serverId: string;
|
|
10
|
+
sourceServerId?: string;
|
|
11
|
+
expectedServer?: unknown;
|
|
12
|
+
server: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** Unsaved configuration and OAuth state belong to one principal and never enter the live registry. */
|
|
15
|
+
export declare class McpConnectionDrafts {
|
|
16
|
+
private readonly options;
|
|
17
|
+
private readonly completed;
|
|
18
|
+
private readonly drafts;
|
|
19
|
+
constructor(options: {
|
|
20
|
+
readConfig: () => Config;
|
|
21
|
+
saveConfig: (config: Config, expectedConfig?: Config) => Promise<{
|
|
22
|
+
saved: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
persisted?: boolean;
|
|
25
|
+
conflict?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
});
|
|
28
|
+
create(owner: string, input: McpDraftInput): Promise<{
|
|
29
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
30
|
+
serverId: string;
|
|
31
|
+
expiresAt: number;
|
|
32
|
+
}>;
|
|
33
|
+
probe(owner: string, id: string): Promise<McpConnectionProbe>;
|
|
34
|
+
authorize(owner: string, id: string): import("./connection-setup.js").McpAuthorization;
|
|
35
|
+
authorization(owner: string, id: string): import("./connection-setup.js").McpAuthorization;
|
|
36
|
+
redirect(owner: string, id: string, url: string): void;
|
|
37
|
+
cancelAuthorization(owner: string, id: string): void;
|
|
38
|
+
tools(owner: string, id: string): Promise<import("./tool-catalog.js").McpCatalogTool[]>;
|
|
39
|
+
/** Caller serializes this with other Gateway config writes. Only this entry is merged into the latest config. */
|
|
40
|
+
commit(owner: string, id: string, enable?: boolean): Promise<{
|
|
41
|
+
reloadRequired?: boolean;
|
|
42
|
+
serverId: string;
|
|
43
|
+
}>;
|
|
44
|
+
remove(owner: string, id: string): void;
|
|
45
|
+
close(): void;
|
|
46
|
+
private get;
|
|
47
|
+
private assertIdle;
|
|
48
|
+
private assertAvailable;
|
|
49
|
+
private dispose;
|
|
50
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { McpServerSchema, init_schema } from "../../config/schema.js";
|
|
2
|
+
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
3
|
+
import { isManagedConnectorServer } from "../../connectors/materialize.js";
|
|
4
|
+
import { createNativeMcpCredentials } from "./credential-store.js";
|
|
5
|
+
import { loadMergedMcpConfig } from "./config.js";
|
|
6
|
+
import { discoverMcpTools } from "./tool-catalog.js";
|
|
7
|
+
import { cancelMcpAuthorization, getMcpAuthorization, probeMcpConnection, startMcpAuthorization, submitMcpRedirect } from "./connection-setup.js";
|
|
8
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
9
|
+
//#region src/agent/mcp/connection-drafts.ts
|
|
10
|
+
init_schema();
|
|
11
|
+
const TTL_MS = 10 * 6e4;
|
|
12
|
+
function canonical(value) {
|
|
13
|
+
if (Array.isArray(value)) return value.map(canonical);
|
|
14
|
+
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).filter(([, child]) => child !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([key, child]) => [key, canonical(child)]));
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function mcpConfigRevision(value) {
|
|
18
|
+
return createHash("sha256").update(JSON.stringify(canonical(value)) ?? "null").digest("hex");
|
|
19
|
+
}
|
|
20
|
+
var McpDraftError = class extends Error {
|
|
21
|
+
constructor(status, message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.status = status;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/** Unsaved configuration and OAuth state belong to one principal and never enter the live registry. */
|
|
27
|
+
var McpConnectionDrafts = class {
|
|
28
|
+
completed = /* @__PURE__ */ new Map();
|
|
29
|
+
drafts = /* @__PURE__ */ new Map();
|
|
30
|
+
constructor(options) {
|
|
31
|
+
this.options = options;
|
|
32
|
+
}
|
|
33
|
+
async create(owner, input) {
|
|
34
|
+
const current = this.options.readConfig();
|
|
35
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(input.serverId) || input.sourceServerId && input.sourceServerId !== input.serverId) throw new McpDraftError(400, "Invalid or changed MCP server ID.");
|
|
36
|
+
const source = Object.hasOwn(current.mcp?.servers ?? {}, input.serverId) ? current.mcp?.servers?.[input.serverId] : void 0;
|
|
37
|
+
if (input.sourceServerId && (!source || isManagedConnectorServer(source))) throw new McpDraftError(409, "The original custom server no longer exists.");
|
|
38
|
+
if (input.sourceServerId && mcpConfigRevision(source) !== mcpConfigRevision(input.expectedServer)) throw new McpDraftError(409, "The original configuration changed. Reload before testing.");
|
|
39
|
+
this.assertAvailable(current, input.serverId, input.sourceServerId);
|
|
40
|
+
const parsed = McpServerSchema.safeParse(input.server);
|
|
41
|
+
if (!parsed.success) throw new McpDraftError(400, "Invalid MCP configuration.");
|
|
42
|
+
const revision = mcpConfigRevision(source);
|
|
43
|
+
const server = structuredClone(parsed.data);
|
|
44
|
+
for (const internal of [
|
|
45
|
+
"xopcConnector",
|
|
46
|
+
"xopcPlugin",
|
|
47
|
+
"xopcOAuthCredentialId",
|
|
48
|
+
"xopcConnectionCheck"
|
|
49
|
+
]) delete server[internal];
|
|
50
|
+
const workspace = getWorkspacePath(current) || process.cwd();
|
|
51
|
+
const config = structuredClone(current);
|
|
52
|
+
config.mcp = { servers: { [input.serverId]: {
|
|
53
|
+
...server,
|
|
54
|
+
enabled: true
|
|
55
|
+
} } };
|
|
56
|
+
const credentials = await createNativeMcpCredentials(true);
|
|
57
|
+
if (this.drafts.size >= 100 || [...this.drafts.values()].filter((draft) => draft.owner === owner).length >= 8) throw new McpDraftError(429, "Too many unsaved MCP connection tests.");
|
|
58
|
+
const id = randomUUID();
|
|
59
|
+
const timer = setTimeout(() => {
|
|
60
|
+
const draft = this.drafts.get(id);
|
|
61
|
+
if (draft && !draft.committing) this.dispose(draft);
|
|
62
|
+
}, TTL_MS);
|
|
63
|
+
timer.unref();
|
|
64
|
+
const draft = {
|
|
65
|
+
id,
|
|
66
|
+
owner,
|
|
67
|
+
serverId: input.serverId,
|
|
68
|
+
sourceServerId: input.sourceServerId,
|
|
69
|
+
revision,
|
|
70
|
+
workspace,
|
|
71
|
+
server,
|
|
72
|
+
config,
|
|
73
|
+
credentials,
|
|
74
|
+
controller: new AbortController(),
|
|
75
|
+
timer,
|
|
76
|
+
expiresAt: Date.now() + TTL_MS,
|
|
77
|
+
running: false,
|
|
78
|
+
committing: false
|
|
79
|
+
};
|
|
80
|
+
this.drafts.set(id, draft);
|
|
81
|
+
return {
|
|
82
|
+
id,
|
|
83
|
+
serverId: draft.serverId,
|
|
84
|
+
expiresAt: draft.expiresAt
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async probe(owner, id) {
|
|
88
|
+
const draft = this.get(owner, id);
|
|
89
|
+
this.assertIdle(draft);
|
|
90
|
+
draft.authorizationId = void 0;
|
|
91
|
+
draft.running = true;
|
|
92
|
+
draft.probe = void 0;
|
|
93
|
+
draft.checkedAt = void 0;
|
|
94
|
+
try {
|
|
95
|
+
const result = await probeMcpConnection(draft.config, draft.workspace, draft.serverId, {
|
|
96
|
+
credentials: draft.credentials,
|
|
97
|
+
signal: draft.controller.signal
|
|
98
|
+
});
|
|
99
|
+
this.get(owner, id);
|
|
100
|
+
draft.probe = result;
|
|
101
|
+
if (result.state === "connected") draft.checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
102
|
+
return result;
|
|
103
|
+
} finally {
|
|
104
|
+
draft.running = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
authorize(owner, id) {
|
|
108
|
+
const draft = this.get(owner, id);
|
|
109
|
+
this.assertIdle(draft);
|
|
110
|
+
if (draft.authorizationId) cancelMcpAuthorization(draft.authorizationId, owner);
|
|
111
|
+
draft.probe = void 0;
|
|
112
|
+
const attempt = startMcpAuthorization(draft.config, draft.workspace, draft.serverId, owner, {
|
|
113
|
+
credentials: draft.credentials,
|
|
114
|
+
authorizationScope: draft.id
|
|
115
|
+
});
|
|
116
|
+
draft.authorizationId = attempt.id;
|
|
117
|
+
return attempt;
|
|
118
|
+
}
|
|
119
|
+
authorization(owner, id) {
|
|
120
|
+
const draft = this.get(owner, id);
|
|
121
|
+
const result = draft.authorizationId && getMcpAuthorization(draft.authorizationId, owner, draft.config);
|
|
122
|
+
if (!result) throw new McpDraftError(404, "Draft authorization not found.");
|
|
123
|
+
if (result.state === "connected" && draft.probe?.state !== "connected") {
|
|
124
|
+
draft.probe = {
|
|
125
|
+
state: "connected",
|
|
126
|
+
toolCount: result.toolCount
|
|
127
|
+
};
|
|
128
|
+
draft.checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
redirect(owner, id, url) {
|
|
133
|
+
const draft = this.get(owner, id);
|
|
134
|
+
if (!draft.authorizationId || !submitMcpRedirect(draft.authorizationId, owner, url, draft.config)) throw new McpDraftError(400, "The callback address does not match this draft authorization.");
|
|
135
|
+
}
|
|
136
|
+
cancelAuthorization(owner, id) {
|
|
137
|
+
const draft = this.get(owner, id);
|
|
138
|
+
if (draft.committing) throw new McpDraftError(409, "This draft is being saved.");
|
|
139
|
+
if (draft.running) throw new McpDraftError(409, "A connection test is still running.");
|
|
140
|
+
if (draft.authorizationId) cancelMcpAuthorization(draft.authorizationId, owner);
|
|
141
|
+
draft.authorizationId = void 0;
|
|
142
|
+
draft.probe = void 0;
|
|
143
|
+
}
|
|
144
|
+
async tools(owner, id) {
|
|
145
|
+
const draft = this.get(owner, id);
|
|
146
|
+
this.assertIdle(draft);
|
|
147
|
+
if (draft.probe?.state !== "connected") throw new McpDraftError(409, "Test the connection first.");
|
|
148
|
+
draft.running = true;
|
|
149
|
+
try {
|
|
150
|
+
const tools = await discoverMcpTools(draft.config, draft.workspace, draft.serverId, {
|
|
151
|
+
credentials: draft.credentials,
|
|
152
|
+
signal: draft.controller.signal
|
|
153
|
+
});
|
|
154
|
+
this.get(owner, id);
|
|
155
|
+
return tools;
|
|
156
|
+
} finally {
|
|
157
|
+
draft.running = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Caller serializes this with other Gateway config writes. Only this entry is merged into the latest config. */
|
|
161
|
+
async commit(owner, id, enable = false) {
|
|
162
|
+
const completed = this.completed.get(id);
|
|
163
|
+
if (completed?.owner === owner) {
|
|
164
|
+
if (completed.enable !== enable) throw new McpDraftError(409, "This test has already been committed with different settings.");
|
|
165
|
+
return {
|
|
166
|
+
serverId: completed.serverId,
|
|
167
|
+
...completed.reloadRequired ? { reloadRequired: true } : {}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const draft = this.get(owner, id);
|
|
171
|
+
this.assertIdle(draft);
|
|
172
|
+
if (draft.authorizationId) this.authorization(owner, id);
|
|
173
|
+
if (draft.probe?.state !== "connected") throw new McpDraftError(409, "A successful connection test is required before saving.");
|
|
174
|
+
const current = this.options.readConfig();
|
|
175
|
+
if (mcpConfigRevision(current.mcp?.servers?.[draft.serverId]) !== draft.revision || (getWorkspacePath(current) || process.cwd()) !== draft.workspace) throw new McpDraftError(409, "Configuration changed after the test. Reload and test again.");
|
|
176
|
+
this.assertAvailable(current, draft.serverId, draft.sourceServerId);
|
|
177
|
+
draft.committing = true;
|
|
178
|
+
let alias;
|
|
179
|
+
let durable;
|
|
180
|
+
let published = false;
|
|
181
|
+
try {
|
|
182
|
+
const server = structuredClone(draft.server);
|
|
183
|
+
if (enable) server.enabled = true;
|
|
184
|
+
if (server.url) {
|
|
185
|
+
const state = await draft.credentials.forServer(draft.serverId, server.url).load();
|
|
186
|
+
const candidateAlias = `mcp_draft_${randomUUID().replaceAll("-", "")}`;
|
|
187
|
+
durable = await createNativeMcpCredentials();
|
|
188
|
+
await durable.forServer(candidateAlias, server.url).save(state?.tokens ? {
|
|
189
|
+
...state,
|
|
190
|
+
codeVerifier: void 0,
|
|
191
|
+
oauthState: void 0
|
|
192
|
+
} : { serverUrl: server.url });
|
|
193
|
+
alias = candidateAlias;
|
|
194
|
+
server.xopcOAuthCredentialId = alias;
|
|
195
|
+
}
|
|
196
|
+
server.xopcConnectionCheck = {
|
|
197
|
+
checkedAt: draft.checkedAt,
|
|
198
|
+
toolCount: draft.probe.toolCount ?? 0,
|
|
199
|
+
revision: mcpConfigRevision(server)
|
|
200
|
+
};
|
|
201
|
+
const latest = this.options.readConfig();
|
|
202
|
+
if (mcpConfigRevision(latest.mcp?.servers?.[draft.serverId]) !== draft.revision || (getWorkspacePath(latest) || process.cwd()) !== draft.workspace) throw new McpDraftError(409, "Configuration changed while preparing the save. Test again.");
|
|
203
|
+
this.assertAvailable(latest, draft.serverId, draft.sourceServerId);
|
|
204
|
+
const next = structuredClone(latest);
|
|
205
|
+
next.mcp = {
|
|
206
|
+
...next.mcp,
|
|
207
|
+
servers: {
|
|
208
|
+
...next.mcp?.servers,
|
|
209
|
+
[draft.serverId]: server
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const result = await this.options.saveConfig(next, structuredClone(latest));
|
|
213
|
+
published = result.persisted === true || alias !== void 0 && this.options.readConfig().mcp?.servers?.[draft.serverId]?.xopcOAuthCredentialId === alias;
|
|
214
|
+
if (result.conflict) throw new McpDraftError(409, "Configuration changed before writing. Reload and test again.");
|
|
215
|
+
if (!result.saved && !result.persisted) throw new McpDraftError(500, "Could not save MCP configuration. Retry or reload the current configuration.");
|
|
216
|
+
const reloadRequired = !result.saved;
|
|
217
|
+
published = true;
|
|
218
|
+
const timer = setTimeout(() => this.completed.delete(id), TTL_MS);
|
|
219
|
+
timer.unref();
|
|
220
|
+
this.completed.set(id, {
|
|
221
|
+
owner,
|
|
222
|
+
enable,
|
|
223
|
+
serverId: draft.serverId,
|
|
224
|
+
reloadRequired,
|
|
225
|
+
timer
|
|
226
|
+
});
|
|
227
|
+
this.dispose(draft);
|
|
228
|
+
return {
|
|
229
|
+
serverId: draft.serverId,
|
|
230
|
+
...reloadRequired ? { reloadRequired: true } : {}
|
|
231
|
+
};
|
|
232
|
+
} finally {
|
|
233
|
+
draft.committing = false;
|
|
234
|
+
if (alias && this.options.readConfig().mcp?.servers?.[draft.serverId]?.xopcOAuthCredentialId === alias) published = true;
|
|
235
|
+
if (!published && alias && durable && draft.server.url) durable.remove(alias, draft.server.url);
|
|
236
|
+
if (this.drafts.has(id) && draft.expiresAt <= Date.now()) this.dispose(draft);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
remove(owner, id) {
|
|
240
|
+
const draft = this.drafts.get(id);
|
|
241
|
+
if (!draft || draft.owner !== owner) return;
|
|
242
|
+
if (draft.committing) throw new McpDraftError(409, "This draft is being saved.");
|
|
243
|
+
this.dispose(draft);
|
|
244
|
+
}
|
|
245
|
+
close() {
|
|
246
|
+
for (const draft of this.drafts.values()) this.dispose(draft);
|
|
247
|
+
for (const item of this.completed.values()) clearTimeout(item.timer);
|
|
248
|
+
this.completed.clear();
|
|
249
|
+
}
|
|
250
|
+
get(owner, id) {
|
|
251
|
+
const draft = this.drafts.get(id);
|
|
252
|
+
if (!draft || draft.owner !== owner) throw new McpDraftError(404, "MCP draft not found or expired.");
|
|
253
|
+
if (draft.expiresAt <= Date.now() && !draft.committing) {
|
|
254
|
+
this.dispose(draft);
|
|
255
|
+
throw new McpDraftError(404, "MCP draft expired.");
|
|
256
|
+
}
|
|
257
|
+
return draft;
|
|
258
|
+
}
|
|
259
|
+
assertIdle(draft) {
|
|
260
|
+
const auth = draft.authorizationId && getMcpAuthorization(draft.authorizationId, draft.owner, draft.config);
|
|
261
|
+
if (draft.running || draft.committing || auth && (auth.state === "starting" || auth.state === "authorizing")) throw new McpDraftError(409, "Another draft operation is still running.");
|
|
262
|
+
}
|
|
263
|
+
assertAvailable(config, id, sourceId) {
|
|
264
|
+
const all = loadMergedMcpConfig({
|
|
265
|
+
cfg: config,
|
|
266
|
+
workspaceDir: getWorkspacePath(config) || process.cwd()
|
|
267
|
+
}).config.mcpServers;
|
|
268
|
+
if (Object.keys(all).some((other) => other !== sourceId && other.replaceAll("-", "_") === id.replaceAll("-", "_"))) throw new McpDraftError(409, "The MCP server ID is already in use.");
|
|
269
|
+
}
|
|
270
|
+
dispose(draft) {
|
|
271
|
+
this.drafts.delete(draft.id);
|
|
272
|
+
clearTimeout(draft.timer);
|
|
273
|
+
draft.controller.abort();
|
|
274
|
+
if (draft.authorizationId) cancelMcpAuthorization(draft.authorizationId, draft.owner);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
//#endregion
|
|
278
|
+
export { McpConnectionDrafts, McpDraftError, mcpConfigRevision };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Config } from '../../config/schema.js';
|
|
2
|
+
import { type McpSessionOptions } from './tool-catalog.js';
|
|
2
3
|
export type McpConnectionProbe = {
|
|
3
4
|
state: 'connected' | 'oauth_required' | 'token_required' | 'error';
|
|
4
5
|
toolCount?: number;
|
|
5
6
|
error?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare function probeMcpConnection(config: Config, workspace: string, serverId: string): Promise<McpConnectionProbe>;
|
|
8
|
+
export declare function probeMcpConnection(config: Config, workspace: string, serverId: string, options?: McpSessionOptions): Promise<McpConnectionProbe>;
|
|
8
9
|
export type McpAuthorization = {
|
|
9
10
|
id: string;
|
|
10
11
|
serverId: string;
|
|
@@ -15,7 +16,9 @@ export type McpAuthorization = {
|
|
|
15
16
|
error?: string;
|
|
16
17
|
};
|
|
17
18
|
/** A UI bridge to native pi's login command; no host-owned OAuth client or token store. */
|
|
18
|
-
export declare function startMcpAuthorization(config: Config, workspace: string, serverId: string, owner: string
|
|
19
|
+
export declare function startMcpAuthorization(config: Config, workspace: string, serverId: string, owner: string, options?: McpSessionOptions & {
|
|
20
|
+
authorizationScope?: string;
|
|
21
|
+
}): McpAuthorization;
|
|
19
22
|
export declare function getMcpAuthorization(id: string, owner: string, config: Config): McpAuthorization | undefined;
|
|
20
23
|
export declare function cancelMcpAuthorization(id: string, owner: string): boolean;
|
|
21
24
|
export declare function submitMcpRedirect(id: string, owner: string, redirectUrl: string, config: Config): boolean;
|
|
@@ -71,11 +71,11 @@ async function advertisesOAuth(config, workspace, serverId) {
|
|
|
71
71
|
const legacy = await metadata(new URL("/.well-known/oauth-authorization-server", url));
|
|
72
72
|
return Boolean(legacy && legacy.issuer === url.origin && typeof legacy.authorization_endpoint === "string" && typeof legacy.token_endpoint === "string");
|
|
73
73
|
}
|
|
74
|
-
async function probeMcpConnection(config, workspace, serverId) {
|
|
74
|
+
async function probeMcpConnection(config, workspace, serverId, options) {
|
|
75
75
|
try {
|
|
76
76
|
return {
|
|
77
77
|
state: "connected",
|
|
78
|
-
toolCount: (await discoverMcpTools(config, workspace, serverId)).length
|
|
78
|
+
toolCount: (await discoverMcpTools(config, workspace, serverId, options)).length
|
|
79
79
|
};
|
|
80
80
|
} catch (error) {
|
|
81
81
|
if (error instanceof McpAuthenticationRequiredError) try {
|
|
@@ -117,15 +117,17 @@ function cancel(attempt) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
/** A UI bridge to native pi's login command; no host-owned OAuth client or token store. */
|
|
120
|
-
function startMcpAuthorization(config, workspace, serverId, owner) {
|
|
120
|
+
function startMcpAuthorization(config, workspace, serverId, owner, options) {
|
|
121
121
|
const server = config.mcp?.servers?.[serverId];
|
|
122
122
|
if (!server?.url || server.enabled === false || isManagedConnectorServer(server) && server.xopcConnector.enabled === false) throw new Error("An enabled HTTP MCP server is required.");
|
|
123
123
|
httpUrl(server.url);
|
|
124
124
|
if (server.auth || Object.keys(server.headers ?? {}).some((name) => name.toLowerCase() === "authorization")) throw new Error("This server uses configured credentials. Remove Authorization before using OAuth.");
|
|
125
|
-
|
|
125
|
+
const scope = options?.authorizationScope ?? serverId;
|
|
126
|
+
for (const attempt of attempts.values()) if (attempt.owner === owner && attempt.scope === scope) cancel(attempt);
|
|
126
127
|
if (attempts.size >= 100) throw new Error("Too many pending sign-ins. Try again later.");
|
|
127
128
|
const attempt = {
|
|
128
129
|
owner,
|
|
130
|
+
scope,
|
|
129
131
|
fingerprint: fingerprint(config, serverId),
|
|
130
132
|
controller: new AbortController(),
|
|
131
133
|
result: {
|
|
@@ -159,7 +161,7 @@ function startMcpAuthorization(config, workspace, serverId, owner) {
|
|
|
159
161
|
attempt.dispose = () => signal?.removeEventListener("abort", stop);
|
|
160
162
|
});
|
|
161
163
|
}
|
|
162
|
-
}).then((tools) => {
|
|
164
|
+
}, options).then((tools) => {
|
|
163
165
|
if (!attempt.controller.signal.aborted) {
|
|
164
166
|
attempt.result.state = "connected";
|
|
165
167
|
attempt.result.toolCount = tools.length;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { McpExtensionOptions } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
export type NativeMcpCredentials = NonNullable<McpExtensionOptions['credentials']>;
|
|
3
|
+
/** Use pi's own stores; never change PI_CODING_AGENT_DIR for an individual connection. */
|
|
4
|
+
export declare function createNativeMcpCredentials(memory?: boolean): Promise<NativeMcpCredentials>;
|
|
5
|
+
/** Credential identity may change on commit without changing the public tool namespace. */
|
|
6
|
+
export declare function routeNativeMcpCredentials(store: NativeMcpCredentials, aliases: ReadonlyMap<string, string>): NativeMcpCredentials;
|