@xopcai/xopc 0.0.368 → 0.0.370
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -174
- package/README.zh-CN.md +59 -174
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js +131 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js +30 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js +252 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js +16 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js +66 -0
- package/dist/browser-ext/_locales/en/messages.json +30 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +30 -1
- package/dist/browser-ext/dist/assets/{auth-beGtbLPS.js → page-context-BeworyNB.js} +1331 -1355
- package/dist/browser-ext/dist/assets/{sidepanel-BT0ojEzG.css → sidepanel-Ccl0eSa1.css} +43 -0
- package/dist/browser-ext/dist/background.js +680 -182
- package/dist/browser-ext/dist/sidepanel.html +2 -2
- package/dist/browser-ext/dist/sidepanel.js +393 -194
- package/dist/browser-ext/manifest.json +2 -8
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-D9ZMh5ZR.js → activity-store-BQ3PMp2q.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bj3rvcTm.js → agent-avatar-dicebear-C61i1QbX.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0fCR1DHx.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-Di99mUTT.js +1 -0
- package/dist/gateway/static/root/assets/agents-BRZZmYH_.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-B5QDepbW.js → agents-admin-api-HBZvVyzF.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-2rTEtB_X.js → app-management-settings-panel-noqqxkds.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BPVBS80k.js → appearance-settings-DG8QN0gR.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-1FuKlZYP.js → apps-page-CgiyzFYo.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BbT1O7oK.js → archive-plugin-BO3I9zRP.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DjwP_h8h.js → automations-page-CgAcRFDS.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BIkxIpab.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-gS7Wg68v.js → binary-plugins-gFD7vH9R.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DbwMaivP.js → block-editor-B1VE-jAe.js} +2 -2
- package/dist/gateway/static/root/assets/browser-automation-inputs-DxRoKFun.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-CIjyMS6f.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BMAivBfp.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-Lswa0hv8.js → capabilities-CY4SiHcP.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dd1PZRQw.js → capabilities-gjQtMhKu.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-DRdcfo68.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DTHR1DrJ.js → capabilities-settings-panel-ZuL6pWjM.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-494dnJsj.js → capability-header-actions-D0GC1FEv.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CgE22Pzd.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bl7-Zk-x.js → chat-terminal-dock-CEjh1utz.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-ByExKr_6.js → computer-settings-page-vFHJAmQr.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BK_5aFxO.js → connector-service-page-DTrwZ4kV.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DRcMiTWu.js +1 -0
- package/dist/gateway/static/root/assets/copy-text-row-C1gaJwlZ.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-BXJv6472.js → date-picker-NfGIPSYY.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-CqguveUi.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DWNEC3mk.js → desktop-pet-CTx1zkJm.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BYwlxGiN.js → desktop-pet-settings-BRDS3EGc.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BAc4F35b.js → device-pairing-wizard-Du4Ciuyw.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D26tSY8Z.js → directory-picker-path-field-CjstlxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-xYIGNegB.js → extension-debug-page-BfAtjhoK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BoQ1-3AW.js → extension-page-BJmudejr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-Cw_JU6RR.js → extension-provider-Br6LXyIj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BH5TFGPe.js → extension-settings-page-UvmHniyz.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-04Wqmw14.js → fallback-models-euw9MGdt.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CNf0ZeRw.js → gateway-config-swr-7RKqgU_U.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-F6D4A7N5.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BheKaO6d.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-BqvCJVUC.js → gateway-settings-C7roPHh1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DIxHacUw.js → gateway-startup-retry-jiV5sbEX.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BGNCTtM3.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CS0q0Kto.js → image-generation-api-DO4mXb6I.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-n_rSLo6b.js → imports-page-DxCoT0VV.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGBkIIzM.css +1 -0
- package/dist/gateway/static/root/assets/index-FCEE325-.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-tVkrHbYF.js → keyboard-shortcuts-settings-CnLln9Ds.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-L8tYuas0.js → local-app-workbench-page-yXRkSrEj.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-SSJ9B1bH.js → local-apps-page-D46buzTk.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-pox8evDV.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-D6_rF-qT.js → locale-store-COVscAqC.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DmcCHnH0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-khN1ThNL.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-_xwUuKce.js → markdown-view-B_qnAcW2.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C631CDu4.js → media-plugins-C0Pc-wSY.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Bb2GK-Nj.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-DyPPksMP.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C_t58yha.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-vIZWQ9Yt.js → notes-api-sBgBcyLW.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-BJ0QS6xx.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BlPDM7GM.js → page-context-capture-button-DfRODHv1.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CiiXwwQE.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BJjWvoER.js → product-open-page-_Bp6HRmm.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CEd4E7Gf.js → product-preview-content-BUdiO0Ct.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Clb-fXYk.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-lszV8HuS.js → projects-page-D9JEEqhh.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-uJnjqTcn.js → registry-api-Bh9UBb-f.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CmyTq3_l.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CjnNQYW8.js → runtime-tools-settings-panel-B1_inj8L.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-B3T3dDOR.js → scenes-page-CUNAZN2_.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DT3c4Vd_.js → schema-form-CfT-9UVw.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-CICkGwn-.js → send-session-input-BW40VHiL.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-BcQodoAu.js → session-api-yjpEz4pP.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BqlvrjPE.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CXZKScvu.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B2vKXmzg.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-D-PZjcss.js → settings-page-1h3vyueg.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cqc7UlZy.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-CWS8EkJS.js → share-link-dialog-HCHM8qnf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-23NJAKiq.js → share-preview-page-Ce6FNWt1.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-iKhHbvBD.js → shares-api-c0dfWz6h.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dh5jisCK.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-C-MWdQwl.js → skill-api-deDZeQS8.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-iy02aB13.js → skill-reload-api-Ge5XymHa.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DZozl9U_.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-CtzyMxqq.js +1 -0
- package/dist/gateway/static/root/assets/{task-detail-page-B2SIEyhZ.js → task-detail-page-5f_V0h-p.js} +2 -2
- package/dist/gateway/static/root/assets/{task-expandable-content-D2LRR4BC.js → task-expandable-content-hYcgCEE3.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BJfhz-Zq.js → theme-store-BOfCKgl6.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-aHD56iaS.js → tracing-settings-page-DDWFXcST.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BCf8CfTC.js → tunnel-api-vMtlbJ-m.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-B4XUkuJd.js → usage-page-B1-BCW8U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BnnTw9RE.js → use-autosave-CSckcjFx.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Itczg0y1.js → use-composer-attachments-DJya1hIL.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-C5ONO7sF.js +2 -0
- package/dist/gateway/static/root/assets/user-model-page-D4BSq9HJ.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BphJku8x.js → voice-api-key-field-GEw5x2fU.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B4u4coFj.js → voice-config-api-3yyVwXln.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-jgOEP1xw.js → work-discovery-overlay-CjiNYJV5.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-N69crzRu.js → workflow-run-setup-panel-DJOetXvm.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CcAPFh2R.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Lzv6GDO8.js → workspace-api-WhbMvdBE.js} +2 -2
- package/dist/gateway/static/root/index.html +32 -34
- package/dist/package.js +1 -1
- package/dist/packages/browser-control-contract/src/automation.js +213 -0
- package/dist/packages/browser-control-contract/src/index.js +43 -12
- package/dist/packages/endpoint-tools-client/src/index.js +189 -0
- package/dist/packages/endpoint-tools-protocol/src/bridge.js +105 -0
- package/dist/packages/endpoint-tools-protocol/src/index.js +93 -2
- package/dist/packages/endpoint-tools-protocol/src/location.js +109 -0
- package/dist/packages/gateway-contract/src/gateway-scopes.js +3 -1
- package/dist/packages/gateway-contract/src/notifications.js +1 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +30 -5
- package/dist/packages/realtime-protocol/src/voice.js +9 -3
- package/dist/src/agent/agent-manager.js +22 -26
- package/dist/src/agent/coding/repository-instructions.js +8 -1
- package/dist/src/agent/embedded/codemode-extension.d.ts +7 -0
- package/dist/src/agent/embedded/codemode-extension.js +232 -0
- package/dist/src/agent/embedded/codemode-output.d.ts +2 -0
- package/dist/src/agent/embedded/codemode-output.js +34 -0
- package/dist/src/agent/embedded/external-tool-discovery.d.ts +6 -0
- package/dist/src/agent/embedded/external-tool-discovery.js +60 -0
- package/dist/src/agent/embedded/model-runtime.js +5 -2
- package/dist/src/agent/embedded/run-for-session.js +10 -1
- package/dist/src/agent/embedded/run-turn.js +10 -3
- package/dist/src/agent/embedded/session-runner.d.ts +9 -1
- package/dist/src/agent/embedded/session-runner.js +111 -23
- package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -0
- package/dist/src/agent/embedded/session-tool-result-guard.js +17 -0
- package/dist/src/agent/embedded/subscribe-session.js +14 -4
- package/dist/src/agent/embedded/tool-metadata.d.ts +15 -0
- package/dist/src/agent/embedded/tool-metadata.js +38 -0
- package/dist/src/agent/embedded/tool-search-extension.d.ts +5 -0
- package/dist/src/agent/embedded/tool-search-extension.js +31 -0
- package/dist/src/agent/embedded/types.d.ts +7 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +6 -0
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +148 -56
- package/dist/src/agent/external-tools/extension-provider.js +8 -1
- package/dist/src/agent/external-tools/gateway-tools.d.ts +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +45 -22
- package/dist/src/agent/external-tools/index.js +46 -14
- package/dist/src/agent/external-tools/memory-provider.js +8 -1
- package/dist/src/agent/external-tools/read-policy.js +2 -1
- package/dist/src/agent/external-tools/service.d.ts +2 -0
- package/dist/src/agent/external-tools/service.js +25 -3
- package/dist/src/agent/external-tools/tool-registry.d.ts +14 -0
- package/dist/src/agent/external-tools/tool-registry.js +14 -0
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +0 -1
- package/dist/src/agent/mcp/config.d.ts +18 -0
- package/dist/src/agent/mcp/{bundle-mcp-config.js → config.js} +8 -25
- package/dist/src/agent/mcp/native-mcp.d.ts +6 -0
- package/dist/src/agent/mcp/native-mcp.js +73 -0
- package/dist/src/agent/service.js +2 -5
- package/dist/src/agent/skills/installer.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/skills/skill-sources.js +1 -1
- package/dist/src/agent/source-context/index.d.ts +0 -1
- package/dist/src/agent/source-context/index.js +1 -2
- package/dist/src/agent/source-context/injector.js +1 -0
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +3 -3
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +1 -1
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +0 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +0 -4
- package/dist/src/agent/tools/browser-automation-tool.d.ts +74 -1
- package/dist/src/agent/tools/browser-automation-tool.js +52 -6
- package/dist/src/agent/tools/cli-clarify.js +1 -1
- package/dist/src/agent/tools/codemode-permissions.d.ts +4 -0
- package/dist/src/agent/tools/codemode-permissions.js +23 -0
- package/dist/src/agent/tools/dataBatch.js +3 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +1 -4
- package/dist/src/agent/tools/factory.js +4 -3
- package/dist/src/agent/transcript/provider-capabilities.js +0 -1
- package/dist/src/agent/transcript/transcript-policy.js +1 -2
- package/dist/src/agent-config/schema.d.ts +28 -0
- package/dist/src/agent-config/schema.js +7 -0
- package/dist/src/auth/credentials.js +7 -20
- package/dist/src/auth/model-credential-store.js +11 -4
- package/dist/src/auth/oauth/index.d.ts +1 -1
- package/dist/src/auth/oauth/index.js +3 -3
- package/dist/src/auth/oauth/openai.d.ts +2 -0
- package/dist/src/auth/oauth/openai.js +90 -0
- package/dist/src/auth/oauth/registry.js +3 -3
- package/dist/src/auth/oauth/types.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -0
- package/dist/src/automations/capabilities/write.d.ts +2 -0
- package/dist/src/automations/domain/types.d.ts +11 -0
- package/dist/src/automations/domain/validation.d.ts +4 -0
- package/dist/src/automations/domain/validation.js +1 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +11 -3
- package/dist/src/automations/service/automation-service.d.ts +1 -0
- package/dist/src/automations/service/automation-service.js +13 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/automations/repository.d.ts +4 -0
- package/dist/src/browser/automations/repository.js +27 -6
- package/dist/src/browser/automations/runner.js +101 -9
- package/dist/src/browser/automations/runtime-service.js +4 -3
- package/dist/src/browser/automations/schema.d.ts +84 -1
- package/dist/src/browser/automations/schema.js +68 -2
- package/dist/src/browser/automations/service.d.ts +78 -1
- package/dist/src/browser/automations/service.js +36 -4
- package/dist/src/browser/automations/types.d.ts +19 -4
- package/dist/src/browser/drivers/extension-driver.d.ts +5 -5
- package/dist/src/browser/drivers/extension-driver.js +10 -10
- package/dist/src/browser/drivers/playwright-driver.js +46 -0
- package/dist/src/browser/index.d.ts +1 -2
- package/dist/src/browser/index.js +2 -3
- package/dist/src/browser/policy/browser-policy.d.ts +0 -1
- package/dist/src/browser/policy/browser-policy.js +1 -4
- package/dist/src/browser/providers/index.d.ts +1 -1
- package/dist/src/browser/providers/index.js +2 -2
- package/dist/src/browser/providers/realtime-extension.d.ts +1 -1
- package/dist/src/browser/providers/realtime-extension.js +5 -1
- package/dist/src/browser/recordings/service.d.ts +22 -0
- package/dist/src/browser/recordings/service.js +160 -0
- package/dist/src/browser/runtime/browser-runtime.d.ts +1 -1
- package/dist/src/browser/runtime/browser-runtime.js +19 -56
- package/dist/src/chat-commands/builtins/model.js +2 -2
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +0 -19
- package/dist/src/cli/commands/mcp.js +36 -2
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/utils/oauth-login.js +2 -2
- package/dist/src/computer/runtime.js +2 -2
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/mcp-config-normalize.d.ts +0 -3
- package/dist/src/config/mcp-config-normalize.js +2 -22
- package/dist/src/config/models-json.d.ts +0 -5
- package/dist/src/config/models-json.js +13 -4
- package/dist/src/config/paths.d.ts +0 -1
- package/dist/src/config/paths.js +1 -4
- package/dist/src/config/schema.d.ts +142 -48
- package/dist/src/config/schema.js +64 -47
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -21
- package/dist/src/connectors/china-catalog.js +5 -5
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -6
- package/dist/src/connectors/connection-recovery-service.js +3 -105
- package/dist/src/connectors/health.d.ts +1 -2
- package/dist/src/connectors/health.js +2 -101
- package/dist/src/connectors/types.d.ts +1 -1
- package/dist/src/endpoint-tools/binding-service.d.ts +2 -0
- package/dist/src/endpoint-tools/binding-service.js +14 -2
- package/dist/src/endpoint-tools/bridge-host.d.ts +15 -0
- package/dist/src/endpoint-tools/bridge-host.js +166 -0
- package/dist/src/endpoint-tools/bridge.d.ts +27 -0
- package/dist/src/endpoint-tools/bridge.js +88 -0
- package/dist/src/endpoint-tools/capability-catalog.d.ts +2 -0
- package/dist/src/endpoint-tools/capability-catalog.js +8 -0
- package/dist/src/endpoint-tools/grant-service.d.ts +69 -0
- package/dist/src/endpoint-tools/grant-service.js +113 -0
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +6 -2
- package/dist/src/endpoint-tools/location-task.d.ts +22 -0
- package/dist/src/endpoint-tools/location-task.js +114 -0
- package/dist/src/endpoint-tools/policy.js +20 -4
- package/dist/src/endpoint-tools/registry.d.ts +2 -0
- package/dist/src/endpoint-tools/registry.js +9 -0
- package/dist/src/endpoint-tools/result-projector.d.ts +15 -0
- package/dist/src/endpoint-tools/result-projector.js +31 -0
- package/dist/src/endpoint-tools/runtime.d.ts +2 -0
- package/dist/src/endpoint-tools/runtime.js +15 -2
- package/dist/src/endpoint-tools/target-resolver.d.ts +12 -0
- package/dist/src/endpoint-tools/target-resolver.js +27 -0
- package/dist/src/endpoint-tools/turn-context.d.ts +6 -0
- package/dist/src/endpoint-tools/turn-context.js +29 -0
- package/dist/src/extensions/agent-plugins/auth.d.ts +0 -2
- package/dist/src/extensions/agent-plugins/auth.js +2 -19
- package/dist/src/extensions/agent-plugins/credentials.js +3 -19
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +1 -5
- package/dist/src/extensions/agent-plugins/source-http-fetch.d.ts +2 -0
- package/dist/src/{agent/mcp/plugin-http-fetch.js → extensions/agent-plugins/source-http-fetch.js} +7 -7
- package/dist/src/extensions/agent-plugins/sources.js +2 -2
- package/dist/src/extensions/agent-plugins/store.js +1 -3
- package/dist/src/extensions/agent-plugins/validation.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/validation.js +13 -20
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +56 -1
- package/dist/src/gateway/chat-stream/mapper.js +9 -0
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -4
- package/dist/src/gateway/hono/lib/config-payload.d.ts +9 -4
- package/dist/src/gateway/hono/lib/config-payload.js +2 -5
- package/dist/src/gateway/hono/oauth-async.js +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +4 -9
- package/dist/src/gateway/hono/routes/agents.js +4 -3
- package/dist/src/gateway/hono/routes/browser-automations.js +23 -7
- package/dist/src/gateway/hono/routes/browser-recordings.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-recordings.js +78 -0
- package/dist/src/gateway/hono/routes/browser.js +1 -34
- package/dist/src/gateway/hono/routes/connection-waits.js +2 -5
- package/dist/src/gateway/hono/routes/connectors.js +5 -60
- package/dist/src/gateway/hono/routes/device-authorizations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-authorizations.js +74 -0
- package/dist/src/gateway/hono/routes/device-push.js +1 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +7 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +1 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +53 -3
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +25 -1
- package/dist/src/gateway/hono/routes/mcp.d.ts +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +11 -237
- package/dist/src/gateway/hono/routes/personal-agent.js +35 -0
- package/dist/src/gateway/hono/routes/session-command-handler.js +11 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +8 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +25 -1
- package/dist/src/gateway/hono/routes/voice.js +5 -2
- package/dist/src/gateway/security/gateway-scopes.js +3 -1
- package/dist/src/gateway/service/agent-runner.js +1 -0
- package/dist/src/gateway/service/config-coordinator.js +2 -5
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +13 -5
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +29 -9
- package/dist/src/gateway/service/sessions-api.js +0 -6
- package/dist/src/gateway/service.js +3 -12
- package/dist/src/gateway/session-reset-service.js +0 -6
- package/dist/src/home-intelligence/generator.d.ts +2 -0
- package/dist/src/home-intelligence/generator.js +53 -4
- package/dist/src/home-intelligence/host.d.ts +2 -1
- package/dist/src/home-intelligence/host.js +23 -3
- package/dist/src/imports/compatibility.js +12 -10
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/migrations/cloud-public-models.js +1 -0
- package/dist/src/notifications/clarification.d.ts +5 -0
- package/dist/src/notifications/clarification.js +66 -0
- package/dist/src/notifications/device-store.js +1 -0
- package/dist/src/notifications/harmony-push.d.ts +1 -0
- package/dist/src/notifications/harmony-push.js +3 -1
- package/dist/src/notifications/planner.d.ts +1 -0
- package/dist/src/notifications/service.d.ts +2 -2
- package/dist/src/notifications/service.js +20 -4
- package/dist/src/notifications/store.d.ts +2 -0
- package/dist/src/notifications/store.js +7 -1
- package/dist/src/notifications/types.d.ts +1 -0
- package/dist/src/notifications/types.js +1 -0
- package/dist/src/providers/env-keys.js +1 -1
- package/dist/src/providers/index.js +26 -24
- package/dist/src/providers/model-call.d.ts +0 -2
- package/dist/src/providers/model-call.js +2 -6
- package/dist/src/providers/model-registry.js +4 -2
- package/dist/src/providers/model-supplements.d.ts +3 -3
- package/dist/src/providers/model-supplements.js +6 -27
- package/dist/src/providers/presentation.js +3 -8
- package/dist/src/providers/prompt-cache-plan.js +1 -1
- package/dist/src/providers/provider-auth-service.d.ts +1 -1
- package/dist/src/providers/provider-auth-service.js +7 -2
- package/dist/src/providers/provider-policy.d.ts +3 -0
- package/dist/src/providers/provider-policy.js +14 -0
- package/dist/src/providers/register-runtime-providers.js +6 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/session/store.js +7 -1
- package/dist/src/session/transcript-events.d.ts +5 -0
- package/dist/src/session/transcript-events.js +1 -0
- package/dist/src/session/types.d.ts +2 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +1 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.d.ts +11 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.js +10 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.d.ts +7 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.js +17 -0
- package/dist/src/storage/sqlite/migrations/238_browser_record_replay.sql +45 -0
- package/dist/src/storage/sqlite/migrations/239_clarification_notifications.sql +26 -0
- package/dist/src/storage/sqlite/migrations/240_device_settings.sql +5 -0
- package/dist/src/storage/sqlite/migrations/241_device_grant_audit.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -1
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tasks/home-query-service.js +6 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +4 -4
- package/dist/src/voice/dashscope/streaming-tts-stream.d.ts +2 -1
- package/dist/src/voice/dashscope/streaming-tts-stream.js +135 -79
- package/dist/src/voice/realtime/agentEngine.js +78 -1
- package/dist/src/voice/realtime/speakable-segmenter.d.ts +2 -0
- package/dist/src/voice/realtime/speakable-segmenter.js +30 -0
- package/dist/src/voice/tts/providers/alibaba-speech.js +17 -1
- package/dist/src/voice/tts/speak-core.d.ts +3 -0
- package/dist/src/voice/tts/speak-core.js +21 -1
- package/dist/src/voice/tts/speech-provider-types.d.ts +8 -0
- package/package.json +18 -7
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D0tD3kCe.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BjdgKCnk.js +0 -1
- package/dist/gateway/static/root/assets/agents-CWXKzX5L.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-C9ZT6TAU.js +0 -6
- package/dist/gateway/static/root/assets/browser-automation-inputs-CXG_JveC.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CJc7OKR3.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-BjaTEUR8.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-djBsC_tG.js +0 -2
- package/dist/gateway/static/root/assets/channels-BaYRJtz3.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DyqRwSH2.js +0 -2
- package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-CWbbhKZa.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-C4KtwMY3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-ChZUzVbe.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DhPPLbdD.js +0 -2
- package/dist/gateway/static/root/assets/index-CK4O2xMa.css +0 -1
- package/dist/gateway/static/root/assets/index-DpLD-7Hc.js +0 -106
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-B_McurIj.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BWD63eg1.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-aKSibklM.js +0 -1
- package/dist/gateway/static/root/assets/messages-Bnx3GMDB.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-Di83uIPw.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-B_fve3_2.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-DnChyp8S.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-BM2qAgg_.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DM4_VLNX.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-O6j9CWX0.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-B0tOE4qz.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BIixHXlQ.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-49SUEWPh.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Ce3gTbT3.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CNEZjF66.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BndNdYsJ.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-EpZeMlvp.js +0 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DJ5vyrvM.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-Bz5lkFG9.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CPCgOfHh.js +0 -6
- package/dist/src/agent/embedded/system-prompt-override.d.ts +0 -2
- package/dist/src/agent/embedded/system-prompt-override.js +0 -21
- package/dist/src/agent/external-tools/mcp-provider.d.ts +0 -32
- package/dist/src/agent/external-tools/mcp-provider.js +0 -208
- package/dist/src/agent/mcp/bundle-mcp-config.d.ts +0 -20
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +0 -79
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +0 -93
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-names.js +0 -25
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-policy.js +0 -6
- package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +0 -46
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +0 -571
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +0 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +0 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -76
- package/dist/src/agent/mcp/bundle-mcp-types.js +0 -1
- package/dist/src/agent/mcp/embedded-mcp.d.ts +0 -10
- package/dist/src/agent/mcp/embedded-mcp.js +0 -14
- package/dist/src/agent/mcp/index.d.ts +0 -5
- package/dist/src/agent/mcp/index.js +0 -12
- package/dist/src/agent/mcp/mcp-config-shared.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-config-shared.js +0 -39
- package/dist/src/agent/mcp/mcp-http.d.ts +0 -23
- package/dist/src/agent/mcp/mcp-http.js +0 -67
- package/dist/src/agent/mcp/mcp-resource-id.d.ts +0 -6
- package/dist/src/agent/mcp/mcp-resource-id.js +0 -19
- package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +0 -26
- package/dist/src/agent/mcp/mcp-stdio-transport.js +0 -120
- package/dist/src/agent/mcp/mcp-stdio.d.ts +0 -18
- package/dist/src/agent/mcp/mcp-stdio.js +0 -35
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +0 -28
- package/dist/src/agent/mcp/mcp-transport-config.js +0 -91
- package/dist/src/agent/mcp/mcp-transport.d.ts +0 -17
- package/dist/src/agent/mcp/mcp-transport.js +0 -141
- package/dist/src/agent/mcp/oauth/index.d.ts +0 -6
- package/dist/src/agent/mcp/oauth/index.js +0 -6
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.d.ts +0 -5
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.js +0 -14
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +0 -30
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +0 -276
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.d.ts +0 -33
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +0 -103
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +0 -31
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +0 -181
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +0 -12
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +0 -91
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.d.ts +0 -22
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.js +0 -1
- package/dist/src/agent/mcp/plugin-http-fetch.d.ts +0 -2
- package/dist/src/agent/source-context/mcp-resource-context.d.ts +0 -8
- package/dist/src/agent/source-context/mcp-resource-context.js +0 -30
- package/dist/src/auth/oauth/openai-codex.d.ts +0 -9
- package/dist/src/auth/oauth/openai-codex.js +0 -414
- package/dist/src/browser/policy/approval-store.d.ts +0 -17
- package/dist/src/browser/policy/approval-store.js +0 -62
- package/dist/src/browser/providers/extension-ws-acquire.d.ts +0 -19
- package/dist/src/browser/providers/extension-ws-acquire.js +0 -78
- package/dist/src/browser/providers/extension.d.ts +0 -61
- package/dist/src/browser/providers/extension.js +0 -378
- package/dist/src/connectors/plugin-mcp-recovery.d.ts +0 -28
- package/dist/src/connectors/plugin-mcp-recovery.js +0 -90
- package/dist/src/extensions/agent-plugins/connection.d.ts +0 -8
- package/dist/src/extensions/agent-plugins/connection.js +0 -41
- package/dist/src/extensions/agent-plugins/health.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/health.js +0 -48
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +0 -1
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +0 -8
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Single shared HTTP + WebSocket listener for the Chrome extension bridge.
|
|
3
|
-
* Gateway and Browser Control sessions share one listener because only one process may bind the port.
|
|
4
|
-
*/
|
|
5
|
-
import type { ExtensionBrowserProvider, ExtensionProviderConfig } from './extension.js';
|
|
6
|
-
export type ExtensionBrowserServerSnapshot = {
|
|
7
|
-
active: boolean;
|
|
8
|
-
refCount: number;
|
|
9
|
-
key: string | null;
|
|
10
|
-
};
|
|
11
|
-
export declare function getExtensionBrowserServerSnapshot(): ExtensionBrowserServerSnapshot;
|
|
12
|
-
/**
|
|
13
|
-
* Increment ref count and return the shared provider plus a one-shot release.
|
|
14
|
-
* First acquire starts the listener; further acquires reuse it (same host:port).
|
|
15
|
-
*/
|
|
16
|
-
export declare function acquireExtensionBrowserServer(config?: ExtensionProviderConfig): Promise<{
|
|
17
|
-
provider: ExtensionBrowserProvider;
|
|
18
|
-
release: () => Promise<void>;
|
|
19
|
-
}>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
//#region src/browser/providers/extension-ws-acquire.ts
|
|
2
|
-
const DEFAULT_PORT = 19820;
|
|
3
|
-
const DEFAULT_HOST = "127.0.0.1";
|
|
4
|
-
const DEFAULT_CONNECTION_TIMEOUT = 3e4;
|
|
5
|
-
const DEFAULT_COMMAND_TIMEOUT = 3e4;
|
|
6
|
-
let mutexTail = Promise.resolve();
|
|
7
|
-
function withExclusive(fn) {
|
|
8
|
-
const prev = mutexTail;
|
|
9
|
-
let unlock;
|
|
10
|
-
mutexTail = new Promise((resolve) => {
|
|
11
|
-
unlock = resolve;
|
|
12
|
-
});
|
|
13
|
-
return prev.then(() => fn()).finally(unlock);
|
|
14
|
-
}
|
|
15
|
-
let state = null;
|
|
16
|
-
function getExtensionBrowserServerSnapshot() {
|
|
17
|
-
if (!state) return {
|
|
18
|
-
active: false,
|
|
19
|
-
refCount: 0,
|
|
20
|
-
key: null
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
active: true,
|
|
24
|
-
refCount: state.refCount,
|
|
25
|
-
key: state.key
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function normalizeConfig(config) {
|
|
29
|
-
return {
|
|
30
|
-
port: config?.port ?? DEFAULT_PORT,
|
|
31
|
-
host: config?.host ?? DEFAULT_HOST,
|
|
32
|
-
connectionTimeout: config?.connectionTimeout ?? DEFAULT_CONNECTION_TIMEOUT,
|
|
33
|
-
commandTimeout: config?.commandTimeout ?? DEFAULT_COMMAND_TIMEOUT
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function serverKey(c) {
|
|
37
|
-
return `${c.host}:${c.port}`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Increment ref count and return the shared provider plus a one-shot release.
|
|
41
|
-
* First acquire starts the listener; further acquires reuse it (same host:port).
|
|
42
|
-
*/
|
|
43
|
-
function acquireExtensionBrowserServer(config) {
|
|
44
|
-
return withExclusive(async () => {
|
|
45
|
-
const full = normalizeConfig(config);
|
|
46
|
-
const key = serverKey(full);
|
|
47
|
-
if (state && state.key !== key) throw new Error(`Chrome extension bridge is already listening on ${state.key}; stop it before using ${key}.`);
|
|
48
|
-
if (!state) {
|
|
49
|
-
const { ExtensionBrowserProvider } = await import("./extension.js");
|
|
50
|
-
const provider = new ExtensionBrowserProvider(full);
|
|
51
|
-
await provider.start();
|
|
52
|
-
state = {
|
|
53
|
-
key,
|
|
54
|
-
provider,
|
|
55
|
-
refCount: 0
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
state.refCount++;
|
|
59
|
-
let released = false;
|
|
60
|
-
const release = async () => {
|
|
61
|
-
await withExclusive(async () => {
|
|
62
|
-
if (released || !state) return;
|
|
63
|
-
released = true;
|
|
64
|
-
state.refCount--;
|
|
65
|
-
if (state.refCount <= 0) {
|
|
66
|
-
await state.provider.shutdown();
|
|
67
|
-
state = null;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return {
|
|
72
|
-
provider: state.provider,
|
|
73
|
-
release
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { acquireExtensionBrowserServer, getExtensionBrowserServerSnapshot };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extension browser provider — connects to the xopc Chrome Extension via WebSocket.
|
|
3
|
-
*
|
|
4
|
-
* The xopc process starts a WebSocket server; the Chrome Extension connects as a client.
|
|
5
|
-
* Commands are sent over the WS connection and results are returned asynchronously.
|
|
6
|
-
*/
|
|
7
|
-
import { type BrowserActionInput, type BrowserWireResult } from '@xopcai/browser-control-contract';
|
|
8
|
-
export interface ExtensionProviderConfig {
|
|
9
|
-
/** WebSocket server port. Default: 19820. */
|
|
10
|
-
port?: number;
|
|
11
|
-
/** Host to bind. Default: 127.0.0.1. */
|
|
12
|
-
host?: string;
|
|
13
|
-
/** Timeout waiting for extension connection (ms). Default: 30000. */
|
|
14
|
-
connectionTimeout?: number;
|
|
15
|
-
/** Default command timeout (ms). Default: 30000. */
|
|
16
|
-
commandTimeout?: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Manages a WebSocket server that the Chrome Extension connects to.
|
|
20
|
-
* Sends commands and receives results over the connection.
|
|
21
|
-
*/
|
|
22
|
-
export declare class ExtensionBrowserProvider {
|
|
23
|
-
readonly name = "extension";
|
|
24
|
-
private server;
|
|
25
|
-
private wss;
|
|
26
|
-
private clientWs;
|
|
27
|
-
private pending;
|
|
28
|
-
private commandCounter;
|
|
29
|
-
private socketConnected;
|
|
30
|
-
private handshakeReceived;
|
|
31
|
-
private connected;
|
|
32
|
-
private extensionProtocolVersion;
|
|
33
|
-
private extensionVersion;
|
|
34
|
-
private connectionId;
|
|
35
|
-
private principalId;
|
|
36
|
-
private readonly config;
|
|
37
|
-
private connectionWaiters;
|
|
38
|
-
constructor(config?: ExtensionProviderConfig);
|
|
39
|
-
/** Start the WebSocket server and wait for the extension to connect. */
|
|
40
|
-
start(): Promise<void>;
|
|
41
|
-
/** Wait for the Chrome Extension to connect. */
|
|
42
|
-
waitForConnection(timeoutMs?: number): Promise<void>;
|
|
43
|
-
/** Send one Browser Control v2 action to the extension. */
|
|
44
|
-
send(input: BrowserActionInput, timeoutMs?: number, visualFallback?: boolean): Promise<BrowserWireResult>;
|
|
45
|
-
/** Whether the extension is currently connected. */
|
|
46
|
-
isConnected(): boolean;
|
|
47
|
-
getConnectionStatus(): {
|
|
48
|
-
socketConnected: boolean;
|
|
49
|
-
connected: boolean;
|
|
50
|
-
protocolVersion: number | null;
|
|
51
|
-
expectedProtocolVersion: number;
|
|
52
|
-
extensionVersion: string | null;
|
|
53
|
-
principalId: string | null;
|
|
54
|
-
};
|
|
55
|
-
private protocolMismatchMessage;
|
|
56
|
-
/** Shutdown the WebSocket server. */
|
|
57
|
-
shutdown(): Promise<void>;
|
|
58
|
-
private _handleMessage;
|
|
59
|
-
private _authenticateCandidate;
|
|
60
|
-
}
|
|
61
|
-
export declare function isBrowserWireResult(value: unknown): value is BrowserWireResult;
|
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { deleteBrowserTabBindingsByPrincipal, getBrowserTabBindingById, init_browser_tab_binding_repository } from "../../storage/sqlite/browser-tab-binding-repository.js";
|
|
4
|
-
import { getDevice, init_device_access_repository } from "../../storage/sqlite/device-access-repository.js";
|
|
5
|
-
import { browserWireAuthenticationPayload } from "../../../packages/browser-control-contract/src/index.js";
|
|
6
|
-
import { isChromeExtensionOrigin } from "../../gateway/security/origin-check.js";
|
|
7
|
-
import crypto from "node:crypto";
|
|
8
|
-
//#region src/browser/providers/extension.ts
|
|
9
|
-
/**
|
|
10
|
-
* Extension browser provider — connects to the xopc Chrome Extension via WebSocket.
|
|
11
|
-
*
|
|
12
|
-
* The xopc process starts a WebSocket server; the Chrome Extension connects as a client.
|
|
13
|
-
* Commands are sent over the WS connection and results are returned asynchronously.
|
|
14
|
-
*/
|
|
15
|
-
init_logger();
|
|
16
|
-
init_device_access_repository();
|
|
17
|
-
init_browser_tab_binding_repository();
|
|
18
|
-
const log = createLogger("ExtensionProvider");
|
|
19
|
-
const DEFAULT_PORT = 19820;
|
|
20
|
-
const DEFAULT_HOST = "127.0.0.1";
|
|
21
|
-
const DEFAULT_CONNECTION_TIMEOUT = 3e4;
|
|
22
|
-
const DEFAULT_COMMAND_TIMEOUT = 3e4;
|
|
23
|
-
/**
|
|
24
|
-
* Manages a WebSocket server that the Chrome Extension connects to.
|
|
25
|
-
* Sends commands and receives results over the connection.
|
|
26
|
-
*/
|
|
27
|
-
var ExtensionBrowserProvider = class {
|
|
28
|
-
name = "extension";
|
|
29
|
-
server = null;
|
|
30
|
-
wss = null;
|
|
31
|
-
clientWs = null;
|
|
32
|
-
pending = /* @__PURE__ */ new Map();
|
|
33
|
-
commandCounter = 0;
|
|
34
|
-
socketConnected = false;
|
|
35
|
-
handshakeReceived = false;
|
|
36
|
-
connected = false;
|
|
37
|
-
extensionProtocolVersion = null;
|
|
38
|
-
extensionVersion = null;
|
|
39
|
-
connectionId = null;
|
|
40
|
-
principalId = null;
|
|
41
|
-
config;
|
|
42
|
-
connectionWaiters = [];
|
|
43
|
-
constructor(config) {
|
|
44
|
-
this.config = {
|
|
45
|
-
port: config?.port ?? DEFAULT_PORT,
|
|
46
|
-
host: config?.host ?? DEFAULT_HOST,
|
|
47
|
-
connectionTimeout: config?.connectionTimeout ?? DEFAULT_CONNECTION_TIMEOUT,
|
|
48
|
-
commandTimeout: config?.commandTimeout ?? DEFAULT_COMMAND_TIMEOUT
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/** Start the WebSocket server and wait for the extension to connect. */
|
|
52
|
-
async start() {
|
|
53
|
-
if (this.server) return;
|
|
54
|
-
const wsModule = await import("ws");
|
|
55
|
-
let WssClass = wsModule.WebSocketServer;
|
|
56
|
-
if (typeof WssClass !== "function") {
|
|
57
|
-
const def = wsModule.default;
|
|
58
|
-
WssClass = def?.WebSocketServer ?? def;
|
|
59
|
-
}
|
|
60
|
-
if (typeof WssClass !== "function") throw new Error("Failed to resolve WebSocketServer from \"ws\" package");
|
|
61
|
-
const WebSocketServer = WssClass;
|
|
62
|
-
const http = await import("node:http");
|
|
63
|
-
this.server = http.createServer((_req, res) => {
|
|
64
|
-
res.writeHead(200, { "Content-Type": "application/json" });
|
|
65
|
-
res.end(JSON.stringify({
|
|
66
|
-
ok: true,
|
|
67
|
-
...this.getConnectionStatus()
|
|
68
|
-
}));
|
|
69
|
-
});
|
|
70
|
-
this.wss = new WebSocketServer({
|
|
71
|
-
server: this.server,
|
|
72
|
-
path: "/browser-ext"
|
|
73
|
-
});
|
|
74
|
-
this.wss.on("connection", (ws, request) => {
|
|
75
|
-
const origin = request.headers.origin?.toLowerCase();
|
|
76
|
-
if (!isChromeExtensionOrigin(origin)) {
|
|
77
|
-
ws.close(4403, "Chrome extension origin required");
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const challenge = {
|
|
81
|
-
type: "auth_challenge",
|
|
82
|
-
protocolVersion: 5,
|
|
83
|
-
connectionId: crypto.randomUUID(),
|
|
84
|
-
challenge: crypto.randomBytes(32).toString("base64url"),
|
|
85
|
-
issuedAt: Date.now()
|
|
86
|
-
};
|
|
87
|
-
let authenticated = false;
|
|
88
|
-
const authenticationTimer = setTimeout(() => {
|
|
89
|
-
if (!authenticated) ws.close(4401, "Browser authentication timed out");
|
|
90
|
-
}, 5e3);
|
|
91
|
-
ws.send(JSON.stringify(challenge));
|
|
92
|
-
ws.on("message", (data) => {
|
|
93
|
-
if (authenticated) {
|
|
94
|
-
this._handleMessage(data.toString(), ws);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (!this._authenticateCandidate(data.toString(), origin, challenge)) {
|
|
98
|
-
clearTimeout(authenticationTimer);
|
|
99
|
-
ws.close(4401, "Browser authentication failed");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
authenticated = true;
|
|
103
|
-
clearTimeout(authenticationTimer);
|
|
104
|
-
const message = JSON.parse(data.toString());
|
|
105
|
-
const previousClient = this.clientWs;
|
|
106
|
-
this.clientWs = ws;
|
|
107
|
-
this.socketConnected = true;
|
|
108
|
-
this.handshakeReceived = true;
|
|
109
|
-
this.connected = true;
|
|
110
|
-
this.extensionProtocolVersion = message.protocolVersion;
|
|
111
|
-
this.extensionVersion = message.extensionVersion;
|
|
112
|
-
this.connectionId = message.connectionId;
|
|
113
|
-
this.principalId = message.principalId;
|
|
114
|
-
if (previousClient && previousClient !== ws) try {
|
|
115
|
-
previousClient.close(4001, "Connection replaced");
|
|
116
|
-
} catch {}
|
|
117
|
-
for (const waiter of this.connectionWaiters) waiter.resolve();
|
|
118
|
-
this.connectionWaiters = [];
|
|
119
|
-
log.info({
|
|
120
|
-
principalId: message.principalId,
|
|
121
|
-
extensionId: message.extensionId,
|
|
122
|
-
connectionId: message.connectionId
|
|
123
|
-
}, "Chrome extension authenticated");
|
|
124
|
-
});
|
|
125
|
-
ws.on("close", (code, reason) => {
|
|
126
|
-
if (this.clientWs !== ws) return;
|
|
127
|
-
log.warn({
|
|
128
|
-
code,
|
|
129
|
-
reason: reason.toString(),
|
|
130
|
-
pendingCount: this.pending.size
|
|
131
|
-
}, "Chrome Extension disconnected");
|
|
132
|
-
const disconnectedPrincipalId = this.principalId;
|
|
133
|
-
this.clientWs = null;
|
|
134
|
-
this.socketConnected = false;
|
|
135
|
-
this.handshakeReceived = false;
|
|
136
|
-
this.connected = false;
|
|
137
|
-
this.extensionProtocolVersion = null;
|
|
138
|
-
this.extensionVersion = null;
|
|
139
|
-
this.connectionId = null;
|
|
140
|
-
this.principalId = null;
|
|
141
|
-
if (disconnectedPrincipalId) deleteBrowserTabBindingsByPrincipal(disconnectedPrincipalId);
|
|
142
|
-
for (const [id, req] of this.pending) {
|
|
143
|
-
clearTimeout(req.timer);
|
|
144
|
-
req.reject(/* @__PURE__ */ new Error("Extension disconnected"));
|
|
145
|
-
this.pending.delete(id);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
const wssEmitter = this.wss;
|
|
150
|
-
await new Promise((resolve, reject) => {
|
|
151
|
-
let settled = false;
|
|
152
|
-
const disposeFailedStart = async () => {
|
|
153
|
-
if (this.wss) {
|
|
154
|
-
try {
|
|
155
|
-
this.wss.close();
|
|
156
|
-
} catch {}
|
|
157
|
-
this.wss = null;
|
|
158
|
-
}
|
|
159
|
-
if (this.server) {
|
|
160
|
-
await new Promise((r) => {
|
|
161
|
-
this.server.close(() => r());
|
|
162
|
-
});
|
|
163
|
-
this.server = null;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const onStartError = (err) => {
|
|
167
|
-
if (settled) return;
|
|
168
|
-
settled = true;
|
|
169
|
-
this.server.removeListener("error", onStartError);
|
|
170
|
-
wssEmitter.removeListener("error", onStartError);
|
|
171
|
-
disposeFailedStart().then(() => reject(err));
|
|
172
|
-
};
|
|
173
|
-
const onListening = () => {
|
|
174
|
-
if (settled) return;
|
|
175
|
-
settled = true;
|
|
176
|
-
this.server.removeListener("error", onStartError);
|
|
177
|
-
wssEmitter.removeListener("error", onStartError);
|
|
178
|
-
log.info({
|
|
179
|
-
port: this.config.port,
|
|
180
|
-
host: this.config.host
|
|
181
|
-
}, "Extension WS server started");
|
|
182
|
-
const onRuntimeError = (err) => {
|
|
183
|
-
log.error({ err }, "Extension WS bridge runtime error");
|
|
184
|
-
};
|
|
185
|
-
this.server.on("error", onRuntimeError);
|
|
186
|
-
wssEmitter.on("error", onRuntimeError);
|
|
187
|
-
resolve();
|
|
188
|
-
};
|
|
189
|
-
this.server.on("error", onStartError);
|
|
190
|
-
wssEmitter.on("error", onStartError);
|
|
191
|
-
this.server.listen(this.config.port, this.config.host, onListening);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
/** Wait for the Chrome Extension to connect. */
|
|
195
|
-
async waitForConnection(timeoutMs) {
|
|
196
|
-
if (this.connected) return;
|
|
197
|
-
if (this.socketConnected && this.handshakeReceived && this.extensionProtocolVersion !== 5) throw new Error(this.protocolMismatchMessage());
|
|
198
|
-
const timeout = timeoutMs ?? this.config.connectionTimeout;
|
|
199
|
-
return new Promise((resolve, reject) => {
|
|
200
|
-
const timer = setTimeout(() => {
|
|
201
|
-
const idx = this.connectionWaiters.findIndex((w) => w.resolve === resolve);
|
|
202
|
-
if (idx >= 0) this.connectionWaiters.splice(idx, 1);
|
|
203
|
-
reject(/* @__PURE__ */ new Error(`Extension connection timeout after ${timeout}ms. Is the Chrome Extension installed and enabled?`));
|
|
204
|
-
}, timeout);
|
|
205
|
-
this.connectionWaiters.push({
|
|
206
|
-
resolve: () => {
|
|
207
|
-
clearTimeout(timer);
|
|
208
|
-
resolve();
|
|
209
|
-
},
|
|
210
|
-
reject: (e) => {
|
|
211
|
-
clearTimeout(timer);
|
|
212
|
-
reject(e);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
/** Send one Browser Control v2 action to the extension. */
|
|
218
|
-
async send(input, timeoutMs, visualFallback = true) {
|
|
219
|
-
if (!this.connected || !this.clientWs) {
|
|
220
|
-
const detail = this.socketConnected ? this.protocolMismatchMessage() : "Extension not connected. Ensure the Chrome Extension is installed and connected.";
|
|
221
|
-
throw new Error(detail);
|
|
222
|
-
}
|
|
223
|
-
if (input.target?.kind === "attached_tab") {
|
|
224
|
-
const binding = getBrowserTabBindingById(input.target.bindingId);
|
|
225
|
-
if (!binding || binding.principalId !== this.principalId) throw new Error("Attached tab binding does not belong to the connected browser");
|
|
226
|
-
}
|
|
227
|
-
const id = `cmd_${++this.commandCounter}_${Date.now()}`;
|
|
228
|
-
const cmd = {
|
|
229
|
-
id,
|
|
230
|
-
protocolVersion: 5,
|
|
231
|
-
connectionId: this.connectionId,
|
|
232
|
-
input,
|
|
233
|
-
timeoutMs: timeoutMs ?? this.config.commandTimeout,
|
|
234
|
-
visualFallback
|
|
235
|
-
};
|
|
236
|
-
return new Promise((resolve, reject) => {
|
|
237
|
-
const timer = setTimeout(() => {
|
|
238
|
-
this.pending.delete(id);
|
|
239
|
-
reject(/* @__PURE__ */ new Error(`Browser action timed out: ${input.action} (${cmd.timeoutMs}ms)`));
|
|
240
|
-
}, cmd.timeoutMs);
|
|
241
|
-
this.pending.set(id, {
|
|
242
|
-
resolve,
|
|
243
|
-
reject,
|
|
244
|
-
timer
|
|
245
|
-
});
|
|
246
|
-
try {
|
|
247
|
-
this.clientWs.send(JSON.stringify(cmd));
|
|
248
|
-
} catch (e) {
|
|
249
|
-
clearTimeout(timer);
|
|
250
|
-
this.pending.delete(id);
|
|
251
|
-
reject(e instanceof Error ? e : new Error(String(e)));
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
/** Whether the extension is currently connected. */
|
|
256
|
-
isConnected() {
|
|
257
|
-
return this.connected;
|
|
258
|
-
}
|
|
259
|
-
getConnectionStatus() {
|
|
260
|
-
return {
|
|
261
|
-
socketConnected: this.socketConnected,
|
|
262
|
-
connected: this.connected,
|
|
263
|
-
protocolVersion: this.extensionProtocolVersion,
|
|
264
|
-
expectedProtocolVersion: 5,
|
|
265
|
-
extensionVersion: this.extensionVersion,
|
|
266
|
-
principalId: this.principalId
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
protocolMismatchMessage() {
|
|
270
|
-
return `Browser extension protocol mismatch (expected 5, received ${this.extensionProtocolVersion ?? "unknown"}). Reload the extension in Chrome.`;
|
|
271
|
-
}
|
|
272
|
-
/** Shutdown the WebSocket server. */
|
|
273
|
-
async shutdown() {
|
|
274
|
-
for (const waiter of this.connectionWaiters) waiter.reject(/* @__PURE__ */ new Error("Provider shutting down"));
|
|
275
|
-
this.connectionWaiters = [];
|
|
276
|
-
for (const [id, req] of this.pending) {
|
|
277
|
-
clearTimeout(req.timer);
|
|
278
|
-
req.reject(/* @__PURE__ */ new Error("Provider shutting down"));
|
|
279
|
-
this.pending.delete(id);
|
|
280
|
-
}
|
|
281
|
-
if (this.clientWs) {
|
|
282
|
-
try {
|
|
283
|
-
this.clientWs.close();
|
|
284
|
-
} catch {}
|
|
285
|
-
this.clientWs = null;
|
|
286
|
-
}
|
|
287
|
-
if (this.wss) {
|
|
288
|
-
try {
|
|
289
|
-
this.wss.close();
|
|
290
|
-
} catch {}
|
|
291
|
-
this.wss = null;
|
|
292
|
-
}
|
|
293
|
-
if (this.server) {
|
|
294
|
-
await new Promise((resolve) => {
|
|
295
|
-
this.server.close(() => resolve());
|
|
296
|
-
});
|
|
297
|
-
this.server = null;
|
|
298
|
-
}
|
|
299
|
-
this.connected = false;
|
|
300
|
-
this.socketConnected = false;
|
|
301
|
-
this.handshakeReceived = false;
|
|
302
|
-
this.extensionProtocolVersion = null;
|
|
303
|
-
this.extensionVersion = null;
|
|
304
|
-
this.connectionId = null;
|
|
305
|
-
this.principalId = null;
|
|
306
|
-
log.info("Extension provider shut down");
|
|
307
|
-
}
|
|
308
|
-
_handleMessage(raw, sourceWs) {
|
|
309
|
-
if (sourceWs !== this.clientWs) return;
|
|
310
|
-
try {
|
|
311
|
-
const msg = JSON.parse(raw);
|
|
312
|
-
if (!this.connectionId || msg.connectionId !== this.connectionId) return;
|
|
313
|
-
if (msg.type === "status") {
|
|
314
|
-
const status = msg;
|
|
315
|
-
if (status.principalId !== this.principalId) return;
|
|
316
|
-
log.debug({ sessionCount: status.sessionCount }, "Browser extension status updated");
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (isBrowserWireKeepAlive(msg)) return;
|
|
320
|
-
if (msg.type === "network_event") {
|
|
321
|
-
log.debug({
|
|
322
|
-
listenerId: msg.listenerId,
|
|
323
|
-
eventType: msg.eventType
|
|
324
|
-
}, "Network event");
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
const id = msg.id;
|
|
328
|
-
const pending = this.pending.get(id);
|
|
329
|
-
if (pending) {
|
|
330
|
-
clearTimeout(pending.timer);
|
|
331
|
-
this.pending.delete(id);
|
|
332
|
-
if (!isBrowserWireResult(msg)) {
|
|
333
|
-
pending.reject(/* @__PURE__ */ new Error("Browser extension returned an incompatible response. Reload the extension in Chrome."));
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
pending.resolve(msg);
|
|
337
|
-
}
|
|
338
|
-
} catch (e) {
|
|
339
|
-
log.error({ err: e }, "Failed to parse extension message");
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
_authenticateCandidate(raw, origin, challenge) {
|
|
343
|
-
try {
|
|
344
|
-
const message = JSON.parse(raw);
|
|
345
|
-
if (message.type !== "authenticate" || message.protocolVersion !== 5 || message.connectionId !== challenge.connectionId || `chrome-extension://${message.extensionId}` !== origin || Math.abs(Date.now() - challenge.issuedAt) > 5e3) return false;
|
|
346
|
-
const device = getDevice(message.principalId);
|
|
347
|
-
if (!device || device.revokedAt !== void 0 || device.platform !== "chrome" || device.extensionId !== message.extensionId) return false;
|
|
348
|
-
const payload = browserWireAuthenticationPayload({
|
|
349
|
-
protocolVersion: message.protocolVersion,
|
|
350
|
-
connectionId: message.connectionId,
|
|
351
|
-
challenge: challenge.challenge,
|
|
352
|
-
issuedAt: challenge.issuedAt,
|
|
353
|
-
principalId: message.principalId,
|
|
354
|
-
extensionId: message.extensionId,
|
|
355
|
-
extensionVersion: message.extensionVersion
|
|
356
|
-
});
|
|
357
|
-
return crypto.verify("sha256", Buffer.from(payload), {
|
|
358
|
-
key: crypto.createPublicKey({
|
|
359
|
-
key: device.publicKeyJwk,
|
|
360
|
-
format: "jwk"
|
|
361
|
-
}),
|
|
362
|
-
dsaEncoding: "ieee-p1363"
|
|
363
|
-
}, Buffer.from(message.signature, "base64url"));
|
|
364
|
-
} catch {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
function isBrowserWireResult(value) {
|
|
370
|
-
if (!value || typeof value !== "object") return false;
|
|
371
|
-
const result = value.result;
|
|
372
|
-
return typeof value.id === "string" && typeof value.connectionId === "string" && Boolean(result) && typeof result === "object" && typeof result.ok === "boolean";
|
|
373
|
-
}
|
|
374
|
-
function isBrowserWireKeepAlive(value) {
|
|
375
|
-
return Boolean(value) && typeof value === "object" && value.type === "keepalive" && typeof value.connectionId === "string" && typeof value.timestamp === "number";
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
|
-
export { ExtensionBrowserProvider, isBrowserWireResult };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { PluginMcpConnectionTarget } from '@xopcai/gateway-contract';
|
|
2
|
-
import { type McpOAuthStatus } from '../agent/mcp/oauth/mcp-oauth-manager.js';
|
|
3
|
-
import type { Config } from '../config/schema.js';
|
|
4
|
-
export type PluginMcpAvailability = {
|
|
5
|
-
available: boolean;
|
|
6
|
-
reason?: string;
|
|
7
|
-
};
|
|
8
|
-
export type PluginMcpVerification = {
|
|
9
|
-
ready: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
};
|
|
12
|
-
export interface PluginMcpRecovery {
|
|
13
|
-
availability(target: PluginMcpConnectionTarget): PluginMcpAvailability;
|
|
14
|
-
status(target: PluginMcpConnectionTarget): Promise<McpOAuthStatus>;
|
|
15
|
-
start(target: PluginMcpConnectionTarget): Promise<McpOAuthStatus>;
|
|
16
|
-
verify(target: PluginMcpConnectionTarget): Promise<PluginMcpVerification>;
|
|
17
|
-
submitCallback(target: PluginMcpConnectionTarget, callbackUrl: string): Promise<McpOAuthStatus>;
|
|
18
|
-
}
|
|
19
|
-
export declare class HostPluginMcpRecovery implements PluginMcpRecovery {
|
|
20
|
-
private readonly getConfig;
|
|
21
|
-
constructor(getConfig: () => Config);
|
|
22
|
-
availability(target: PluginMcpConnectionTarget): PluginMcpAvailability;
|
|
23
|
-
status(target: PluginMcpConnectionTarget): Promise<McpOAuthStatus>;
|
|
24
|
-
start(target: PluginMcpConnectionTarget): Promise<McpOAuthStatus>;
|
|
25
|
-
verify(target: PluginMcpConnectionTarget): Promise<PluginMcpVerification>;
|
|
26
|
-
submitCallback(target: PluginMcpConnectionTarget, callbackUrl: string): Promise<McpOAuthStatus>;
|
|
27
|
-
private resolveServer;
|
|
28
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { AgentPluginStore } from "../extensions/agent-plugins/store.js";
|
|
2
|
-
import { savePluginAuthBinding } from "../extensions/agent-plugins/auth.js";
|
|
3
|
-
import { loadMergedBundleMcpConfig } from "../agent/mcp/bundle-mcp-config.js";
|
|
4
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
5
|
-
import { getMcpOAuthManager } from "../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
6
|
-
import { listBundleMcpServerCapabilitiesForGateway } from "../agent/mcp/bundle-mcp-gateway.js";
|
|
7
|
-
//#region src/connectors/plugin-mcp-recovery.ts
|
|
8
|
-
var HostPluginMcpRecovery = class {
|
|
9
|
-
constructor(getConfig) {
|
|
10
|
-
this.getConfig = getConfig;
|
|
11
|
-
}
|
|
12
|
-
availability(target) {
|
|
13
|
-
const plugin = new AgentPluginStore().get(target.pluginId);
|
|
14
|
-
if (!plugin) return {
|
|
15
|
-
available: false,
|
|
16
|
-
reason: "The plugin is no longer installed."
|
|
17
|
-
};
|
|
18
|
-
if (!plugin.receipt.enabled) return {
|
|
19
|
-
available: false,
|
|
20
|
-
reason: "Enable the plugin before connecting its account."
|
|
21
|
-
};
|
|
22
|
-
if (plugin.readiness === "blocked") return {
|
|
23
|
-
available: false,
|
|
24
|
-
reason: "Repair the plugin before connecting its account."
|
|
25
|
-
};
|
|
26
|
-
if (plugin.servers[target.serverName]?.type !== "streamable-http") return {
|
|
27
|
-
available: false,
|
|
28
|
-
reason: "This plugin server does not support OAuth."
|
|
29
|
-
};
|
|
30
|
-
return { available: true };
|
|
31
|
-
}
|
|
32
|
-
async status(target) {
|
|
33
|
-
const server = this.resolveServer(target);
|
|
34
|
-
return getMcpOAuthManager(server).status(target.serverId, server);
|
|
35
|
-
}
|
|
36
|
-
async start(target) {
|
|
37
|
-
const availability = this.availability(target);
|
|
38
|
-
if (!availability.available) throw new Error(availability.reason);
|
|
39
|
-
await savePluginAuthBinding(new AgentPluginStore(), target.pluginId, target.serverName, { mode: "oauth" });
|
|
40
|
-
const server = this.resolveServer(target);
|
|
41
|
-
return getMcpOAuthManager(server).start({
|
|
42
|
-
serverId: target.serverId,
|
|
43
|
-
rawServer: server,
|
|
44
|
-
cfg: this.getConfig()
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
async verify(target) {
|
|
48
|
-
const availability = this.availability(target);
|
|
49
|
-
if (!availability.available) return {
|
|
50
|
-
ready: false,
|
|
51
|
-
error: availability.reason
|
|
52
|
-
};
|
|
53
|
-
const status = await this.status(target);
|
|
54
|
-
if (status.status !== "connected") return {
|
|
55
|
-
ready: false,
|
|
56
|
-
error: status.session?.error
|
|
57
|
-
};
|
|
58
|
-
const cfg = this.getConfig();
|
|
59
|
-
const capabilities = await listBundleMcpServerCapabilitiesForGateway({
|
|
60
|
-
workspaceDir: getWorkspacePath(cfg) || "./workspace",
|
|
61
|
-
cfg,
|
|
62
|
-
serverId: target.serverId
|
|
63
|
-
});
|
|
64
|
-
if (capabilities.error) return {
|
|
65
|
-
ready: false,
|
|
66
|
-
error: capabilities.error.message
|
|
67
|
-
};
|
|
68
|
-
if (capabilities.toolCount === 0) return {
|
|
69
|
-
ready: false,
|
|
70
|
-
error: "The connected MCP server did not expose any tools."
|
|
71
|
-
};
|
|
72
|
-
return { ready: true };
|
|
73
|
-
}
|
|
74
|
-
async submitCallback(target, callbackUrl) {
|
|
75
|
-
const server = this.resolveServer(target);
|
|
76
|
-
return getMcpOAuthManager(server).submitCallback(target.serverId, server, callbackUrl);
|
|
77
|
-
}
|
|
78
|
-
resolveServer(target) {
|
|
79
|
-
const cfg = this.getConfig();
|
|
80
|
-
const server = loadMergedBundleMcpConfig({
|
|
81
|
-
workspaceDir: getWorkspacePath(cfg) || "./workspace",
|
|
82
|
-
cfg
|
|
83
|
-
}).config.mcpServers[target.serverId];
|
|
84
|
-
const origin = server?.xopcPlugin;
|
|
85
|
-
if (!server || origin?.id !== target.pluginId || origin.serverName !== target.serverName) throw new Error("Plugin MCP server is unavailable.");
|
|
86
|
-
return server;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
//#endregion
|
|
90
|
-
export { HostPluginMcpRecovery };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ConnectionNeed } from '@xopcai/gateway-contract';
|
|
2
|
-
import { AgentPluginStore } from './store.js';
|
|
3
|
-
export declare function pluginMcpCandidateRef(pluginId: string, serverName: string): string;
|
|
4
|
-
export declare function parsePluginMcpCandidateRef(ref: string): {
|
|
5
|
-
pluginId: string;
|
|
6
|
-
serverName: string;
|
|
7
|
-
} | undefined;
|
|
8
|
-
export declare function resolvePluginMcpConnectionCandidate(ref: string, store?: AgentPluginStore): ConnectionNeed | undefined;
|