@comate/zulu 0.0.9 → 0.0.12

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/README.md +98 -0
  2. package/comate-engine/bin/comate.js +10 -0
  3. package/comate-engine/fallbackServer.js +1 -0
  4. package/comate-engine/node_modules/@comate/plugin-engine/dist/index.d.ts +188 -0
  5. package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +36 -0
  6. package/comate-engine/node_modules/@comate/plugin-engine/package.json +49 -0
  7. package/comate-engine/node_modules/@comate/plugin-host/bin.js +44 -0
  8. package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -0
  9. package/comate-engine/node_modules/@comate/plugin-host/dist/main.d.ts +14 -0
  10. package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +9 -0
  11. package/comate-engine/node_modules/@comate/plugin-host/dist/user-Btg63hPI.js +36 -0
  12. package/comate-engine/node_modules/@comate/plugin-host/package.json +47 -0
  13. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +2849 -0
  14. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +36 -0
  15. package/comate-engine/node_modules/@comate/plugin-shared-internals/package.json +72 -0
  16. package/comate-engine/node_modules/@comate/preview-proxy/bin/preview.js +13 -0
  17. package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +350 -0
  18. package/comate-engine/node_modules/@comate/preview-proxy/package.json +83 -0
  19. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.css +1 -0
  20. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +2 -0
  21. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js.LICENSE.txt +58 -0
  22. package/comate-engine/node_modules/compare-versions/LICENSE +21 -0
  23. package/comate-engine/node_modules/compare-versions/README.md +133 -0
  24. package/comate-engine/node_modules/compare-versions/lib/esm/compare.d.ts +19 -0
  25. package/comate-engine/node_modules/compare-versions/lib/esm/compare.js +44 -0
  26. package/comate-engine/node_modules/compare-versions/lib/esm/compare.js.map +1 -0
  27. package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.d.ts +8 -0
  28. package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js +29 -0
  29. package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js.map +1 -0
  30. package/comate-engine/node_modules/compare-versions/lib/esm/index.d.ts +5 -0
  31. package/comate-engine/node_modules/compare-versions/lib/esm/index.js +5 -0
  32. package/comate-engine/node_modules/compare-versions/lib/esm/index.js.map +1 -0
  33. package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.d.ts +14 -0
  34. package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js +66 -0
  35. package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js.map +1 -0
  36. package/comate-engine/node_modules/compare-versions/lib/esm/utils.d.ts +7 -0
  37. package/comate-engine/node_modules/compare-versions/lib/esm/utils.js +37 -0
  38. package/comate-engine/node_modules/compare-versions/lib/esm/utils.js.map +1 -0
  39. package/comate-engine/node_modules/compare-versions/lib/esm/validate.d.ts +28 -0
  40. package/comate-engine/node_modules/compare-versions/lib/esm/validate.js +31 -0
  41. package/comate-engine/node_modules/compare-versions/lib/esm/validate.js.map +1 -0
  42. package/comate-engine/node_modules/compare-versions/lib/umd/index.js +216 -0
  43. package/comate-engine/node_modules/compare-versions/lib/umd/index.js.map +1 -0
  44. package/comate-engine/node_modules/compare-versions/package.json +45 -0
  45. package/comate-engine/node_modules/compare-versions/src/compare.ts +54 -0
  46. package/comate-engine/node_modules/compare-versions/src/compareVersions.ts +31 -0
  47. package/comate-engine/node_modules/compare-versions/src/index.ts +5 -0
  48. package/comate-engine/node_modules/compare-versions/src/satisfies.ts +69 -0
  49. package/comate-engine/node_modules/compare-versions/src/utils.ts +50 -0
  50. package/comate-engine/node_modules/compare-versions/src/validate.ts +36 -0
  51. package/comate-engine/node_modules/pkce-challenge/LICENSE +21 -0
  52. package/comate-engine/node_modules/pkce-challenge/README.md +55 -0
  53. package/comate-engine/node_modules/pkce-challenge/dist/index.browser.d.ts +19 -0
  54. package/comate-engine/node_modules/pkce-challenge/dist/index.browser.js +72 -0
  55. package/comate-engine/node_modules/pkce-challenge/dist/index.node.cjs +80 -0
  56. package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.cts +19 -0
  57. package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.ts +19 -0
  58. package/comate-engine/node_modules/pkce-challenge/dist/index.node.js +75 -0
  59. package/comate-engine/node_modules/pkce-challenge/package.json +58 -0
  60. package/comate-engine/node_modules/web-streams-polyfill/LICENSE +22 -0
  61. package/comate-engine/node_modules/web-streams-polyfill/README.md +119 -0
  62. package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.es5.js +8 -0
  63. package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.js +8 -0
  64. package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.js +8 -0
  65. package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.mjs +8 -0
  66. package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.js +8 -0
  67. package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.mjs +8 -0
  68. package/comate-engine/node_modules/web-streams-polyfill/package.json +98 -0
  69. package/comate-engine/node_modules/web-streams-polyfill/types/polyfill.d.ts +28 -0
  70. package/comate-engine/node_modules/web-streams-polyfill/types/ponyfill.d.ts +809 -0
  71. package/comate-engine/node_modules/web-streams-polyfill/types/tsdoc-metadata.json +11 -0
  72. package/comate-engine/package.json +94 -0
  73. package/comate-engine/plugins/aiscan/assets/icon.svg +12 -0
  74. package/comate-engine/plugins/aiscan/dist/index.js +53861 -0
  75. package/comate-engine/plugins/aiscan/package.json +67 -0
  76. package/comate-engine/plugins/appdev/assets/icon.png +0 -0
  77. package/comate-engine/plugins/appdev/dist/help.md +12 -0
  78. package/comate-engine/plugins/appdev/dist/index.d.ts +2 -0
  79. package/comate-engine/plugins/appdev/dist/index.js +194 -0
  80. package/comate-engine/plugins/appdev/dist/providers/err.d.ts +8 -0
  81. package/comate-engine/plugins/appdev/dist/providers/err.js +37 -0
  82. package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +5 -0
  83. package/comate-engine/plugins/appdev/dist/providers/fallback.js +28 -0
  84. package/comate-engine/plugins/appdev/dist/providers/help.d.ts +8 -0
  85. package/comate-engine/plugins/appdev/dist/providers/help.js +19 -0
  86. package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +8 -0
  87. package/comate-engine/plugins/appdev/dist/providers/medusa.js +39 -0
  88. package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +8 -0
  89. package/comate-engine/plugins/appdev/dist/providers/qa.js +33 -0
  90. package/comate-engine/plugins/appdev/package.json +67 -0
  91. package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
  92. package/comate-engine/plugins/bfc/dist/config/config.d.ts +4 -0
  93. package/comate-engine/plugins/bfc/dist/config/config.js +4 -0
  94. package/comate-engine/plugins/bfc/dist/help.md +11 -0
  95. package/comate-engine/plugins/bfc/dist/index.d.ts +2 -0
  96. package/comate-engine/plugins/bfc/dist/index.js +452 -0
  97. package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +8 -0
  98. package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +77 -0
  99. package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +8 -0
  100. package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +71 -0
  101. package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +8 -0
  102. package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +74 -0
  103. package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +10 -0
  104. package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +71 -0
  105. package/comate-engine/plugins/bfc/dist/providers/help.d.ts +8 -0
  106. package/comate-engine/plugins/bfc/dist/providers/help.js +19 -0
  107. package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +14 -0
  108. package/comate-engine/plugins/bfc/dist/service/generateService.js +27 -0
  109. package/comate-engine/plugins/bfc/package.json +85 -0
  110. package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
  111. package/comate-engine/plugins/bpm/dist/index.js +313 -0
  112. package/comate-engine/plugins/bpm/package.json +65 -0
  113. package/comate-engine/plugins/casebuilder/assets/icon.svg +1 -0
  114. package/comate-engine/plugins/casebuilder/dist/help.md +33 -0
  115. package/comate-engine/plugins/casebuilder/dist/index.js +837 -0
  116. package/comate-engine/plugins/casebuilder/package.json +80 -0
  117. package/comate-engine/plugins/centrino/assets/icon.png +0 -0
  118. package/comate-engine/plugins/centrino/dist/help.md +30 -0
  119. package/comate-engine/plugins/centrino/dist/index.js +1046 -0
  120. package/comate-engine/plugins/centrino/package.json +68 -0
  121. package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
  122. package/comate-engine/plugins/cnap/dist/help.md +11 -0
  123. package/comate-engine/plugins/cnap/dist/index.js +171 -0
  124. package/comate-engine/plugins/cnap/package.json +65 -0
  125. package/comate-engine/plugins/demo-feature/assets/icon.svg +1 -0
  126. package/comate-engine/plugins/demo-feature/dist/help.md +1 -0
  127. package/comate-engine/plugins/demo-feature/dist/index.d.ts +2 -0
  128. package/comate-engine/plugins/demo-feature/dist/index.js +36008 -0
  129. package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.d.ts +12 -0
  130. package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.js +23 -0
  131. package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.d.ts +8 -0
  132. package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.js +26 -0
  133. package/comate-engine/plugins/demo-feature/dist/providers/config.d.ts +13 -0
  134. package/comate-engine/plugins/demo-feature/dist/providers/config.js +25 -0
  135. package/comate-engine/plugins/demo-feature/dist/providers/context.d.ts +10 -0
  136. package/comate-engine/plugins/demo-feature/dist/providers/context.js +49 -0
  137. package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.d.ts +8 -0
  138. package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.js +65 -0
  139. package/comate-engine/plugins/demo-feature/dist/providers/explainCode.d.ts +9 -0
  140. package/comate-engine/plugins/demo-feature/dist/providers/explainCode.js +24 -0
  141. package/comate-engine/plugins/demo-feature/dist/providers/fallback.d.ts +5 -0
  142. package/comate-engine/plugins/demo-feature/dist/providers/fallback.js +23 -0
  143. package/comate-engine/plugins/demo-feature/dist/providers/file.d.ts +13 -0
  144. package/comate-engine/plugins/demo-feature/dist/providers/file.js +36 -0
  145. package/comate-engine/plugins/demo-feature/dist/providers/help.d.ts +8 -0
  146. package/comate-engine/plugins/demo-feature/dist/providers/help.js +19 -0
  147. package/comate-engine/plugins/demo-feature/dist/providers/information.d.ts +13 -0
  148. package/comate-engine/plugins/demo-feature/dist/providers/information.js +23 -0
  149. package/comate-engine/plugins/demo-feature/dist/providers/knowledge.d.ts +15 -0
  150. package/comate-engine/plugins/demo-feature/dist/providers/knowledge.js +71 -0
  151. package/comate-engine/plugins/demo-feature/dist/providers/log.d.ts +12 -0
  152. package/comate-engine/plugins/demo-feature/dist/providers/log.js +21 -0
  153. package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.d.ts +8 -0
  154. package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.js +23 -0
  155. package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.d.ts +8 -0
  156. package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.js +47 -0
  157. package/comate-engine/plugins/demo-feature/dist/providers/prompt.d.ts +7 -0
  158. package/comate-engine/plugins/demo-feature/dist/providers/prompt.js +7 -0
  159. package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.d.ts +8 -0
  160. package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.js +17 -0
  161. package/comate-engine/plugins/demo-feature/dist/providers/render.d.ts +8 -0
  162. package/comate-engine/plugins/demo-feature/dist/providers/render.js +75 -0
  163. package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.d.ts +10 -0
  164. package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.js +173 -0
  165. package/comate-engine/plugins/demo-feature/dist/providers/section.d.ts +8 -0
  166. package/comate-engine/plugins/demo-feature/dist/providers/section.js +136 -0
  167. package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.d.ts +12 -0
  168. package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.js +17 -0
  169. package/comate-engine/plugins/demo-feature/dist/providers/streaming.d.ts +8 -0
  170. package/comate-engine/plugins/demo-feature/dist/providers/streaming.js +29 -0
  171. package/comate-engine/plugins/demo-feature/dist/providers/userDetail.d.ts +8 -0
  172. package/comate-engine/plugins/demo-feature/dist/providers/userDetail.js +28 -0
  173. package/comate-engine/plugins/demo-feature/package.json +214 -0
  174. package/comate-engine/plugins/demo-timer/assets/icon.svg +2 -0
  175. package/comate-engine/plugins/demo-timer/dist/index.js +463 -0
  176. package/comate-engine/plugins/demo-timer/package.json +73 -0
  177. package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
  178. package/comate-engine/plugins/dev-tools/dist/help.md +18 -0
  179. package/comate-engine/plugins/dev-tools/dist/index.js +166160 -0
  180. package/comate-engine/plugins/dev-tools/package.json +95 -0
  181. package/comate-engine/plugins/devaux/assets/icon.svg +1 -0
  182. package/comate-engine/plugins/devaux/dist/help.md +41 -0
  183. package/comate-engine/plugins/devaux/dist/index.js +73829 -0
  184. package/comate-engine/plugins/devaux/dist/static/tree-sitter-cpp.wasm +0 -0
  185. package/comate-engine/plugins/devaux/dist/static/tree-sitter-go.wasm +0 -0
  186. package/comate-engine/plugins/devaux/dist/static/tree-sitter.wasm +0 -0
  187. package/comate-engine/plugins/devaux/dist/tree-sitter.wasm +0 -0
  188. package/comate-engine/plugins/devaux/package.json +83 -0
  189. package/comate-engine/plugins/f2c/assets/icon.svg +11 -0
  190. package/comate-engine/plugins/f2c/dist/help.md +13 -0
  191. package/comate-engine/plugins/f2c/dist/index.js +64551 -0
  192. package/comate-engine/plugins/f2c/package.json +56 -0
  193. package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
  194. package/comate-engine/plugins/fcnap/dist/help.md +9 -0
  195. package/comate-engine/plugins/fcnap/dist/index.js +105 -0
  196. package/comate-engine/plugins/fcnap/package.json +50 -0
  197. package/comate-engine/plugins/front-end-skills/assets/icon.svg +1 -0
  198. package/comate-engine/plugins/front-end-skills/dist/help.md +17 -0
  199. package/comate-engine/plugins/front-end-skills/dist/index.js +8172 -0
  200. package/comate-engine/plugins/front-end-skills/package.json +79 -0
  201. package/comate-engine/plugins/gdp/assets/icon.png +0 -0
  202. package/comate-engine/plugins/gdp/dist/help.md +11 -0
  203. package/comate-engine/plugins/gdp/dist/index.js +53065 -0
  204. package/comate-engine/plugins/gdp/package.json +79 -0
  205. package/comate-engine/plugins/git/assets/git.svg +1 -0
  206. package/comate-engine/plugins/git/assets/icon.svg +1 -0
  207. package/comate-engine/plugins/git/dist/help.md +7 -0
  208. package/comate-engine/plugins/git/dist/index.js +32675 -0
  209. package/comate-engine/plugins/git/package.json +91 -0
  210. package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
  211. package/comate-engine/plugins/harmonyos/dist/index.js +78 -0
  212. package/comate-engine/plugins/harmonyos/package.json +37 -0
  213. package/comate-engine/plugins/iapi/assets/icon.png +0 -0
  214. package/comate-engine/plugins/iapi/dist/help.md +13 -0
  215. package/comate-engine/plugins/iapi/dist/index.js +458 -0
  216. package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-go.wasm +0 -0
  217. package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-java.wasm +0 -0
  218. package/comate-engine/plugins/iapi/dist/static/tree-sitter-go.wasm +0 -0
  219. package/comate-engine/plugins/iapi/dist/static/tree-sitter-java.wasm +0 -0
  220. package/comate-engine/plugins/iapi/dist/tree-sitter.wasm +0 -0
  221. package/comate-engine/plugins/iapi/package.json +102 -0
  222. package/comate-engine/plugins/icafe/assets/icafe.svg +1 -0
  223. package/comate-engine/plugins/icafe/dist/help.md +5 -0
  224. package/comate-engine/plugins/icafe/dist/index.js +885 -0
  225. package/comate-engine/plugins/icafe/package.json +74 -0
  226. package/comate-engine/plugins/ievalue/assets/iEValue.svg +10 -0
  227. package/comate-engine/plugins/ievalue/dist/index.js +2920 -0
  228. package/comate-engine/plugins/ievalue/package.json +88 -0
  229. package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
  230. package/comate-engine/plugins/ipipe/dist/help.md +15 -0
  231. package/comate-engine/plugins/ipipe/dist/index.js +7264 -0
  232. package/comate-engine/plugins/ipipe/package.json +62 -0
  233. package/comate-engine/plugins/jarvis/assets/icon.svg +1 -0
  234. package/comate-engine/plugins/jarvis/dist/help.md +17 -0
  235. package/comate-engine/plugins/jarvis/dist/index.js +140416 -0
  236. package/comate-engine/plugins/jarvis/package.json +93 -0
  237. package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
  238. package/comate-engine/plugins/mapsearch/dist/help.md +4 -0
  239. package/comate-engine/plugins/mapsearch/dist/index.js +145 -0
  240. package/comate-engine/plugins/mapsearch/package.json +53 -0
  241. package/comate-engine/plugins/paddle/assets/icon.png +0 -0
  242. package/comate-engine/plugins/paddle/assets/paconvert-3.0.1-py3-none-any.whl +0 -0
  243. package/comate-engine/plugins/paddle/dist/help.md +31 -0
  244. package/comate-engine/plugins/paddle/dist/index.js +1011 -0
  245. package/comate-engine/plugins/paddle/package.json +129 -0
  246. package/comate-engine/plugins/robot/assets/Robot.png +0 -0
  247. package/comate-engine/plugins/robot/dist/index.js +288 -0
  248. package/comate-engine/plugins/robot/package.json +67 -0
  249. package/comate-engine/plugins/security/assets/comate.png +0 -0
  250. package/comate-engine/plugins/security/dist/index.js +18393 -0
  251. package/comate-engine/plugins/security/package.json +82 -0
  252. package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
  253. package/comate-engine/plugins/smartapp/dist/help.md +4 -0
  254. package/comate-engine/plugins/smartapp/dist/index.js +113 -0
  255. package/comate-engine/plugins/smartapp/package.json +54 -0
  256. package/comate-engine/plugins/springer/assets/icon.png +0 -0
  257. package/comate-engine/plugins/springer/dist/help.md +4 -0
  258. package/comate-engine/plugins/springer/dist/index.js +94525 -0
  259. package/comate-engine/plugins/springer/package.json +71 -0
  260. package/comate-engine/plugins/testmate/assets/icon.svg +1 -0
  261. package/comate-engine/plugins/testmate/dist/help.md +62 -0
  262. package/comate-engine/plugins/testmate/dist/index.js +21483 -0
  263. package/comate-engine/plugins/testmate/package.json +85 -0
  264. package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
  265. package/comate-engine/plugins/tor/dist/help.md +22 -0
  266. package/comate-engine/plugins/tor/dist/index.js +807 -0
  267. package/comate-engine/plugins/tor/package.json +99 -0
  268. package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
  269. package/comate-engine/plugins/weiyun/dist/help.md +11 -0
  270. package/comate-engine/plugins/weiyun/dist/index.js +100491 -0
  271. package/comate-engine/plugins/weiyun/package.json +55 -0
  272. package/comate-engine/plugins/wenku/assets/icon.svg +1 -0
  273. package/comate-engine/plugins/wenku/dist/index.js +249 -0
  274. package/comate-engine/plugins/wenku/package.json +55 -0
  275. package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
  276. package/comate-engine/plugins/workcard/dist/help.md +30 -0
  277. package/comate-engine/plugins/workcard/dist/index.js +490 -0
  278. package/comate-engine/plugins/workcard/package.json +95 -0
  279. package/comate-engine/plugins/xiaomi-aiot/assets/icon.png +0 -0
  280. package/comate-engine/plugins/xiaomi-aiot/dist/help.md +6 -0
  281. package/comate-engine/plugins/xiaomi-aiot/dist/index.js +37466 -0
  282. package/comate-engine/plugins/xiaomi-aiot/package.json +63 -0
  283. package/comate-engine/server.d.ts +3 -0
  284. package/comate-engine/server.js +474 -0
  285. package/dist/bundle/index.js +29 -58174
  286. package/package.json +2 -1
