@oomol-lab/open-connector 1.9.0 → 1.9.1
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/assets/open-connector/catalog/apps/agentearth.json +441 -0
- package/assets/open-connector/catalog/apps/appgrowing_mcp.json +863 -0
- package/assets/open-connector/catalog/apps/arcmira.json +610 -0
- package/assets/open-connector/catalog/apps/bainiu.json +654 -0
- package/assets/open-connector/catalog/apps/chaport.json +331 -0
- package/assets/open-connector/catalog/apps/cnb.json +1408 -0
- package/assets/open-connector/catalog/apps/crtsh.json +123 -0
- package/assets/open-connector/catalog/apps/eastmoney_miaoxiang.json +406 -0
- package/assets/open-connector/catalog/apps/fastmoss_mcp.json +876 -876
- package/assets/open-connector/catalog/apps/ftshare.json +1162 -0
- package/assets/open-connector/catalog/apps/fusion-api.json +143 -0
- package/assets/open-connector/catalog/apps/fxbaogao.json +308 -0
- package/assets/open-connector/catalog/apps/github.json +38 -3
- package/assets/open-connector/catalog/apps/hrmos_kintai.json +7519 -0
- package/assets/open-connector/catalog/apps/humor_api.json +351 -0
- package/assets/open-connector/catalog/apps/kaonavi.json +1723 -0
- package/assets/open-connector/catalog/apps/linear_mcp.json +882 -22
- package/assets/open-connector/catalog/apps/listinggood.json +362 -0
- package/assets/open-connector/catalog/apps/notion_mcp.json +338 -1
- package/assets/open-connector/catalog/apps/outlook.json +414 -0
- package/assets/open-connector/catalog/apps/porteden.json +1258 -0
- package/assets/open-connector/catalog/apps/qiuxiaoce.json +915 -0
- package/assets/open-connector/catalog/apps/qqmusic.json +1834 -0
- package/assets/open-connector/catalog/apps/rakuraku_seisan.json +217 -0
- package/assets/open-connector/catalog/apps/redfox.json +9661 -897
- package/assets/open-connector/catalog/apps/salesforce.json +4907 -0
- package/assets/open-connector/catalog/apps/sansan.json +4594 -0
- package/assets/open-connector/catalog/apps/smarthr.json +8071 -0
- package/assets/open-connector/catalog/apps/smooth.json +914 -0
- package/assets/open-connector/catalog/apps/tapd.json +727 -0
- package/assets/open-connector/catalog/apps/tencent_meeting_mcp.json +1301 -0
- package/assets/open-connector/catalog/apps/threatfox.json +203 -0
- package/assets/open-connector/catalog/apps/tradebee.json +915 -0
- package/assets/open-connector/catalog/apps/twittrapi.json +4914 -0
- package/assets/open-connector/catalog/apps/urlhaus.json +246 -0
- package/assets/open-connector/catalog/apps/weread.json +1514 -0
- package/assets/open-connector/catalog/apps/whatsapp.json +12 -0
- package/assets/open-connector/catalog/apps/zhiliaobiaoxun.json +812 -0
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +2 -1
- package/src/connection-service.js +55 -11
- package/src/core/provider-error-codes.d.ts +9 -0
- package/src/core/provider-error-codes.js +13 -0
- package/src/core/request.d.ts +2 -0
- package/src/core/request.js +11 -2
- package/src/mail/imap-smtp/protocol.js +4 -3
- package/src/oauth/oauth-flow-service.js +1 -0
- package/src/oauth/oauth-token.d.ts +2 -0
- package/src/providers/17track/runtime.js +17 -20
- package/src/providers/action-contracts.generated.d.ts +36 -6
- package/src/providers/agentearth/actions.d.ts +2 -0
- package/src/providers/agentearth/actions.js +100 -0
- package/src/providers/agentearth/executors.d.ts +4 -0
- package/src/providers/agentearth/executors.js +109 -0
- package/src/providers/appgrowing_mcp/actions.d.ts +2 -0
- package/src/providers/appgrowing_mcp/actions.js +175 -0
- package/src/providers/appgrowing_mcp/executors.d.ts +4 -0
- package/src/providers/appgrowing_mcp/executors.js +66 -0
- package/src/providers/arcmira/executors.d.ts +3 -0
- package/src/providers/arcmira/executors.js +8 -0
- package/src/providers/arcmira/runtime.d.ts +6 -0
- package/src/providers/arcmira/runtime.js +41 -0
- package/src/providers/bainiu/actions.d.ts +2 -0
- package/src/providers/bainiu/actions.js +108 -0
- package/src/providers/bainiu/executors.d.ts +4 -0
- package/src/providers/bainiu/executors.js +113 -0
- package/src/providers/baixiao/executors.js +1 -1
- package/src/providers/bing_webmaster/executors.js +1 -1
- package/src/providers/chaport/actions.d.ts +2 -0
- package/src/providers/chaport/actions.js +70 -0
- package/src/providers/chaport/executors.d.ts +4 -0
- package/src/providers/chaport/executors.js +128 -0
- package/src/providers/clickup/runtime.js +49 -52
- package/src/providers/cnb/actions.d.ts +2 -0
- package/src/providers/cnb/actions.js +341 -0
- package/src/providers/cnb/executors.d.ts +4 -0
- package/src/providers/cnb/executors.js +135 -0
- package/src/providers/coupontools/runtime.js +11 -14
- package/src/providers/crtsh/executors.d.ts +3 -0
- package/src/providers/crtsh/executors.js +19 -0
- package/src/providers/crtsh/runtime.d.ts +17 -0
- package/src/providers/crtsh/runtime.js +84 -0
- package/src/providers/eastmoney_miaoxiang/actions.d.ts +2 -0
- package/src/providers/eastmoney_miaoxiang/actions.js +95 -0
- package/src/providers/eastmoney_miaoxiang/executors.d.ts +4 -0
- package/src/providers/eastmoney_miaoxiang/executors.js +81 -0
- package/src/providers/fastmoss_mcp/actions-content.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-content.js +140 -0
- package/src/providers/fastmoss_mcp/actions-creator.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-creator.js +154 -0
- package/src/providers/fastmoss_mcp/actions-product.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-product.js +167 -0
- package/src/providers/fastmoss_mcp/actions-research.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-research.js +174 -0
- package/src/providers/fastmoss_mcp/actions-shop.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-shop.js +142 -0
- package/src/providers/fastmoss_mcp/actions.js +11 -12
- package/src/providers/fastmoss_mcp/schemas.d.ts +51 -0
- package/src/providers/fastmoss_mcp/schemas.js +52 -0
- package/src/providers/ftshare/actions.d.ts +2 -0
- package/src/providers/ftshare/actions.js +124 -0
- package/src/providers/ftshare/executors.d.ts +4 -0
- package/src/providers/ftshare/executors.js +102 -0
- package/src/providers/fusion-api/operations.js +37 -0
- package/src/providers/fxbaogao/actions.d.ts +2 -0
- package/src/providers/fxbaogao/actions.js +74 -0
- package/src/providers/fxbaogao/executors.d.ts +4 -0
- package/src/providers/fxbaogao/executors.js +155 -0
- package/src/providers/github/app-installation.d.ts +37 -0
- package/src/providers/github/app-installation.js +233 -0
- package/src/providers/github/executors.js +93 -15
- package/src/providers/github/runtime-repository.js +21 -1
- package/src/providers/github/runtime-shared.d.ts +2 -0
- package/src/providers/github/runtime-shared.js +1 -0
- package/src/providers/googledrive/runtime-request.js +3 -3
- package/src/providers/hrmos_kintai/actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/actions.js +139 -0
- package/src/providers/hrmos_kintai/attendance-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/attendance-actions.js +276 -0
- package/src/providers/hrmos_kintai/business-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/business-actions.js +143 -0
- package/src/providers/hrmos_kintai/business-schemas.d.ts +4 -0
- package/src/providers/hrmos_kintai/business-schemas.js +320 -0
- package/src/providers/hrmos_kintai/executors.d.ts +4 -0
- package/src/providers/hrmos_kintai/executors.js +61 -0
- package/src/providers/hrmos_kintai/export-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/export-actions.js +58 -0
- package/src/providers/hrmos_kintai/operations.d.ts +9 -0
- package/src/providers/hrmos_kintai/operations.js +278 -0
- package/src/providers/hrmos_kintai/runtime.d.ts +10 -0
- package/src/providers/hrmos_kintai/runtime.js +217 -0
- package/src/providers/hrmos_kintai/schemas.d.ts +10 -0
- package/src/providers/hrmos_kintai/schemas.js +70 -0
- package/src/providers/humor_api/actions.d.ts +2 -0
- package/src/providers/humor_api/actions.js +96 -0
- package/src/providers/humor_api/executors.d.ts +4 -0
- package/src/providers/humor_api/executors.js +76 -0
- package/src/providers/kaonavi/actions.d.ts +4 -0
- package/src/providers/kaonavi/actions.js +144 -0
- package/src/providers/kaonavi/additional-actions.d.ts +10 -0
- package/src/providers/kaonavi/additional-actions.js +203 -0
- package/src/providers/kaonavi/executors.d.ts +4 -0
- package/src/providers/kaonavi/executors.js +69 -0
- package/src/providers/kaonavi/runtime.d.ts +4 -0
- package/src/providers/kaonavi/runtime.js +69 -0
- package/src/providers/linear_mcp/actions.d.ts +14 -0
- package/src/providers/linear_mcp/actions.js +134 -0
- package/src/providers/linear_mcp/runtime-mcp.d.ts +7 -1
- package/src/providers/linear_mcp/runtime-mcp.js +140 -28
- package/src/providers/linkfox/runtime.js +48 -51
- package/src/providers/listinggood/actions.d.ts +2 -0
- package/src/providers/listinggood/actions.js +95 -0
- package/src/providers/listinggood/executors.d.ts +4 -0
- package/src/providers/listinggood/executors.js +99 -0
- package/src/providers/mcp-tools.d.ts +3 -0
- package/src/providers/mcp-tools.js +5 -4
- package/src/providers/notion_mcp/executors.js +53 -24
- package/src/providers/notion_mcp/mcp-response.d.ts +26 -0
- package/src/providers/notion_mcp/mcp-response.js +95 -0
- package/src/providers/omise/executors.js +1 -1
- package/src/providers/outlook/executors.js +35 -2
- package/src/providers/porteden/actions.d.ts +2 -0
- package/src/providers/porteden/actions.js +162 -0
- package/src/providers/porteden/executors.d.ts +4 -0
- package/src/providers/porteden/executors.js +140 -0
- package/src/providers/provider-runtime.d.ts +3 -2
- package/src/providers/pushover/runtime.js +28 -31
- package/src/providers/qianfan/runtime.js +16 -19
- package/src/providers/qiuxiaoce/actions.d.ts +2 -0
- package/src/providers/qiuxiaoce/actions.js +248 -0
- package/src/providers/qiuxiaoce/executors.d.ts +4 -0
- package/src/providers/qiuxiaoce/executors.js +76 -0
- package/src/providers/qiuxiaoce/routes.d.ts +1 -0
- package/src/providers/qiuxiaoce/routes.js +20 -0
- package/src/providers/qqmusic/actions.d.ts +2 -0
- package/src/providers/qqmusic/actions.js +229 -0
- package/src/providers/qqmusic/executors.d.ts +4 -0
- package/src/providers/qqmusic/executors.js +92 -0
- package/src/providers/qqmusic/report-schema.d.ts +4 -0
- package/src/providers/qqmusic/report-schema.js +119 -0
- package/src/providers/rakuraku_seisan/actions.d.ts +2 -0
- package/src/providers/rakuraku_seisan/actions.js +50 -0
- package/src/providers/rakuraku_seisan/executors.d.ts +4 -0
- package/src/providers/rakuraku_seisan/executors.js +40 -0
- package/src/providers/rakuraku_seisan/runtime.d.ts +8 -0
- package/src/providers/rakuraku_seisan/runtime.js +251 -0
- package/src/providers/redfox/actions-account.d.ts +2 -0
- package/src/providers/redfox/actions-account.js +24 -0
- package/src/providers/redfox/actions-autohome.d.ts +2 -0
- package/src/providers/redfox/actions-autohome.js +51 -0
- package/src/providers/redfox/actions-baijiahao.d.ts +2 -0
- package/src/providers/redfox/actions-baijiahao.js +58 -0
- package/src/providers/redfox/actions-bilibili.d.ts +2 -0
- package/src/providers/redfox/actions-bilibili.js +67 -0
- package/src/providers/redfox/actions-dongchedi.d.ts +2 -0
- package/src/providers/redfox/actions-dongchedi.js +49 -0
- package/src/providers/redfox/actions-douyin.d.ts +2 -0
- package/src/providers/redfox/actions-douyin.js +297 -0
- package/src/providers/redfox/actions-generation.d.ts +2 -0
- package/src/providers/redfox/actions-generation.js +293 -0
- package/src/providers/redfox/actions-instagram.d.ts +2 -0
- package/src/providers/redfox/actions-instagram.js +49 -0
- package/src/providers/redfox/actions-kuaishou.d.ts +2 -0
- package/src/providers/redfox/actions-kuaishou.js +53 -0
- package/src/providers/redfox/actions-search.d.ts +2 -0
- package/src/providers/redfox/actions-search.js +125 -0
- package/src/providers/redfox/actions-tiktok.d.ts +2 -0
- package/src/providers/redfox/actions-tiktok.js +136 -0
- package/src/providers/redfox/actions-tools.d.ts +2 -0
- package/src/providers/redfox/actions-tools.js +151 -0
- package/src/providers/redfox/actions-toutiao.d.ts +2 -0
- package/src/providers/redfox/actions-toutiao.js +68 -0
- package/src/providers/redfox/actions-transcription.d.ts +2 -0
- package/src/providers/redfox/actions-transcription.js +165 -0
- package/src/providers/redfox/actions-wechat-channel.d.ts +2 -0
- package/src/providers/redfox/actions-wechat-channel.js +63 -0
- package/src/providers/redfox/actions-wechat.d.ts +2 -0
- package/src/providers/redfox/actions-wechat.js +302 -0
- package/src/providers/redfox/actions-weibo.d.ts +2 -0
- package/src/providers/redfox/actions-weibo.js +61 -0
- package/src/providers/redfox/actions-x.d.ts +2 -0
- package/src/providers/redfox/actions-x.js +126 -0
- package/src/providers/redfox/actions-xiaohongshu.d.ts +2 -0
- package/src/providers/redfox/actions-xiaohongshu.js +244 -0
- package/src/providers/redfox/actions-yiche.d.ts +2 -0
- package/src/providers/redfox/actions-yiche.js +59 -0
- package/src/providers/redfox/actions-youtube.d.ts +2 -0
- package/src/providers/redfox/actions-youtube.js +64 -0
- package/src/providers/redfox/actions-zhihu.d.ts +2 -0
- package/src/providers/redfox/actions-zhihu.js +26 -0
- package/src/providers/redfox/actions.d.ts +2 -0
- package/src/providers/redfox/actions.js +49 -0
- package/src/providers/redfox/executors.d.ts +2 -14
- package/src/providers/redfox/executors.js +28 -551
- package/src/providers/redfox/routes.d.ts +11 -0
- package/src/providers/redfox/routes.js +329 -0
- package/src/providers/redfox/runtime.d.ts +6 -0
- package/src/providers/redfox/runtime.js +151 -0
- package/src/providers/redfox/schemas.d.ts +9 -0
- package/src/providers/redfox/schemas.js +40 -0
- package/src/providers/registry.generated.js +30 -0
- package/src/providers/salesforce/context.d.ts +16 -0
- package/src/providers/salesforce/context.js +58 -0
- package/src/providers/salesforce/executors.d.ts +5 -0
- package/src/providers/salesforce/executors.js +54 -0
- package/src/providers/salesforce/media.d.ts +9 -0
- package/src/providers/salesforce/media.js +66 -0
- package/src/providers/salesforce/oauth.d.ts +2 -0
- package/src/providers/salesforce/oauth.js +89 -0
- package/src/providers/salesforce/runtime-analytics.d.ts +2 -0
- package/src/providers/salesforce/runtime-analytics.js +60 -0
- package/src/providers/salesforce/runtime-automation.d.ts +2 -0
- package/src/providers/salesforce/runtime-automation.js +64 -0
- package/src/providers/salesforce/runtime-base.d.ts +2 -0
- package/src/providers/salesforce/runtime-base.js +51 -0
- package/src/providers/salesforce/runtime-bulk.d.ts +2 -0
- package/src/providers/salesforce/runtime-bulk.js +98 -0
- package/src/providers/salesforce/runtime-data.d.ts +2 -0
- package/src/providers/salesforce/runtime-data.js +207 -0
- package/src/providers/salesforce/runtime-files.d.ts +2 -0
- package/src/providers/salesforce/runtime-files.js +108 -0
- package/src/providers/salesforce/transport.d.ts +9 -0
- package/src/providers/salesforce/transport.js +65 -0
- package/src/providers/sansan/actions.d.ts +2 -0
- package/src/providers/sansan/actions.js +165 -0
- package/src/providers/sansan/admin-actions.d.ts +2 -0
- package/src/providers/sansan/admin-actions.js +181 -0
- package/src/providers/sansan/admin.d.ts +2 -0
- package/src/providers/sansan/admin.js +42 -0
- package/src/providers/sansan/business-actions.d.ts +2 -0
- package/src/providers/sansan/business-actions.js +160 -0
- package/src/providers/sansan/business.d.ts +2 -0
- package/src/providers/sansan/business.js +51 -0
- package/src/providers/sansan/executors.d.ts +4 -0
- package/src/providers/sansan/executors.js +59 -0
- package/src/providers/sansan/file-schema.d.ts +2 -0
- package/src/providers/sansan/file-schema.js +8 -0
- package/src/providers/sansan/files.d.ts +11 -0
- package/src/providers/sansan/files.js +49 -0
- package/src/providers/sansan/organization-actions.d.ts +2 -0
- package/src/providers/sansan/organization-actions.js +198 -0
- package/src/providers/sansan/organization-columns.d.ts +2 -0
- package/src/providers/sansan/organization-columns.js +33 -0
- package/src/providers/sansan/organization.d.ts +2 -0
- package/src/providers/sansan/organization.js +88 -0
- package/src/providers/sansan/read.d.ts +2 -0
- package/src/providers/sansan/read.js +25 -0
- package/src/providers/sansan/request.d.ts +22 -0
- package/src/providers/sansan/request.js +94 -0
- package/src/providers/sansan/schemas.d.ts +7 -0
- package/src/providers/sansan/schemas.js +72 -0
- package/src/providers/shopee/runtime.d.ts +33 -29
- package/src/providers/shopee/runtime.js +166 -169
- package/src/providers/smarthr/actions.d.ts +2 -0
- package/src/providers/smarthr/actions.js +286 -0
- package/src/providers/smarthr/employee-runtime.d.ts +1 -0
- package/src/providers/smarthr/employee-runtime.js +63 -0
- package/src/providers/smarthr/employee-schema.d.ts +3 -0
- package/src/providers/smarthr/employee-schema.js +222 -0
- package/src/providers/smarthr/executors.d.ts +4 -0
- package/src/providers/smarthr/executors.js +35 -0
- package/src/providers/smarthr/pagination.d.ts +1 -0
- package/src/providers/smarthr/pagination.js +84 -0
- package/src/providers/smarthr/resource-routes.d.ts +16 -0
- package/src/providers/smarthr/resource-routes.js +163 -0
- package/src/providers/smarthr/runtime.d.ts +13 -0
- package/src/providers/smarthr/runtime.js +242 -0
- package/src/providers/smarthr/supplemental-actions.d.ts +2 -0
- package/src/providers/smarthr/supplemental-actions.js +541 -0
- package/src/providers/smooth/actions.d.ts +2 -0
- package/src/providers/smooth/actions.js +138 -0
- package/src/providers/smooth/executors.d.ts +4 -0
- package/src/providers/smooth/executors.js +102 -0
- package/src/providers/tapd/actions.d.ts +8 -0
- package/src/providers/tapd/actions.js +89 -0
- package/src/providers/tapd/executors.d.ts +4 -0
- package/src/providers/tapd/executors.js +137 -0
- package/src/providers/teable/runtime.js +12 -15
- package/src/providers/tencent_meeting_mcp/actions.d.ts +2 -0
- package/src/providers/tencent_meeting_mcp/actions.js +420 -0
- package/src/providers/tencent_meeting_mcp/executors.d.ts +4 -0
- package/src/providers/tencent_meeting_mcp/executors.js +117 -0
- package/src/providers/threatfox/executors.d.ts +4 -0
- package/src/providers/threatfox/executors.js +40 -0
- package/src/providers/threatfox/runtime.d.ts +15 -0
- package/src/providers/threatfox/runtime.js +128 -0
- package/src/providers/ticket_tailor/runtime.js +1 -1
- package/src/providers/ticketmaster/runtime.js +3 -6
- package/src/providers/timelinesai/runtime.js +13 -16
- package/src/providers/tradebee/actions.d.ts +2 -0
- package/src/providers/tradebee/actions.js +176 -0
- package/src/providers/tradebee/executors.d.ts +4 -0
- package/src/providers/tradebee/executors.js +83 -0
- package/src/providers/twittrapi/executors.d.ts +4 -0
- package/src/providers/twittrapi/executors.js +17 -0
- package/src/providers/twittrapi/runtime.d.ts +12 -0
- package/src/providers/twittrapi/runtime.js +203 -0
- package/src/providers/urlhaus/executors.d.ts +4 -0
- package/src/providers/urlhaus/executors.js +40 -0
- package/src/providers/urlhaus/runtime.d.ts +15 -0
- package/src/providers/urlhaus/runtime.js +142 -0
- package/src/providers/wangdian/runtime.js +16 -19
- package/src/providers/weread/actions.d.ts +2 -0
- package/src/providers/weread/actions.js +424 -0
- package/src/providers/weread/executors.d.ts +4 -0
- package/src/providers/weread/executors.js +98 -0
- package/src/providers/whatsapp/runtime.js +6 -1
- package/src/providers/workast/runtime.js +12 -17
- package/src/providers/youzan/runtime.js +21 -24
- package/src/providers/zenkit/runtime.js +13 -19
- package/src/providers/zhiliaobiaoxun/actions.d.ts +2 -0
- package/src/providers/zhiliaobiaoxun/actions.js +138 -0
- package/src/providers/zhiliaobiaoxun/executors.d.ts +4 -0
- package/src/providers/zhiliaobiaoxun/executors.js +78 -0
- package/src/server/api/auth.d.ts +2 -0
- package/src/server/api/auth.js +2 -1
- package/src/server/api/console-catalog-routes.d.ts +17 -0
- package/src/server/api/console-catalog-routes.js +88 -0
- package/src/server/api/console-oauth-routes.d.ts +18 -0
- package/src/server/api/console-oauth-routes.js +298 -0
- package/src/server/api/docs-routes.d.ts +12 -0
- package/src/server/api/docs-routes.js +38 -0
- package/src/server/api/http-utils.d.ts +1 -0
- package/src/server/api/http-utils.js +8 -0
- package/src/server/api/marketplace-routes.d.ts +7 -0
- package/src/server/api/marketplace-routes.js +62 -0
- package/src/server/api/mcp-routes.d.ts +18 -0
- package/src/server/api/mcp-routes.js +37 -0
- package/src/server/api/policy-routes.d.ts +13 -0
- package/src/server/api/policy-routes.js +50 -0
- package/src/server/api/policy-snapshot.d.ts +14 -0
- package/src/server/api/policy-snapshot.js +30 -0
- package/src/server/api/run-log-routes.d.ts +7 -0
- package/src/server/api/run-log-routes.js +70 -0
- package/src/server/api/runtime-api.d.ts +0 -7
- package/src/server/api/runtime-api.js +0 -13
- package/src/server/api/runtime-app-routes.d.ts +10 -0
- package/src/server/api/runtime-app-routes.js +72 -0
- package/src/server/api/runtime-catalog-routes.d.ts +37 -0
- package/src/server/api/runtime-catalog-routes.js +133 -0
- package/src/server/api/runtime-execution-routes.d.ts +16 -0
- package/src/server/api/runtime-execution-routes.js +198 -0
- package/src/server/api/saas-oauth-routes.d.ts +9 -0
- package/src/server/api/saas-oauth-routes.js +27 -0
- package/src/server/api/saas-project-routes.d.ts +7 -0
- package/src/server/api/saas-project-routes.js +16 -0
- package/src/server/api/transit-file-routes.d.ts +9 -0
- package/src/server/api/transit-file-routes.js +49 -0
- package/src/server/api/trigger-routes.d.ts +15 -0
- package/src/server/api/trigger-routes.js +48 -0
- package/src/server/connect-app.d.ts +1 -0
- package/src/server/connect-app.js +3 -1
- package/src/server/connect-server.d.ts +3 -54
- package/src/server/connect-server.js +95 -1148
- package/src/providers/fastmoss_mcp/official-tools.json +0 -2922
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { ConnectionError } from "../../connection-service.js";
|
|
3
|
+
import { optionalBoolean, optionalRecord, optionalString, requiredRawString, requiredString, requiredStringArray, } from "../../core/cast.js";
|
|
4
|
+
import { OAuthClientConfigError } from "../../oauth/oauth-client-config-service.js";
|
|
5
|
+
import { OAuthCallbackError, OAuthFlowError } from "../../oauth/oauth-flow-service.js";
|
|
6
|
+
import { HttpRequestError, jsonError, readConnectionName as defaultReadConnectionName, readJsonBody, } from "./http-utils.js";
|
|
7
|
+
import { renderOAuthCompletionPage } from "./oauth-completion-page.js";
|
|
8
|
+
function readOAuthClientConfigInput(body) {
|
|
9
|
+
const keys = ["clientId", "clientSecret", "requestedScopes", "redirectUri", "extra", "secretExtra"];
|
|
10
|
+
if (!keys.some((key) => key in body)) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
clientId: optionalString(body.clientId) ?? "",
|
|
15
|
+
clientSecret: optionalString(body.clientSecret) ?? "",
|
|
16
|
+
requestedScopes: readOptionalStringArray(body, "requestedScopes"),
|
|
17
|
+
redirectUri: readOptionalRawString(body, "redirectUri"),
|
|
18
|
+
extra: optionalRecord(body.extra),
|
|
19
|
+
secretExtra: optionalRecord(body.secretExtra),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** An absent field is undefined; a present one, null included, must be a string (blank is kept for the caller to read as unset). */
|
|
23
|
+
function readOptionalRawString(body, fieldName) {
|
|
24
|
+
if (!(fieldName in body))
|
|
25
|
+
return undefined;
|
|
26
|
+
return requiredRawString(body[fieldName], fieldName, (message) => new HttpRequestError("invalid_input", `${message}.`));
|
|
27
|
+
}
|
|
28
|
+
function readOptionalStringArray(body, fieldName) {
|
|
29
|
+
if (!(fieldName in body))
|
|
30
|
+
return undefined;
|
|
31
|
+
return requiredStringArray(body[fieldName], fieldName, (message) => new HttpRequestError("invalid_input", `${message}.`));
|
|
32
|
+
}
|
|
33
|
+
/** Console connection management and OAuth client configuration / authorization routes. */
|
|
34
|
+
export function createConsoleOAuthRoutes({ connections, oauthFlow, oauthClientConfigs, saasProject, logger, oauthCloseDelaySeconds, readConnectionName = defaultReadConnectionName, }) {
|
|
35
|
+
const app = new Hono();
|
|
36
|
+
const writeConnectionResult = async (context, operation, logContext) => {
|
|
37
|
+
try {
|
|
38
|
+
const result = await operation;
|
|
39
|
+
if (logContext) {
|
|
40
|
+
logger?.info(logContext, logContext.operation === "disconnect" ? "connection disconnect completed" : "connection completed");
|
|
41
|
+
}
|
|
42
|
+
return context.json(result);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof ConnectionError) {
|
|
46
|
+
if (logContext) {
|
|
47
|
+
const cancelled = error.code === "connection_cancelled";
|
|
48
|
+
logger?.[cancelled ? "info" : "warn"]({
|
|
49
|
+
...logContext,
|
|
50
|
+
errorCode: error.code,
|
|
51
|
+
}, cancelled
|
|
52
|
+
? "connection cancelled"
|
|
53
|
+
: logContext.operation === "disconnect"
|
|
54
|
+
? "connection disconnect failed"
|
|
55
|
+
: "connection failed");
|
|
56
|
+
}
|
|
57
|
+
return jsonError(context, error.code === "unknown_service" ? 404 : 400, error.code, error.message);
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const writeOAuthResult = async (context, operation) => {
|
|
63
|
+
try {
|
|
64
|
+
return context.json(await operation);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (error instanceof OAuthClientConfigError || error instanceof OAuthFlowError) {
|
|
68
|
+
return jsonError(context, error.code === "unknown_service" ? 404 : 400, error.code, error.message);
|
|
69
|
+
}
|
|
70
|
+
if (error instanceof HttpRequestError) {
|
|
71
|
+
return jsonError(context, 400, error.code, error.message);
|
|
72
|
+
}
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
app.get("/api/connections", async (context) => context.json(await connections.listConnections()));
|
|
77
|
+
app.put("/api/connections/:service", async (context) => {
|
|
78
|
+
const service = context.req.param("service");
|
|
79
|
+
const body = await readJsonBody(context);
|
|
80
|
+
const authType = optionalString(body.authType);
|
|
81
|
+
if (!authType) {
|
|
82
|
+
logger?.warn({
|
|
83
|
+
errorCode: "invalid_input",
|
|
84
|
+
path: context.req.path,
|
|
85
|
+
service,
|
|
86
|
+
}, "connection rejected");
|
|
87
|
+
return jsonError(context, 400, "invalid_input", "authType is required.");
|
|
88
|
+
}
|
|
89
|
+
const values = body.values ?? body;
|
|
90
|
+
const connectionName = readConnectionName(context, body);
|
|
91
|
+
const logContext = {
|
|
92
|
+
operation: "connect",
|
|
93
|
+
path: context.req.path,
|
|
94
|
+
service,
|
|
95
|
+
authType,
|
|
96
|
+
connectionName,
|
|
97
|
+
};
|
|
98
|
+
if (authType === "no_auth") {
|
|
99
|
+
logger?.info(logContext, "connection started");
|
|
100
|
+
return writeConnectionResult(context, connections.connectWithoutAuth(service, { connectionName }), logContext);
|
|
101
|
+
}
|
|
102
|
+
if (authType === "api_key") {
|
|
103
|
+
logger?.info(logContext, "connection started");
|
|
104
|
+
return writeConnectionResult(context, connections.connectWithApiKey(service, {
|
|
105
|
+
values,
|
|
106
|
+
connectionName,
|
|
107
|
+
signal: context.req.raw.signal,
|
|
108
|
+
}), logContext);
|
|
109
|
+
}
|
|
110
|
+
if (authType === "custom_credential") {
|
|
111
|
+
logger?.info(logContext, "connection started");
|
|
112
|
+
return writeConnectionResult(context, connections.connectWithCustomCredential(service, {
|
|
113
|
+
values,
|
|
114
|
+
connectionName,
|
|
115
|
+
signal: context.req.raw.signal,
|
|
116
|
+
}), logContext);
|
|
117
|
+
}
|
|
118
|
+
logger?.warn({
|
|
119
|
+
...logContext,
|
|
120
|
+
errorCode: "unsupported_auth_type",
|
|
121
|
+
}, "connection rejected");
|
|
122
|
+
return jsonError(context, 400, "unsupported_auth_type", `${service} does not support ${authType}.`);
|
|
123
|
+
});
|
|
124
|
+
app.delete("/api/connections/:service", async (context) => {
|
|
125
|
+
const service = context.req.param("service");
|
|
126
|
+
const body = await readJsonBody(context);
|
|
127
|
+
const connectionName = readConnectionName(context, body);
|
|
128
|
+
const logContext = {
|
|
129
|
+
operation: "disconnect",
|
|
130
|
+
path: context.req.path,
|
|
131
|
+
service,
|
|
132
|
+
connectionName,
|
|
133
|
+
};
|
|
134
|
+
logger?.info(logContext, "connection disconnect started");
|
|
135
|
+
return writeConnectionResult(context, connections.disconnect(service, connectionName, { revoke: optionalBoolean(body.revoke) }), logContext);
|
|
136
|
+
});
|
|
137
|
+
app.get("/api/oauth/configs", async (context) => {
|
|
138
|
+
const configs = await oauthClientConfigs.listConfigs();
|
|
139
|
+
const sources = await saasProject?.listSources();
|
|
140
|
+
return context.json(configs.map((config) => ({
|
|
141
|
+
...config,
|
|
142
|
+
oauthSource: sources?.get(config.service) ?? { mode: "local" },
|
|
143
|
+
customClientAvailable: sources?.has(config.service) ? false : config.customClientAvailable,
|
|
144
|
+
})));
|
|
145
|
+
});
|
|
146
|
+
app.put("/api/oauth/configs/:service", async (context) => {
|
|
147
|
+
const service = context.req.param("service");
|
|
148
|
+
const body = await readJsonBody(context);
|
|
149
|
+
return writeOAuthResult(context, oauthClientConfigs.upsertConfig({
|
|
150
|
+
service,
|
|
151
|
+
clientId: optionalString(body.clientId) ?? "",
|
|
152
|
+
clientSecret: optionalString(body.clientSecret) ?? "",
|
|
153
|
+
requestedScopes: readOptionalStringArray(body, "requestedScopes"),
|
|
154
|
+
redirectUri: readOptionalRawString(body, "redirectUri"),
|
|
155
|
+
extra: optionalRecord(body.extra),
|
|
156
|
+
secretExtra: optionalRecord(body.secretExtra),
|
|
157
|
+
}));
|
|
158
|
+
});
|
|
159
|
+
app.delete("/api/oauth/configs/:service", async (context) => {
|
|
160
|
+
const service = context.req.param("service");
|
|
161
|
+
return writeOAuthResult(context, oauthClientConfigs.deleteConfig(service));
|
|
162
|
+
});
|
|
163
|
+
app.post("/api/oauth/connection-requests", async (context) => {
|
|
164
|
+
try {
|
|
165
|
+
const { consoleOAuthConnectionInput } = await import("./connection-input.js");
|
|
166
|
+
const parsed = consoleOAuthConnectionInput.safeParse(await readJsonBody(context));
|
|
167
|
+
if (!parsed.success)
|
|
168
|
+
return jsonError(context, 400, "invalid_input", "Invalid OAuth connection request.");
|
|
169
|
+
const { appId, ...input } = parsed.data;
|
|
170
|
+
const target = appId ? await connections.getStoredConnection(appId) : undefined;
|
|
171
|
+
if (target && (target.service !== input.service || target.connectionName !== input.connectionName))
|
|
172
|
+
return jsonError(context, 400, "invalid_input", "The selected connection no longer matches.");
|
|
173
|
+
return context.json(await oauthFlow.startConnectionRequest({
|
|
174
|
+
...input,
|
|
175
|
+
target,
|
|
176
|
+
owner: "local-admin",
|
|
177
|
+
signal: context.req.raw.signal,
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
if (error instanceof OAuthClientConfigError ||
|
|
182
|
+
error instanceof OAuthFlowError ||
|
|
183
|
+
error instanceof ConnectionError)
|
|
184
|
+
return jsonError(context, error.code === "unknown_service" || error.code === "app_not_found" ? 404 : 400, error.code, error.message);
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
app.post("/api/oauth/authorizations", async (context) => {
|
|
189
|
+
const body = await readJsonBody(context);
|
|
190
|
+
const requestedService = optionalString(body.service);
|
|
191
|
+
const connectionName = readConnectionName(context, body);
|
|
192
|
+
try {
|
|
193
|
+
const service = requiredString(body.service, "service", (message) => new OAuthFlowError("invalid_input", message));
|
|
194
|
+
const logContext = {
|
|
195
|
+
path: context.req.path,
|
|
196
|
+
service,
|
|
197
|
+
connectionName,
|
|
198
|
+
};
|
|
199
|
+
logger?.info(logContext, "oauth authorization started");
|
|
200
|
+
const authorization = await oauthFlow.startAuthorization({
|
|
201
|
+
service,
|
|
202
|
+
connectionName,
|
|
203
|
+
clientConfig: readOAuthClientConfigInput(body),
|
|
204
|
+
authorizationOptionIds: readOptionalStringArray(body, "authorizationOptionIds"),
|
|
205
|
+
});
|
|
206
|
+
const authorizationUrl = new URL(authorization.authorizationUrl);
|
|
207
|
+
logger?.info({
|
|
208
|
+
...logContext,
|
|
209
|
+
authorizationHost: authorizationUrl.host,
|
|
210
|
+
redirectUri: authorizationUrl.searchParams.get("redirect_uri") ?? undefined,
|
|
211
|
+
}, "oauth authorization created");
|
|
212
|
+
return context.json(authorization);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (error instanceof OAuthClientConfigError ||
|
|
216
|
+
error instanceof OAuthFlowError ||
|
|
217
|
+
error instanceof ConnectionError) {
|
|
218
|
+
logger?.warn({
|
|
219
|
+
errorCode: error.code,
|
|
220
|
+
path: context.req.path,
|
|
221
|
+
service: requestedService,
|
|
222
|
+
connectionName,
|
|
223
|
+
}, "oauth authorization failed");
|
|
224
|
+
const status = error.code === "unknown_service" ? 404 : 400;
|
|
225
|
+
return jsonError(context, status, error.code, error.message);
|
|
226
|
+
}
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
app.get("/oauth/callback", async (context) => {
|
|
231
|
+
const state = context.req.query("state");
|
|
232
|
+
const code = context.req.query("code");
|
|
233
|
+
const logContext = {
|
|
234
|
+
path: context.req.path,
|
|
235
|
+
hasState: Boolean(state),
|
|
236
|
+
hasCode: Boolean(code),
|
|
237
|
+
};
|
|
238
|
+
logger?.info(logContext, "oauth callback received");
|
|
239
|
+
const providerError = context.req.query("error");
|
|
240
|
+
if (providerError) {
|
|
241
|
+
const returnUri = state
|
|
242
|
+
? await oauthFlow.rejectAuthorization(state, providerError === "access_denied")
|
|
243
|
+
: undefined;
|
|
244
|
+
if (returnUri)
|
|
245
|
+
return context.redirect(returnUri);
|
|
246
|
+
const providerErrorDescription = context.req.query("error_description");
|
|
247
|
+
logger?.warn({
|
|
248
|
+
...logContext,
|
|
249
|
+
errorCode: "oauth_provider_error",
|
|
250
|
+
providerError,
|
|
251
|
+
providerErrorDescription,
|
|
252
|
+
}, "oauth callback failed");
|
|
253
|
+
return jsonError(context, 400, "oauth_provider_error", `OAuth provider returned error "${providerError}"${providerErrorDescription ? `: ${providerErrorDescription}` : "."}`);
|
|
254
|
+
}
|
|
255
|
+
if (!state || !code) {
|
|
256
|
+
if (state)
|
|
257
|
+
await oauthFlow.rejectAuthorization(state, false);
|
|
258
|
+
logger?.warn({
|
|
259
|
+
...logContext,
|
|
260
|
+
errorCode: "invalid_oauth_callback",
|
|
261
|
+
}, "oauth callback failed");
|
|
262
|
+
return jsonError(context, 400, "invalid_oauth_callback", "OAuth callback requires state and code.");
|
|
263
|
+
}
|
|
264
|
+
let service;
|
|
265
|
+
try {
|
|
266
|
+
const callbackUrl = new URL(context.req.url);
|
|
267
|
+
const completed = await oauthFlow.completeAuthorization({
|
|
268
|
+
state,
|
|
269
|
+
code,
|
|
270
|
+
callbackParameters: Object.fromEntries(callbackUrl.searchParams),
|
|
271
|
+
callbackQuery: callbackUrl.search,
|
|
272
|
+
signal: context.req.raw.signal,
|
|
273
|
+
});
|
|
274
|
+
service = completed.service;
|
|
275
|
+
if (completed.returnUri)
|
|
276
|
+
return context.redirect(completed.returnUri);
|
|
277
|
+
logger?.info({
|
|
278
|
+
...logContext,
|
|
279
|
+
service,
|
|
280
|
+
}, "oauth callback completed");
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
if (error instanceof OAuthCallbackError && error.returnUri)
|
|
284
|
+
return context.redirect(error.returnUri);
|
|
285
|
+
if (error instanceof OAuthFlowError || error instanceof ConnectionError) {
|
|
286
|
+
const cancelled = error instanceof ConnectionError && error.code === "connection_cancelled";
|
|
287
|
+
logger?.[cancelled ? "info" : "warn"]({
|
|
288
|
+
...logContext,
|
|
289
|
+
errorCode: error.code,
|
|
290
|
+
}, cancelled ? "oauth callback cancelled" : "oauth callback failed");
|
|
291
|
+
return jsonError(context, error.code === "unknown_service" ? 404 : 400, error.code, error.message);
|
|
292
|
+
}
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
return context.html(renderOAuthCompletionPage(service, oauthCloseDelaySeconds));
|
|
296
|
+
});
|
|
297
|
+
return app;
|
|
298
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProviderDefinition } from "../../core/types.ts";
|
|
2
|
+
import type { MiddlewareHandler } from "hono";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
/** The Scalar API reference is only rendered for /docs, so its package is loaded on demand. */
|
|
5
|
+
export declare function loadDocsHandler(openapiUrl?: string): Promise<MiddlewareHandler>;
|
|
6
|
+
export interface DocsRoutesOptions {
|
|
7
|
+
providers: ProviderDefinition[];
|
|
8
|
+
publicOrigin: string;
|
|
9
|
+
serveDocumentation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** OpenAPI 3.1 schema and interactive documentation routes. */
|
|
12
|
+
export declare function createDocsRoutes({ providers, publicOrigin, serveDocumentation }: DocsRoutesOptions): Hono;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { optionalString } from "../../core/cast.js";
|
|
3
|
+
import { PromiseCache } from "../../core/promise-cache.js";
|
|
4
|
+
const docsHandler = new PromiseCache();
|
|
5
|
+
/** The Scalar API reference is only rendered for /docs, so its package is loaded on demand. */
|
|
6
|
+
export function loadDocsHandler(openapiUrl = "/openapi.json") {
|
|
7
|
+
return docsHandler.get(openapiUrl, async () => {
|
|
8
|
+
const { Scalar } = await import("@scalar/hono-api-reference");
|
|
9
|
+
return Scalar({
|
|
10
|
+
pageTitle: "OOMOL Connect API Reference",
|
|
11
|
+
url: openapiUrl,
|
|
12
|
+
theme: "default",
|
|
13
|
+
darkMode: false,
|
|
14
|
+
forceDarkModeState: "light",
|
|
15
|
+
customCss: `
|
|
16
|
+
:root {
|
|
17
|
+
--scalar-color-accent: rgb(59, 99, 251);
|
|
18
|
+
--scalar-background-accent: rgba(59, 99, 251, 0.12);
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/** OpenAPI 3.1 schema and interactive documentation routes. */
|
|
25
|
+
export function createDocsRoutes({ providers, publicOrigin, serveDocumentation }) {
|
|
26
|
+
const app = new Hono();
|
|
27
|
+
app.get("/openapi.json", async (context) => {
|
|
28
|
+
const { createOpenApiDocument } = await import("./openapi.js");
|
|
29
|
+
return context.json(createOpenApiDocument(providers, {
|
|
30
|
+
actionId: optionalString(context.req.query("actionId")),
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
if (serveDocumentation !== false) {
|
|
34
|
+
const openapiUrl = `${new URL(publicOrigin).pathname.replace(/\/+$/, "")}/openapi.json`;
|
|
35
|
+
app.get("/docs", async (context, next) => (await loadDocsHandler(openapiUrl))(context, next));
|
|
36
|
+
}
|
|
37
|
+
return app;
|
|
38
|
+
}
|
|
@@ -37,3 +37,4 @@ export declare class HttpRequestError extends Error {
|
|
|
37
37
|
readonly status: RuntimeStatus;
|
|
38
38
|
constructor(code: string, message: string, status?: RuntimeStatus);
|
|
39
39
|
}
|
|
40
|
+
export declare function readConnectionName(context: Context, body?: Record<string, unknown>): string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { optionalString } from "../../core/cast.js";
|
|
1
2
|
/**
|
|
2
3
|
* Read an optional JSON object request body.
|
|
3
4
|
*
|
|
@@ -91,3 +92,10 @@ export class HttpRequestError extends Error {
|
|
|
91
92
|
this.status = status;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
95
|
+
export function readConnectionName(context, body) {
|
|
96
|
+
return (optionalString(body?.connectionName) ??
|
|
97
|
+
optionalString(body?.alias) ??
|
|
98
|
+
optionalString(context.req.header("x-oo-connector-alias")) ??
|
|
99
|
+
optionalString(context.req.query("connectionName")) ??
|
|
100
|
+
optionalString(context.req.query("alias")));
|
|
101
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MarketplaceService } from "../../marketplace/marketplace-service.ts";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
export interface MarketplaceRoutesOptions {
|
|
4
|
+
marketplace: MarketplaceService;
|
|
5
|
+
}
|
|
6
|
+
/** Marketplace configuration and provider preference routes. */
|
|
7
|
+
export declare function createMarketplaceRoutes({ marketplace }: MarketplaceRoutesOptions): Hono;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { optionalString } from "../../core/cast.js";
|
|
3
|
+
import { MarketplaceError } from "../../marketplace/marketplace-service.js";
|
|
4
|
+
import { jsonError, readJsonBody } from "./http-utils.js";
|
|
5
|
+
function writeMarketplaceError(context, error) {
|
|
6
|
+
const status = error.status;
|
|
7
|
+
return jsonError(context, status === 401 || status === 403 || status === 404 || status === 502 || status === 504 ? status : 400, error.code, error.message);
|
|
8
|
+
}
|
|
9
|
+
/** Marketplace configuration and provider preference routes. */
|
|
10
|
+
export function createMarketplaceRoutes({ marketplace }) {
|
|
11
|
+
const app = new Hono();
|
|
12
|
+
app.get("/marketplace", (context) => context.json(marketplace.getState()));
|
|
13
|
+
app.get("/marketplace/discovery", async (context) => {
|
|
14
|
+
try {
|
|
15
|
+
return context.json(await marketplace.getDefaultDiscovery(context.req.raw.signal));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error instanceof MarketplaceError)
|
|
19
|
+
return writeMarketplaceError(context, error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const configureMarketplace = async (context) => {
|
|
24
|
+
const body = await readJsonBody(context);
|
|
25
|
+
const input = {
|
|
26
|
+
discoveryUrl: optionalString(body.discoveryUrl),
|
|
27
|
+
apiKey: optionalString(body.apiKey),
|
|
28
|
+
enabled: typeof body.enabled === "boolean" ? body.enabled : undefined,
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
return context.json(await marketplace.configure(input));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error instanceof MarketplaceError)
|
|
35
|
+
return writeMarketplaceError(context, error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
app.put("/marketplace", configureMarketplace);
|
|
40
|
+
app.patch("/marketplace", configureMarketplace);
|
|
41
|
+
app.delete("/marketplace", async (context) => {
|
|
42
|
+
await marketplace.remove();
|
|
43
|
+
return context.json(marketplace.getState());
|
|
44
|
+
});
|
|
45
|
+
app.get("/provider-preferences", async (context) => context.json(await marketplace.listProviderPreferences()));
|
|
46
|
+
app.patch("/provider-preferences/:service", async (context) => {
|
|
47
|
+
const service = context.req.param("service");
|
|
48
|
+
const body = await readJsonBody(context);
|
|
49
|
+
if (typeof body.enabled !== "boolean") {
|
|
50
|
+
return jsonError(context, 400, "invalid_input", "enabled must be a boolean.");
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
return context.json(await marketplace.setProviderEnabled(service, body.enabled));
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error instanceof MarketplaceError)
|
|
57
|
+
return jsonError(context, 404, error.code, error.message);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return app;
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CatalogStore } from "../../catalog-store.ts";
|
|
2
|
+
import type { ConnectionService } from "../../connection-service.ts";
|
|
3
|
+
import type { ActionPolicySnapshot } from "../../core/action-policy.ts";
|
|
4
|
+
import type { ActionSearchIndexProvider } from "../../core/action-search.ts";
|
|
5
|
+
import type { ActionRunner } from "../actions/action-runner.ts";
|
|
6
|
+
import type { Context } from "hono";
|
|
7
|
+
import { Hono } from "hono";
|
|
8
|
+
export type McpModule = typeof import("../../mcp.ts");
|
|
9
|
+
export declare function loadMcpModule(): Promise<McpModule>;
|
|
10
|
+
export interface McpRoutesOptions {
|
|
11
|
+
catalog: CatalogStore;
|
|
12
|
+
connections: ConnectionService;
|
|
13
|
+
actions: ActionRunner;
|
|
14
|
+
actionSearch: ActionSearchIndexProvider;
|
|
15
|
+
getPolicySnapshot: (context: Context) => Promise<ActionPolicySnapshot>;
|
|
16
|
+
}
|
|
17
|
+
/** MCP transport and tool discovery routes. */
|
|
18
|
+
export declare function createMcpRoutes({ catalog, connections, actions, actionSearch, getPolicySnapshot, }: McpRoutesOptions): Hono;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { PromiseCache } from "../../core/promise-cache.js";
|
|
3
|
+
import { readRuntimeGrant } from "./auth.js";
|
|
4
|
+
const mcpModule = new PromiseCache();
|
|
5
|
+
export function loadMcpModule() {
|
|
6
|
+
return mcpModule.get("", () => import("../../mcp.js"));
|
|
7
|
+
}
|
|
8
|
+
function rejectMcpMethod(context) {
|
|
9
|
+
return context.json({
|
|
10
|
+
jsonrpc: "2.0",
|
|
11
|
+
error: {
|
|
12
|
+
code: -32000,
|
|
13
|
+
message: "Method not allowed.",
|
|
14
|
+
},
|
|
15
|
+
id: null,
|
|
16
|
+
}, 405);
|
|
17
|
+
}
|
|
18
|
+
/** MCP transport and tool discovery routes. */
|
|
19
|
+
export function createMcpRoutes({ catalog, connections, actions, actionSearch, getPolicySnapshot, }) {
|
|
20
|
+
const app = new Hono();
|
|
21
|
+
app.post("/mcp", async (context) => {
|
|
22
|
+
const { handleMcpRequest } = await loadMcpModule();
|
|
23
|
+
return await handleMcpRequest(context.req.raw, {
|
|
24
|
+
catalog,
|
|
25
|
+
connections,
|
|
26
|
+
actions,
|
|
27
|
+
actionSearch,
|
|
28
|
+
getPolicySnapshot: () => getPolicySnapshot(context),
|
|
29
|
+
runtimeGrant: readRuntimeGrant(context),
|
|
30
|
+
signal: context.req.raw.signal,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
app.get("/mcp", (context) => rejectMcpMethod(context));
|
|
34
|
+
app.delete("/mcp", (context) => rejectMcpMethod(context));
|
|
35
|
+
app.get("/mcp/tools", async (context) => context.json({ tools: (await loadMcpModule()).listMcpToolSummaries() }));
|
|
36
|
+
return app;
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionPolicySnapshot } from "../../core/action-policy.ts";
|
|
2
|
+
import type { IRuntimePolicyStore } from "../storage/runtime-policy-store.ts";
|
|
3
|
+
import type { RuntimeTokenService } from "../storage/runtime-token-service.ts";
|
|
4
|
+
import type { Context } from "hono";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
export interface PolicyRoutesOptions {
|
|
7
|
+
runtimeTokens: RuntimeTokenService;
|
|
8
|
+
runtimePolicyStore: IRuntimePolicyStore;
|
|
9
|
+
deploymentPolicyRules: unknown;
|
|
10
|
+
getPolicySnapshot: (context: Context) => Promise<ActionPolicySnapshot>;
|
|
11
|
+
}
|
|
12
|
+
/** Runtime token management and runtime policy administration routes. */
|
|
13
|
+
export declare function createPolicyRoutes({ runtimeTokens, runtimePolicyStore, deploymentPolicyRules, getPolicySnapshot, }: PolicyRoutesOptions): Hono;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { optionalString } from "../../core/cast.js";
|
|
3
|
+
import { summarizeRuntimeToken } from "../storage/runtime-token-service.js";
|
|
4
|
+
import { jsonError, readJsonBody } from "./http-utils.js";
|
|
5
|
+
import { policyRequestMaxBytes, readRuntimePolicyRules, readTokenPolicy } from "./policy-input.js";
|
|
6
|
+
/** Runtime token management and runtime policy administration routes. */
|
|
7
|
+
export function createPolicyRoutes({ runtimeTokens, runtimePolicyStore, deploymentPolicyRules, getPolicySnapshot, }) {
|
|
8
|
+
const app = new Hono();
|
|
9
|
+
app.get("/runtime-tokens", async (context) => context.json(await runtimeTokens.listTokens()));
|
|
10
|
+
app.post("/runtime-tokens", async (context) => {
|
|
11
|
+
const body = await readJsonBody(context, policyRequestMaxBytes);
|
|
12
|
+
const name = optionalString(body.name);
|
|
13
|
+
if (!name) {
|
|
14
|
+
return jsonError(context, 400, "invalid_input", "name is required.");
|
|
15
|
+
}
|
|
16
|
+
const created = await runtimeTokens.createToken(name, readTokenPolicy(body, true));
|
|
17
|
+
return context.json({
|
|
18
|
+
token: created.token,
|
|
19
|
+
record: summarizeRuntimeToken(created.record),
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
app.put("/runtime-tokens/:id", async (context) => {
|
|
23
|
+
const id = context.req.param("id");
|
|
24
|
+
const body = await readJsonBody(context, policyRequestMaxBytes);
|
|
25
|
+
const token = await runtimeTokens.updateTokenPolicy(id, readTokenPolicy(body));
|
|
26
|
+
return token
|
|
27
|
+
? context.json(token)
|
|
28
|
+
: jsonError(context, 404, "runtime_token_not_found", `Runtime token not found: ${id}.`);
|
|
29
|
+
});
|
|
30
|
+
app.delete("/runtime-tokens/:id", async (context) => {
|
|
31
|
+
const id = context.req.param("id");
|
|
32
|
+
if (!(await runtimeTokens.revokeToken(id))) {
|
|
33
|
+
return jsonError(context, 404, "runtime_token_not_found", `Runtime token not found: ${id}.`);
|
|
34
|
+
}
|
|
35
|
+
return context.json({ id, revoked: true });
|
|
36
|
+
});
|
|
37
|
+
app.get("/runtime-policy", async (context) => context.json((await getPolicySnapshot(context)).state));
|
|
38
|
+
app.put("/runtime-policy", async (context) => {
|
|
39
|
+
const body = await readJsonBody(context, policyRequestMaxBytes);
|
|
40
|
+
const rules = readRuntimePolicyRules(body);
|
|
41
|
+
const updatedAt = new Date().toISOString();
|
|
42
|
+
await runtimePolicyStore.set({ rules, updatedAt });
|
|
43
|
+
return context.json({
|
|
44
|
+
deployment: deploymentPolicyRules,
|
|
45
|
+
runtime: rules,
|
|
46
|
+
updatedAt,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return app;
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ActionPolicyService, ActionPolicySnapshot } from "../../core/action-policy.ts";
|
|
2
|
+
import type { RuntimeLogger } from "../../core/types.ts";
|
|
3
|
+
import type { IRuntimePolicyStore } from "../storage/runtime-policy-store.ts";
|
|
4
|
+
import type { Context } from "hono";
|
|
5
|
+
export interface PolicySnapshotProviderOptions {
|
|
6
|
+
actionPolicy: ActionPolicyService;
|
|
7
|
+
runtimePolicyStore: IRuntimePolicyStore;
|
|
8
|
+
logger?: RuntimeLogger;
|
|
9
|
+
}
|
|
10
|
+
export type PolicySnapshotProvider = (context: Context) => Promise<ActionPolicySnapshot>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a request-scoped cached ActionPolicySnapshot provider backed by a WeakMap.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPolicySnapshotProvider({ actionPolicy, runtimePolicyStore, logger, }: PolicySnapshotProviderOptions): PolicySnapshotProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { emptyPolicyRules } from "../../core/action-policy.js";
|
|
2
|
+
import { readRuntimeGrant } from "./auth.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a request-scoped cached ActionPolicySnapshot provider backed by a WeakMap.
|
|
5
|
+
*/
|
|
6
|
+
export function createPolicySnapshotProvider({ actionPolicy, runtimePolicyStore, logger, }) {
|
|
7
|
+
const policySnapshots = new WeakMap();
|
|
8
|
+
async function loadPolicySnapshot(context) {
|
|
9
|
+
try {
|
|
10
|
+
const record = await runtimePolicyStore.get();
|
|
11
|
+
return actionPolicy.createSnapshot(record?.rules ?? emptyPolicyRules(), readRuntimeGrant(context), record?.updatedAt);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
logger?.error({
|
|
15
|
+
method: context.req.method,
|
|
16
|
+
path: context.req.path,
|
|
17
|
+
}, "runtime policy load failed");
|
|
18
|
+
throw new Error("Runtime policy is unavailable.");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return (context) => {
|
|
22
|
+
const request = context.req.raw;
|
|
23
|
+
let snapshot = policySnapshots.get(request);
|
|
24
|
+
if (!snapshot) {
|
|
25
|
+
snapshot = loadPolicySnapshot(context);
|
|
26
|
+
policySnapshots.set(request, snapshot);
|
|
27
|
+
}
|
|
28
|
+
return snapshot;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ActionRunner } from "../actions/action-runner.ts";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
export interface RunLogRoutesOptions {
|
|
4
|
+
actions: ActionRunner;
|
|
5
|
+
}
|
|
6
|
+
/** Action execution run log query and inspection routes. */
|
|
7
|
+
export declare function createRunLogRoutes({ actions }: RunLogRoutesOptions): Hono;
|