@tencent-rtc/mcp 1.0.0

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.
Files changed (286) hide show
  1. package/@tencent/aegis-node-sdk/CHANGELOG.md +8 -0
  2. package/@tencent/aegis-node-sdk/LICENSE +21 -0
  3. package/@tencent/aegis-node-sdk/README.md +562 -0
  4. package/@tencent/aegis-node-sdk/lib/aegis.min.js +1 -0
  5. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +14 -0
  6. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +1 -0
  7. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +9 -0
  8. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +2 -0
  9. package/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +85 -0
  10. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +3 -0
  11. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +9 -0
  12. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +3 -0
  13. package/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +9 -0
  14. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +62 -0
  15. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +11 -0
  16. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +4 -0
  17. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +130 -0
  18. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +34 -0
  19. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +2 -0
  20. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +18 -0
  21. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +8 -0
  22. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +8 -0
  23. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +2 -0
  24. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +4 -0
  25. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +10 -0
  26. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +3 -0
  27. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +3 -0
  28. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +34 -0
  29. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +12 -0
  30. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +14 -0
  31. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +2 -0
  32. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +12 -0
  33. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +3 -0
  34. package/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +33 -0
  35. package/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts +0 -0
  36. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +2 -0
  37. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +18 -0
  38. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +60 -0
  39. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +15 -0
  40. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +5 -0
  41. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +6 -0
  42. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +18 -0
  43. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +12 -0
  44. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +10 -0
  45. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +20 -0
  46. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +27 -0
  47. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +2 -0
  48. package/@tencent/aegis-node-sdk/package.json +19 -0
  49. package/@tencent/polaris/README.md +407 -0
  50. package/@tencent/polaris/dist/consumer/health.d.ts +126 -0
  51. package/@tencent/polaris/dist/consumer/health.js +283 -0
  52. package/@tencent/polaris/dist/consumer/health.js.map +1 -0
  53. package/@tencent/polaris/dist/consumer/index.d.ts +120 -0
  54. package/@tencent/polaris/dist/consumer/index.js +348 -0
  55. package/@tencent/polaris/dist/consumer/index.js.map +1 -0
  56. package/@tencent/polaris/dist/consumer/monitor.d.ts +145 -0
  57. package/@tencent/polaris/dist/consumer/monitor.js +343 -0
  58. package/@tencent/polaris/dist/consumer/monitor.js.map +1 -0
  59. package/@tencent/polaris/dist/consumer/selector.d.ts +73 -0
  60. package/@tencent/polaris/dist/consumer/selector.js +316 -0
  61. package/@tencent/polaris/dist/consumer/selector.js.map +1 -0
  62. package/@tencent/polaris/dist/errors.d.ts +373 -0
  63. package/@tencent/polaris/dist/errors.js +154 -0
  64. package/@tencent/polaris/dist/errors.js.map +1 -0
  65. package/@tencent/polaris/dist/global.d.ts +16 -0
  66. package/@tencent/polaris/dist/global.js +18 -0
  67. package/@tencent/polaris/dist/global.js.map +1 -0
  68. package/@tencent/polaris/dist/index.d.ts +62 -0
  69. package/@tencent/polaris/dist/index.js +145 -0
  70. package/@tencent/polaris/dist/index.js.map +1 -0
  71. package/@tencent/polaris/dist/instance.d.ts +109 -0
  72. package/@tencent/polaris/dist/instance.js +38 -0
  73. package/@tencent/polaris/dist/instance.js.map +1 -0
  74. package/@tencent/polaris/dist/limiter/bucket.d.ts +51 -0
  75. package/@tencent/polaris/dist/limiter/bucket.js +152 -0
  76. package/@tencent/polaris/dist/limiter/bucket.js.map +1 -0
  77. package/@tencent/polaris/dist/limiter/index.d.ts +73 -0
  78. package/@tencent/polaris/dist/limiter/index.js +149 -0
  79. package/@tencent/polaris/dist/limiter/index.js.map +1 -0
  80. package/@tencent/polaris/dist/limiter/ratelimit.d.ts +27 -0
  81. package/@tencent/polaris/dist/limiter/ratelimit.js +134 -0
  82. package/@tencent/polaris/dist/limiter/ratelimit.js.map +1 -0
  83. package/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +17 -0
  84. package/@tencent/polaris/dist/limiter/ratelimiter/base.js +15 -0
  85. package/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +1 -0
  86. package/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +59 -0
  87. package/@tencent/polaris/dist/limiter/ratelimiter/global.js +397 -0
  88. package/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +1 -0
  89. package/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +3 -0
  90. package/@tencent/polaris/dist/limiter/ratelimiter/index.js +19 -0
  91. package/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +1 -0
  92. package/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +17 -0
  93. package/@tencent/polaris/dist/limiter/ratelimiter/local.js +52 -0
  94. package/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +1 -0
  95. package/@tencent/polaris/dist/location.d.ts +48 -0
  96. package/@tencent/polaris/dist/location.js +67 -0
  97. package/@tencent/polaris/dist/location.js.map +1 -0
  98. package/@tencent/polaris/dist/logging.d.ts +106 -0
  99. package/@tencent/polaris/dist/logging.js +130 -0
  100. package/@tencent/polaris/dist/logging.js.map +1 -0
  101. package/@tencent/polaris/dist/metadata.d.ts +78 -0
  102. package/@tencent/polaris/dist/metadata.js +119 -0
  103. package/@tencent/polaris/dist/metadata.js.map +1 -0
  104. package/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +47 -0
  105. package/@tencent/polaris/dist/plugins/breaker/polaris.js +162 -0
  106. package/@tencent/polaris/dist/plugins/breaker/polaris.js.map +1 -0
  107. package/@tencent/polaris/dist/plugins/lb/base.d.ts +24 -0
  108. package/@tencent/polaris/dist/plugins/lb/base.js +32 -0
  109. package/@tencent/polaris/dist/plugins/lb/base.js.map +1 -0
  110. package/@tencent/polaris/dist/plugins/lb/edf.d.ts +24 -0
  111. package/@tencent/polaris/dist/plugins/lb/edf.js +77 -0
  112. package/@tencent/polaris/dist/plugins/lb/edf.js.map +1 -0
  113. package/@tencent/polaris/dist/plugins/lb/hashring.d.ts +24 -0
  114. package/@tencent/polaris/dist/plugins/lb/hashring.js +53 -0
  115. package/@tencent/polaris/dist/plugins/lb/hashring.js.map +1 -0
  116. package/@tencent/polaris/dist/plugins/lb/sticky.d.ts +31 -0
  117. package/@tencent/polaris/dist/plugins/lb/sticky.js +88 -0
  118. package/@tencent/polaris/dist/plugins/lb/sticky.js.map +1 -0
  119. package/@tencent/polaris/dist/plugins/lb/swrr.d.ts +25 -0
  120. package/@tencent/polaris/dist/plugins/lb/swrr.js +72 -0
  121. package/@tencent/polaris/dist/plugins/lb/swrr.js.map +1 -0
  122. package/@tencent/polaris/dist/plugins/lb/wr.d.ts +17 -0
  123. package/@tencent/polaris/dist/plugins/lb/wr.js +50 -0
  124. package/@tencent/polaris/dist/plugins/lb/wr.js.map +1 -0
  125. package/@tencent/polaris/dist/plugins/lb/wrr.d.ts +19 -0
  126. package/@tencent/polaris/dist/plugins/lb/wrr.js +81 -0
  127. package/@tencent/polaris/dist/plugins/lb/wrr.js.map +1 -0
  128. package/@tencent/polaris/dist/plugins/logging/console.d.ts +10 -0
  129. package/@tencent/polaris/dist/plugins/logging/console.js +38 -0
  130. package/@tencent/polaris/dist/plugins/logging/console.js.map +1 -0
  131. package/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +32 -0
  132. package/@tencent/polaris/dist/plugins/naming/local-server/index.js +88 -0
  133. package/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +1 -0
  134. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +124 -0
  135. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +398 -0
  136. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +1 -0
  137. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +27 -0
  138. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +287 -0
  139. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +1 -0
  140. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +15 -0
  141. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +43 -0
  142. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +1 -0
  143. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +28 -0
  144. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +249 -0
  145. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +1 -0
  146. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +19 -0
  147. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +222 -0
  148. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +1 -0
  149. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +26 -0
  150. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +99 -0
  151. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +1 -0
  152. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +60 -0
  153. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +259 -0
  154. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +1 -0
  155. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +24 -0
  156. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +18 -0
  157. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +12 -0
  158. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +39 -0
  159. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +115 -0
  160. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +1 -0
  161. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +24 -0
  162. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +22 -0
  163. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +28 -0
  164. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +80 -0
  165. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +18 -0
  166. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +65 -0
  167. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +66 -0
  168. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +95 -0
  169. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +1568 -0
  170. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +36 -0
  171. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +51 -0
  172. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +1 -0
  173. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +18 -0
  174. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +67 -0
  175. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +82 -0
  176. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +11 -0
  177. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +46 -0
  178. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +16 -0
  179. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +10 -0
  180. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +1102 -0
  181. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +29 -0
  182. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +77 -0
  183. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +1 -0
  184. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +12 -0
  185. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +28 -0
  186. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +395 -0
  187. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +13 -0
  188. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +116 -0
  189. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +1 -0
  190. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +67 -0
  191. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +67 -0
  192. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +1 -0
  193. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +99 -0
  194. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +217 -0
  195. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +1 -0
  196. package/@tencent/polaris/dist/plugins/registry/memory.d.ts +10 -0
  197. package/@tencent/polaris/dist/plugins/registry/memory.js +50 -0
  198. package/@tencent/polaris/dist/plugins/registry/memory.js.map +1 -0
  199. package/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +51 -0
  200. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js +145 -0
  201. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +1 -0
  202. package/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +11 -0
  203. package/@tencent/polaris/dist/plugins/router/polaris/rule.js +174 -0
  204. package/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +1 -0
  205. package/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +25 -0
  206. package/@tencent/polaris/dist/plugins/router/trpc/canary.js +36 -0
  207. package/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +1 -0
  208. package/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +10 -0
  209. package/@tencent/polaris/dist/plugins/router/trpc/env.js +34 -0
  210. package/@tencent/polaris/dist/plugins/router/trpc/env.js.map +1 -0
  211. package/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +56 -0
  212. package/@tencent/polaris/dist/plugins/router/trpc/set.js +106 -0
  213. package/@tencent/polaris/dist/plugins/router/trpc/set.js.map +1 -0
  214. package/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +31 -0
  215. package/@tencent/polaris/dist/plugins/shaping/unirate.js +124 -0
  216. package/@tencent/polaris/dist/plugins/shaping/unirate.js.map +1 -0
  217. package/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +61 -0
  218. package/@tencent/polaris/dist/plugins/shaping/warmup.js +171 -0
  219. package/@tencent/polaris/dist/plugins/shaping/warmup.js.map +1 -0
  220. package/@tencent/polaris/dist/plugins/weight/polaris.d.ts +23 -0
  221. package/@tencent/polaris/dist/plugins/weight/polaris.js +159 -0
  222. package/@tencent/polaris/dist/plugins/weight/polaris.js.map +1 -0
  223. package/@tencent/polaris/dist/plugins.d.ts +619 -0
  224. package/@tencent/polaris/dist/plugins.js +91 -0
  225. package/@tencent/polaris/dist/plugins.js.map +1 -0
  226. package/@tencent/polaris/dist/polaris.d.ts +33 -0
  227. package/@tencent/polaris/dist/polaris.js +59 -0
  228. package/@tencent/polaris/dist/polaris.js.map +1 -0
  229. package/@tencent/polaris/dist/provider/index.d.ts +102 -0
  230. package/@tencent/polaris/dist/provider/index.js +168 -0
  231. package/@tencent/polaris/dist/provider/index.js.map +1 -0
  232. package/@tencent/polaris/dist/registry.d.ts +174 -0
  233. package/@tencent/polaris/dist/registry.js +660 -0
  234. package/@tencent/polaris/dist/registry.js.map +1 -0
  235. package/@tencent/polaris/dist/rules.d.ts +163 -0
  236. package/@tencent/polaris/dist/rules.js +24 -0
  237. package/@tencent/polaris/dist/rules.js.map +1 -0
  238. package/@tencent/polaris/dist/scripts/postinstall.d.ts +1 -0
  239. package/@tencent/polaris/dist/scripts/postinstall.js +71 -0
  240. package/@tencent/polaris/dist/scripts/postinstall.js.map +1 -0
  241. package/@tencent/polaris/dist/service.d.ts +18 -0
  242. package/@tencent/polaris/dist/service.js +3 -0
  243. package/@tencent/polaris/dist/service.js.map +1 -0
  244. package/@tencent/polaris/dist/skeleton.d.ts +87 -0
  245. package/@tencent/polaris/dist/skeleton.js +282 -0
  246. package/@tencent/polaris/dist/skeleton.js.map +1 -0
  247. package/@tencent/polaris/dist/utils.d.ts +36 -0
  248. package/@tencent/polaris/dist/utils.js +74 -0
  249. package/@tencent/polaris/dist/utils.js.map +1 -0
  250. package/@tencent/polaris/dist/weak.d.ts +11 -0
  251. package/@tencent/polaris/dist/weak.js +44 -0
  252. package/@tencent/polaris/dist/weak.js.map +1 -0
  253. package/@tencent/polaris/package.json +114 -0
  254. package/README.md +61 -0
  255. package/cursor-setting.png +0 -0
  256. package/index.js +16 -0
  257. package/index.js.map +1 -0
  258. package/mcp-server-prompt.png +0 -0
  259. package/mcp.json +8 -0
  260. package/package.json +49 -0
  261. package/resource/doc/tuicallkit/android/.gitkeep +0 -0
  262. package/resource/doc/tuicallkit/android/api_TUICallKit.md +610 -0
  263. package/resource/doc/tuicallkit/android/api_TUICallObserver.md +784 -0
  264. package/resource/doc/tuicallkit/android/how_to_integrated_android_callkit.md +286 -0
  265. package/resource/doc/tuicallkit/faq/faq.md +127 -0
  266. package/resource/doc/tuicallkit/flutter/api_TUICallDefine.md +938 -0
  267. package/resource/doc/tuicallkit/flutter/api_TUICallKit.md +469 -0
  268. package/resource/doc/tuicallkit/flutter/api_TUICallObserver.md +897 -0
  269. package/resource/doc/tuicallkit/flutter/how_to_integrated_flutter_callkit.md +226 -0
  270. package/resource/doc/tuicallkit/flutter/how_to_run_flutter_callkit_demo.md +101 -0
  271. package/resource/doc/tuicallkit/iOS/api_TUICallKit.md +398 -0
  272. package/resource/doc/tuicallkit/iOS/api_TUICallObserver.md +781 -0
  273. package/resource/doc/tuicallkit/iOS/how_to_integrated_iOS_callkit.md +268 -0
  274. package/resource/doc/tuicallkit/iOS/how_to_run_iOS_callkit_demo.md +98 -0
  275. package/resource/doc/tuicallkit/react/.gitkeep +0 -0
  276. package/resource/doc/tuicallkit/react/api_TUICallKit.md +354 -0
  277. package/resource/doc/tuicallkit/react/how_to_integrated_react_callkit.md +166 -0
  278. package/resource/doc/tuicallkit/react/how_to_run_react_callkit_demo.md +61 -0
  279. package/resource/doc/tuicallkit/vue/.gitkeep +0 -0
  280. package/resource/doc/tuicallkit/vue/api_TUICallKit.md +354 -0
  281. package/resource/doc/tuicallkit/vue/how_to_integrated_vue_callkit.md +187 -0
  282. package/resource/doc/tuicallkit/vue/how_to_run_vue_callkit_demo.md +61 -0
  283. package/server.js +132 -0
  284. package/server.js.map +1 -0
  285. package/streamableHttp.js +74 -0
  286. package/streamableHttp.js.map +1 -0
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ var _a, _b, _c;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SkeletonClass = exports.kGlobal = exports.kMaybeAlreadyDisposed = exports.kDisposed = exports.emitMaxInstancesExceededWarning = exports.isStatReporterPlugin = exports.ResultType = exports.kAPIReport = exports.kAPICollector = exports.kCollector = exports.kLogger = void 0;
5
+ const errors_1 = require("./errors");
6
+ const global_1 = require("./global");
7
+ const logging_1 = require("./logging");
8
+ const plugins_1 = require("./plugins");
9
+ const utils_1 = require("./utils");
10
+ exports.kLogger = Symbol("kLogger");
11
+ const kInitializePlugin = Symbol("kInitializePlugin");
12
+ // #region collector
13
+ exports.kCollector = Symbol("kCollector");
14
+ exports.kAPICollector = Symbol("kAPICollector");
15
+ exports.kAPIReport = Symbol("kAPIReport");
16
+ const kReportTimer = Symbol("kReportTimer");
17
+ const kNeedAPICollector = Symbol("kNeedAPICollector");
18
+ var ResultType;
19
+ (function (ResultType) {
20
+ /** 未知 */
21
+ ResultType[ResultType["Unknown"] = 0] = "Unknown";
22
+ /** 用户调用成功 */
23
+ ResultType[ResultType["Success"] = 1] = "Success";
24
+ /** 由于用户的原因,如参数错误导致的调用错误 */
25
+ ResultType[ResultType["UserFail"] = 2] = "UserFail";
26
+ /** 由于系统原因(SDK 或者 Server)导致用户调用失败 */
27
+ ResultType[ResultType["SystemFail"] = 3] = "SystemFail";
28
+ })(ResultType = exports.ResultType || (exports.ResultType = {}));
29
+ const kSep = "|";
30
+ const classifyCost = (cost) => {
31
+ if (cost < 50) {
32
+ return "[0ms,50ms)";
33
+ }
34
+ if (cost >= 50 && cost < 100) {
35
+ return "[50ms,100ms)";
36
+ }
37
+ if (cost >= 100 && cost < 150) {
38
+ return "[100ms,150ms)";
39
+ }
40
+ if (cost >= 150 && cost < 200) {
41
+ return "[150ms,200ms)";
42
+ }
43
+ return "[200ms,)";
44
+ };
45
+ // #endregion
46
+ // #region config
47
+ const pickConfig = (plugins, result = Object.create(null)) => {
48
+ Object.values(plugins).forEach((plugin) => {
49
+ var _d;
50
+ if (plugin === undefined) {
51
+ if (plugin === plugins[plugins_1.PluginType.CircuitBreaker]) {
52
+ return;
53
+ }
54
+ (0, utils_1.UNREACHABLE)();
55
+ }
56
+ if (Array.isArray(plugin)) {
57
+ return pickConfig(plugin, result);
58
+ }
59
+ const config = (_d = plugin.getConfig) === null || _d === void 0 ? void 0 : _d.call(plugin);
60
+ if (config !== undefined) {
61
+ result[plugin.name] = config;
62
+ }
63
+ });
64
+ return result;
65
+ };
66
+ // #endregion
67
+ exports.isStatReporterPlugin = ((plugin) => (plugin.type & plugins_1.PluginType.StatReporter) !== 0);
68
+ const emitMaxInstancesExceededWarning = (type, count) => {
69
+ /**
70
+ * 由于 `process.emitWarning` 实现中判断了传入的 `err instanceof Error`,
71
+ * 而在某些场景下(如 Mock 时) `Error` 对象会被用户代码修改(替换),
72
+ * 而 Node.js 所判断的对象(表达式右值)为原始 `Error` 对象(不受用户代码影响),
73
+ * 导致调用时抛出 [ERR_INVALID_ARG_TYPE] 异常,
74
+ * 故在这里使用 `PrimordialsError`,也就是 Node.js 原始 `Error` 对象。
75
+ */
76
+ const warning = new errors_1.PrimordialsError("Possible multiple useless instantiations detected. "
77
+ + `Current ${type} is instantiated ${count} times. `
78
+ + "Call setMaxInstances(n) to increase limit, "
79
+ + "or explicit call dispose() to release instance.");
80
+ warning.name = "MaxInstancesExceededWarning";
81
+ warning.type = type;
82
+ warning.count = count;
83
+ process.emitWarning(warning);
84
+ };
85
+ exports.emitMaxInstancesExceededWarning = emitMaxInstancesExceededWarning;
86
+ const isUserFail = (code) => code === errors_1.ErrorCodes.InvalidArgument
87
+ || code === errors_1.ErrorCodes.InvalidConfig
88
+ || code === errors_1.ErrorCodes.ServiceNotFound
89
+ || code === errors_1.ErrorCodes.StateError
90
+ || code === errors_1.ErrorCodes.ServerError /** 非 `ServerException` 均属于用户异常 */;
91
+ // #region dispose
92
+ exports.kDisposed = Symbol("kDisposed");
93
+ exports.kMaybeAlreadyDisposed = Symbol("kMaybeAlreadyDisposed");
94
+ const performDispose = (plugin) => {
95
+ if (!plugin.isDisposed) {
96
+ plugin.dispose();
97
+ }
98
+ };
99
+ const disposePlugin = (plugin, sync) => {
100
+ if (typeof plugin.dispose === "function") {
101
+ if (sync) {
102
+ performDispose(plugin);
103
+ }
104
+ else {
105
+ process.nextTick(performDispose, plugin);
106
+ }
107
+ }
108
+ };
109
+ // #endregion
110
+ exports.kGlobal = Symbol("kGlobal");
111
+ /**
112
+ * API 骨架类,用于 `Consumer` | `Provider` | `Limiter`
113
+ */
114
+ class SkeletonClass {
115
+ constructor(plugins, options, logger) {
116
+ this[_a] = false;
117
+ this[_b] = Object.create(null);
118
+ this[_c] = false;
119
+ this.plugins = plugins;
120
+ this[exports.kLogger] = logger !== null && logger !== void 0 ? logger : new logging_1.DefaultLogger(this.plugins[plugins_1.PluginType.TraceLogging], options);
121
+ this[exports.kGlobal] = (0, global_1.createGlobalOptions)(options);
122
+ this[kInitializePlugin]();
123
+ let config;
124
+ this.plugins[plugins_1.PluginType.StatReporter].forEach((reporter) => {
125
+ var _d;
126
+ (_d = reporter.systemConfig) === null || _d === void 0 ? void 0 : _d.call(reporter, config !== null && config !== void 0 ? config : (config = {
127
+ system: options,
128
+ plugins: pickConfig(Object.values(this.plugins))
129
+ })).catch(err => this[exports.kDisposed] || this[exports.kLogger].error(`[${reporter.name}] [systemConfig]`, err));
130
+ this[kNeedAPICollector] || (this[kNeedAPICollector] = typeof reporter.apiStatistics === "function");
131
+ });
132
+ }
133
+ // #region dispose
134
+ [(_a = exports.kDisposed, _b = exports.kCollector, _c = kNeedAPICollector, exports.kMaybeAlreadyDisposed)]() {
135
+ if (this[exports.kDisposed]) {
136
+ throw new errors_1.StateError("Already disposed");
137
+ }
138
+ }
139
+ /**
140
+ * @description
141
+ * dispose order:
142
+ * ... [plugins] ... -> TraceLogging
143
+ *
144
+ * @param sync 是否同步释放
145
+ */
146
+ dispose(sync) {
147
+ if (this[exports.kDisposed]) {
148
+ return;
149
+ }
150
+ this[exports.kDisposed] = true;
151
+ const logging = this.plugins[plugins_1.PluginType.TraceLogging];
152
+ const plugins = Object.values(this.plugins);
153
+ const { length } = plugins;
154
+ for (let i = 0; i <= length; i += 1) {
155
+ const val = i === length ? logging : plugins[i];
156
+ if (i !== length && val === logging) {
157
+ continue;
158
+ }
159
+ if (Array.isArray(val)) {
160
+ val.forEach((plugin) => disposePlugin(plugin, sync));
161
+ }
162
+ else {
163
+ disposePlugin(val, sync);
164
+ }
165
+ }
166
+ }
167
+ // #endregion
168
+ // #region logger & trace
169
+ setVerbosity(verbosity) {
170
+ this[exports.kLogger].setVerbosity(verbosity);
171
+ }
172
+ enableTracing() {
173
+ this[exports.kLogger].enableTracing();
174
+ }
175
+ disableTracing() {
176
+ this[exports.kLogger].disableTracing();
177
+ }
178
+ // #endregion
179
+ [kInitializePlugin]() {
180
+ const { globalVariables, enableReporter } = this[exports.kGlobal];
181
+ if (!enableReporter) {
182
+ const pluginSet = new Set();
183
+ Object.entries(this.plugins).forEach(([key, val]) => {
184
+ if (key !== `${plugins_1.PluginType.StatReporter}`) {
185
+ if (Array.isArray(val)) {
186
+ val.forEach(plugin => pluginSet.add(plugin));
187
+ }
188
+ else {
189
+ pluginSet.add(val);
190
+ }
191
+ }
192
+ });
193
+ this.plugins[plugins_1.PluginType.StatReporter].forEach(
194
+ /**
195
+ * 由于 `StatReporter` 插件可能与其它插件(如:`NamingService`)实现在一个对象内,
196
+ * 故需要判断对象的全局唯一性,再调用 dispose 方法
197
+ */
198
+ plugin => !pluginSet.has(plugin) && disposePlugin(plugin, false));
199
+ this.plugins[plugins_1.PluginType.StatReporter] = [];
200
+ }
201
+ const logging = this.plugins[plugins_1.PluginType.TraceLogging];
202
+ const logger = this[exports.kLogger];
203
+ Object.values(this.plugins).forEach((val) => {
204
+ var _d, _e;
205
+ // fix TypeScript 4.3.2 bug
206
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
207
+ if (val) {
208
+ if (Array.isArray(val)) {
209
+ if (val !== logging) {
210
+ val.forEach((plugin) => {
211
+ var _d, _e;
212
+ (_d = plugin.setLogger) === null || _d === void 0 ? void 0 : _d.call(plugin, logger);
213
+ (_e = plugin.setVariables) === null || _e === void 0 ? void 0 : _e.call(plugin, globalVariables);
214
+ });
215
+ }
216
+ }
217
+ else {
218
+ (_d = val.setLogger) === null || _d === void 0 ? void 0 : _d.call(val, logger);
219
+ (_e = val.setVariables) === null || _e === void 0 ? void 0 : _e.call(val, globalVariables);
220
+ }
221
+ }
222
+ });
223
+ }
224
+ // #region API
225
+ [exports.kAPICollector](api, cost, err) {
226
+ if (!this[kNeedAPICollector]) {
227
+ return;
228
+ }
229
+ let code = "0";
230
+ if (typeof err !== "undefined") {
231
+ if ((0, errors_1.isPolarisError)(err)) {
232
+ code = err[errors_1.kErrorCode];
233
+ }
234
+ else {
235
+ code = errors_1.ErrorCodes.InternalError;
236
+ }
237
+ }
238
+ const key = api + kSep + classifyCost(cost) + kSep + code;
239
+ const collector = this[exports.kCollector];
240
+ if (collector[key] === undefined) {
241
+ collector[key] = 1;
242
+ }
243
+ else {
244
+ collector[key] += 1;
245
+ }
246
+ if (this[kReportTimer] === undefined) {
247
+ this[kReportTimer] = setTimeout(() => {
248
+ this[exports.kAPIReport]();
249
+ this[kReportTimer] = undefined;
250
+ }, 1 * utils_1.kMinutes).unref(); /** 上报的指标值单位为每分钟 */
251
+ }
252
+ }
253
+ [exports.kAPIReport]() {
254
+ const collector = this[exports.kCollector];
255
+ this[exports.kCollector] = Object.create(null);
256
+ Object.keys(collector).forEach((key) => {
257
+ const [api, delay, code] = key.split(kSep);
258
+ const statKey = {
259
+ api,
260
+ delay,
261
+ code,
262
+ result: ResultType.Unknown
263
+ };
264
+ if (code === "0") {
265
+ statKey.result = ResultType.Success;
266
+ }
267
+ else if (isUserFail(code)) {
268
+ statKey.result = ResultType.UserFail;
269
+ }
270
+ else {
271
+ statKey.result = ResultType.SystemFail;
272
+ }
273
+ const statValue = collector[key];
274
+ this.plugins[plugins_1.PluginType.StatReporter].forEach((reporter) => {
275
+ var _d;
276
+ (_d = reporter.apiStatistics) === null || _d === void 0 ? void 0 : _d.call(reporter, statKey, statValue).catch(err => this[exports.kDisposed] || this[exports.kLogger].error(`[${reporter.name}] [apiStatistics]`, err));
277
+ });
278
+ });
279
+ }
280
+ }
281
+ exports.SkeletonClass = SkeletonClass;
282
+ //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../src/skeleton.ts"],"names":[],"mappings":";;;;AAAA,qCAAgG;AAChG,qCAA8D;AAC9D,uCAAgE;AAChE,uCAA+E;AAC/E,mCAA6D;AAEhD,QAAA,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACzC,MAAM,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEtD,oBAAoB;AACP,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAClC,QAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACxC,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEtD,IAAY,UASX;AATD,WAAY,UAAU;IACpB,SAAS;IACT,iDAAW,CAAA;IACX,aAAa;IACb,iDAAW,CAAA;IACX,2BAA2B;IAC3B,mDAAY,CAAA;IACZ,oCAAoC;IACpC,uDAAc,CAAA;AAChB,CAAC,EATW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QASrB;AAuCD,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE;IAC5C,IAAI,IAAI,GAAG,EAAE,EAAE;QACb,OAAO,YAAY,CAAC;KACrB;IACD,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,GAAG,GAAG,EAAE;QAC5B,OAAO,cAAc,CAAC;KACvB;IACD,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,GAAG,EAAE;QAC7B,OAAO,eAAe,CAAC;KACxB;IACD,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,G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CAAC;YAC/I,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CAEF;AAxLD,sCAwLC"}
@@ -0,0 +1,36 @@
1
+ export declare const kModuleVersion: string;
2
+ export declare const kModuleName: string;
3
+ export declare const kNanos = 1000;
4
+ export declare const kMillisecond = 1;
5
+ export declare const kSeconds: number;
6
+ export declare const kMinutes: number;
7
+ export declare const kHours: number;
8
+ export declare const kDays: number;
9
+ /**
10
+ * 求最大公约数
11
+ * @param values 数值
12
+ */
13
+ export declare function GreatestCommonDivisor(...values: number[]): number;
14
+ /**
15
+ * 判断开关是否开启
16
+ * @param it 开关字符串
17
+ */
18
+ export declare function on(it?: string): boolean;
19
+ /**
20
+ * UNREACHABLE CODE
21
+ */
22
+ export declare function UNREACHABLE(): never;
23
+ /**
24
+ * UNIMPLEMENTED
25
+ */
26
+ export declare function UNIMPLEMENTED(): never;
27
+ export declare type PartialSubset<T, U extends keyof T = never> = {
28
+ [P in keyof T]: P extends U ? Partial<T[P]> : T[P];
29
+ };
30
+ export declare type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
31
+ export declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
32
+ export declare type RemoveNever<T> = Pick<T, {
33
+ [K in keyof T]: T[K] extends never ? never : K;
34
+ }[keyof T]>;
35
+ export declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
36
+ export declare type PromiseConstructorParameters = Parameters<ConstructorParameters<typeof Promise>[0]>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UNIMPLEMENTED = exports.UNREACHABLE = exports.on = exports.GreatestCommonDivisor = exports.kDays = exports.kHours = exports.kMinutes = exports.kSeconds = exports.kMillisecond = exports.kNanos = exports.kModuleName = exports.kModuleVersion = void 0;
4
+ const errors_1 = require("./errors");
5
+ // #region Module Info
6
+ /* eslint-disable @typescript-eslint/naming-convention */
7
+ /*
8
+ * note:
9
+ * 由于这里引用了 `src` 外文件,导致在构建时输出目录不正确
10
+ * 所以这里使用 require(...) 来代替 import ...
11
+ */
12
+ const pkg = require("../package.json"); // eslint-disable-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
13
+ exports.kModuleVersion = pkg.version;
14
+ exports.kModuleName = pkg.name;
15
+ /* eslint-enable @typescript-eslint/naming-convention */
16
+ // #endregion
17
+ // #region Time Constant
18
+ /* eslint-disable @typescript-eslint/naming-convention */
19
+ exports.kNanos = 1000;
20
+ exports.kMillisecond = 1;
21
+ exports.kSeconds = 1000 * exports.kMillisecond;
22
+ exports.kMinutes = 60 * exports.kSeconds;
23
+ exports.kHours = 60 * exports.kMinutes;
24
+ exports.kDays = 24 * exports.kHours;
25
+ /* eslint-enable @typescript-eslint/naming-convention */
26
+ // #endregion
27
+ // #region Functions
28
+ /**
29
+ * 求最大公约数
30
+ * @param values 数值
31
+ */
32
+ function GreatestCommonDivisor(...values) {
33
+ const len = values.length;
34
+ while (values.some(value => value !== values[0])) {
35
+ values.sort((a, b) => b - a);
36
+ for (let i = 0; i < len - 1; i++) {
37
+ const remains = values[i] % values[i + 1];
38
+ if (remains === 0) {
39
+ values[i] = values[i + 1];
40
+ }
41
+ else {
42
+ values[i] = remains;
43
+ }
44
+ }
45
+ }
46
+ return values[0] || NaN;
47
+ }
48
+ exports.GreatestCommonDivisor = GreatestCommonDivisor;
49
+ /**
50
+ * 判断开关是否开启
51
+ * @param it 开关字符串
52
+ */
53
+ function on(it) {
54
+ return !!it && it !== "0" && it !== "false" && it !== "off";
55
+ }
56
+ exports.on = on;
57
+ // #endregion
58
+ // #region Assert Method
59
+ /**
60
+ * UNREACHABLE CODE
61
+ */
62
+ function UNREACHABLE() {
63
+ throw new errors_1.FatalError("UNREACHABLE CODE", UNREACHABLE);
64
+ }
65
+ exports.UNREACHABLE = UNREACHABLE;
66
+ /**
67
+ * UNIMPLEMENTED
68
+ */
69
+ function UNIMPLEMENTED() {
70
+ throw new errors_1.FatalError("UNIMPLEMENTED", UNIMPLEMENTED);
71
+ }
72
+ exports.UNIMPLEMENTED = UNIMPLEMENTED;
73
+ // #endregion
74
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAEtC,sBAAsB;AACtB,yDAAyD;AACzD;;;;GAIG;AACH,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAA4B,CAAC,CAAC,gGAAgG;AAEtJ,QAAA,cAAc,GAAG,GAAG,CAAC,OAAiB,CAAC;AACvC,QAAA,WAAW,GAAG,GAAG,CAAC,IAAc,CAAC;AAC9C,wDAAwD;AACxD,aAAa;AAEb,wBAAwB;AACxB,yDAAyD;AAC5C,QAAA,MAAM,GAAG,IAAK,CAAC;AACf,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,QAAQ,GAAG,IAAK,GAAG,oBAAY,CAAC;AAChC,QAAA,QAAQ,GAAG,EAAE,GAAG,gBAAQ,CAAC;AACzB,QAAA,MAAM,GAAG,EAAE,GAAG,gBAAQ,CAAC;AACvB,QAAA,KAAK,GAAG,EAAE,GAAG,cAAM,CAAC;AACjC,wDAAwD;AACxD,aAAa;AAEb,oBAAoB;AACpB;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAG,MAAgB;IACvD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QAChD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1C,IAAI,OAAO,KAAK,CAAC,EAAE;gBACjB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aAC3B;iBAAM;gBACL,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;aACrB;SACF;KACF;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;AAC1B,CAAC;AAfD,sDAeC;AAED;;;GAGG;AACH,SAAgB,EAAE,CAAC,EAAW;IAC5B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,CAAC;AAC9D,CAAC;AAFD,gBAEC;AACD,aAAa;AAEb,wBAAwB;AACxB;;GAEG;AACH,SAAgB,WAAW;IACzB,MAAM,IAAI,mBAAU,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC;AAFD,kCAEC;AAED;;GAEG;AACH,SAAgB,aAAa;IAC3B,MAAM,IAAI,mBAAU,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACvD,CAAC;AAFD,sCAEC;AAkBD,aAAa"}
@@ -0,0 +1,11 @@
1
+ export interface WeakReference<T> {
2
+ equal(value: T): boolean;
3
+ find(values: T[]): T | undefined;
4
+ reset(target: T): WeakReference<T>;
5
+ }
6
+ declare type WeakReferenceConstructor = new <T extends object>(target: T) => WeakReference<T>;
7
+ /**
8
+ * `WeakReference` 提供 Weak 类型容器,用于兼容不支持 `WeakRef` 环境
9
+ */
10
+ export declare const WeakReference: WeakReferenceConstructor;
11
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WeakReference = void 0;
4
+ /**
5
+ * `WeakReference` 提供 Weak 类型容器,用于兼容不支持 `WeakRef` 环境
6
+ */
7
+ exports.WeakReference = (typeof WeakRef === "function")
8
+ ? class {
9
+ constructor(target) {
10
+ this.ref = new WeakRef(target);
11
+ }
12
+ reset(target) {
13
+ this.ref = new WeakRef(target);
14
+ return this;
15
+ }
16
+ equal(value) {
17
+ return this.ref.deref() === value;
18
+ }
19
+ find(values) {
20
+ const target = this.ref.deref();
21
+ if (target === undefined) {
22
+ return undefined;
23
+ }
24
+ return values.includes(target) ? target : undefined;
25
+ }
26
+ }
27
+ : class {
28
+ constructor(target) {
29
+ this.ref = new WeakSet();
30
+ this.ref.add(target);
31
+ }
32
+ reset(target) {
33
+ this.ref.add(target);
34
+ return this;
35
+ }
36
+ equal(value) {
37
+ return this.ref.has(value);
38
+ }
39
+ find(values) {
40
+ return values.find(value => this.ref.has(value));
41
+ }
42
+ };
43
+ // #endregion
44
+ //# sourceMappingURL=weak.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weak.js","sourceRoot":"","sources":["../src/weak.ts"],"names":[],"mappings":";;;AAmBA;;GAEG;AACU,QAAA,aAAa,GAA6B,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC;IACpF,CAAC,CAAC;QAGA,YAAY,MAAS;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,MAAS;YACb,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,CAAC,KAAQ;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,MAAW;YACd,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,OAAO,SAAS,CAAC;aAClB;YACD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QACtD,CAAC;KACF;IACD,CAAC,CAAC;QAGA,YAAY,MAAS;YAFJ,QAAG,GAAe,IAAI,OAAO,EAAE,CAAC;YAG/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAED,KAAK,CAAC,MAAS;YACb,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,CAAC,KAAQ;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,MAAW;YACd,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,aAAa"}
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@tencent/polaris",
3
+ "version": "0.4.5",
4
+ "description": "Polaris(北极星)名字服务 SDK",
5
+ "author": "superzheng <superzheng@tencent.com>",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "http://git.woa.com/polaris/polaris-nodejs.git"
15
+ },
16
+ "funding": "wxwork://message?username=superzheng",
17
+ "bugs": "https://git.woa.com/polaris/polaris-nodejs/issues",
18
+ "homepage": "https://git.woa.com/polaris/polaris-nodejs",
19
+ "keywords": [
20
+ "polaris"
21
+ ],
22
+ "scripts": {
23
+ "build": "npm run lint && npm run clean && npm run build:src && npm run build:scripts && npm run pb:ts && npm run pb:dist:base && npm run pb:dist:grpc",
24
+ "build:src": "tsc -p tsconfig.json",
25
+ "build:scripts": "tsc -p tsconfig.scripts.json",
26
+ "coverage": "cross-env NODE_ENV=test nyc ava",
27
+ "clean": "shx rm -rf .nyc-output coverage dist",
28
+ "lint": "eslint --max-warnings=0 \"@(src|test|tools)/**/*.@(js|ts)\"",
29
+ "check": "npm run build",
30
+ "test": "cross-env NODE_ENV=test ava",
31
+ "pb:ts": "ts-node ./tools/pb2ts.ts src/plugins/naming/polaris-server/discover-pb src/plugins/naming/polaris-server/monitor-pb src/plugins/naming/polaris-server/ratelimit-pb",
32
+ "pb:dist:base": "shx cp -r src/plugins/naming/polaris-server/discover-pb src/plugins/naming/polaris-server/monitor-pb src/plugins/naming/polaris-server/ratelimit-pb dist/plugins/naming/polaris-server/",
33
+ "pb:dist:grpc": "shx cp -r src/plugins/naming/polaris-server/connector/grpc/pb dist/plugins/naming/polaris-server/connector/grpc/pb",
34
+ "lines": "bash -c \"find . -name \\*.ts | grep -v -E tools\\|test\\|node_modules\\|.d.ts | xargs cat | wc -l\"",
35
+ "postinstall": "node -e \"try{require('./dist/scripts/postinstall')}catch(e){}\""
36
+ },
37
+ "devDependencies": {
38
+ "@commitlint/cli": "^16.1.0",
39
+ "@commitlint/config-conventional": "^16.0.0",
40
+ "@hjkcai/eslint-config-halo": "^8.6.3",
41
+ "@types/debug": "^4.1.5",
42
+ "@types/node": "^17.0.10",
43
+ "@types/semver": "^7.3.9",
44
+ "@types/sinon": "^10.0.6",
45
+ "@types/uuid": "^8.3.4",
46
+ "ava": "^4.0.1",
47
+ "cross-env": "^7.0.3",
48
+ "eslint": "^8.7.0",
49
+ "husky": "^7.0.4",
50
+ "nyc": "^15.1.0",
51
+ "shx": "^0.3.4",
52
+ "sinon": "^12.0.1",
53
+ "tmp-promise": "^3.0.3",
54
+ "ts-node": "^10.4.0",
55
+ "typescript": "^4.4.5"
56
+ },
57
+ "husky": {
58
+ "hooks": {
59
+ "commit-msg": "commitlint -e .git/COMMIT_EDITMSG",
60
+ "pre-push": "npm run check"
61
+ }
62
+ },
63
+ "nyc": {
64
+ "extension": [
65
+ ".ts"
66
+ ],
67
+ "include": [
68
+ "src/**/*.ts"
69
+ ],
70
+ "exclude": [
71
+ "**/*.d.ts"
72
+ ],
73
+ "reporter": [
74
+ "lcov",
75
+ "text",
76
+ "text-summary"
77
+ ]
78
+ },
79
+ "ava": {
80
+ "extensions": [
81
+ "ts"
82
+ ],
83
+ "require": [
84
+ "ts-node/register"
85
+ ],
86
+ "files": [
87
+ "test/**/*.test.ts"
88
+ ],
89
+ "ignoredByWatcher": [
90
+ "!src/**/*.ts"
91
+ ]
92
+ },
93
+ "commitlint": {
94
+ "extends": [
95
+ "@commitlint/config-conventional"
96
+ ],
97
+ "rules": {
98
+ "subject-case": [
99
+ 0
100
+ ]
101
+ }
102
+ },
103
+ "dependencies": {
104
+ "@grpc/grpc-js": "^1.5.1",
105
+ "@grpc/proto-loader": "^0.6.6",
106
+ "@types/hashring": "^3.2.1",
107
+ "axios": "^0.25.0",
108
+ "debug": "^4.3.1",
109
+ "hashring": "^3.2.0",
110
+ "protobufjs": "^6.11.2",
111
+ "semver": "^7.3.5",
112
+ "uuid": "^8.3.2"
113
+ }
114
+ }
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ ## Tencent SDK Model Context Protocol (MCP) Server for Cursor IDE
2
+
3
+ This repository provides a CLI-based Model Context Protocol (MCP) server that exposes Tencent SDK documentation and Tencent API resources to LLM-powered tools.
4
+ This improves the LLM AI Agent's ability to understand and interact with Tencent's SDKs and APIs.
5
+
6
+
7
+ ## Features
8
+
9
+ - MCP server exposing tools for interacting with Tencent via JSON-RPC over STDIN/STDOUT.
10
+ - MCP server supports SSE Mode by supplying `HTTP_PORT` environment variable.
11
+ - Retrieve official Tencent SDK documentation (HTML → Markdown) for:
12
+ - Languages: JavaScript, Java, Swift, Objective-C, Kotlin.
13
+ - API reference sections: configuration, calls function.
14
+ - Retrieve official Tencent TUICallKit SDK documentation (HTML → Markdown) for:
15
+ - TUICallKit SDK languages: JavaScript, Kotlin, Swift.
16
+ - TUICallKit SDK topics: configuration, calls function.
17
+ - Converts remote HTML articles to Markdown using `jsdom` and `turndown` for consistent documentation formatting.
18
+ - Input validation via Zod schemas for all tool parameters, ensuring robust error handling.
19
+ - Extensible tool definitions leveraging the Model Context Protocol SDK (`@modelcontextprotocol/sdk`) with `McpServer` and `StdioServerTransport`.
20
+
21
+
22
+ ## Prerequisites
23
+ - Node.js (>= 18) and npm
24
+ - Cursor IDE with MCP support
25
+
26
+
27
+ ## How To Use
28
+ To set up the @tencentcloud/sdk-mcp MCP Server, follow these steps:
29
+
30
+ - Step1: Installation.
31
+
32
+ ```
33
+ npx -y @tencentcloud/sdk-mcp
34
+ ```
35
+
36
+
37
+ - Step2: In your Cursor project, create or open the `.cursor/mcp.json` or `~/.cursor/mcp.json` files and add your config.
38
+
39
+ ```javascript
40
+ {
41
+ "mcpServers": {
42
+ "tencentcloud-sdk-mcp": {
43
+ "command": "npx",
44
+ "args": ["-y", "@tencentcloud/sdk-mcp"]
45
+ }
46
+ }
47
+ }
48
+ ```
49
+ When you save the file, a notification is displayed. In the prompt, click **Enable**.
50
+
51
+ ![mcp-server-prompt](./mcp-server-prompt.png)
52
+
53
+ - Step3: Navigate to **Cursor Settings** (the gear icon in top right corner) -> **MCP**, and check if tencentcloud-sdk-mcp server is enabled.
54
+
55
+ ![cursor-setting](cursor-setting.png)
56
+
57
+
58
+ Step4: Ask the AI agent to build your Tencentcloud sdk app for you by describing the functionality yourself or by using a sample prompt.
59
+
60
+ > [!WARNING]
61
+ Make sure to use the Agent mode. Depending on your Cursor rules, you may also need to explicitly ask the AI agent to use the Tencentcloud sdk-mcp server.
Binary file
package/index.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
5
+ const server_js_1 = require("./server.js");
6
+ async function main() {
7
+ const server = (0, server_js_1.createServer)();
8
+ const transport = new stdio_js_1.StdioServerTransport();
9
+ await server.connect(transport);
10
+ console.debug("Tencent RTC MCP Server running on stdio");
11
+ }
12
+ main().catch((error) => {
13
+ console.error("Fatal error in main():", error);
14
+ process.exit(1);
15
+ });
16
+ //# sourceMappingURL=index.js.map