@@ -0,0 +1,7 @@
1
+ import { PromptProvider } from '@comate/plugin-host';
2
+ export declare class CustomPromptProvider extends PromptProvider {
3
+ static promptName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ promptTemplate: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { PromptProvider } from '@comate/plugin-host';
2
+ export class CustomPromptProvider extends PromptProvider {
3
+ static promptName = 'message';
4
+ static displayName = '提问';
5
+ static description = '向大模型提问';
6
+ promptTemplate = '根据{{query}}写一副对联';
7
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class RAGProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
2
+ export class RAGProvider extends SkillProvider {
3
+ static skillName = 'RAG';
4
+ static displayName = '检索增强生成(RAG)';
5
+ static description = '通过检索增强生成(RAG)进行问答';
6
+ static parameters = {
7
+ type: 'object',
8
+ properties: {},
9
+ };
10
+ async *execute() {
11
+ const { query } = this.currentContext;
12
+ const stream = new StringChunkStream();
13
+ const output = await this.llm.askRAG({ prompt: query, retrieveFrom: { workspace: true } });
14
+ this.logger.info('RAG output:', { output });
15
+ yield stream.flush(output);
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class RenderProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ }
@@ -0,0 +1,75 @@
1
+ import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
2
+ const data = [
3
+ { name: 'John', age: 30, city: 'New York' },
4
+ { name: 'Jane', age: 25, city: 'Chicago' },
5
+ { name: 'Bob', age: 35, city: 'San Francisco' },
6
+ ];
7
+ // Define the columns for the table
8
+ const columns = [
9
+ { title: 'Name', field: 'name' },
10
+ { title: 'Age', field: 'age' },
11
+ { title: 'City', field: 'city' },
12
+ ];
13
+ const COMATE_OFFICIAL_SITE = 'https://comate.baidu.com';
14
+ const COMATE_LOGO = 'https://comate.baidu.com/images/comate.png';
15
+ const description = (table) => `
16
+ 展示渲染\`markdown\`的能力
17
+
18
+ # 一级标题
19
+ ## 二级标题
20
+ ### 三级标题
21
+ #### 四级标题
22
+ ##### 五级标题
23
+ ###### 六级标题
24
+
25
+ **这是加粗的文字**
26
+ *这是倾斜的文字*
27
+ ~~这是删除线~~
28
+
29
+ [Comate 官网](${COMATE_OFFICIAL_SITE})
30
+ ![Comate Logo](${COMATE_LOGO})
31
+
32
+ [打开README.md文件](./README.md:12)
33
+
34
+ - 无序列表项一
35
+ - 无序列表项二
36
+ - 无序列表项2.1
37
+ - 无序列表项2.1.1
38
+ - 无序列表项2.1.2
39
+ - 无序列表项2.2
40
+ - 无序列表项三
41
+
42
+ 1. 有序列表项一
43
+ 2. 有序列表项二
44
+ - 有序列表项2.1
45
+ - 有序列表项2.1.1
46
+ - 有序列表项2.1.2
47
+ - 有序列表项2.2
48
+ 3. 有序列表项三
49
+
50
+ \`行内代码\`
51
+ \`\`\`typescript
52
+ // This is a code block
53
+ function add(a: number, b: number): number {
54
+ return a + b;
55
+ }
56
+ \`\`\`
57
+
58
+ > 这是一段引用
59
+
60
+ ${table}
61
+ `;
62
+ export class RenderProvider extends SkillProvider {
63
+ static skillName = 'render';
64
+ static displayName = '渲染表格';
65
+ static description = '渲染markdown表格';
66
+ static parameters = {
67
+ type: 'object',
68
+ properties: {},
69
+ required: [],
70
+ };
71
+ async *execute() {
72
+ const stream = new StringChunkStream();
73
+ yield stream.flushReplaceLast(description(this.render.table(data, { columns })));
74
+ }
75
+ }
@@ -0,0 +1,10 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class RenderJsxProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ handleCommand(commandName: string, data: any): AsyncIterableIterator<TaskProgressChunk>;
9
+ handleChatCancel(cancleToken: string): void;
10
+ }
@@ -0,0 +1,173 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@comate/plugin-host/jsx-runtime";
2
+ import { ElementChunkStream, SkillProvider, } from '@comate/plugin-host';
3
+ const code = `const range = (start, stop, step=1) => {
4
+ return Array.from(
5
+ { length: (stop - start) / step + 1 },
6
+ (value, i) => start + i * step
7
+ )
8
+ }
9
+ `;
10
+ const bashcode = `
11
+ ls -al
12
+ fd -e .ts
13
+ `;
14
+ const markdownStr = `
15
+ # Comate插件宿主运行时
16
+
17
+ 本包提供在插件进程中运行的逻辑。
18
+
19
+ ## 使用时目录结构
20
+
21
+
22
+ 正常情况下,在Comate Engine中,运行的代码结构是这样的:
23
+
24
+
25
+ ## 项目目录结构
26
+
27
+ 本项目各目录的职责如下:
28
+
29
+ - \`index.ts\`:导出面向插件开发者的接口。
30
+
31
+
32
+ \`\`\`typescript
33
+ export {
34
+ ElementChunkStream,
35
+ FunctionParameterDefinition,
36
+ SkillProvider,
37
+ TaskProgressChunk,
38
+ }
39
+ console.log('hello world')
40
+ \`\`\`
41
+ `;
42
+ const mockAccept = [
43
+ {
44
+ type: 'replace',
45
+ path: '/path/to/file',
46
+ range: { start: { line: 1, character: 1 }, end: { line: 1, character: 5 } },
47
+ newText: 'new text for replace',
48
+ },
49
+ {
50
+ type: 'insert',
51
+ path: '/path/to/another/file',
52
+ position: { line: 2, character: 2 },
53
+ newText: 'new text for insert',
54
+ },
55
+ ];
56
+ function sleep5s() {
57
+ return new Promise(resolve => {
58
+ setTimeout(() => resolve(), 5000);
59
+ });
60
+ }
61
+ export class RenderJsxProvider extends SkillProvider {
62
+ static skillName = 'render';
63
+ static displayName = '渲染表格';
64
+ static description = '渲染markdown表格';
65
+ static parameters = {
66
+ type: 'object',
67
+ properties: {},
68
+ required: [],
69
+ };
70
+ async *execute() {
71
+ const isRegenerated = this.isRegenerated;
72
+ const stream = new ElementChunkStream();
73
+ if (isRegenerated) {
74
+ yield stream.flush(_jsx("h1", { children: "\u91CD\u65B0\u751F\u6210" }));
75
+ }
76
+ yield stream.flush(_jsx("h1", { children: "\u4E00\u7EA7\u6807\u9898" }));
77
+ yield stream.flush(_jsx("h2", { children: "\u4E8C\u7EA7\u6807\u9898" }));
78
+ yield stream.flush(_jsx("h3", { children: "\u4E09\u7EA7\u6807\u9898" }));
79
+ yield stream.flush(_jsx("h4", { children: "\u56DB\u7EA7\u6807\u9898" }));
80
+ yield stream.flush(_jsx("h5", { children: "\u4E94\u7EA7\u6807\u9898" }));
81
+ yield stream.flush(_jsx("h6", { children: "\u516D\u7EA7\u6807\u9898" }));
82
+ yield stream.flush(_jsx("p", { children: _jsx("strong", { children: "\u8FD9\u662F\u52A0\u7C97\u7684\u6587\u5B57" }) }));
83
+ yield stream.flush(_jsx("em", { children: "\u8FD9\u662F\u503E\u659C\u7684\u6587\u5B57" }));
84
+ yield stream.flush(_jsxs("ul", { children: [_jsxs("li", { children: ["\u65E0\u5E8F\u5217\u8868\u9879\u4E00", _jsxs("ul", { children: [_jsx("li", { children: "\u5D4C\u5957\u5217\u88681.1" }), _jsxs("li", { children: ["\u5D4C\u5957\u5217\u88681.2", _jsxs("ul", { children: [_jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2.1" }), _jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2.2" })] })] }), _jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2" })] })] }), _jsx("li", { children: "\u65E0\u5E8F\u5217\u8868\u9879\u4E8C" }), _jsx("li", { children: "\u65E0\u5E8F\u5217\u8868\u9879\u4E09" })] }));
85
+ yield stream.flush(_jsxs("ol", { children: [_jsxs("li", { children: ["\u6709\u5E8F\u5217\u8868\u9879\u4E00", _jsxs("ol", { children: [_jsx("li", { children: "\u5D4C\u5957\u5217\u88681.1" }), _jsxs("li", { children: ["\u5D4C\u5957\u5217\u88681.2", _jsxs("ol", { children: [_jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2.1" }), _jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2.2" })] })] }), _jsx("li", { children: "\u5D4C\u5957\u5217\u88681.2" })] })] }), _jsx("li", { children: "\u6709\u5E8F\u5217\u8868\u9879\u4E8C" }), _jsx("li", { children: "\u6709\u5E8F\u5217\u8868\u9879\u4E09" })] }));
86
+ yield stream.flush(_jsx("p", { children: _jsx("code", { children: "\u884C\u5185\u4EE3\u7801" }) }));
87
+ yield stream.flush(_jsxs("blockquote", { children: [_jsx("p", { children: "\u8FD9\u662F\u4E00\u6BB5\u5F15\u75281" }), _jsx("p", { children: "\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282 \u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282 \u8FD9\u662F\u4E00\u6BB5\u5F15\u75282\u8FD9\u662F\u4E00\u6BB5\u5F15\u75282" }), _jsx("p", { children: "\u8FD9\u662F\u4E00\u6BB5\u5F15\u75283" }), _jsx("span", { children: "\u8FD9\u662F\u4E00\u4E2Aspan" })] }));
88
+ yield stream.flush(_jsx("code-block", { language: "javascript", closed: false, children: code }));
89
+ yield stream.flush(_jsx("code-block", { language: "bash", closed: false, children: bashcode }));
90
+ yield stream.flush(_jsxs("p", { children: [_jsxs("p", { children: [_jsx("file-link", { showIcon: true, to: "/README.md", line: 2, children: "/README.md" }), _jsx("file-link", { showIcon: true, to: "/README.md", line: 2, children: "1.java" })] }), _jsxs("p", { children: [_jsx("alert-tag", { level: "critical", children: "\u4E25\u91CD" }), _jsx("file-link", { to: "/README.md", line: 2, children: "/README.md" }), "\u8FD9\u91CC\u662F\u4E00\u4E9B\u63CF\u8FF0\u8FD9\u91CC\u662F\u4E00\u4E9B\u63CF\u8FF0\u8FD9\u91CC\u662F\u4E00\u4E9B\u63CF\u8FF0\u8FD9\u91CC\u662F\u4E00\u4E9B\u63CF\u8FF0"] }), _jsxs("p", { children: ["Comate \u4EE3\u7801\u5B89\u5168\u6839\u636E\u626B\u63CF\u7ED3\u679C\u548C\u4FEE\u590D\u5EFA\u8BAE\u5BF9 ", _jsx("file-link", { to: "/README.md", line: 2, children: "xxx.pom" }), ' ', "Comate \u4EE3\u7801\u5B89\u5168\u6839\u636E\u626B\u63CF\u7ED3\u679C\u548C\u4FEE\u590D\u5EFA\u8BAE\u5BF9"] }), _jsxs("p", { children: [_jsx("file-link", { showIcon: true, to: "./README.md", line: 3, children: "src/mfdsafsadfdsaain/resfdsafources/mappfdafers/lStudentMapxxxxpe.xml" }), _jsx("file-link", { showIcon: true, to: "./README.md", line: 3, children: "src/mfdsafsadfdsaain/resfdsafources/mappfdafers/lStudentMapxxxxpe.xml" })] })] }));
91
+ yield stream.flush(_jsx("p", { children: _jsx("a", { href: "http://www.baidu.com", children: "\u5916\u94FE" }) }));
92
+ yield stream.flush(_jsx("p", { children: _jsx("loading", { children: "\u8BF7\u7A0D\u5019..." }) }));
93
+ yield stream.flush(_jsx("markdown", { children: markdownStr }));
94
+ yield stream.flush(_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "\u5E8F\u53F7" }), _jsx("th", { children: "fileName" }), _jsx("th", { children: "\u63CF\u8FF0" }), _jsx("th", { children: _jsx("flex", { horizontalCentered: true, children: "\u64CD\u4F5C" }) })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "1" }), _jsx("td", { children: "test_xxx_xxx.py" }), _jsx("td", { children: "\u8BF7\u6C42\u591A\u4E2A\u63A5\u53E3+\u5728\u65E7\u7528\u4F8B\u7684\u57FA\u7840\u4E0A\u751F\u6210\u65B0\u7684\u7528\u4F8B" }), _jsx("td", { children: _jsx("flex", { horizontalCentered: true, children: _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "text", action: "insertToFile", actionData: {
95
+ // 输出内容不包含采纳内容时,需要设置includeHiddenStatsCode 保证采纳上报数据有效
96
+ includeHiddenStatsCode: true,
97
+ filePath: 'JPASQLi.java',
98
+ position: { line: 1, character: 0 },
99
+ newText: 'test 1\ntest 2\n',
100
+ }, children: "\u91C7\u7EB3" }) }) })] }), _jsxs("tr", { children: [_jsx("td", { children: "2" }), _jsx("td", { children: "test_yyy_yyy.py" }), _jsx("td", { children: "\u8BF7\u6C42\u591A\u4E2A\u63A5\u53E3+\u5728\u65E7\u7528\u4F8B\u7684\u57FA\u7840\u4E0A\u751F\u6210\u65B0\u7684\u7528\u4F8B" }), _jsx("td", { children: _jsx("flex", { horizontalCentered: true, children: _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "text", action: "insertToFile", actionData: {
101
+ filePath: 'JPASQLi.java',
102
+ position: { line: 1, character: 0 },
103
+ newText: 'test 1\ntest 2\n',
104
+ }, children: "\u91C7\u7EB3" }) }) })] }), _jsxs("tr", { children: [_jsx("td", { children: "3" }), _jsx("td", { children: "test_zzz_zzz.py" }), _jsx("td", { children: "\u8BF7\u6C42\u591A\u4E2A\u63A5\u53E3+\u5728\u65E7\u7528\u4F8B\u7684\u57FA\u7840\u4E0A\u751F\u6210\u65B0\u7684\u7528\u4F8B" }), _jsx("td", { children: _jsx("flex", { horizontalCentered: true, children: _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "text", action: "insertToFile", actionData: {
105
+ filePath: 'JPASQLi.java',
106
+ position: { line: 1, character: 0 },
107
+ newText: 'test 1\ntest 2\n',
108
+ }, children: "\u91C7\u7EB3" }) }) })] })] })] }));
109
+ const Child = _jsx("h1", { children: "hello world" });
110
+ yield stream.flush(_jsxs("p", { children: ["Child hello world will not Show.", Child] }));
111
+ yield stream.flush(_jsx("alert-tag", { level: "normal", children: "\u6B63\u5E38" }));
112
+ yield stream.flush(_jsx("br", {}));
113
+ yield stream.flush(_jsx("alert-tag", { level: "low", children: "\u4F4E\u5371" }));
114
+ yield stream.flush(_jsx("br", {}));
115
+ yield stream.flush(_jsx("alert-tag", { level: "medium", children: "\u4E2D\u5371" }));
116
+ yield stream.flush(_jsx("br", {}));
117
+ yield stream.flush(_jsx("alert-tag", { level: "high", children: "\u9AD8\u5371" }));
118
+ yield stream.flush(_jsx("br", {}));
119
+ yield stream.flush(_jsx("alert-tag", { level: "critical", children: "\u4E25\u91CD" }));
120
+ yield stream.flush(_jsx("br", {}));
121
+ yield stream.flush(_jsxs("button-group", { children: [_jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "no", replyText: "button-group A\u884C\u4E3A replyText", children: "button-group A\u884C\u4E3A" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "button-group B\u884C\u4E3A replyText", variant: "primary", children: "button-group B\u884C\u4E3A" })] }));
122
+ yield stream.flush(_jsxs("flex", { centered: true, gap: "s", children: [_jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "primary", children: "primaryButton" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", children: "defaultButton" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "text", children: "textButton" })] }));
123
+ yield stream.flush(_jsxs("flex", { centered: true, gap: "s", children: [_jsx("command-button", { commandName: "commitMessage:confirmIssue", action: "copy", data: "yes", tooltipText: "\u590D\u5236\u590D\u5236\u590D\u5236\u590D\u5236\u590D\u5236", actionData: "git commit -m some message", children: "\u590D\u5236" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", action: "insertIntoTerminal", data: "yes", tooltipText: "\u7ED1\u5361\u7ED1\u5361\u7ED1\u5361\u7ED1\u5361", actionData: "git commit -m some message", children: "\u7ED1\u5361" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", action: "detail", data: "yes", tooltipText: "\u8BE6\u60C5\u8BE6\u60C5\u8BE6\u60C5\u8BE6\u60C5", children: "\u8BE6\u60C5" }), _jsx("command-button", { commandName: "commitMessage:confirmIssue", action: "execute", data: "yes", tooltipText: "\u6267\u884C\u6267\u884C\u6267\u884C\u6267\u884C", children: "\u6267\u884C" })] }));
124
+ yield stream.flush(_jsx("h4", { children: "\u652F\u6301\u91C7\u7EB3\u66FF\u6362\u81F3\u6587\u4EF6" }));
125
+ yield stream.flush(_jsx("code-block", { language: "javascript", actions: ['showFileReplaceDiff', 'replaceToFile'], replaceToFileData: {
126
+ filePath: 'JPASQLi.java',
127
+ from: ` public void bad1(EntityManager em, String password) {
128
+ String sql = "select * from Users where user = 'admin' and password='"+password+"'";
129
+ // ruleid:jpa-sqli
130
+ em.createNativeQuery(sql);
131
+ }`,
132
+ to: '234\n567',
133
+ replaceAll: true,
134
+ }, closed: false, children: code }));
135
+ yield stream.flush(_jsx("code-block", { language: "javascript", actions: ['showFileInsertDiff', 'insertToFile'], insertToFileData: {
136
+ filePath: 'JPASQLi.java',
137
+ position: { line: 1, character: 0 },
138
+ newText: 'test 1\ntest 2\n',
139
+ metadata: { needsConfirmation: true },
140
+ }, closed: false, children: code }));
141
+ yield stream.flush(_jsx("code-block", { language: "javascript", actions: ['showFileInsertDiff', 'smartApply'], smartApplyData: {
142
+ filePath: 'JPASQLi.java',
143
+ }, closed: false, visibleLines: 3, children: code }));
144
+ yield stream.flush(_jsx("code-block", { language: "javascript", closed: false, readonly: true, readonlyFileData: {
145
+ filePath: '/README.md',
146
+ startLine: 1,
147
+ endLine: 3,
148
+ }, children: code }));
149
+ yield stream.flush(_jsx("card", { color: 'green', children: code }));
150
+ yield stream.flush(_jsxs("collapse-panel", { collapsible: false, title: '\u6298\u53E0\u9762\u677F\u793A\u4F8B', extra: _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText", variant: "text", action: 'batchAccept', actionData: mockAccept, children: "\u4E00\u952E\u91C7\u7EB3" }), children: [_jsx("card", { color: 'green', children: code }), _jsx("collapse-panel", { collapsible: true, title: '\u5D4C\u5957\u6298\u53E0\u9762\u677F', children: code })] }));
151
+ await sleep5s();
152
+ // const elements = [<h1>一级标题</h1>, <h2>2级标题</h2>, <h3>3级标题</h3>, <code>行内代码</code>];
153
+ // yield stream.flushReplaceAll(elements);
154
+ yield stream.flush(_jsx("p", { children: "\u7ED3\u675F" }));
155
+ }
156
+ // 承接点击事件
157
+ async *handleCommand(commandName, data) {
158
+ console.log('commandName', commandName);
159
+ console.log('commandNameData', data);
160
+ const stream = new ElementChunkStream();
161
+ console.log(this.commandContext);
162
+ if (commandName === 'commitMessage:confirmIssue') {
163
+ if (data === 'no') {
164
+ yield stream.flushReplaceLast(_jsx("p", { children: "\u70B9\u51FB\u6570\u636E\u4E3Ano" }));
165
+ return;
166
+ }
167
+ yield stream.flushReplaceLast(_jsx("p", { children: "\u70B9\u51FB\u6570\u636E\u4E3Ayes" }));
168
+ }
169
+ }
170
+ handleChatCancel(cancleToken) {
171
+ this.logger.info(`handleChatCancel: ${cancleToken}`);
172
+ }
173
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class SectionProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ }
@@ -0,0 +1,136 @@
1
+ import { SkillProvider, SectionChunkStream, } from '@comate/plugin-host';
2
+ import { TaskStatus } from '@comate/plugin-shared-internals';
3
+ const dynamicActionItemsMock = {
4
+ label: '思考过程',
5
+ done: false,
6
+ collapsible: true,
7
+ type: 'actionItems',
8
+ tasks: [
9
+ {
10
+ desc: 'Design database schema',
11
+ status: TaskStatus.SUCCEED,
12
+ taskType: 'PLAN',
13
+ subTasks: [
14
+ {
15
+ desc: 'Define tables and relationships',
16
+ status: TaskStatus.SUCCEED,
17
+ detail: ['Users', 'Products', 'Orders'],
18
+ taskType: 'SEARCH',
19
+ },
20
+ {
21
+ desc: 'Choose database engine',
22
+ status: TaskStatus.FAIL,
23
+ detail: ['PostgreSQL chosen for relational data storage'],
24
+ taskType: 'REASONING',
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ desc: 'Implement authentication system',
30
+ status: TaskStatus.PROCESSING,
31
+ detail: ['JWT based authentication', 'OAuth2 integration pending'],
32
+ taskType: 'CODE_GENERATE',
33
+ },
34
+ {
35
+ desc: 'Write unit tests for user service',
36
+ status: TaskStatus.INIT,
37
+ taskType: 'CODE_GENERATE',
38
+ },
39
+ ],
40
+ };
41
+ const dynamicActionItemsMock2 = {
42
+ label: '思考过程',
43
+ done: false,
44
+ collapsible: true,
45
+ type: 'actionItems',
46
+ tasks: [
47
+ {
48
+ desc: 'Design database schema',
49
+ status: TaskStatus.SUCCEED,
50
+ taskType: 'PLAN',
51
+ subTasks: [
52
+ {
53
+ desc: 'Define tables and relationships',
54
+ status: TaskStatus.SUCCEED,
55
+ detail: ['Users', 'Products', 'Orders'],
56
+ taskType: 'SEARCH',
57
+ },
58
+ {
59
+ desc: 'Choose database engine',
60
+ status: TaskStatus.FAIL,
61
+ detail: ['PostgreSQL chosen for relational data storage'],
62
+ taskType: 'REASONING',
63
+ },
64
+ ],
65
+ },
66
+ {
67
+ desc: 'Implement authentication system',
68
+ status: TaskStatus.SUCCEED,
69
+ detail: ['JWT based authentication', 'OAuth2 integration pending'],
70
+ taskType: 'CODE_GENERATE',
71
+ },
72
+ {
73
+ desc: 'Write unit tests for user service',
74
+ status: TaskStatus.INIT,
75
+ taskType: 'CODE_GENERATE',
76
+ },
77
+ ],
78
+ };
79
+ const notificationSectionsMock = {
80
+ label: '',
81
+ done: false,
82
+ collapsible: true,
83
+ type: 'notification',
84
+ notifications: [{
85
+ notificationType: 'fail',
86
+ title: 'xxxxxx文件、xxxxxxxxx文件自动采纳失败,建议单文件采纳或复制',
87
+ path: 'https://developer.baidu.com/singleTagPage.html?tagId=326&type=QUESTION&from=BaiduComate',
88
+ }],
89
+ };
90
+ const mockAccept = [
91
+ {
92
+ type: 'replace',
93
+ path: '/path/to/file',
94
+ range: { start: { line: 1, character: 1 }, end: { line: 3, character: 5 } },
95
+ newText: 'new text for replace',
96
+ },
97
+ {
98
+ type: 'insert',
99
+ path: '/path/to/another/file',
100
+ position: { line: 0, character: 3 },
101
+ newText: 'new text for insert',
102
+ },
103
+ ];
104
+ const actionConfig = {
105
+ name: '批量采纳',
106
+ icon: 'accept',
107
+ description: '采纳全部3个已生成的单测文件',
108
+ successLabel: '采纳成功',
109
+ data: mockAccept,
110
+ };
111
+ function sleep(seconds) {
112
+ return new Promise(resolve => {
113
+ setTimeout(() => resolve(), seconds);
114
+ });
115
+ }
116
+ export class SectionProvider extends SkillProvider {
117
+ static skillName = 'section';
118
+ static displayName = '渲染section';
119
+ static description = '渲染section';
120
+ static parameters = {
121
+ type: 'object',
122
+ properties: {},
123
+ required: [],
124
+ };
125
+ async *execute() {
126
+ const stream = new SectionChunkStream();
127
+ yield stream.flushReplaceLast({ dynamicSections: [dynamicActionItemsMock] }, 'section rendered');
128
+ await sleep(2000);
129
+ yield stream.flushReplaceLast({ dynamicSections: [dynamicActionItemsMock] }, 'section rendered');
130
+ await sleep(2000);
131
+ yield stream.flushReplaceLast({
132
+ dynamicSections: [dynamicActionItemsMock2],
133
+ dynamicFooterSections: [notificationSectionsMock],
134
+ }, 'section rendered section updated', { actions: {}, actionConfigs: { batchAccept: actionConfig } });
135
+ }
136
+ }
@@ -0,0 +1,12 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ interface Args {
3
+ query: string;
4
+ }
5
+ export declare class selectedKnowledgeProvider extends SkillProvider<Args> {
6
+ static skillName: string;
7
+ static displayName: string;
8
+ static description: string;
9
+ static parameters: FunctionParameterDefinition;
10
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
11
+ }
12
+ export {};
@@ -0,0 +1,17 @@
1
+ import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
2
+ export class selectedKnowledgeProvider extends SkillProvider {
3
+ static skillName = 'selectedKnowledgeList';
4
+ static displayName = '知识选择';
5
+ static description = '知识选择';
6
+ static parameters = {
7
+ type: 'object',
8
+ properties: {},
9
+ };
10
+ async *execute() {
11
+ const stream = new TaskProgressChunkStream();
12
+ // example filesSelected
13
+ const selectedKnowledgeList = this.retriever.selectedKnowledgeList();
14
+ const files = selectedKnowledgeList.filter(item => item.type === 'FILE');
15
+ yield stream.flush(files.map(item => item.name).join('\n'));
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class StreamingProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ }
@@ -0,0 +1,29 @@
1
+ import { SkillProvider, StringChunkStream, TextModel, } from '@comate/plugin-host';
2
+ export class StreamingProvider extends SkillProvider {
3
+ static skillName = 'streaming';
4
+ static displayName = '流式输出';
5
+ static description = '流式输出大模型的返回';
6
+ static parameters = {
7
+ type: 'object',
8
+ properties: {},
9
+ };
10
+ async *execute() {
11
+ const { query } = this.currentContext;
12
+ const stream = new StringChunkStream();
13
+ const prompt = this.llm.createPrompt(query || '给我讲个故事');
14
+ const chunks = this.llm.askForTextStreaming(prompt, {
15
+ model: TextModel.Default,
16
+ modelOptions: {
17
+ temperature: 0.95,
18
+ openMaxOutput: true,
19
+ penaltyScore: 1.8,
20
+ topP: 0.9,
21
+ // 开启多轮对话,当前内存保存上下文
22
+ enableMultiturnDialogue: { byPlugin: true, onlyQuery: query },
23
+ },
24
+ });
25
+ for await (const chunk of chunks) {
26
+ yield stream.flush(chunk);
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
2
+ export declare class UserDetailProvider extends SkillProvider {
3
+ static skillName: string;
4
+ static displayName: string;
5
+ static description: string;
6
+ static parameters: FunctionParameterDefinition;
7
+ execute(): AsyncIterableIterator<TaskProgressChunk>;
8
+ }
@@ -0,0 +1,28 @@
1
+ import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
2
+ export class UserDetailProvider extends SkillProvider {
3
+ static skillName = 'userDetail';
4
+ static displayName = '用户信息';
5
+ static description = '获取用户信息';
6
+ static parameters = {
7
+ type: 'object',
8
+ properties: {},
9
+ required: [],
10
+ };
11
+ async *execute() {
12
+ const stream = new TaskProgressChunkStream();
13
+ try {
14
+ const userId = this.currentUser.id;
15
+ const userDetail = await this.currentUser.requestDetail() || {};
16
+ const data = { ...userDetail, userId };
17
+ yield stream.flushReplaceLast([
18
+ '```JSON',
19
+ JSON.stringify(data, null, 4),
20
+ '```',
21
+ ]
22
+ .join('\n'));
23
+ }
24
+ catch (error) {
25
+ yield stream.flushReplaceLast('获取用户信息失败');
26
+ }
27
+ }
28
+ }