@xopcai/xopc 0.0.369 → 0.0.371
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/dist/sidepanel.js +21 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Stj17S9u.js → agent-avatar-dicebear-C8MqXy6W.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BLaL4law.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BrysdA6F.js +1 -0
- package/dist/gateway/static/root/assets/agents-BJRyMNx2.js +66 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-pJFe6M6c.js → app-management-settings-panel-Bi02swpZ.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BrxSpBWa.js → appearance-settings-rr0qirDm.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DegSl5Lh.js → apps-page-Sz3wl3lV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BZQ_VHjp.js → automations-page-DqdbP0hD.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CxgKlA5d.js +6 -0
- package/dist/gateway/static/root/assets/{block-editor-3XjFv3kK.js → block-editor-CfVR1zGa.js} +3 -3
- package/dist/gateway/static/root/assets/browser-automations-page-DeYnh3mY.js +3 -0
- package/dist/gateway/static/root/assets/{browser-settings-page-ch2_bQF0.js → browser-settings-page-DDZvlGCD.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-DO-vfNKI.js → capabilities-CY4SiHcP.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-B48r0DDa.js → capabilities-gjQtMhKu.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-Bl6PZqx3.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-NckMsJ5N.js → capabilities-settings-panel-B-MM4LJA.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-CY8KCO9j.js → capability-header-actions-CAiY7HK1.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CHOS2CGa.js → channels-D1_fDkhu.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bwknnb4c.js → chat-terminal-dock-D6slpF2a.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-B2xeFCSt.js → computer-settings-page-D1n_uQHN.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C83DnAqK.js → connector-service-page-FvSCyJzn.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DroD-gQn.js +1 -0
- package/dist/gateway/static/root/assets/copy-text-row-C1gaJwlZ.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-Bq9GR-DU.js → date-picker-Bl-HqvGU.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DY4nU-HL.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-BwsbQw8V.js → desktop-pet-_A89B2xw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-sL9i44pP.js → desktop-pet-settings-BJWkGynu.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DJ_ITvkI.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BFlDmsS5.js → directory-picker-path-field-Bj2Cpmxs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-7Z1Tp7-w.js → extension-debug-page-BfAtjhoK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-uGqvb8QX.js → extension-page-BFjc1zDp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-xlSyz4Z6.js → extension-provider-Br6LXyIj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CKHgrjOs.js → extension-settings-page-oAwllsMb.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BwQg0G1D.js → fallback-models-KHd6tw_t.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-F6D4A7N5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-BAQnSEMJ.js → gateway-settings-BIyhyiOq.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CEjaIUTF.js +2 -0
- package/dist/gateway/static/root/assets/{imports-page-re1_Nh64.js → imports-page-ClFqRiGQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGBkIIzM.css +1 -0
- package/dist/gateway/static/root/assets/index-GBFmI8im.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B_xja9LN.js → keyboard-shortcuts-settings-Ca9_GJSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CErdCrPX.js → local-app-workbench-page-BaK9zX1-.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BPL2RXdK.js → local-apps-page-1CjSftZ3.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-pox8evDV.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-6joZBbcx.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-Cnubkklb.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-B6DHbMzT.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CGZkIKdi.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-tf77xIz3.js → page-context-capture-button-y3QmhTu2.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-C_roXCJB.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dc3Y-Y7J.js → product-open-page-CSRYWt0f.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-MG_hmVA3.js → product-preview-content-DuOML6gs.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-v7xtnvha.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-MllfNLGA.js → projects-page-BuJCBT6n.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bs-C70el.js → remote-access-hub-DpHnyBnG.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DpJ5jNzR.js → runtime-tools-settings-panel-DTMTL0hy.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-Dpxamkw6.js → scenes-page-B0JqO_fM.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DUeyQ1zh.js → schema-form-g4z7GH4W.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-Dgn4BRk_.js → send-session-input-BW40VHiL.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BqlvrjPE.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CftImbH7.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkvbSieZ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DouHuBXt.js → settings-page-YD-U8BVw.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-q_X3kxw2.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-DJTabLAM.js → share-link-dialog-HCHM8qnf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-jw7h4t_B.js → share-preview-page-Ce6FNWt1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-KHRg_-03.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CfyX_0zN.js → skill-api-BpqDMkNB.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-Bnfn51ks.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DWf256TE.js → system-settings-panel-CncvC2CI.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DE6N1ZQe.js → task-detail-page-BVJKdnMC.js} +2 -2
- package/dist/gateway/static/root/assets/{tunnel-api-BBm9esrY.js → tunnel-api-g7etuoaT.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-C93x89uW.js → usage-page-Dao1I-5F.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-C7Gaaai1.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-jr986ucl.js +2 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bs2MKiTv.js → work-discovery-overlay-CC3mr7tX.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BR_U_snV.js → workflow-run-setup-panel-CqpXZJxs.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DOk6tBbK.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Si2o3inw.js → workspace-api-WhbMvdBE.js} +2 -2
- package/dist/gateway/static/root/index.html +18 -20
- package/dist/package.js +1 -1
- 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 +95 -2
- package/dist/packages/endpoint-tools-protocol/src/location.js +109 -0
- package/dist/packages/endpoint-tools-protocol/src/personal.js +149 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +30 -5
- package/dist/src/agent/agent-manager.js +23 -27
- package/dist/src/agent/background-review/run-background-review.js +1 -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 +174 -53
- 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/inbound/attachment-pipeline.js +1 -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 +3 -6
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/installer.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/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/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/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/transcript/provider-capabilities.js +0 -1
- package/dist/src/agent/transcript/transcript-policy.js +1 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
- package/dist/src/agent-catalog/repository.js +1 -1
- 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/drafts.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/builtins/model.js +2 -2
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +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 +2 -2
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/cli/utils/oauth-login.js +2 -2
- package/dist/src/config/agent-profile.js +1 -1
- 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 +130 -36
- package/dist/src/config/schema.js +52 -35
- 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 +21 -4
- 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 +21 -1
- 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/endpoint-tools/upload-service.d.ts +4 -2
- package/dist/src/endpoint-tools/upload-service.js +29 -4
- 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 +14 -21
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +58 -3
- 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 +5 -4
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- 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/endpoint-compatibility.js +8 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +1 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +70 -3
- package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -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/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- 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 +26 -2
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- 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 +7 -16
- package/dist/src/gateway/session-reset-service.js +0 -6
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/compatibility.js +12 -10
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/personal-agent/service.js +1 -1
- 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/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/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/capabilities/read.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- 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/realtime/persona-context.js +1 -1
- package/package.json +20 -9
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CCRfvuov.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CRlzd8El.js +0 -1
- package/dist/gateway/static/root/assets/agents-_ug2LCQb.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BQywN6nG.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-yiEuG1v7.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BEnFt_dj.js +0 -2
- package/dist/gateway/static/root/assets/connectors-page-D6wTmWA6.js +0 -2
- package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-BTERkA9X.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DI2bqaKO.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DDWymi-o.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BZDjvwet.js +0 -2
- package/dist/gateway/static/root/assets/index-BB1z8QxA.js +0 -106
- package/dist/gateway/static/root/assets/index-D9R6tU7r.css +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DRPsDCj1.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DL-BM0xq.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BOVRHhXk.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DJJK2yL4.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-oCxO7ZTv.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DOk9gUK5.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-3uAzbW4T.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-LInoZ_Yi.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BCVlNHtq.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bz-ue9fZ.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-B5BoZ-1y.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BlnlzGjH.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DjdTeYzm.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Db2VYg1b.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-B74LkVbp.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Crk4SxtC.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/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,9 +1,9 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
3
3
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
4
|
-
import { DEFAULT_AGENT_ID, init_id, normalizeAgentId } from "./id.js";
|
|
5
4
|
import { AgentDefaultsSchema, AgentEntrySchema, DEFAULT_AGENT_MODEL_REF, DEFAULT_SKILL_POLICY } from "../agent-config/schema.js";
|
|
6
5
|
import { init_agent_config } from "../agent-config/index.js";
|
|
6
|
+
import { DEFAULT_AGENT_ID, init_id, normalizeAgentId } from "./id.js";
|
|
7
7
|
import { BindingsSchema, init_binding_schema } from "../routing/binding-schema.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
//#region src/agent-catalog/repository.ts
|
|
@@ -136,6 +136,13 @@ export declare const WorkflowPolicySchema: z.ZodObject<{
|
|
|
136
136
|
allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
137
137
|
}, z.core.$strict>;
|
|
138
138
|
export declare const RuntimePolicySchema: z.ZodObject<{
|
|
139
|
+
codemode: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
141
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
142
|
+
maxConcurrentCalls: z.ZodDefault<z.ZodNumber>;
|
|
143
|
+
maxCalls: z.ZodDefault<z.ZodNumber>;
|
|
144
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strict>>;
|
|
139
146
|
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
140
147
|
low: "low";
|
|
141
148
|
high: "high";
|
|
@@ -224,6 +231,13 @@ export declare const AgentDefaultsSchema: z.ZodObject<{
|
|
|
224
231
|
allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
225
232
|
}, z.core.$strict>>;
|
|
226
233
|
runtime: z.ZodDefault<z.ZodObject<{
|
|
234
|
+
codemode: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
236
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
237
|
+
maxConcurrentCalls: z.ZodDefault<z.ZodNumber>;
|
|
238
|
+
maxCalls: z.ZodDefault<z.ZodNumber>;
|
|
239
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
240
|
+
}, z.core.$strict>>;
|
|
227
241
|
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
228
242
|
low: "low";
|
|
229
243
|
high: "high";
|
|
@@ -435,6 +449,13 @@ export declare const AgentEntrySchema: z.ZodObject<{
|
|
|
435
449
|
allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
436
450
|
}, z.core.$strict>>;
|
|
437
451
|
runtime: z.ZodOptional<z.ZodObject<{
|
|
452
|
+
codemode: z.ZodOptional<z.ZodObject<{
|
|
453
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
454
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
455
|
+
maxConcurrentCalls: z.ZodDefault<z.ZodNumber>;
|
|
456
|
+
maxCalls: z.ZodDefault<z.ZodNumber>;
|
|
457
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
458
|
+
}, z.core.$strict>>;
|
|
438
459
|
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
439
460
|
low: "low";
|
|
440
461
|
high: "high";
|
|
@@ -572,6 +593,13 @@ export declare const EffectiveAgentConfigSchema: z.ZodObject<{
|
|
|
572
593
|
allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
573
594
|
}, z.core.$strict>;
|
|
574
595
|
runtime: z.ZodObject<{
|
|
596
|
+
codemode: z.ZodOptional<z.ZodObject<{
|
|
597
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
598
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
599
|
+
maxConcurrentCalls: z.ZodDefault<z.ZodNumber>;
|
|
600
|
+
maxCalls: z.ZodDefault<z.ZodNumber>;
|
|
601
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
602
|
+
}, z.core.$strict>>;
|
|
575
603
|
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
576
604
|
low: "low";
|
|
577
605
|
high: "high";
|
|
@@ -92,6 +92,13 @@ var init_schema = __esmMin((() => {
|
|
|
92
92
|
allowed: z.array(z.string().min(1)).optional()
|
|
93
93
|
}).strict();
|
|
94
94
|
RuntimePolicySchema = z.object({
|
|
95
|
+
codemode: z.object({
|
|
96
|
+
enabled: z.boolean().default(false),
|
|
97
|
+
timeoutMs: z.number().int().min(1).max(6e4).default(6e4),
|
|
98
|
+
maxConcurrentCalls: z.number().int().min(1).max(4).default(4),
|
|
99
|
+
maxCalls: z.number().int().min(1).max(32).default(32),
|
|
100
|
+
maxOutputTokens: z.number().int().min(1).max(4e3).default(4e3)
|
|
101
|
+
}).strict().optional(),
|
|
95
102
|
thinkingLevel: z.enum([
|
|
96
103
|
"off",
|
|
97
104
|
"minimal",
|
|
@@ -4,8 +4,9 @@ import { init_logger } from "../utils/logger.js";
|
|
|
4
4
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
5
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
6
6
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
7
|
-
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
8
7
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
8
|
+
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
9
|
+
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
9
10
|
import { dirname, join } from "path";
|
|
10
11
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
11
12
|
//#region src/auth/credentials.ts
|
|
@@ -18,24 +19,6 @@ function toOAuthCredentials(token) {
|
|
|
18
19
|
expires: expiresAt ?? Number.MAX_SAFE_INTEGER
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function normalizeLegacyOAuthToken(token) {
|
|
22
|
-
if (token.provider !== "google-gemini-cli" && token.provider !== "google-antigravity") return token;
|
|
23
|
-
let access = token.access;
|
|
24
|
-
let projectId = token.projectId;
|
|
25
|
-
for (let depth = 0; depth < 5; depth += 1) try {
|
|
26
|
-
const legacy = JSON.parse(access);
|
|
27
|
-
if (typeof legacy.token !== "string" || !legacy.token) break;
|
|
28
|
-
access = legacy.token;
|
|
29
|
-
if (typeof projectId !== "string" && typeof legacy.projectId === "string") projectId = legacy.projectId;
|
|
30
|
-
} catch {
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
return access === token.access ? token : {
|
|
34
|
-
...token,
|
|
35
|
-
access,
|
|
36
|
-
projectId
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
22
|
function getCredentialResolver(options) {
|
|
40
23
|
if (options) return new CredentialResolver(options);
|
|
41
24
|
defaultResolver ??= new CredentialResolver();
|
|
@@ -55,6 +38,7 @@ var init_credentials = __esmMin((() => {
|
|
|
55
38
|
init_paths();
|
|
56
39
|
init_registry();
|
|
57
40
|
init_oauth_provider_lock();
|
|
41
|
+
init_provider_policy();
|
|
58
42
|
log = createLogger("Credentials");
|
|
59
43
|
warnedExpiredOAuthTokens = /* @__PURE__ */ new Set();
|
|
60
44
|
CredentialResolver = class {
|
|
@@ -73,6 +57,7 @@ var init_credentials = __esmMin((() => {
|
|
|
73
57
|
*/
|
|
74
58
|
async resolveApiKey(provider) {
|
|
75
59
|
const normalizedProvider = provider.toLowerCase();
|
|
60
|
+
assertCurrentModelProvider(normalizedProvider);
|
|
76
61
|
const oauthDefinition = getOAuthProviderDefinition(normalizedProvider);
|
|
77
62
|
if (oauthDefinition?.oauthOnly) {
|
|
78
63
|
const token = await this.loadOAuthToken(normalizedProvider);
|
|
@@ -125,6 +110,7 @@ var init_credentials = __esmMin((() => {
|
|
|
125
110
|
*/
|
|
126
111
|
async resolveApiKeySource(provider) {
|
|
127
112
|
const normalizedProvider = provider.toLowerCase();
|
|
113
|
+
assertCurrentModelProvider(normalizedProvider);
|
|
128
114
|
if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) return await this.hasUsableOAuthTokenRecord(normalizedProvider) ? "oauth" : null;
|
|
129
115
|
if (this.agentId) {
|
|
130
116
|
if (await this.loadFromAgentCredentials(normalizedProvider)) return "agent";
|
|
@@ -169,6 +155,7 @@ var init_credentials = __esmMin((() => {
|
|
|
169
155
|
*/
|
|
170
156
|
async saveApiKey(provider, key, options = {}) {
|
|
171
157
|
const normalizedProvider = provider.toLowerCase();
|
|
158
|
+
assertCurrentModelProvider(normalizedProvider);
|
|
172
159
|
if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) throw new Error(`${normalizedProvider} only supports OAuth credentials`);
|
|
173
160
|
const profileId = options.profileName ? `${normalizedProvider}:${options.profileName}` : `${normalizedProvider}:default`;
|
|
174
161
|
const profile = {
|
|
@@ -268,7 +255,7 @@ var init_credentials = __esmMin((() => {
|
|
|
268
255
|
try {
|
|
269
256
|
const content = await readFile(oauthPath, "utf-8");
|
|
270
257
|
const token = JSON.parse(content);
|
|
271
|
-
return token.provider === normalizedProvider ?
|
|
258
|
+
return token.provider === normalizedProvider ? token : null;
|
|
272
259
|
} catch {
|
|
273
260
|
return null;
|
|
274
261
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
3
|
+
import { assertCurrentModelProvider, init_provider_policy, isRetiredModelProvider } from "../providers/provider-policy.js";
|
|
3
4
|
import { CredentialResolver, init_credentials } from "./credentials.js";
|
|
4
5
|
//#region src/auth/model-credential-store.ts
|
|
5
6
|
function normalizeProviderId(providerId) {
|
|
@@ -35,6 +36,7 @@ var XopcModelCredentialStore;
|
|
|
35
36
|
var init_model_credential_store = __esmMin((() => {
|
|
36
37
|
init_credentials();
|
|
37
38
|
init_oauth_provider_lock();
|
|
39
|
+
init_provider_policy();
|
|
38
40
|
XopcModelCredentialStore = class {
|
|
39
41
|
runtimeApiKeys = /* @__PURE__ */ new Map();
|
|
40
42
|
constructor(repository = new CredentialResolver()) {
|
|
@@ -43,6 +45,7 @@ var init_model_credential_store = __esmMin((() => {
|
|
|
43
45
|
async read(providerId, options) {
|
|
44
46
|
options?.signal?.throwIfAborted();
|
|
45
47
|
const normalizedProvider = normalizeProviderId(providerId);
|
|
48
|
+
if (isRetiredModelProvider(normalizedProvider)) return void 0;
|
|
46
49
|
const runtimeApiKey = this.runtimeApiKeys.get(normalizedProvider);
|
|
47
50
|
if (runtimeApiKey) return runtimeApiKey;
|
|
48
51
|
const token = await this.repository.loadOAuthTokenRecord(normalizedProvider);
|
|
@@ -54,10 +57,13 @@ var init_model_credential_store = __esmMin((() => {
|
|
|
54
57
|
const oauthTokens = await this.repository.listOAuthTokens();
|
|
55
58
|
options?.signal?.throwIfAborted();
|
|
56
59
|
const credentials = /* @__PURE__ */ new Map();
|
|
57
|
-
for (const token of oauthTokens)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
for (const token of oauthTokens) {
|
|
61
|
+
if (isRetiredModelProvider(token.provider)) continue;
|
|
62
|
+
credentials.set(normalizeProviderId(token.provider), {
|
|
63
|
+
providerId: normalizeProviderId(token.provider),
|
|
64
|
+
type: "oauth"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
61
67
|
for (const providerId of this.runtimeApiKeys.keys()) credentials.set(providerId, {
|
|
62
68
|
providerId,
|
|
63
69
|
type: "api_key"
|
|
@@ -66,6 +72,7 @@ var init_model_credential_store = __esmMin((() => {
|
|
|
66
72
|
}
|
|
67
73
|
async modify(providerId, update, options) {
|
|
68
74
|
const normalizedProvider = normalizeProviderId(providerId);
|
|
75
|
+
assertCurrentModelProvider(normalizedProvider);
|
|
69
76
|
return withOAuthProviderLock(normalizedProvider, async () => {
|
|
70
77
|
options?.signal?.throwIfAborted();
|
|
71
78
|
const persisted = await this.repository.loadOAuthTokenRecord(normalizedProvider);
|
|
@@ -11,6 +11,6 @@ export * from './kimi-coding.js';
|
|
|
11
11
|
export * from './github-copilot.js';
|
|
12
12
|
export * from './google-gemini-cli.js';
|
|
13
13
|
export * from './google-antigravity.js';
|
|
14
|
-
export * from './openai
|
|
14
|
+
export * from './openai.js';
|
|
15
15
|
export * from './xopc-cloud.js';
|
|
16
16
|
export * from './registry.js';
|
|
@@ -7,7 +7,7 @@ import { init_google_gemini_cli } from "./google-gemini-cli.js";
|
|
|
7
7
|
import { init_kimi_coding, kimiCodingOAuthProvider } from "./kimi-coding.js";
|
|
8
8
|
import { init_minimax_cn, minimaxCnOAuthProvider } from "./minimax-cn.js";
|
|
9
9
|
import { init_minimax, minimaxOAuthProvider } from "./minimax.js";
|
|
10
|
-
import {
|
|
10
|
+
import { init_openai, openaiOAuthProvider } from "./openai.js";
|
|
11
11
|
import { init_xopc_cloud, xopcCloudOAuthProvider, xopcShareOAuthProvider, xopcTunnelOAuthProvider } from "./xopc-cloud.js";
|
|
12
12
|
import { OAUTH_PROVIDER_DEFINITIONS, getModelOAuthProviderIds, getOAuthProviderDefinition, getOAuthProviderIds, getOAuthProviderInterfaces, init_registry, isOAuthOnlyProvider } from "./registry.js";
|
|
13
13
|
//#region src/auth/oauth/index.ts
|
|
@@ -18,8 +18,8 @@ init_kimi_coding();
|
|
|
18
18
|
init_github_copilot();
|
|
19
19
|
init_google_gemini_cli();
|
|
20
20
|
init_google_antigravity();
|
|
21
|
-
|
|
21
|
+
init_openai();
|
|
22
22
|
init_xopc_cloud();
|
|
23
23
|
init_registry();
|
|
24
24
|
//#endregion
|
|
25
|
-
export { OAUTH_PROVIDER_DEFINITIONS, anthropicOAuthProvider, getModelOAuthProviderIds, getOAuthProviderDefinition, getOAuthProviderIds, getOAuthProviderInterfaces, githubCopilotOAuthProvider, antigravityOAuthProvider as googleAntigravityOAuthProvider, geminiCliOAuthProvider as googleGeminiCliOAuthProvider, isOAuthOnlyProvider, kimiCodingOAuthProvider, loginAnthropic, loginAntigravity, loginGeminiCli,
|
|
25
|
+
export { OAUTH_PROVIDER_DEFINITIONS, anthropicOAuthProvider, getModelOAuthProviderIds, getOAuthProviderDefinition, getOAuthProviderIds, getOAuthProviderInterfaces, githubCopilotOAuthProvider, antigravityOAuthProvider as googleAntigravityOAuthProvider, geminiCliOAuthProvider as googleGeminiCliOAuthProvider, isOAuthOnlyProvider, kimiCodingOAuthProvider, loginAnthropic, loginAntigravity, loginGeminiCli, minimaxCnOAuthProvider, minimaxOAuthProvider, openaiOAuthProvider, refreshAnthropicToken, refreshAntigravityToken, refreshGoogleCloudToken, xopcCloudOAuthProvider, xopcShareOAuthProvider, xopcTunnelOAuthProvider };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
3
|
+
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
4
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "../oauth-provider-lock.js";
|
|
5
|
+
import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { readFile } from "node:fs/promises";
|
|
9
|
+
import { openaiProvider } from "@earendil-works/pi-ai/providers/openai";
|
|
10
|
+
//#region src/auth/oauth/openai.ts
|
|
11
|
+
async function getDeviceId(signal) {
|
|
12
|
+
return withOAuthProviderLock("openai-device-id", async () => {
|
|
13
|
+
const path = join(resolveCredentialsDir(), "openai-device-id");
|
|
14
|
+
try {
|
|
15
|
+
const id = (await readFile(path, "utf8")).trim();
|
|
16
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)) throw new Error("Invalid OpenAI installation device ID");
|
|
17
|
+
return id;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code !== "ENOENT") throw error;
|
|
20
|
+
const id = randomUUID();
|
|
21
|
+
await writeTextAtomic(path, id);
|
|
22
|
+
return id;
|
|
23
|
+
}
|
|
24
|
+
}, { signal });
|
|
25
|
+
}
|
|
26
|
+
function getOpenaiOAuth() {
|
|
27
|
+
registerBundledOAuthFlows();
|
|
28
|
+
const oauth = openaiProvider().auth.oauth;
|
|
29
|
+
if (!oauth) throw new Error("OpenAI ChatGPT OAuth is unavailable");
|
|
30
|
+
return oauth;
|
|
31
|
+
}
|
|
32
|
+
function fromPiCredential({ type: _type, ...credentials }) {
|
|
33
|
+
return credentials;
|
|
34
|
+
}
|
|
35
|
+
function toAuthInteraction(callbacks) {
|
|
36
|
+
return {
|
|
37
|
+
signal: callbacks.signal ?? new AbortController().signal,
|
|
38
|
+
async prompt(prompt) {
|
|
39
|
+
if (prompt.type === "select") return await callbacks.onSelect({
|
|
40
|
+
message: prompt.message,
|
|
41
|
+
options: [...prompt.options]
|
|
42
|
+
}) ?? "";
|
|
43
|
+
return callbacks.onPrompt({
|
|
44
|
+
message: prompt.message,
|
|
45
|
+
placeholder: prompt.placeholder,
|
|
46
|
+
signal: prompt.signal
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
notify(event) {
|
|
50
|
+
if (event.type === "auth_url") callbacks.onAuth({
|
|
51
|
+
url: event.url,
|
|
52
|
+
instructions: event.instructions
|
|
53
|
+
});
|
|
54
|
+
else if (event.type === "device_code") callbacks.onDeviceCode(event);
|
|
55
|
+
else callbacks.onProgress?.(event.message);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var openaiOAuthProvider;
|
|
60
|
+
var init_openai = __esmMin((() => {
|
|
61
|
+
init_paths();
|
|
62
|
+
init_write_file_atomic();
|
|
63
|
+
init_oauth_provider_lock();
|
|
64
|
+
init_register_bundled_oauth_flows();
|
|
65
|
+
openaiOAuthProvider = {
|
|
66
|
+
id: "openai",
|
|
67
|
+
name: "OpenAI (ChatGPT subscription)",
|
|
68
|
+
usesCallbackServer: true,
|
|
69
|
+
loginMethods: ["browser"],
|
|
70
|
+
async login(callbacks) {
|
|
71
|
+
const deviceId = await getDeviceId(callbacks.signal);
|
|
72
|
+
return fromPiCredential(await getOpenaiOAuth().login(toAuthInteraction(callbacks), {
|
|
73
|
+
getDeviceId: () => deviceId,
|
|
74
|
+
agentName: "xopc"
|
|
75
|
+
}));
|
|
76
|
+
},
|
|
77
|
+
async refreshToken(credentials, signal) {
|
|
78
|
+
return fromPiCredential(await getOpenaiOAuth().refresh({
|
|
79
|
+
...credentials,
|
|
80
|
+
type: "oauth"
|
|
81
|
+
}, signal ?? new AbortController().signal));
|
|
82
|
+
},
|
|
83
|
+
getApiKey(credentials) {
|
|
84
|
+
return credentials.access;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}));
|
|
88
|
+
//#endregion
|
|
89
|
+
init_openai();
|
|
90
|
+
export { init_openai, openaiOAuthProvider };
|
|
@@ -8,7 +8,7 @@ import { init_google_gemini_cli } from "./google-gemini-cli.js";
|
|
|
8
8
|
import { init_kimi_coding, kimiCodingOAuthProvider } from "./kimi-coding.js";
|
|
9
9
|
import { init_minimax_cn, minimaxCnOAuthProvider } from "./minimax-cn.js";
|
|
10
10
|
import { init_minimax, minimaxOAuthProvider } from "./minimax.js";
|
|
11
|
-
import {
|
|
11
|
+
import { init_openai, openaiOAuthProvider } from "./openai.js";
|
|
12
12
|
import { init_xopc_cloud, xopcCloudOAuthProvider, xopcShareOAuthProvider, xopcTunnelOAuthProvider } from "./xopc-cloud.js";
|
|
13
13
|
//#region src/auth/oauth/registry.ts
|
|
14
14
|
function definition(provider, purpose, displayName = provider.name) {
|
|
@@ -44,7 +44,7 @@ var init_registry = __esmMin((() => {
|
|
|
44
44
|
init_kimi_coding();
|
|
45
45
|
init_minimax_cn();
|
|
46
46
|
init_minimax();
|
|
47
|
-
|
|
47
|
+
init_openai();
|
|
48
48
|
init_xopc_cloud();
|
|
49
49
|
OAUTH_PROVIDER_DEFINITIONS = {
|
|
50
50
|
"xopc-cloud": {
|
|
@@ -69,7 +69,7 @@ var init_registry = __esmMin((() => {
|
|
|
69
69
|
"github-copilot": definition(githubCopilotOAuthProvider, "models"),
|
|
70
70
|
"google-gemini-cli": definition(geminiCliOAuthProvider, "models"),
|
|
71
71
|
"google-antigravity": definition(antigravityOAuthProvider, "models"),
|
|
72
|
-
|
|
72
|
+
openai: definition(openaiOAuthProvider, "models")
|
|
73
73
|
};
|
|
74
74
|
}));
|
|
75
75
|
//#endregion
|
|
@@ -3,8 +3,8 @@ import { generatePKCE, init_pkce } from "./pkce.js";
|
|
|
3
3
|
import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
|
|
4
4
|
import { hostname } from "node:os";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
|
-
import http from "node:http";
|
|
7
6
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
7
|
+
import http from "node:http";
|
|
8
8
|
//#region src/auth/oauth/xopc-cloud.ts
|
|
9
9
|
function consoleUrl() {
|
|
10
10
|
return (process.env.XOPC_CONSOLE_URL ?? resolveConnectedPlatformEndpoint("authorizationServer") ?? DEFAULT_CONSOLE_URL).replace(/\/+$/, "");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
3
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
4
5
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
5
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
7
|
//#region src/auth/sync-provider-auth.ts
|
|
@@ -81,6 +82,7 @@ function readOAuthAccessTokenSync(provider) {
|
|
|
81
82
|
*/
|
|
82
83
|
function resolveProviderApiKeySync(provider) {
|
|
83
84
|
const normalized = provider.toLowerCase();
|
|
85
|
+
assertCurrentModelProvider(normalized);
|
|
84
86
|
if (isOAuthOnlyProvider(normalized)) return readOAuthAccessTokenSync(normalized);
|
|
85
87
|
const fromAgent = readApiKeyFromProfilesFile(resolveAgentAuthProfilesPath(getDefaultAgentId()), normalized);
|
|
86
88
|
if (fromAgent) return fromAgent;
|
|
@@ -91,6 +93,7 @@ function resolveProviderApiKeySync(provider) {
|
|
|
91
93
|
/** Resolve one agent's private credential, then the shared credential and OAuth token. */
|
|
92
94
|
function resolveProviderApiKeyForAgentSync(provider, agentId, _config) {
|
|
93
95
|
const normalized = provider.toLowerCase();
|
|
96
|
+
assertCurrentModelProvider(normalized);
|
|
94
97
|
if (isOAuthOnlyProvider(normalized)) return readOAuthAccessTokenSync(normalized);
|
|
95
98
|
if (agentId?.trim()) {
|
|
96
99
|
const fromAgent = readApiKeyFromProfilesFile(resolveAgentAuthProfilesPath(agentId.trim()), normalized);
|
|
@@ -105,6 +108,7 @@ function resolveProviderApiKeyForAgentSync(provider, agentId, _config) {
|
|
|
105
108
|
* matching async CredentialResolver resolution (excluding env — callers check env separately).
|
|
106
109
|
*/
|
|
107
110
|
function hasProviderAuthOnDiskSync(provider) {
|
|
111
|
+
assertCurrentModelProvider(provider.toLowerCase());
|
|
108
112
|
if (isOAuthOnlyProvider(provider.toLowerCase())) return hasOAuthTokenSync(provider);
|
|
109
113
|
if (hasApiKeyInProfilesFile(resolveAgentAuthProfilesPath(getDefaultAgentId()), provider)) return true;
|
|
110
114
|
if (hasApiKeyInProfilesFile(resolveAuthProfilesPath(), provider)) return true;
|
|
@@ -114,6 +118,7 @@ function hasProviderAuthOnDiskSync(provider) {
|
|
|
114
118
|
var init_sync_provider_auth = __esmMin((() => {
|
|
115
119
|
init_paths();
|
|
116
120
|
init_resolve_route();
|
|
121
|
+
init_provider_policy();
|
|
117
122
|
init_registry();
|
|
118
123
|
}));
|
|
119
124
|
//#endregion
|
|
@@ -3,10 +3,10 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
3
3
|
import { init_trust_policy, resolveAutomationSafetyForTrust } from "../../user-context/trust-policy.js";
|
|
4
4
|
import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
|
|
5
5
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
6
|
-
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
7
6
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
8
7
|
import { ExternalEffectNotAppliedError } from "../../capabilities/runtime/external-operations.js";
|
|
9
8
|
import { defineExternalCapability, defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
9
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
10
10
|
import { AutomationCreateCapabilityInputSchema } from "./write.js";
|
|
11
11
|
import { simulateAutomation } from "../draft/automation-draft-validator.js";
|
|
12
12
|
import { AutomationDraftService } from "../draft/automation-draft-service.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { requireXopcDatabase } from "../storage/sqlite/connection.js";
|
|
2
2
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
3
3
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
4
|
-
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
5
4
|
import { cutoverLegacyAgentConfig } from "../agent-catalog/migrations/legacy-config-cutover.js";
|
|
6
5
|
import "../agent-catalog/index.js";
|
|
6
|
+
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
7
7
|
import { migrateIdentityMarkdownToCatalog } from "../agent-catalog/migrations/identity-markdown-cutover.js";
|
|
8
8
|
import { migrateCloudPublicModelsSync } from "../migrations/cloud-public-models.js";
|
|
9
9
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqliteCommitEffectError, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
2
3
|
import { CapabilityError } from "./errors.js";
|
|
3
4
|
import { executeExternalOperation } from "./external-operations.js";
|
|
4
|
-
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/capabilities/runtime/dispatcher.ts
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CapabilityError } from "./errors.js";
|
|
2
2
|
import { CapabilityDispatcher } from "./dispatcher.js";
|
|
3
|
+
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
3
4
|
import { registerLocalAppReadCapabilities } from "../../local-apps/capabilities/read.js";
|
|
4
5
|
import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
|
|
5
6
|
import { registerNoteWriteCapabilities } from "../../notes/capabilities/write.js";
|
|
@@ -18,7 +19,6 @@ import { registerSceneReadCapabilities } from "../../scenes/capabilities/read.js
|
|
|
18
19
|
import { registerSceneWriteCapabilities } from "../../scenes/capabilities/write.js";
|
|
19
20
|
import { registerSettingsCapability } from "./settings.js";
|
|
20
21
|
import { registerAppContextCapability } from "./app-context.js";
|
|
21
|
-
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
22
22
|
//#region src/capabilities/runtime/product.ts
|
|
23
23
|
function createProductDispatcher(getNotes, taskWrites) {
|
|
24
24
|
const dispatcher = new CapabilityDispatcher();
|
|
@@ -66,10 +66,10 @@ const switchCommand = {
|
|
|
66
66
|
"group"
|
|
67
67
|
],
|
|
68
68
|
acceptsArgs: true,
|
|
69
|
-
examples: ["/switch openai/gpt-
|
|
69
|
+
examples: ["/switch openai/gpt-6-sol", "/switch anthropic/claude-sonnet-5"],
|
|
70
70
|
handler: async (ctx, args) => {
|
|
71
71
|
if (!args.trim()) return {
|
|
72
|
-
content: joinBlocks("❌ Missing model ref.", "**Usage:** `/switch provider/model-id`", "Run `/models` — each line shows a display name and a `provider/model` ref in backticks. Copy that ref.", "**Example:** `/switch openai/gpt-
|
|
72
|
+
content: joinBlocks("❌ Missing model ref.", "**Usage:** `/switch provider/model-id`", "Run `/models` — each line shows a display name and a `provider/model` ref in backticks. Copy that ref.", "**Example:** `/switch openai/gpt-6-sol`"),
|
|
73
73
|
success: false
|
|
74
74
|
};
|
|
75
75
|
await ctx.setTyping(true);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeAgentId, validateAgentIdForNewAgent } from "../../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope, resolveAgentDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
4
|
-
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
5
4
|
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
5
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
7
|
//#region src/cli/commands/agents.ts
|
|
8
8
|
init_repository();
|
|
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
53
53
|
id: "database-schema",
|
|
54
54
|
label: "Database schema",
|
|
55
55
|
status: "pass",
|
|
56
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
56
|
+
message: `SQLite schema v${status.dbVersion} (current release v241).`,
|
|
57
57
|
hints: []
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
|
|
2
1
|
import { AgentCatalogRepository, init_repository } from "../../../../agent-catalog/repository.js";
|
|
2
|
+
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
|
|
3
3
|
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
4
4
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
5
5
|
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { pluginServerId } from "../../extensions/agent-plugins/validation.js";
|
|
2
1
|
import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
|
|
3
|
-
import { savePluginAuthBinding } from "../../extensions/agent-plugins/auth.js";
|
|
4
|
-
import { materializePluginServers } from "../../extensions/agent-plugins/mcp-adapter.js";
|
|
5
2
|
import { loadConfig } from "../../config/loader.js";
|
|
6
3
|
import { getContextWithOpts } from "../context.js";
|
|
7
|
-
import { getMcpOAuthManager } from "../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
8
4
|
import { isAgentPluginArchive, withAgentPluginSource } from "../../extensions/agent-plugins/sources.js";
|
|
9
5
|
import { removePluginCredentials } from "../../extensions/agent-plugins/credentials.js";
|
|
10
6
|
import { join, resolve } from "node:path";
|
|
@@ -63,21 +59,6 @@ function addAgentPluginLifecycleCommands(command) {
|
|
|
63
59
|
store.remove(id, options.removeData);
|
|
64
60
|
console.log(`Removed ${raw}; credentials ${options.removeCredentials ? "deleted" : "retained"}${options.removeData ? ", plugin data deleted" : ", plugin data retained"}.`);
|
|
65
61
|
});
|
|
66
|
-
command.command("connect").argument("<id>", "plugin:<name>").requiredOption("--mcp <server>", "MCP server name").action(async (raw, options) => {
|
|
67
|
-
const store = new AgentPluginStore();
|
|
68
|
-
const id = raw.replace(/^plugin:/, "");
|
|
69
|
-
const plugin = store.get(id);
|
|
70
|
-
if (!plugin || plugin.readiness === "blocked") throw new Error("Plugin is unavailable");
|
|
71
|
-
await savePluginAuthBinding(store, id, options.mcp, { mode: "oauth" });
|
|
72
|
-
const serverId = pluginServerId(id, options.mcp);
|
|
73
|
-
const server = materializePluginServers(plugin, store)[serverId];
|
|
74
|
-
if (!server) throw new Error("MCP server not found");
|
|
75
|
-
const status = await getMcpOAuthManager(server).start({
|
|
76
|
-
serverId,
|
|
77
|
-
rawServer: server
|
|
78
|
-
});
|
|
79
|
-
console.log(JSON.stringify(status, null, 2));
|
|
80
|
-
});
|
|
81
62
|
}
|
|
82
63
|
//#endregion
|
|
83
64
|
export { addAgentPluginLifecycleCommands, installAgentPluginFromCli, isAgentPluginSource };
|
|
@@ -1,12 +1,46 @@
|
|
|
1
|
+
import { getNativePiAgentDir, prepareNativeMcpConfig } from "../../agent/mcp/native-mcp.js";
|
|
1
2
|
import { loadConfig } from "../../config/loader.js";
|
|
2
3
|
import { register } from "../registry.js";
|
|
3
4
|
import { createGatewayHttpClientFromConfig } from "../../mcp/gateway-http-client.js";
|
|
4
5
|
import { createCapabilityMcpServer } from "../../mcp/capability-server.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { chmodSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { main } from "@earendil-works/pi-coding-agent";
|
|
5
9
|
import { Command } from "commander";
|
|
6
10
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
11
|
//#region src/cli/commands/mcp.ts
|
|
8
12
|
function createMcpCommand(ctx) {
|
|
9
|
-
const command = new Command("mcp").description("
|
|
13
|
+
const command = new Command("mcp").description("Manage native pi MCP servers and expose Gateway capabilities");
|
|
14
|
+
for (const action of [
|
|
15
|
+
"list",
|
|
16
|
+
"login",
|
|
17
|
+
"logout"
|
|
18
|
+
]) {
|
|
19
|
+
const native = command.command(action).description(`Use pi's native MCP ${action}`);
|
|
20
|
+
if (action !== "list") native.argument("<server>", "Configured MCP server ID");
|
|
21
|
+
if (action === "list") native.option("--json", "Print pi MCP diagnostics as JSON");
|
|
22
|
+
if (action === "login") native.option("--timeout <seconds>", "Browser sign-in timeout in seconds");
|
|
23
|
+
native.action(async (serverOrOptions, loginOptions) => {
|
|
24
|
+
const server = typeof serverOrOptions === "string" ? serverOrOptions : void 0;
|
|
25
|
+
const options = typeof serverOrOptions === "string" ? loginOptions : serverOrOptions;
|
|
26
|
+
const mcp = await prepareNativeMcpConfig(loadConfig(ctx.configPath), ctx.workspacePath || process.cwd());
|
|
27
|
+
if (mcp.errors.length) throw new Error(mcp.errors.join("\n"));
|
|
28
|
+
const path = join(getNativePiAgentDir(), "mcp.json");
|
|
29
|
+
if (existsSync(path) && JSON.parse(readFileSync(path, "utf8")).xopcGenerated !== true) throw new Error("The pi directory contains a user-managed mcp.json. Use a dedicated PI_CODING_AGENT_DIR for xopc.");
|
|
30
|
+
if (existsSync(path)) chmodSync(path, 384);
|
|
31
|
+
writeFileSync(path, JSON.stringify({
|
|
32
|
+
xopcGenerated: true,
|
|
33
|
+
mcpServers: Object.fromEntries(mcp.servers.map((entry) => [entry.name, entry.config]))
|
|
34
|
+
}), { mode: 384 });
|
|
35
|
+
await main([
|
|
36
|
+
"mcp",
|
|
37
|
+
action,
|
|
38
|
+
...server ? [server] : [],
|
|
39
|
+
...action === "list" && options?.json ? ["--json"] : [],
|
|
40
|
+
...action === "login" && loginOptions?.timeout ? ["--timeout", loginOptions.timeout] : []
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
10
44
|
command.command("capabilities").description("Run an opt-in stdio MCP proxy for an explicit capability allowlist").requiredOption("--allow-capability <ids...>", "Exact capability IDs; no wildcards").action(async (options) => {
|
|
11
45
|
const server = createCapabilityMcpServer(createGatewayHttpClientFromConfig({ config: loadConfig(ctx.configPath) }), options.allowCapability);
|
|
12
46
|
const transport = new StdioServerTransport();
|
|
@@ -39,7 +73,7 @@ function createMcpCommand(ctx) {
|
|
|
39
73
|
register({
|
|
40
74
|
id: "mcp",
|
|
41
75
|
name: "mcp",
|
|
42
|
-
description: "
|
|
76
|
+
description: "Manage native pi MCP servers and expose Gateway capabilities",
|
|
43
77
|
factory: createMcpCommand,
|
|
44
78
|
metadata: {
|
|
45
79
|
category: "utility",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
2
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
2
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
4
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
4
5
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
5
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
6
6
|
import { listImageProviderSpecs } from "../../../packages/image-providers/src/catalog.js";
|
|
7
7
|
import "../../../packages/image-providers/src/index.js";
|
|
8
8
|
import { loadConfig } from "../../config/loader.js";
|
|
@@ -22,7 +22,7 @@ init_repository();
|
|
|
22
22
|
init_providers();
|
|
23
23
|
const IMAGE_GENERATION_IDS = new Set(listImageProviderSpecs().flatMap((provider) => provider.models.map((model) => model.id)));
|
|
24
24
|
const VISION_IDS = new Set([
|
|
25
|
-
"gpt-
|
|
25
|
+
"gpt-6-sol",
|
|
26
26
|
"gpt-5.6-luna",
|
|
27
27
|
"gpt-5.6-sol",
|
|
28
28
|
"gpt-5.6-terra",
|