@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compactObject, optionalInteger, optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
|
-
import { createProviderTimeout, ProviderRequestError, providerUserAgent, toProviderExecutionError, } from "../provider-runtime.js";
|
|
2
|
+
import { createProviderTimeout, ProviderRequestError, providerUserAgent, toProviderExecutionError, providerInputError, } from "../provider-runtime.js";
|
|
3
3
|
export const youzanApiBaseUrl = "https://open.youzanyun.com";
|
|
4
4
|
const youzanTokenUrl = `${youzanApiBaseUrl}/auth/token`;
|
|
5
5
|
export async function validateYouzanCredential(values, fetcher, signal) {
|
|
@@ -22,10 +22,10 @@ export function resolveYouzanCredential(input) {
|
|
|
22
22
|
const clientSecret = optionalString(input.clientSecret);
|
|
23
23
|
const grantId = optionalString(input.grantId);
|
|
24
24
|
if (!clientId || !clientSecret || !grantId) {
|
|
25
|
-
throw
|
|
25
|
+
throw providerInputError("youzan clientId, clientSecret, and grantId are required");
|
|
26
26
|
}
|
|
27
27
|
if ([...grantId].some((character) => character < "0" || character > "9")) {
|
|
28
|
-
throw
|
|
28
|
+
throw providerInputError("youzan grantId must contain only digits");
|
|
29
29
|
}
|
|
30
30
|
return { clientId, clientSecret, grantId };
|
|
31
31
|
}
|
|
@@ -202,7 +202,7 @@ export const youzanActionHandlers = {
|
|
|
202
202
|
function validatePageWindow(input, defaultPageSize, maximum) {
|
|
203
203
|
const page = optionalInteger(input.page) ?? 1;
|
|
204
204
|
if (page * (optionalInteger(input.pageSize) ?? defaultPageSize) > maximum) {
|
|
205
|
-
throw
|
|
205
|
+
throw providerInputError(`page multiplied by pageSize cannot exceed ${maximum}`);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
function validateOrderTimePairs(input) {
|
|
@@ -212,7 +212,7 @@ function validateOrderTimePairs(input) {
|
|
|
212
212
|
["completedAfter", "completedBefore"],
|
|
213
213
|
]) {
|
|
214
214
|
if ((input[after] !== undefined) !== (input[before] !== undefined)) {
|
|
215
|
-
throw
|
|
215
|
+
throw providerInputError(`${after} and ${before} must be provided together`);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -233,7 +233,7 @@ async function requestYouzanApi(api, version, body, context) {
|
|
|
233
233
|
throw createYouzanApiError(response.status, payload);
|
|
234
234
|
}
|
|
235
235
|
if (payload.data === undefined || payload.data === null) {
|
|
236
|
-
throw
|
|
236
|
+
throw new ProviderRequestError(502, "Youzan returned an invalid data payload", undefined, "provider_error");
|
|
237
237
|
}
|
|
238
238
|
return payload.data;
|
|
239
239
|
}
|
|
@@ -249,19 +249,19 @@ async function fetchYouzanJson(url, init, fetcher, parentSignal) {
|
|
|
249
249
|
parsed = JSON.parse(text);
|
|
250
250
|
}
|
|
251
251
|
catch {
|
|
252
|
-
throw
|
|
252
|
+
throw new ProviderRequestError(502, "Youzan returned invalid JSON", undefined, "provider_error");
|
|
253
253
|
}
|
|
254
254
|
const payload = optionalRecord(parsed);
|
|
255
255
|
if (!payload)
|
|
256
|
-
throw
|
|
256
|
+
throw new ProviderRequestError(502, "Youzan returned invalid JSON", undefined, "provider_error");
|
|
257
257
|
return { response, payload };
|
|
258
258
|
}
|
|
259
259
|
catch (error) {
|
|
260
260
|
if (error instanceof ProviderRequestError)
|
|
261
261
|
throw error;
|
|
262
262
|
if (timeout.didTimeout())
|
|
263
|
-
throw
|
|
264
|
-
throw
|
|
263
|
+
throw new ProviderRequestError(504, "Youzan request timed out", undefined, "provider_error");
|
|
264
|
+
throw new ProviderRequestError(502, error instanceof Error ? `Youzan request failed: ${error.message}` : "Youzan request failed", undefined, "provider_error");
|
|
265
265
|
}
|
|
266
266
|
finally {
|
|
267
267
|
timeout.cleanup();
|
|
@@ -270,21 +270,21 @@ async function fetchYouzanJson(url, init, fetcher, parentSignal) {
|
|
|
270
270
|
function createYouzanTokenError(status, payload, phase) {
|
|
271
271
|
const message = readYouzanMessage(payload, "Youzan rejected the application credentials");
|
|
272
272
|
if (status === 429)
|
|
273
|
-
return
|
|
273
|
+
return new ProviderRequestError(429, message, payload, "rate_limited");
|
|
274
274
|
if (status >= 500)
|
|
275
|
-
return
|
|
275
|
+
return new ProviderRequestError(502, message, payload, "provider_error");
|
|
276
276
|
return phase === "validate"
|
|
277
|
-
?
|
|
278
|
-
:
|
|
277
|
+
? new ProviderRequestError(400, message, payload, "invalid_input")
|
|
278
|
+
: new ProviderRequestError(401, message, payload, "authorization_failed");
|
|
279
279
|
}
|
|
280
280
|
function createYouzanApiError(status, payload) {
|
|
281
281
|
const message = readYouzanMessage(payload, "Youzan API request failed");
|
|
282
282
|
if (status === 429)
|
|
283
|
-
return
|
|
283
|
+
return new ProviderRequestError(429, message, payload, "rate_limited");
|
|
284
284
|
if (status === 401 || status === 403 || payload.code === 40010) {
|
|
285
|
-
return
|
|
285
|
+
return new ProviderRequestError(401, message, payload, "authorization_failed");
|
|
286
286
|
}
|
|
287
|
-
return
|
|
287
|
+
return new ProviderRequestError(502, message, payload, "provider_error");
|
|
288
288
|
}
|
|
289
289
|
function readYouzanMessage(payload, fallback) {
|
|
290
290
|
return optionalString(payload.message) ?? optionalString(payload.msg) ?? fallback;
|
|
@@ -292,24 +292,21 @@ function readYouzanMessage(payload, fallback) {
|
|
|
292
292
|
function requireObject(value, label) {
|
|
293
293
|
const object = optionalRecord(value);
|
|
294
294
|
if (!object)
|
|
295
|
-
throw
|
|
295
|
+
throw new ProviderRequestError(502, `${label} payload is invalid`, undefined, "provider_error");
|
|
296
296
|
return object;
|
|
297
297
|
}
|
|
298
298
|
function requireObjectArray(value, label) {
|
|
299
299
|
if (!Array.isArray(value))
|
|
300
|
-
throw
|
|
300
|
+
throw new ProviderRequestError(502, `${label} payload is invalid`, undefined, "provider_error");
|
|
301
301
|
const objects = value.map(optionalRecord);
|
|
302
302
|
if (objects.some((item) => item === undefined)) {
|
|
303
|
-
throw
|
|
303
|
+
throw new ProviderRequestError(502, `${label} payload is invalid`, undefined, "provider_error");
|
|
304
304
|
}
|
|
305
305
|
return objects;
|
|
306
306
|
}
|
|
307
307
|
function requireNonNegativeInteger(value, label) {
|
|
308
308
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
309
|
-
throw
|
|
309
|
+
throw new ProviderRequestError(502, `${label} payload is invalid`, undefined, "provider_error");
|
|
310
310
|
}
|
|
311
311
|
return value;
|
|
312
312
|
}
|
|
313
|
-
function youzanError(code, message, status, details) {
|
|
314
|
-
return new ProviderRequestError(status, message, details, code);
|
|
315
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { optionalRecord, optionalString } from "../../core/cast.js";
|
|
1
|
+
import { booleanString, optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
2
|
import { ProviderRequestError, providerUserAgent, requiredInputString, requiredResponseRecord, runProviderRequest, } from "../provider-runtime.js";
|
|
3
3
|
export const zenkitApiBaseUrl = "https://base.zenkit.com/api/v1";
|
|
4
4
|
const zenkitValidationPath = "/auth/currentuser";
|
|
@@ -57,7 +57,7 @@ async function listWorkspacesAndLists(context) {
|
|
|
57
57
|
phase: "execute",
|
|
58
58
|
});
|
|
59
59
|
if (!Array.isArray(payload)) {
|
|
60
|
-
throw
|
|
60
|
+
throw new ProviderRequestError(502, "Zenkit workspaces response must be an array", undefined, "provider_error");
|
|
61
61
|
}
|
|
62
62
|
return { workspaces: payload };
|
|
63
63
|
}
|
|
@@ -90,10 +90,10 @@ async function searchEntries(input, context) {
|
|
|
90
90
|
limit: stringifyOptionalNumber(input.limit),
|
|
91
91
|
preferredListIds: stringifyOptionalArray(input.preferredListIds),
|
|
92
92
|
excludeListEntryUUIDs: stringifyOptionalArray(input.excludeEntryUuids),
|
|
93
|
-
searchInArchive:
|
|
94
|
-
includeRelatedLists:
|
|
95
|
-
includeRelatedWorkspaces:
|
|
96
|
-
includeRelatedListElements:
|
|
93
|
+
searchInArchive: booleanString(input.searchInArchive),
|
|
94
|
+
includeRelatedLists: booleanString(input.includeRelatedLists),
|
|
95
|
+
includeRelatedWorkspaces: booleanString(input.includeRelatedWorkspaces),
|
|
96
|
+
includeRelatedListElements: booleanString(input.includeRelatedListElements),
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
99
|
return { results: requiredResponseRecord(payload, "Zenkit entry search response") };
|
|
@@ -181,21 +181,21 @@ async function readZenkitPayload(response) {
|
|
|
181
181
|
if (!response.ok) {
|
|
182
182
|
return { message: text.trim().slice(0, 500) };
|
|
183
183
|
}
|
|
184
|
-
throw
|
|
184
|
+
throw new ProviderRequestError(502, "Zenkit returned invalid JSON", undefined, "provider_error");
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
function mapZenkitError(status, payload, phase) {
|
|
188
188
|
const message = readZenkitErrorMessage(payload) ?? `Zenkit request failed with status ${status}`;
|
|
189
189
|
if (status === 429) {
|
|
190
|
-
return
|
|
190
|
+
return new ProviderRequestError(429, message, undefined, "rate_limited");
|
|
191
191
|
}
|
|
192
192
|
if (phase === "validate" && status >= 400 && status < 500) {
|
|
193
|
-
return
|
|
193
|
+
return new ProviderRequestError(400, message, undefined, "invalid_input");
|
|
194
194
|
}
|
|
195
195
|
if (status === 400 || status === 404 || status === 409 || status === 422) {
|
|
196
|
-
return
|
|
196
|
+
return new ProviderRequestError(status === 404 ? 404 : 400, message, undefined, "invalid_input");
|
|
197
197
|
}
|
|
198
|
-
return
|
|
198
|
+
return new ProviderRequestError(status || 502, message, undefined, "provider_error");
|
|
199
199
|
}
|
|
200
200
|
function readZenkitErrorMessage(payload) {
|
|
201
201
|
const body = optionalRecord(payload);
|
|
@@ -213,26 +213,20 @@ function requireAllId(value, fieldName) {
|
|
|
213
213
|
}
|
|
214
214
|
function requirePositiveInteger(value, fieldName) {
|
|
215
215
|
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
216
|
-
throw
|
|
216
|
+
throw new ProviderRequestError(400, `${fieldName} must be a positive integer`, undefined, "invalid_input");
|
|
217
217
|
}
|
|
218
218
|
return value;
|
|
219
219
|
}
|
|
220
220
|
function requireInputObject(value, fieldName) {
|
|
221
221
|
const object = optionalRecord(value);
|
|
222
222
|
if (!object) {
|
|
223
|
-
throw
|
|
223
|
+
throw new ProviderRequestError(400, `${fieldName} must be an object`, undefined, "invalid_input");
|
|
224
224
|
}
|
|
225
225
|
return object;
|
|
226
226
|
}
|
|
227
227
|
function stringifyOptionalNumber(value) {
|
|
228
228
|
return typeof value === "number" ? String(value) : undefined;
|
|
229
229
|
}
|
|
230
|
-
function stringifyOptionalBoolean(value) {
|
|
231
|
-
return typeof value === "boolean" ? String(value) : undefined;
|
|
232
|
-
}
|
|
233
230
|
function stringifyOptionalArray(value) {
|
|
234
231
|
return Array.isArray(value) ? value.join(",") : undefined;
|
|
235
232
|
}
|
|
236
|
-
function providerError(code, message, status) {
|
|
237
|
-
return new ProviderRequestError(status, message, undefined, code);
|
|
238
|
-
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsonSchema as s } from "../../core/json-schema.js";
|
|
2
|
+
import { defineProviderAction } from "../../core/provider-definition.js";
|
|
3
|
+
const bidFields = {
|
|
4
|
+
bid_id: s.integer("The notice ID."),
|
|
5
|
+
title: s.string("The notice title."),
|
|
6
|
+
bid_type: s.string("The notice type returned by the provider, such as 招标 or 中标."),
|
|
7
|
+
bid_process: s.string("The procurement stage name."),
|
|
8
|
+
pub_time: s.string("The publication time as returned by the provider."),
|
|
9
|
+
money: s.nullable(s.number("The amount in CNY.")),
|
|
10
|
+
money_wan: s.nullable(s.number("The amount in ten thousand CNY.")),
|
|
11
|
+
province: s.string("The province name."),
|
|
12
|
+
city: s.string("The city name."),
|
|
13
|
+
county: s.string("The county or district name."),
|
|
14
|
+
caller_name: s.string("The purchaser name."),
|
|
15
|
+
winner_names: s.array("Winning suppliers.", s.string("A supplier name.")),
|
|
16
|
+
url: s.string("The notice URL on Zhiliao Biaoxun."),
|
|
17
|
+
};
|
|
18
|
+
const meta = s.looseObject("Request and billing metadata.", {
|
|
19
|
+
request_id: s.string("The upstream request ID."),
|
|
20
|
+
tool_name: s.string("The upstream tool name."),
|
|
21
|
+
cost_units: s.number("Credits charged for this request."),
|
|
22
|
+
execution_time_ms: s.number("Upstream execution time in milliseconds."),
|
|
23
|
+
});
|
|
24
|
+
function output(data) {
|
|
25
|
+
return s.looseRequiredObject("The successful upstream response, including billing metadata.", {
|
|
26
|
+
success: s.literal(true, { description: "Whether the request succeeded." }),
|
|
27
|
+
data,
|
|
28
|
+
error: s.nullable(s.looseObject("Upstream error information; null on success.", {})),
|
|
29
|
+
meta,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const bidList = s.looseObject("Matching procurement notices.", {
|
|
33
|
+
total: s.integer("The total number of matching notices."),
|
|
34
|
+
returned: s.integer("The number of notices returned on this page."),
|
|
35
|
+
items: s.array("Notices on this page.", s.looseObject("A procurement notice.", bidFields)),
|
|
36
|
+
});
|
|
37
|
+
const identity = {
|
|
38
|
+
bid_id: s.integer("The notice ID; pair it with bid_type."),
|
|
39
|
+
bid_type: s.integer("The notice type: 1 for tenders, 2 for awards.", { minimum: 1, maximum: 2 }),
|
|
40
|
+
bid_url: s.nonWhitespaceString("The notice URL; forwarded to the provider without downloading it."),
|
|
41
|
+
};
|
|
42
|
+
export const zhiliaobiaoxunActions = [
|
|
43
|
+
defineProviderAction("zhiliaobiaoxun", {
|
|
44
|
+
name: "search_bids",
|
|
45
|
+
operationType: "read",
|
|
46
|
+
requiredScopes: [],
|
|
47
|
+
description: "Search Chinese tender and award notices by keywords, region, publication date, or amount. Returns one page per call and charges provider credits. Increase page to continue.",
|
|
48
|
+
inputSchema: s.object("Notice search filters.", {
|
|
49
|
+
keywords: s.array("Search keywords.", s.nonWhitespaceString("A search keyword."), {
|
|
50
|
+
minItems: 1,
|
|
51
|
+
}),
|
|
52
|
+
match_modes: s.array("Fields in which to match keywords; omit for provider defaults.", s.stringEnum("A keyword matching mode.", [
|
|
53
|
+
"all",
|
|
54
|
+
"sm",
|
|
55
|
+
"title",
|
|
56
|
+
"brand",
|
|
57
|
+
"fulltext",
|
|
58
|
+
"caller",
|
|
59
|
+
"winner",
|
|
60
|
+
"winner_tender",
|
|
61
|
+
"tender",
|
|
62
|
+
"agency",
|
|
63
|
+
])),
|
|
64
|
+
bid_type: s.stringEnum("Notice category: 招标 for tenders, 中标 for awards, 全部 for both.", [
|
|
65
|
+
"招标",
|
|
66
|
+
"中标",
|
|
67
|
+
"全部",
|
|
68
|
+
]),
|
|
69
|
+
bid_process: s.array("Procurement stages: 1 intent, 2 pre-tender, 4 tender, 5 amendment, 6 award candidates, 7 award, 8 contract, 9 acceptance, 10 cancellation. Default: [1,2,4,7,8].", s.integer("A procurement stage ID.")),
|
|
70
|
+
begin_date: s.string("Inclusive publication start date, YYYY-MM-DD.", { format: "date" }),
|
|
71
|
+
end_date: s.string("Inclusive publication end date, YYYY-MM-DD.", { format: "date" }),
|
|
72
|
+
provinces: s.array("Province names, such as 北京 or 内蒙古.", s.nonWhitespaceString("A province name.")),
|
|
73
|
+
cities: s.array("City names, such as 石家庄 or 合肥.", s.nonWhitespaceString("A city name.")),
|
|
74
|
+
counties: s.array("County or district names, such as 长安区.", s.nonWhitespaceString("A county or district name.")),
|
|
75
|
+
min_amount: s.number("Minimum amount in ten thousand CNY."),
|
|
76
|
+
max_amount: s.number("Maximum amount in ten thousand CNY."),
|
|
77
|
+
page: s.integer("Page number, starting at 1; defaults to 1.", { minimum: 1, default: 1 }),
|
|
78
|
+
page_size: s.integer("Notices per page; defaults to 20.", { minimum: 1, default: 20 }),
|
|
79
|
+
}, { required: ["keywords"] }),
|
|
80
|
+
outputSchema: output(bidList),
|
|
81
|
+
}),
|
|
82
|
+
defineProviderAction("zhiliaobiaoxun", {
|
|
83
|
+
name: "get_bid_detail",
|
|
84
|
+
operationType: "read",
|
|
85
|
+
requiredScopes: [],
|
|
86
|
+
description: "Read a procurement notice with its full text and attachment links. Supply a notice URL, unique key, or notice ID. Charges provider credits; attachments are returned as URLs.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
...s.object("Notice identifiers; supply at least one locator.", {
|
|
89
|
+
...identity,
|
|
90
|
+
uniq_key: s.nonWhitespaceString("The provider's unique notice key."),
|
|
91
|
+
}, { required: [] }),
|
|
92
|
+
anyOf: [{ required: ["bid_id"] }, { required: ["bid_url"] }, { required: ["uniq_key"] }],
|
|
93
|
+
},
|
|
94
|
+
outputSchema: output(s.looseObject("Notice details, preserving additional provider fields.", {
|
|
95
|
+
...bidFields,
|
|
96
|
+
uniq_key: s.string("The provider's unique notice key."),
|
|
97
|
+
source: s.string("The notice body."),
|
|
98
|
+
source_ext: s.string("Extracted attachment content."),
|
|
99
|
+
source_url: s.string("The original publication URL."),
|
|
100
|
+
attachment_urls: s.array("Attachment URLs; no files are downloaded by this action.", s.string("An attachment URL.")),
|
|
101
|
+
contact_privacy: s.string("Provider contact visibility: full or masked, depending on the account."),
|
|
102
|
+
})),
|
|
103
|
+
}),
|
|
104
|
+
defineProviderAction("zhiliaobiaoxun", {
|
|
105
|
+
name: "get_bid_timeline",
|
|
106
|
+
operationType: "read",
|
|
107
|
+
requiredScopes: [],
|
|
108
|
+
description: "Retrieve notices for every stage of the same procurement project, ordered by publication time ascending. Supply a notice URL or a notice ID with its type. Charges provider credits.",
|
|
109
|
+
inputSchema: {
|
|
110
|
+
...s.object("A notice identifying the procurement project.", {
|
|
111
|
+
...identity,
|
|
112
|
+
bid_type: {
|
|
113
|
+
type: ["integer", "string"],
|
|
114
|
+
enum: [1, 2, "1", "2"],
|
|
115
|
+
description: "The notice type: 1 for tenders, 2 for awards; numeric strings are accepted.",
|
|
116
|
+
},
|
|
117
|
+
}, { required: [] }),
|
|
118
|
+
anyOf: [{ required: ["bid_url"] }, { required: ["bid_id", "bid_type"] }],
|
|
119
|
+
},
|
|
120
|
+
outputSchema: output(s.looseObject("The project timeline.", {
|
|
121
|
+
total: s.integer("The number of notices across project stages."),
|
|
122
|
+
items: s.array("Project notices ordered by publication time ascending.", s.looseObject("A procurement notice.", bidFields)),
|
|
123
|
+
})),
|
|
124
|
+
}),
|
|
125
|
+
defineProviderAction("zhiliaobiaoxun", {
|
|
126
|
+
name: "get_account_balance",
|
|
127
|
+
operationType: "read",
|
|
128
|
+
requiredScopes: [],
|
|
129
|
+
description: "Read available credits and cumulative charged and consumed credits for the connected account. This endpoint does not consume credits.",
|
|
130
|
+
inputSchema: s.requiredObject("No input parameters are required.", {}),
|
|
131
|
+
outputSchema: output(s.looseObject("Account credit balance.", {
|
|
132
|
+
user_id: s.integer("The account ID associated with the API key."),
|
|
133
|
+
balance: s.number("Available credits."),
|
|
134
|
+
total_charged: s.number("Cumulative credits added to the account."),
|
|
135
|
+
total_consumed: s.number("Cumulative credits consumed."),
|
|
136
|
+
})),
|
|
137
|
+
}),
|
|
138
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CredentialValidators, ProviderExecutors, ProviderProxyExecutor } from "../../core/types.ts";
|
|
2
|
+
export declare const executors: ProviderExecutors;
|
|
3
|
+
export declare const credentialValidators: CredentialValidators;
|
|
4
|
+
export declare const proxy: ProviderProxyExecutor;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { optionalRecord, optionalRawString, optionalNumber } from "../../core/cast.js";
|
|
2
|
+
import { requiredInputString, requiredResponseRecord, ProviderRequestError, runProviderRequest, defineApiKeyProviderExecutors, defineProviderProxy, mapProviderActionHandlers, readProviderProxyErrorMessage, withRetryAfterSeconds, } from "../provider-runtime.js";
|
|
3
|
+
import { zhiliaobiaoxunActions } from "./actions.js";
|
|
4
|
+
const baseUrl = "https://mcp-server.zhiliaobiaoxun.com/api_v2";
|
|
5
|
+
const defaultHeaders = { accept: "application/json", "content-type": "application/json" };
|
|
6
|
+
async function request({ actionName, body, apiKey, fetcher, parentSignal }) {
|
|
7
|
+
return runProviderRequest({ signal: parentSignal, label: "Zhiliao Biaoxun" }, async (signal) => {
|
|
8
|
+
const isBalance = actionName === "get_account_balance";
|
|
9
|
+
const response = await fetcher(`${baseUrl}/${isBalance ? "account/balance" : actionName}`, {
|
|
10
|
+
method: isBalance ? "GET" : "POST",
|
|
11
|
+
headers: { ...defaultHeaders, "X-API-Key": apiKey },
|
|
12
|
+
signal,
|
|
13
|
+
body: isBalance ? undefined : JSON.stringify(body),
|
|
14
|
+
});
|
|
15
|
+
const text = await response.text();
|
|
16
|
+
let payload;
|
|
17
|
+
try {
|
|
18
|
+
payload = JSON.parse(text);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
payload = undefined;
|
|
22
|
+
}
|
|
23
|
+
const envelope = optionalRecord(payload);
|
|
24
|
+
if (!response.ok || envelope?.success !== true) {
|
|
25
|
+
const error = optionalRecord(envelope?.error);
|
|
26
|
+
const code = optionalRawString(error?.code);
|
|
27
|
+
const message = optionalRawString(error?.message) || `HTTP ${response.status}; invalid or unsuccessful response`;
|
|
28
|
+
const detail = [code, message].filter(Boolean).join(": ").split(apiKey).join("[REDACTED]");
|
|
29
|
+
const limited = response.status === 429 || code === "RATE_LIMITED";
|
|
30
|
+
throw new ProviderRequestError(response.ok ? (limited ? 429 : 502) : response.status, `Zhiliao Biaoxun request failed: ${detail}`, undefined, limited ? "rate_limited" : "provider_error");
|
|
31
|
+
}
|
|
32
|
+
return envelope;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const handlers = mapProviderActionHandlers("zhiliaobiaoxun", zhiliaobiaoxunActions, (action) => async (dataInput, context) => {
|
|
36
|
+
return request({
|
|
37
|
+
actionName: action.name,
|
|
38
|
+
body: dataInput,
|
|
39
|
+
apiKey: context.apiKey,
|
|
40
|
+
fetcher: context.fetcher,
|
|
41
|
+
parentSignal: context.signal,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
export const executors = defineApiKeyProviderExecutors("zhiliaobiaoxun", handlers, {
|
|
45
|
+
skipDnsValidation: true,
|
|
46
|
+
});
|
|
47
|
+
export const credentialValidators = {
|
|
48
|
+
async apiKey(input, { fetcher, signal }) {
|
|
49
|
+
const response = await request({
|
|
50
|
+
actionName: "get_account_balance",
|
|
51
|
+
body: {},
|
|
52
|
+
apiKey: requiredInputString(input.apiKey, "API Key"),
|
|
53
|
+
fetcher: fetcher,
|
|
54
|
+
parentSignal: signal,
|
|
55
|
+
});
|
|
56
|
+
const data = requiredResponseRecord(response.data, "Zhiliao Biaoxun account data");
|
|
57
|
+
const userId = optionalNumber(data.user_id);
|
|
58
|
+
return {
|
|
59
|
+
profile: { displayName: userId == null ? "Zhiliao Biaoxun API Key" : `Zhiliao Biaoxun ${userId}` },
|
|
60
|
+
grantedScopes: [],
|
|
61
|
+
metadata: {},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export const proxy = defineProviderProxy({
|
|
66
|
+
service: "zhiliaobiaoxun",
|
|
67
|
+
baseUrl,
|
|
68
|
+
auth: { type: "api_key_header", name: "X-API-Key" },
|
|
69
|
+
skipDnsValidation: true,
|
|
70
|
+
customizeRequest({ headers }) {
|
|
71
|
+
for (const [name, value] of Object.entries({ accept: "application/json", "content-type": "application/json" }))
|
|
72
|
+
if (!headers.has(name))
|
|
73
|
+
headers.set(name, value);
|
|
74
|
+
},
|
|
75
|
+
async readError(response) {
|
|
76
|
+
return new ProviderRequestError(response.status, await readProviderProxyErrorMessage(response, "Provider request failed"), withRetryAfterSeconds(response), response.status === 429 ? "rate_limited" : "provider_error");
|
|
77
|
+
},
|
|
78
|
+
});
|
package/src/server/api/auth.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type { Context, MiddlewareHandler } from "hono";
|
|
|
7
7
|
export interface LocalAuthOptions {
|
|
8
8
|
adminToken?: string;
|
|
9
9
|
runtimeToken?: string;
|
|
10
|
+
/** Keep runtime endpoints protected even when the last stored token is revoked. */
|
|
11
|
+
requireRuntimeAuth?: boolean;
|
|
10
12
|
hasRuntimeTokens?(): Promise<boolean>;
|
|
11
13
|
resolveRuntimeToken?(token: string): Promise<RuntimeGrant | undefined>;
|
|
12
14
|
verifyRuntimeJwt?: RuntimeJwtVerifier;
|
package/src/server/api/auth.js
CHANGED
|
@@ -20,6 +20,7 @@ export function createLocalAuthMiddleware(options) {
|
|
|
20
20
|
const runtimeToken = normalizeToken(options.runtimeToken);
|
|
21
21
|
if (!adminToken &&
|
|
22
22
|
!runtimeToken &&
|
|
23
|
+
!options.requireRuntimeAuth &&
|
|
23
24
|
!options.hasRuntimeTokens &&
|
|
24
25
|
!options.resolveRuntimeToken &&
|
|
25
26
|
!options.verifyRuntimeJwt) {
|
|
@@ -140,7 +141,7 @@ async function hasValidToken(context, options, scope) {
|
|
|
140
141
|
const hasRuntimeTokens = options.hasRuntimeTokens
|
|
141
142
|
? await options.hasRuntimeTokens()
|
|
142
143
|
: options.resolveRuntimeToken !== undefined;
|
|
143
|
-
if (!hasRuntimeTokens && !options.verifyRuntimeJwt) {
|
|
144
|
+
if (!options.requireRuntimeAuth && !hasRuntimeTokens && !options.verifyRuntimeJwt) {
|
|
144
145
|
return true;
|
|
145
146
|
}
|
|
146
147
|
return hasValidRuntimeToken(context, options);
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { ActionSearchDocument, ActionSearchIndexProvider } from "../../core/action-search.ts";
|
|
5
|
+
import type { Context } from "hono";
|
|
6
|
+
import { Hono } from "hono";
|
|
7
|
+
export interface ConsoleCatalogRoutesOptions {
|
|
8
|
+
catalog: CatalogStore;
|
|
9
|
+
connections: ConnectionService;
|
|
10
|
+
actionSearch: ActionSearchIndexProvider;
|
|
11
|
+
publicOrigin: string;
|
|
12
|
+
getPolicySnapshot: (context: Context) => Promise<ActionPolicySnapshot>;
|
|
13
|
+
readConnectionName?: (context: Context, body?: Record<string, unknown>) => string | undefined;
|
|
14
|
+
serializeSearchResults?: (results: ActionSearchDocument[]) => Promise<unknown[]>;
|
|
15
|
+
}
|
|
16
|
+
/** Console catalog, providers, actions and documentation routes. */
|
|
17
|
+
export declare function createConsoleCatalogRoutes({ catalog, connections, actionSearch, publicOrigin, getPolicySnapshot, readConnectionName, serializeSearchResults: injectedSerializeSearchResults, }: ConsoleCatalogRoutesOptions): Hono;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { ConnectionError } from "../../connection-service.js";
|
|
3
|
+
import { searchActions } from "../../core/action-search.js";
|
|
4
|
+
import { renderActionMarkdown } from "./action-markdown.js";
|
|
5
|
+
import { jsonError, notFound, readConnectionName as defaultReadConnectionName } from "./http-utils.js";
|
|
6
|
+
import { mapConnectionErrorStatus } from "./runtime-api.js";
|
|
7
|
+
import { readSearchQuery, serializeActionSearchResult } from "./runtime-catalog-routes.js";
|
|
8
|
+
function stripWeakPrefix(etag) {
|
|
9
|
+
return etag.startsWith("W/") ? etag.slice(2) : etag;
|
|
10
|
+
}
|
|
11
|
+
function requestMatchesEtag(ifNoneMatch, etag) {
|
|
12
|
+
if (!ifNoneMatch)
|
|
13
|
+
return false;
|
|
14
|
+
if (ifNoneMatch.trim() === "*")
|
|
15
|
+
return true;
|
|
16
|
+
const target = stripWeakPrefix(etag);
|
|
17
|
+
return ifNoneMatch.split(",").some((candidate) => stripWeakPrefix(candidate.trim()) === target);
|
|
18
|
+
}
|
|
19
|
+
/** Console catalog, providers, actions and documentation routes. */
|
|
20
|
+
export function createConsoleCatalogRoutes({ catalog, connections, actionSearch, publicOrigin, getPolicySnapshot, readConnectionName = defaultReadConnectionName, serializeSearchResults: injectedSerializeSearchResults, }) {
|
|
21
|
+
const app = new Hono();
|
|
22
|
+
const serializeSearchResults = injectedSerializeSearchResults ??
|
|
23
|
+
(async (results) => {
|
|
24
|
+
const authenticated = new Set(await connections.listAuthenticatedServices([...new Set(results.map((result) => result.service))]));
|
|
25
|
+
return results.flatMap((result) => {
|
|
26
|
+
const action = catalog.actionsById.get(result.id);
|
|
27
|
+
if (!action)
|
|
28
|
+
return [];
|
|
29
|
+
return [serializeActionSearchResult(result, action, authenticated.has(action.service))];
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
app.get("/providers", (context) => {
|
|
33
|
+
const { providerSummariesJson, providerSummariesEtag } = catalog;
|
|
34
|
+
context.header("ETag", providerSummariesEtag);
|
|
35
|
+
if (requestMatchesEtag(context.req.header("If-None-Match"), providerSummariesEtag)) {
|
|
36
|
+
return context.body(null, 304);
|
|
37
|
+
}
|
|
38
|
+
return context.body(providerSummariesJson, 200, { "Content-Type": "application/json" });
|
|
39
|
+
});
|
|
40
|
+
app.get("/providers/:service", (context) => {
|
|
41
|
+
const provider = catalog.providers.find((p) => p.service === context.req.param("service"));
|
|
42
|
+
if (!provider)
|
|
43
|
+
return notFound(context);
|
|
44
|
+
return context.json(provider);
|
|
45
|
+
});
|
|
46
|
+
app.get("/actions", (context) => context.json(catalog.actions));
|
|
47
|
+
app.get("/actions/search", async (context) => {
|
|
48
|
+
const query = readSearchQuery(context);
|
|
49
|
+
if (!query.ok) {
|
|
50
|
+
return jsonError(context, 400, "invalid_input", query.message);
|
|
51
|
+
}
|
|
52
|
+
const index = await actionSearch.get();
|
|
53
|
+
return context.json(await serializeSearchResults(searchActions(index, query.q, {
|
|
54
|
+
service: query.service,
|
|
55
|
+
limit: query.limit,
|
|
56
|
+
})));
|
|
57
|
+
});
|
|
58
|
+
app.get("/actions/:actionId/agent.md", async (context) => {
|
|
59
|
+
const actionId = context.req.param("actionId");
|
|
60
|
+
const action = catalog.actionsById.get(actionId);
|
|
61
|
+
if (!action)
|
|
62
|
+
return notFound(context);
|
|
63
|
+
try {
|
|
64
|
+
const policy = (await getPolicySnapshot(context)).evaluate(action);
|
|
65
|
+
return context.text(renderActionMarkdown(action, {
|
|
66
|
+
transport: { kind: "http", origin: publicOrigin },
|
|
67
|
+
connection: await connections.getConnectionSummary(action.service, readConnectionName(context)),
|
|
68
|
+
policy,
|
|
69
|
+
}), 200, {
|
|
70
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error instanceof ConnectionError) {
|
|
75
|
+
const status = mapConnectionErrorStatus(error);
|
|
76
|
+
return jsonError(context, status, error.code, error.message);
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
app.get("/actions/:actionId", (context) => {
|
|
82
|
+
const action = catalog.actionsById.get(context.req.param("actionId"));
|
|
83
|
+
if (!action)
|
|
84
|
+
return notFound(context);
|
|
85
|
+
return context.json(action);
|
|
86
|
+
});
|
|
87
|
+
return app;
|
|
88
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConnectionService } from "../../connection-service.ts";
|
|
2
|
+
import type { RuntimeLogger } from "../../core/types.ts";
|
|
3
|
+
import type { OAuthClientConfigService } from "../../oauth/oauth-client-config-service.ts";
|
|
4
|
+
import type { OAuthFlowService } from "../../oauth/oauth-flow-service.ts";
|
|
5
|
+
import type { SaasProjectService } from "../../saas/saas-project-service.ts";
|
|
6
|
+
import type { Context } from "hono";
|
|
7
|
+
import { Hono } from "hono";
|
|
8
|
+
export interface ConsoleOAuthRoutesOptions {
|
|
9
|
+
connections: ConnectionService;
|
|
10
|
+
oauthFlow: OAuthFlowService;
|
|
11
|
+
oauthClientConfigs: OAuthClientConfigService;
|
|
12
|
+
saasProject?: SaasProjectService;
|
|
13
|
+
logger?: RuntimeLogger;
|
|
14
|
+
oauthCloseDelaySeconds?: number;
|
|
15
|
+
readConnectionName?: (context: Context, body?: Record<string, unknown>) => string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** Console connection management and OAuth client configuration / authorization routes. */
|
|
18
|
+
export declare function createConsoleOAuthRoutes({ connections, oauthFlow, oauthClientConfigs, saasProject, logger, oauthCloseDelaySeconds, readConnectionName, }: ConsoleOAuthRoutesOptions): Hono;
|